comp.lang.idl-pvwave archive - RDF feed
type: channel
description: Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
items: contouring the CT slice
items: Re: contouring the CT slice

contouring the CT slice
type: item
description: Hi All, I have serial cross sections of some long bones, which I would like to calculate centroids and mass moments of inertia for each slice. The steps I have managed to do so far: 1.) Read the stack as a three dimensional volume: 2.) Calculate a threshold for segmenting the data 3.) Get the internal and external contours with contours function. The problem, when I look at the values of PATH_XY with PATH_DATA_COORDS option, those are combined points of two contours. So sorting them out becomes quite tricky. The reason I need those points, I have somebody else's fortran routine to calculate moments based on individual points and it needs two separate inputs... So the first question what else I can use other than contour procedure to get the coordinates of external and internal contours? And what may be a better way to approach this problem? Thanks for your time, Murat
creator: Murat Maga
date: 2003-05-04T23:17:19-00:00

Re: contouring the CT slice
type: item
description: Murat Maga (maga@mail.utexas.edu) writes: > I have serial cross sections of some long bones, which I would like to > calculate centroids and mass moments of inertia for each slice. > The steps I have managed to do so far: > 1.) Read the stack as a three dimensional volume: > 2.) Calculate a threshold for segmenting the data > 3.) Get the internal and external contours with contours function. > > The problem, when I look at the values of PATH_XY with PATH_DATA_COORDS > option, those are combined points of two contours. So sorting them out > becomes quite tricky. Tricky, maybe, but certainly not impossible. You will probably need the information in PATH_INFO to do it correctly. > The reason I need those points, I have somebody else's fortran routine > to calculate moments based on individual points and it needs two > separate inputs... Say what!? How do you expect the contours to help here? > So the first question what else I can use other than contour procedure > to get the coordinates of external and internal contours? And what may > be a better way to approach this problem? You could try using ISOCONTOUR, but I think this approach is probably fine. Cheers, David -- David W. Fanning, Ph.D. Fanning Software Consulting, Inc. Phone: 970-221-0438, E-mail: david@dfanning.com Coyote's Guide to IDL Programming: http://www.dfanning.com/ Toll-Free IDL Book Orders: 1-888-461-0155
creator: David Fanning
date: 2003-05-04T23:27:39-00:00

Re: contouring the CT slice
type: item
description: Murat Maga wrote: > Hi All, > I have serial cross sections of some long bones, which I would like to > calculate centroids and mass moments of inertia for each slice. > The steps I have managed to do so far: > 1.) Read the stack as a three dimensional volume: > 2.) Calculate a threshold for segmenting the data > 3.) Get the internal and external contours with contours function. > > The problem, when I look at the values of PATH_XY with PATH_DATA_COORDS > option, those are combined points of two contours. So sorting them out > becomes quite tricky. > The reason I need those points, I have somebody else's fortran routine > to calculate moments based on individual points and it needs two > separate inputs... > > So the first question what else I can use other than contour procedure > to get the coordinates of external and internal contours? And what may > be a better way to approach this problem? > Thanks for your time, > Murat When anatomical information becomes important, I find that manual landmarking is the fastest and easiest way to get the job done. You'd probably have to locate the center of the bone marrow on each slide manually anyway; so you may store these center points in an array. Then have your IDL code crawl the CT data - first from the marked bone marrow center to each point along the image border, on each line until it hits your bone threshold level then store those coordinates as part of your inner contour data; then from the outside, crawl from each point along the image border back to the marked bone marrow center landmark until you hit bone threshold level, and record those coordinates as well as part of the outer contours. This probably does not take as long as it sounds; worked fine for me when I tried to measure the skin thickness on a CT head scan and evaluate tissue swelling due to an injury, correcting it for any local anatomical 'normal value' by subtracting the contralateral measurement. Don't forget that you can always alter your data to s…
creator: Wolf Schweitzer
date: 2003-05-06T08:57:04-00:00

Re: contouring the CT slice
type: item
description: > Murat Maga wrote: >> Hi All, >> I have serial cross sections of some long bones, which I would like to >> calculate centroids and mass moments of inertia for each slice. >> The steps I have managed to do so far: >> 1.) Read the stack as a three dimensional volume: >> 2.) Calculate a threshold for segmenting the data >> 3.) Get the internal and external contours with contours function. >> I'm not sure you need to use contours for this. You can calculate the centre of mass of an image using the following routine (it's not very pretty but it does the job): ; PURPOSE: ; returns intensity weighted centre of image ; ; CATEGORY: ; image processing ; ; CALLING SEQUENCE: ; cog_pos=cog(image) ; ; INPUTS: ; image ; OUPUT: ; returns position as a structure {x:xpos,y:ypos} ; EXAMPLE: ; cpos=cog(image) ; Function cog,image s = size(image) tot = total(image) if(tot gt 0) then begin xtotal=0 ytotal=0 xmax = s(1)-1.0 ymax = s(2)-1.0 for i = 0.0 , xmax do xtotal = xtotal + total(image(i,*)*i) for i = 0.0 , ymax do ytotal = ytotal + total(image(*,i)*i) cog_pos = {x: xtotal/tot, $ y: ytotal/tot} endif else cog_pos={x:0,y:0} return,cog_pos end Why not just threshold the image and apply CoG to each thresholded slice? You could used a single seed point together with search_3d to make sure that you just had a single connected bone region. If you needed information about the pixels around the inner and outer edges of the bone then you could use morphology - just dilate the bone region once then subtract off the undilated image. Anne
creator: anne.martel
date: 2003-05-06T16:09:51-00:00

Re: contouring the CT slice
type: item
description: Thank you very much for the kind and detailed responses. I wanted the contours, because PATH_XY gives me the coordinates of each point that make up the contour. And I have a small routine which takes two arrays, one for internal and one of external, of x-y coordinates of polygons. Then it calculates the centroid, second moments of area, polar moments and such... Wolf: Manual landmarking is not really quite feasible as I want to look at couple of ten thousands of slice (combined sample). Anne: Thanks for th subroutine, I will definitely try that. Best, Murat
creator: Murat Maga
date: 2003-05-06T22:45:37-00:00