View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0012204ITKITKpublic2011-05-17 17:262011-05-17 17:27
Reporterxiaoxiao 
Assigned Toxiaoxiao 
PrioritynormalSeverityminorReproducibilityalways
StatusassignedResolutionopen 
PlatformOSOS Version
Product VersionITK-3-20 
Target VersionITK-4-A3Fixed in Version 
Summary0012204: wrong behavior of GaussianBlurImageFunction evaluating at a continuous index
Description
When using itk::GaussianBlurImageFunction on a point of an image to get the weighted /interpolated values from its neighbors, if sigma is set to be zero, the GuassianBlurImageFunction should return the original value of the point. It is indeed the case when evaluating using EvaluateAtIndex(), however, when you call EvaluateAtContinousIndex() instead, the return value is zero.


An easy test to repeat this includes the following code (the complete code is attached):
....
gaussianFunction->SetSigma( 0.0 );
gaussianFunction->UseImageSpacingOn();

....

ConstIteratorType it( inputImage, region )

it.GoToBegin();
while( !it.IsAtEnd() )
      {
      out.Set( gaussianFunction->EvaluateAtContinuousIndex(it.GetIndex() ) );
       ++it;
      ++out;
      }
...

The resulting zero-blurred image is zero everywhere.

*****************************************************************

The problem lies in the function itk::GaussianBlurImageFunction::EvaluateAtContinousIndex().

The Gaussian kernel size (line 371) is determined by the input sigma(m_Sigma).
So when sigma is set to be zero, the Gaussian kernel is empty. Therefore, the convolution results with the zero Gaussian kernel is zero.

Also, the kernel size is wrong when the the sigmas are in physical unit, which is true by default. The radius size of the gaussianNeighbood should always be in pixel unit. Therefore, When the image spacing is close to 1.0, the resulting blurred image is not affected much. But when the image spacing is far from 1.0, for example (in one dimension case) : 1) When spacing is 10mm and sigma is 50 mm, then the Gaussian kernel array is a (50 *2 +1)= 101 long vector, which will extremely slowing down the convolution process; 2) When spacing is 0.1mm, and the sigma is 1 mm, the Gaussian kernel is only a 3 vector, which means only the two nearest neighbors are included in the convolution process, resulting in poor blurring results.
--
Steps To Reproduce
The testing code is attached (modified from http://www.vtk.org/Wiki/index.php?title=ITK/Examples/Functions/GuassianBlurImageFunction&oldid=38671 [^]
)

The test program GuassianBlurImageFunction can be generated.

To test the zero sigma problem, run :
 GuassianBlurImageFunction <input image> <output image> 0 6

TagsNo tags attached.
Resolution Date
Sprint
Sprint Statusbacklog
Attached Filescxx file icon GuassianBlurImageFunction.cxx [^] (2,078 bytes) 2011-05-17 17:27
txt file icon CMakeLists.txt [^] (269 bytes) 2011-05-17 17:27 [Show Content]

 Relationships

  Notes
There are no notes attached to this issue.

 Issue History
Date Modified Username Field Change
2011-05-17 17:26 xiaoxiao New Issue
2011-05-17 17:26 xiaoxiao Status new => assigned
2011-05-17 17:26 xiaoxiao Assigned To => xiaoxiao
2011-05-17 17:27 xiaoxiao File Added: GuassianBlurImageFunction.cxx
2011-05-17 17:27 xiaoxiao File Added: CMakeLists.txt


Copyright © 2000 - 2018 MantisBT Team