[Insight-users] Watershed Segmentation - running itkWatershedSegment1.cxx

Luis Ibanez luis.ibanez at kitware.com
Wed, 03 Mar 2004 23:24:23 -0500


Hi Neha,

In your particular case the Breast image is not an RGB
and you probably don't want to use the conversion that
the watershed example is doing.

You should try a pipeline like:

Reader-->RecursiveGradientMagnitude-->Watershed-->Writer

and the reader should probably be instantiated over an
image of pixel type "unsigned short" or "float" since
mamograms are usually encoded in 16bits.

The output of the Watershed filter is an image of labels
encoded in 'unsigned long'.  If you look at the code of
the example that you just run, you will find that the
filter converting the watershed output to RGB is build
by combining the classes:

    - ScalarToRGBPixelFunctor
http://www.itk.org/Insight/Doxygen/html/classitk_1_1Functor_1_1ScalarToRGBPixelFunctor.html

    - UnaryFunctorImageFilter
http://www.itk.org/Insight/Doxygen/html/classitk_1_1Functor_1_1ScalarToRGBPixelFunctor.html


This combination uses a hash table for translating labels
into random RGB colors.



Regards,



    Luis



-----------------
neha k wrote:

> Hi Luis,
>  
> Thanks for the suggestion.   The example program in 
> ITK/Examples/Segmentation/itkWatershedSegment1.cxx is working properly 
> for breast image.  I get RGB output image.
>  
> I have one question about above example. I input the breast image as 
> MetaHeader image (breast.mhd).  Is it correct to read this image as RGB 
> pixel type(program reads image as RGB pixel type) when input image 
> grayscale raw image?.  I am little confused here. 
>  
> Now about problem in my program of getting output of 0 bytes, should I 
> try to convert the output of watershed to RGB pixel similar to one in 
> above example program. What itk class should I use? (input breast images 
> are grayscale raw images)
>  
> Thanks,
> Neha 
> 
> */Luis Ibanez <luis.ibanez at kitware.com>/* wrote:
> 
> 
>     Hi Neha,
> 
> 
>     There is no reason for a writer to produce
>     an image of zero size. Unless an exception
>     is thrown during the writing process, or
>     it is actually receiving an image with a
>     region of size zero.
> 
> 
> 
>     Please do the following experiment:
> 
>     Use the example in
> 
>     Insight/Examples/Segmentation/
>     WatershedSegmentation1.cxx
> 
> 
>     for processing your (256 x 256) image.
>     and let us know what you get.
> 
> 
> 
>     Thanks
> 
> 
>     Luis
> 
> 
> 
>