[Insight-users] problem with BilateralImageFilter - GradientAnisotropicDiffusionImageFilter

Luis Ibanez luis.ibanez at kitware.com
Sun Sep 18 11:32:46 EDT 2005



Hi Juan,

Thanks for posting the additional information about your project.


1) The performance of ITK *MUST* be measured in Release mode only.

    The reason is that ITK uses C++ templates and Generic Programming
    and it has been designed on the assumption that many of the methods
    will get inlined.

    When you compile a program for Debug, inlining is disabled,
    and you get a high performance penalty.  It is common to find that
    ITK code run 10X faster when compiled for Release.


2) Do not perform slice-by-slice processing !!

    This is a primitive and retrograd approach for image processing.
    Such methodology has been very detrimental for the progress of
    the medical imaging field.

    ITK was designned as an N-Dimensional toolkit and offers you all
    the functionalities for managing your images in their natural
    dimension.

    Slice-by-Slice processing is not equivalent to 3D processing,
    particularly for smoothing.


3) If you have a 3D volume stored as a series of 2D images, you can
    start by loading it as a 3D volume by using the ImageSeriesReader,
    just as it is explained in the ITK Software Guide

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




If you still find that the Bilateral image filter is not fast enough
for the requirements of your application, then you should consider
using other filters such as


     - Curvature Flow
     - Gradient Anisotropic Diffusion
     - Median (run in multiple iterations).




Regards,


     Luis



---------------------------------------
Juan Gabriel Ramírez Sosa wrote:
> 1) Number of pixels:  (256*256)=65536. 
> 2) I works my application in way debug.  
> 3) I want to use Bilateral image Filter and Gradient Anisotropic
> Filter to heighten contours before the segmentation... I uses the
> Median filter for the control of the noise.
> 
> Now I comment my problem:
> I works with a series of images extension raw (98 altogether). 
> According to the examples that appear in user guide the
> BilateralImageFilter works from the dimensions of the image.  As I
> said to you, work with a type of image 3d, with type of pixel unsigned
> to char.
> 
> My questions: 
> 1) It is necessary that it must filter in the 3 dimensions.  
> 2) How it would be the suitable use to filter my series.  
> 3) I can only use 2 dimensions and I obtain appropriate results in the filtrate?
> 
> 
> Thank you very much Luis.  
> 
> Juan G.
> 
> 
> 
> 2005/9/15, Luis Ibanez <luis.ibanez at kitware.com>:
> 
>>Hi Juan,
>>
>>1) What is the number of pixels on each slice ?
>>
>>2) Are you compiling your application for "Release" ?
>>    There is a huge difference in performance
>>    between Release and Debug mode.
>>
>>3) Do you need to use the Bilateral image filter ?
>>    There are other faster options, including
>>    CurvatureFlow and the Median filter.
>>
>>
>>  Regards,
>>
>>
>>     Luis
>>
>>
>>
>>----------------------------------
>>Juan Gabriel Ramírez Sosa wrote:
>>
>>>Hello, i uses the GradientAnisotropicDiffusionImageFilter and
>>>BilateralImageFilter in a raw image that contains 97 slices.
>>>
>>>With the first filter my application run very slow, it take more than
>>>5 minutes in apply the filter.  If you can help me and make it faster
>>>thanks.
>>>
>>>And with the BilateralImageFilter and parameters domain sigma 4 and
>>>range sigma 5 the aplication run, but it shows an error after 5
>>>minutes when i apply the filter.
>>>
>>>
>>>I uses the following code for the BilateralImageFilter
>>>
>>>///////////////
>>>try{
>>> this->filter->SetInput(this->pDoc->reader->GetOutput() );
>>> const unsigned int Dimension =  OutputImageType::ImageDimension;
>>> double domainSigmas[Dimension];
>>>const double rangeSigma = float(this->m_spinransigma.GetPos());
>>>for(unsigned int i=0; i<Dimension; i++)
>>>{
>>>domainSigmas[i] = float(this->m_spindomsigma.GetPos());
>>>}
>>>this->filter->SetDomainSigma( domainSigmas );
>>>this->filter->SetRangeSigma( rangeSigma );
>>>this->filter->Update();
>>>rescaler->SetOutputMinimum(   0 );
>>>rescaler->SetOutputMaximum( 255 );
>>>this->rescaler->SetInput(filter->GetOutput() );
>>>this->pDoc->connector->SetInput(this->rescaler->GetOutput());
>>>this->pDoc->connector->Update();
>>>}
>>>catch( itk::ExceptionObject & err )
>>>{
>>> MessageBox(err.what(),"Alerta",MB_ICONERROR);
>>> return;
>>>}
>>>///////////////////////////
>>>
>>>some help, any suggestion, thank.
>>>
>>>Juancho.
>>>_______________________________________________
>>>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