[ITK] Some Troubles with the itkPatchBasedDenoisingImageFilter

Kristen Zygmunt krismz at sci.utah.edu
Tue Apr 19 12:32:22 EDT 2016


Hi Andreas,
  The patch-based denoising filter’s defaults were meant to work reasonably well in many cases, though it does default to 1 iteration to match the non-local means algorithm.  So if the image is not being denoised enough, you can increase the number of iterations to improve denoising results.  However, you’ll want to address the speed issues first.  It is critical for this algorithm that ITK be built in release mode instead of debug mode, so please check that it is built in release mode (or at least relwithdebinfo) first.

If, after trying the suggestions below, your results are still slower than you expect, please respond with the size of image you are trying to process and some details on amount of memory on your machine.  And if it’s still not being denoised after 2-5 iterations, please provide a before and after screenshot if possible.

You can look at some of the options that are used in the itkPatchBasedDenoisingImageFilterTest as these were tuned to run faster tests.  In particular, I would suggest starting with sampler->SetNumberOfResultsRequested(500) which determines how many patches any given patch will be compared to.  Depending on the characteristics of your image, you can get away with smaller numbers here.  You could start small (like a few hundred or a thousand) and then increase if the denoised image is not of good enough quality.  Also, the patch radius plays a critical role in the speed and performance of the algorithm.  The radius can be somewhat related to feature sizes in a particular image, but the general guideline is to pick the smallest possible radius that gives good denoising results for your image or class of images.  The default is 4, so perhaps try that first.  Also prefer an even patch radius to an odd one.  Remember that this is a radius, so the patch size for radius of 4 will be 9x9.

You can control how many pixels are used for the sigma kernel bandwidth estimation as a fraction of the image size with denoisingImageFilter->SetKernelBandwidthFractionPixelsForEstimation(0.20) to use 20% of the image pixels for estimation (note that there is a confusing comment in the test driver where 33% is in the comment but 0.20 is used in the code.  The comment here should read 20%).  Additionally, if you are doing multiple iterations of denoising, you don’t necessarily need to update sigma every denoising iteration.  Use denoisingImageFilter->SetKernelBandwidthUpdateFrequency(n) to update sigma every nth iteration.

Hope this helps!
Kris

> 
> Date: Tue, 19 Apr 2016 00:18:42 +0200
> From: Andreas Klos <aklos at outlook.de>
> To: "community at itk.org" <community at itk.org>
> Subject: [ITK] Some Troubles with the
> 	itkPatchBasedDenoisingImageFilter
> Message-ID: <COL128-W65BF9ACC3BC74578C6E6FCC66B0 at phx.gbl>
> Content-Type: text/plain; charset="iso-8859-1"
> 
> Dear great ITK- Community,
> Currently I am struggeling with the "itkPatchBasedDenoisingImageFilter". I try to use this filter but it does not work for me at the moment. I try to process a 16bit dicom Image with this denoising filter. 
> 
> Currently when i try to apply this filter my computer seems to be very busy for several minutes. But the result of the computation is the same like the original data. As if there where no processing step performed on the image.
> 
> So the question is, do I have to downsample my image to 8 bit image? or do I have to do a special weigthing when I work with 16 bit images? Or is there something special which I should consider when I use this filter?
> 
> Because there is no real example about this filter I also have some questions on how to configure this filter to use it in an efficient way. 
> When I took a look in the doxygen of itk about this filter I read this sentence "It implements schemes for random sampling of patches non-locally (from the entire image)...". Do I understand it right that I can use subsamples of an image to create a searchwindow to reduce the computational time? 
> 
> It would be very greatful if someone can help me to get a clear mind about this filter and how to apply it correctly.
> 
> Below is my current not really satisfying code where I try to determine my search window and the patch size.
> 
> Best Regards,
> Andreas
> 	
> typedef itk::Image<PixelType, 2> ImageType2D;
> 
> typedef itk::PatchBasedDenoisingImageFilter<ImageType2D, ImageType2D> PatchBasedDenoisingFilterType;
> 
> 
> 	typedef itk::Statistics::GaussianRandomSpatialNeighborSubsampler<PatchBasedDenoisingFilterType::PatchSampleType, ImageType2D::RegionType> SamplerType;
> 
> 	PatchBasedDenoisingFilterType::Pointer denoisingImageFilter= PatchBasedDenoisingFilterType::New();
> 
> 
> 	SamplerType::Pointer sampler = SamplerType::New();
> 
> //The value for the patchRadius is provided by the user through a GUI
> 	double dataArray[1];
> 
> 
> 	dataArray[0] = _patchSize;
> 
> itk::Array<double> dArray;
> 	
> dArray.SetData(dataArray);
> 	denoisingImageFilter->SetInput(inputImage);
> 
> 
> //Here I set my PatchRadius. my default value is 7 
> 	denoisingImageFilter->SetPatchRadius(dArray[0]);
> 
> 
> 
> //Here I try to define a searchwindow to reduce the computational time 
> 	sampler->SetRadius(21);
> 
> 
> 	denoisingImageFilter->SetSampler(sampler);
> 
> 
> 	try{
> 
> 
> 		denoisingImageFilter->Update();
> 
> 
> 	}
> 
> 
> 	catch (itk::ExceptionObject error){
> 
> 
> 		std::cerr << "An ExceptionObject was caught!" << std::endl;
> 
> 
> 		std::cerr << error << std::endl;
> 
> 
> 	}
> 



More information about the Community mailing list