[Insight-users] GradientAnisotropicDiffusionImageFilter

Luis Ibanez luis.ibanez at kitware.com
Mon Feb 5 08:19:36 EST 2007


Hi A.G.

Please find attached a modified version of the
GradientAnisotropicDiffusion example that you
have in Insight/Examples/Filtering.

This modified version uses:

    Dimension = 3
    input pixel type = unsigned char
    output pixel type = float

and then casts the output of the filter
in order to write it as an unsigned char.

We tested this example with the image:

       brainweb165a10f17.mha

That you can download from:

http://public.kitware.com/pub/itk/Data/BrainWeb/

The command line used for running it was:

./GradientAnisotropicDiffusion
~/data/BrainWeb/brainweb165a10f17.mha
output.mhd
6 0.06 3.0


The execution time was 90 seconds.


The output image is visibly smoothed.


Note that the BrainWeb images were generated with
a pixels independent 3% noise level. If you were
attempting to smooth images that already have a very
low level of noise, or a low spatial frequency noise,
then the effect of this filter is less noticeable.



Please give it a try to the attached example
using the BrainWave image. Once you get it to
work with that image, please try your own image
and let us know if you still have any problems.




    Thanks



      Luis



===========================
AG wrote:
> Hello Luis,
> 
> Thanks for responding to my post.
> 
> I have tried just about everything with this filter including using  
> float for both inputs and outputs.  In fact, I used it in the form of  
> the example and simply modified the input and output parts.  I also  
> tried to track it in the debugger and my sense is that something is  off 
> when the thread is running without proper values of the timeStep  and 
> the conductance.
> 
> I'd appreciate any help you can offer.
> 
> A.G.
> WaveMetrics, Inc.
> 
> 
> 
> On Feb 4, 2007, at 11:01 AM, Luis Ibanez wrote:
> 
>>
>> Hi A.G.
>>
>> The itkGradientAnisotropicDiffusionImageFilter
>> http://www.itk.org/Insight/Doxygen/html/ 
>> classitk_1_1GradientAnisotropicDiffusionImageFilter.html
>>
>> derives from the itkAnisotropicDiffusionImageFilter:
>> http://www.itk.org/Insight/Doxygen/html/ 
>> classitk_1_1AnisotropicDiffusionImageFilter.html
>>
>> whose documentation states:
>>
>>   "Inputs and Outputs
>>
>>    This is an image-to-image filter. The requirements for data types
>>    and dimensionality of the input and output are defined by  subclasses.
>>    In general, these filters expect images of real-valued types. This
>>    means pixel types of floats, doubles, or a user-defined type with
>>    floating point accuracy and arithmetic operations."
>>
>>
>> You may want to cast your input image to a type
>> itk::Image<float,dimension> before passing it to
>> the GradientAnisotropicDiffusionImageFilter.
>>
>> You can use the CastImageFilter<> for this purpose.
>>
>>
>> Note that the GradientAnisotropicDiffusionImageFilter
>> itself must also be instantiated over image types
>> whose pixel type is float or double.
>>
>>
>>
>>   Regards,
>>
>>
>>      Luis
>>
>>
>>
>> ---------
>> AG wrote:
>>
>>> Hello,
>>> I'm using a slightly modified version of Examples/Filtering/  
>>> GradientAnisotropicDiffusionImageFilter.cxx in my application.
>>> Testing the code with a 3D image of unsigned short input and  saving 
>>> a  float image output I find that the output is identical  to the 
>>> input  independent of the input parameters.  FWIW I have  tested this 
>>> with  conductance in the range of [0.05,50], time  steps in the range 
>>> of  0.01 to 0.125 and 5 iterations.
>>> Can anyone suggest why the filter does not seem to affect the image?
>>> TIA,
>>> A.G.
>>> WaveMetrics, Inc.
>>> _______________________________________________
>>> Insight-users mailing list
>>> Insight-users at itk.org
>>> http://www.itk.org/mailman/listinfo/insight-users
> 
> 
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: GradientAnisotropicDiffusion.cxx
Type: text/x-c++src
Size: 3028 bytes
Desc: not available
Url : http://public.kitware.com/pipermail/insight-users/attachments/20070205/999de828/GradientAnisotropicDiffusion.cxx
-------------- next part --------------
# This project is designed to be built outside the Insight source tree.
PROJECT(GradientAnisotropicDiffusion)

# Find ITK.
FIND_PACKAGE(ITK REQUIRED)
IF(ITK_FOUND)
  INCLUDE(${ITK_USE_FILE})
ENDIF(ITK_FOUND)

ADD_EXECUTABLE(GradientAnisotropicDiffusion GradientAnisotropicDiffusion.cxx )

TARGET_LINK_LIBRARIES(GradientAnisotropicDiffusion ITKCommon ITKIO)


More information about the Insight-users mailing list