[Insight-users] GeodesicActiveContourImageFilter

Chris McIntosh cmcintos.sfu at gmail.com
Mon Feb 12 04:39:15 EST 2007


Hello,

If I understand you correctly you want two things:

Note: I suggest reading up on level sets so that you are more familiar 
with the theory behind them before going
to far into using them, as you may be using the wrong level set 
formulation for your task.

A great paper on level sets, that easy to understand is:
Active Contours Without Edges
http://www.math.ucla.edu/~lvese/PAPERS/IEEEIP2001.pdf


Option 1: Get only the contour of a level set function.
----------------------------
A level set function Phi is a signed distance transform of the contour 
your after. i.e. it implies the contour and is hence an implicit shape rep.
As such no morphology is needed.

Therefore,   Phi is zero at the boundary, negative inside and positive 
outside (though I think in ITK this is backwards?? )
http://en.wikipedia.org/wiki/Heaviside_step_function

outside = heaviside(phi); %%i.e. set everything positive equal to one, 
else zero
contour = dirac(phi); %%i.e. set everything equal to zero equal to one, 
else zero
inside = 1-heaviside(phi);

So, if these functions are not in itk, then simple threshold filters 
will do the trick.

As a side note, depending on the smoothness constraints etc, phi may 
deviate from a signed distance transform in ITK.
At that point you'd still want the zero level set, but there would 
actually be no zeros in the image. So, you'd need to extract
the zero crossings (i.e. where the voxels change between negative and 
positive). Perhaps somebody knows a built
in method for that in ITK?

Option 2: Get the inside of the segmentation
----------------------------------
Simply mask the image by heaviside(phi), i.e. by the white inside black 
outside image you are currently seeing.
i.e.
mask = heaviside(phi);
for x = 1 to numpixels
     I_final(x) = mask(x)*I(x);
end

You might have to divide the mask by 255 (or whatever its max value is) 
of course, if its not already binary.

Cheers,

Chris


Pui Yu Lau wrote:

> Hi everyone,
>
>    Thanks for the help in regards to the previous email.  I sent a 
> followup email on a further problem, which may have been deleted from 
> the user list because I realized I started talking about vtk 
> functions, thinking they were itk.  Anyways, I'm hoping someone can 
> help me in my problem:
>
> I am attempting to segment certain anatomical structures from 3D 
> images that have been sliced.  I'm segmenting the structures using 
> GeodesicActiveContour.  However, at the end of the 
> geodesicactivecontour filter, I am left with a black and white image 
> due to the binary filter.  I was wondering if there was any way I can 
> extract the contour of my structure, then use the contour and apply it 
> to my original greyscale image (so it won't be black and white) and 
> isolate the structure, while keeping the rest of the image in black, 
> for example.
>
> My main focus is on getting the contour extraction, and I have been 
> recommended to look for some sort of morphological filter.  Through 
> the ITK guide, I looked up the binary and greyscale filters from the 
> mathematical morphology as well as section 7.6 on extracting regions, 
> but I cannot seem to find functions to do what I want.  I was 
> wondering if anyone has any idea on what I may have overlooked or for 
> suggestions on tackling my problem differently.
> - PY
>
>
> Luis Ibanez wrote:
>
>>
>> Hi Pui,
>>
>> Please read carefully the description of this filter
>> in the ITK Software Guide.
>>
>>   http://www.itk.org/ItkSoftwareGuide.pdf
>>
>> You seem to have missed many of the important feature
>> of the example. It may be convenient for you to read
>> the previous sections on Level Sets. In particular the
>> section on the FastMarching filter and the ShapeDetection
>> filter.
>>
>>
>> The source code of the GeodesicActiveContour example
>> is available at:
>>
>>
>>      Insight/Code/Segmentation/
>>        GeodesicActiveContourImageFilter.cxx
>>
>>
>> In lines 319-320 you will find:
>>
>>   geodesicActiveContour->SetInput(  fastMarching->GetOutput() );
>>   geodesicActiveContour->SetFeatureImage( sigmoid->GetOutput() );
>>
>>
>> Where the SetInput() method is setting the initial level set
>> to be used by the GeodesicActiveContour filter. This initial
>> level set is computed in this particular case, as the output
>> of a FastMarching image filter that is feed only with seed point.
>> The fast marching filter in this case is simply producing a
>> set of circles (or sphere) around the seed points.
>>
>> The SetFeatureImage() is connecting the image that is going
>> to be used for computing the speed image. This feature image
>> is computed as the sigmoid mapping of the gradient magnitude
>> image.  The goal is to have an image that has low (dark) value
>> in the edges where you want your level set to stop, and high
>> (bright) values in the regions where you want the level set to
>> propagate rapidly.
>>
>>
>> The command line parameters passed to the example are described
>> in lines 128-137:
>>
>>   if( argc < 10 )
>>     {
>>     std::cerr << "Missing Parameters " << std::endl;
>>     std::cerr << "Usage: " << argv[0];
>>     std::cerr << " inputImage  outputImage";
>>     std::cerr << " seedX seedY InitialDistance";
>>     std::cerr << " Sigma SigmoidAlpha SigmoidBeta";
>>     std::cerr << " PropagationScaling"  << std::endl;
>>     return 1;
>>     }
>>
>>
>>
>>    a) Input image (the image to be segmented
>>    b) Ouput image (segmentation resulting from the level set)
>>    c) (x,y) index coordinates of the seed point for FastMarching
>>    d) initial distance for fast marcing
>>    e) Sigma for the smoothing of the gradient magnitude filter
>>    f) Alpha and Beta parameters of the Sigmoid
>>    g) Propagation scaling parameter for the Geodesic Active contour
>>
>>
>>
>> In general the initial level set image could be *any* rough
>> segmentation of the object. You could produce such initial
>> segmentation by a manual delineation, a quick region growing
>> algorithm or a simple thresholding.
>>
>> It is quite common to implement two-stage segmentation methods
>> where the first stage only produces a quick and dirty segmentation,
>> that is then passed to a second stage where a level set method will
>> fine tune the segmentatino. Note that level sets cannot perform
>> magic on a poor initial segmentation. It is at least desirable for
>> the initial segmentation to be close to the edges of the object
>> to be segmented.
>>
>>
>>
>>      Regards,
>>
>>
>>        Luis
>>
>>
>> ==================
>> Pui Yu Lau wrote:
>>
>>> Hi,
>>>
>>>    I'm a new user to ITK, and I've been trying to learn to use some 
>>> of the segmentation filters.  I've been looking at the Geodesic 
>>> Active Contour method, and I am confused on how it actually works.  
>>> Looking through the guide, it seems that it takes two initial image 
>>> inputs, where the first one is the initial level set, and the second 
>>> is the feature image.  However, when running the example of 
>>> GeodesicActiveContourImageFilter, the images used were 
>>> BrainProtonDensitySlice.png and 
>>> GeodesicActiveContourImageFilterOutput.png, where the latter does 
>>> not exist.  So, my question is, in this case, is the 
>>> BrainProtonDensitySlice the feature image (input), while the 
>>> GeodesicActiveContourImageFilterOutput is the initial level set 
>>> (output)?  If not, what exactly is the initial level set image?
>>>
>>> - PY
>>>
>>> _______________________________________________
>>> Insight-users mailing list
>>> Insight-users at itk.org
>>> http://www.itk.org/mailman/listinfo/insight-users
>>>
>>
>>
>
>
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users



More information about the Insight-users mailing list