[Insight-users] Anisotropic Diffusion filtering

Luis Ibanez luis.ibanez at kitware.com
Fri Aug 10 08:45:45 EDT 2007


Hi Rashed,

That sounds indeed like a bug...

but before we go there:

1) Why are you setting explicitly the ImageIO in the Reader and Writer ?
    The filename extension of GIPL files should be enough for letting the
    IO factory find the appropriate ImageIO class.

2) Where you getting any error messages when not setting
    the ImageIO directly ?

3) Now that you add the ImageIO, do you get any error messages ?


   Thanks


      Luis


------------------
rashedk wrote:
> Hi Luis, 
> 
> Thanks for your reply. I am working with GIPL images, and so after you asked
> me to test the anisotropic filter with a single slice of my image, I started
> trying to use the ExtractImageFilter to extract a slice. So to read and
> write GIPL images by setting ImageIO explicitly: 
> 
> typedef itk::GiplImageIO ImageIOType; 
> ImageIOType::Pointer giplIO = ImageIOType::New(); 
> reader->SetImageIO(giplIO); 
> writer->SetImageIO(giplIO); 
> 
> I am not able to extract a slice of my image (after adding these lines to
> the example code of ExtractImageFilter). Now I am getting the feeling that
> perhaps there are some issues with GIPL Input/Output in ITK?? 
> 
> However, i have tested flushing a GIPL reader's output to a GIPL writer's
> input without a filter in between, and that works perfectly fine. 
> 
> 
> 
> 
> 
> Luis Ibanez wrote:
> 
>>
>>Hi Rashed,
>>
>>
>>
>>  1) Could you post somewhere in a public web site
>>     a slice of one of your 3D images ?
>>
>>
>>  2) The numerical values recommended for the parameters
>>     of this filter, are for a typical MRI image.
>>
>>     If your images happen to have a very different
>>     appearance then you need to explore different settings
>>     for the parameters.
>>
>>     I would strongly suggest you to do this first in a single
>>     slice of the 3D image (use the ExtractImageFilter), since
>>     it will be a lot faster to try many different combinations
>>     of the filter parameters.
>>
>>
>>  3) 50 iterations, should be more than enough for producing
>>     a visible effect in the images... unless your images are
>>     very particular,
>>
>>     What is the modality of your images ? (CT? MRI? Ultrasound ?)
>>     What is the content of the image ? brain?, liver?
>>
>>
>>  4) The time step should be small. The critical values are in the
>>     order of 0.625. Whenever you go higher than that the filter
>>     becomes numerically unstable. You should probably stay below
>>     half that value, just to be safe.
>>
>>     Note however, that there is a relationship between the time
>>     step and the number of iterations. After all, this filter is
>>     simulating the melting of the material in your image as if it
>>     were a physical problem. This is a discretization of a continuous
>>     physical model. If you use half of the time steps, you will need
>>     double the iterations in order to cover the same process.
>>
>>     That being said, this is just a simile, there is no real melting
>>     happening here, so you simply use the physical model as an analogy
>>     for smoothing the image.
>>
>>
>>  5) A Gaussian smoothing of 20-30 is *HUGE*.
>>
>>     What specific filter did you use for the smoothing ?
>>     What is the pixel spacing of your images ?
>>
>>
>>
>>  Please give us more information,
>>
>>
>>     Thanks
>>
>>
>>        Luis
>>
>>
>>---------------------
>>rashed karim wrote:
>>
>>>Hi everyone,
>>> 
>>>I am trying to use the itkGradientAnisotropicDiffusionImageFilter class 
>>>for smoothing my MRI images. To my dismay, my images are not responding 
>>>to the filter even when I run 50 or so iterations with a conductance of 
>>>about 3.0 (i.e. output image is the same as the input image with no 
>>>visible difference). An earlier forum post had suggested to use a 3.0 
>>>conductance level, but such a high conductance rate makes the 
>>>output image unrecognizable (lots of salt-pepper noise).
>>> 
>>>So has anyone used this filter before, and if so, what sort of 
>>>parameter values (number of iterations, conductance and time step) 
>>>should I be looking to use. Although I know that these values depend 
>>>on the type of my images I am working with, but any suggestions will be 
>>>very useful.
>>> 
>>>Also in the documentation it says somewhere that the time step parameter 
>>>is similar to the width of the gaussian kernel. I have tried values of 
>>>20.0 - 30.0. However, I get a warning message telling me that this sort 
>>>of value is an "unstable time step" for my images. The message also 
>>>suggests a timestep which is usually a very small value (~ 0.05). What i 
>>>dont understand, is that I had no problems (isotropic) 
>>>Gaussian smoothing my images with widths ranging from 20.0 - 30.0, then 
>>>why does the anisotropic filter complain for such widths?
>>> 
>>>Here is part of my code if it helps:
>>> 
>>> typedef itk::Image< PixelType, 3 > InputImageType;
>>> typedef itk::Image< PixelType, 3 > OutputImageType;
>>> typedef itk::ImageFileReader< InputImageType > ReaderType;
>>> typedef itk::ImageFileWriter< OutputImageType >  WriterType;
>>> typedef itk::GiplImageIO ImageIOType;
>>> typedef itk::GradientAnisotropicDiffusionImageFilter<InputImageType, 
>>>OutputImageType > FilterType;
>>> 
>>>
>>> ReaderType::Pointer reader = ReaderType::New();
>>> WriterType::Pointer writer = WriterType::New();
>>> ImageIOType::Pointer giplIO = ImageIOType::New();
>>> FilterType::Pointer filter = FilterType::New();
>>>
>>> reader->SetFileName( argv[1] );
>>> writer->SetFileName( argv[2] );
>>> 
>>> 
>>> // for GIPL files
>>> reader->SetImageIO(giplIO);
>>> writer->SetImageIO(giplIO);
>>> 
>>> //reader->Update();
>>> 
>>> writer->SetInput(filter->GetOutput());
>>> filter->SetInput(reader->GetOutput());
>>> filter->SetNumberOfIterations( numberOfIterations );
>>> filter->SetTimeStep( timeStep );
>>> filter->SetConductanceParameter( conductance );
>>> writer->Update();
>>>
>>>Thanks for any suggestions,
>>>
>>> 
>>>
>>>Regards,
>>>
>>>Rashed Karim.
>>>
>>>
>>>------------------------------------------------------------------------
>>>
>>>_______________________________________________
>>>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