MantisBT - ITK | |||||
View Issue Details | |||||
ID | Project | Category | View Status | Date Submitted | Last Update |
0012204 | ITK | ITK | public | 2011-05-17 17:26 | 2011-05-17 17:27 |
Reporter | xiaoxiao | ||||
Assigned To | xiaoxiao | ||||
Priority | normal | Severity | minor | Reproducibility | always |
Status | assigned | Resolution | open | ||
Platform | OS | OS Version | |||
Product Version | ITK-3-20 | ||||
Target Version | ITK-4-A3 | Fixed in Version | |||
Resolution Date | |||||
Sprint | |||||
Sprint Status | backlog | ||||
Summary | 0012204: 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 | ||||
Additional Information | |||||
Tags | No tags attached. | ||||
Relationships | |||||
Attached Files | ![]() https://public.kitware.com/Bug/file/3880/GuassianBlurImageFunction.cxx ![]() https://public.kitware.com/Bug/file/3881/CMakeLists.txt | ||||
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 |
There are no notes attached to this issue. |