[Insight-users] Re: calling updates: Mathematical Morphology Binary filters and SetErodeValue,SetDilateValue

Luis Ibanez luis.ibanez@kitware.com
Sun, 02 Mar 2003 12:02:20 -0500


Hi Digvijay,


You may want to take a look at the
description of the MathematicalMorphology
filters in the SoftwareGuide.pdf

http://www.itk.org/ItkSoftwareGuide.pdf

Section 5.4.3, pdf-page 106 to 108.

----

You are missing to provide the values
that define the foreground/background
in your binary image.

The MathematicalMorphologyBinary filters
need to be informed of what is your
definition of "binary" image. For some
people this may mean "0" and "1" values.
Some other may want to use "0" and
"255" values.  In order to accomodate
different needs, the methods

       SetErodeValue()
       SetDilateValue()

are available in these morphological
filters.

Please add a call to these methods before
invoking Update() on the filters.

----

Also note that the fltkImageViewer may
behave better when you use 0,255 as
values for the binary image.


Let us know if you find any further problems


Thanks


   Luis


-------------------------------------

digvijay singh wrote:
> hi luis..
> i have been using the BinaryDilateImageFilter and
> BinaryErodeImageFilter in succession in different
> fashion to implement opening and closing operations.
> However i see a blank image in fltk image viewer after
> erosion , a blank after dilation and hence a blank
> after a open ...the levels in the input image are 0
> and 1 ... any ideas what could be wrong ...i am
> cutting and pasting the relevant code ..the initial
> input is a binary image that has been thresholded..is
> it that i am not calling an update somewhere...
> please lemme know
> thanks
> digvijay
> /***************************************/
> 
> typedef unsigned char BinaryImagePixelType ;
> typedef Image<BinaryImagePixelType, 3 >
> BinaryImageType ;
> 
> typedef
> BinaryBallStructuringElement<BinaryImagePixelType ,3>
> StructuringElementType ;
>   StructuringElementType ball ;
> 
> ball.SetRadius(1) ;
> ball.CreateStructuringElement() ;
> 
> typedef BinaryDilateImageFilter<BinaryImageType,
> BinaryImageType , StructuringElementType>
> dilateFilterType ;
> typedef BinaryErodeImageFilter<BinaryImageType,
> BinaryImageType, StructuringElementType>
> erodeFilterType ;
> dilateFilterType::Pointer dilateFilterOpen =
> dilateFilterType::New () ;
> erodeFilterType::Pointer erodeFilterOpen =
> erodeFilterType::New () ;
> 
> 
> erodeFilterOpen->SetInput (filterimage) ;/* this is a
> binary image and image operations until this stage are
> fine...*/
>   erodeFilterOpen->SetKernel (ball) ;
> erodeFilterOpen->SetErodeValue ( 1 ) ;
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> dilateFilterOpen->SetInput(
> erodeFilterOpen->GetOutput()) ;
>   dilateFilterOpen->SetKernel ( ball ) ;
> dilateFilterOpen->SetDilateValue ( 1 ) ;
> openImage =  dilateFilterOpen->GetOutput() ;
> flag = 1;
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> dilateFilterOpen->SetInput (openImage) ;
> 
> dilateFilterOpen->SetKernel (ball) ;
> dilateFilterOpen->SetDilateValue ( 1 ) ;
> 
> erodeFilterOpen->SetInput
> (dilateFilterOpen->GetOutput()) ;
> erodeFilterOpen->SetKernel (ball) ;
> erodeFilterOpen->SetErodeValue ( 1 ) ;
> 
> closeImage =  erodeFilterOpen->GetOutput() ;
> 
> 
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Tax Center - forms, calculators, tips, more
> http://taxes.yahoo.com/
>