[Insight-users] Anisotropic Diffusion filtering

Luis Ibanez luis.ibanez at kitware.com
Wed Aug 15 08:02:27 EDT 2007

Hi Rashed,

Thanks for confirming that the gradient anisotropic
diffusion is working for you once you change the pixel

Writing the output as GIPL worked fine for me, using
the CVS version of ITK updated yesterday.

       What version of ITK are you using ?

You clearly don't have the most recent version of ITK
because the instruction that throws the Exception for
Unknown pixel type in the itkGiplImageIO.cxx file is
now in lines 713-715, not in line 688 as your error
message indicates.

BTW: It would have been *VERY USEFUL* if from the
      beginning you have posted to the mailing list
      the *EXACT* error message that you were getting
      from the GiplImageIO class.     :-)

Please update your version of ITK and let us know
if you still have any problems.



rashedk wrote:
> Hi Luis, 
> I greatly appreciate you testing the programs on my image slices. The
> Gradient anisotropic diffusion now works perfectly fine, and it does smooth
> the image whilst preserving the edges. As you mentioned about setting the
> pixel type to float, as this is what is used by the PDE solver of the
> filter. I remember using 'short' and 'int' instead, which may be why i wasnt
> able to get it to work. 
> However, I am still curious as to why writing to a GIPL file after filtering
> is still not working. So i am using this:
> GradientAnisotropicDiffusionImageFilter slice.hdr sliceGADSmoothed.gipl 10
> 0.05 3.0
> and I am getting this exception:
> Location: "Unknown"
> File: \Insight Toolkit\project\Code\Io\itkGiplImageIO.cxx
> Line: 688
> Description: Pixel Type Unknown
> However, when i use:
> GradientAnisotropicDiffusionImageFilter slice.hdr sliceGADSmoothed.hdr 10
> 0.05 3.0
> it works perfectly fine - i.e. it writes the output to ANALYZE format ok. 
> Many Thanks
> Rashed. 
> Luis Ibanez wrote:
>>Hi Rashed,
>>      Thanks for posting your image.
>>We tested both of your reported problems:
>>  a) Problem reading / writing GIPL images
>>  b) Problem running Gradient anisotropic diffusion.
>>However, both of these scenarios worked fine in our tests.
>>Please find attached the source code of the tests we ran,
>>a) We were able to convert your slice.hdr (Analyze image)
>>    to GIPL just using the ImageReadWrite.cxx program attached.
>>    The image was converted without any problem.
>>b) We were able to extract a slice from the Analyze image and
>>    save it as a GIPL image, using the attached ImageReadExtractWrite.cxx
>>    program.
>>c) We were able to run GradientAnisotropic diffusion on your
>>    input analyze image and produce a GIPL image as output
>>   with  the expected result of a smoothed image, and still having
>>   some degree of edge-preservation.
>>   The command line used was:
>>    GradientAnisotropicDiffusionImageFilter slice.hdr
>>0.05 3.0
>>   That is, 10 iterations, a time step of 0.05 and a conductance of 3.0
>>   The computation took 31 seconds in a Precision WorkStation 450
>>   with  Intel Xeon CPU 2.40GHz running Debian Linux, and compiled
>>   for Release using Gcc 4.1.
>>   Note that your image is called slice.hdr but it actually contains 8
>>   of 200x208 pixels in size.
>>   Note also that the pixel type used for the Gradient Anisotropic
>>   is "float", this is due to the use of the PDE solver in this filter. In
>>   pipeline, you could use the CastImageFilter or the RescaleImageFilter
>>   for converting the pixel type your image before passing it to the
>>   GradientAnistropicDiffusionImageFilter.
>>  Please give it a try to the attached programs and let us know if you
>>  find any difficulties using the GradientAnisotropicDiffusion filter or
>>  the GIPL file format.
>>     Thanks
>>        Luis

More information about the Insight-users mailing list