comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » contouring the CT slice
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: contouring the CT slice [message #34994 is a reply to message #34921] Tue, 06 May 2003 09:09 Go to previous messageGo to previous message
anne.martel is currently offline  anne.martel
Messages: 6
Registered: April 2002
Junior Member
> 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
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: egg timer
Next Topic: sec : U Re: checking for Demo mode

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sun Oct 12 01:03:05 PDT 2025

Total time taken to generate the page: 0.01108 seconds