<div>Hi guys,</div><div><br></div><div>I was testing SignedMaurerDistanceMapImageFilter today, and I ran into some weird results. Namely, there seem to be some wrong results for my test images. To make things more obvious, I created 2D test cases and they are attached, as well as results.</div>
<div><br></div><div>bin_* are binary test images. They were extracted from 3D versions which were written as intermediate debug output from my project (obtained using BinaryThresholdImageFilter).</div><div>df_* are outputs created with the test program below. Some obvious errors are circled in red. [The result for real life data is over the 80KB list limitation so I had to remove it. The problems are in the lower left corner and along the entire right edge.]</div>
<div><br></div><div>Are these know limitations, bugs which I discovered or my misinterpretation of the purpose of this filter?</div><div><br></div><div>Regards,</div><div>Dženan</div><div><br></div><div><font class="Apple-style-span" face="'courier new', monospace">bugTester.cpp</font> (uses ITK 3.20):</div>
<div><font class="Apple-style-span" face="'courier new', monospace">#include "itkImageFileReader.h"</font></div><div><font class="Apple-style-span" face="'courier new', monospace">#include "itkImageFileWriter.h"</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace">#include "itkImage.h"</font></div><div><font class="Apple-style-span" face="'courier new', monospace">#include "itkContinuousIndex.h"</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace">#include "itkSignedMaurerDistanceMapImageFilter.h"</font></div><div><font class="Apple-style-span" face="'courier new', monospace">#include "itkRescaleIntensityImageFilter.h"</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace">#include <iostream></font></div><div><font class="Apple-style-span" face="'courier new', monospace">using namespace std;</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace">int main( int argc, char ** argv )</font></div><div><font class="Apple-style-span" face="'courier new', monospace">{</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> typedef itk::Image<short, 2> ShortImageType;</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> typedef itk::Image<unsigned short, 2> UShortImageType;</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> typedef itk::Image<unsigned char, 2> VisualizingImageType;</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> typedef itk::ImageFileReader< VisualizingImageType > ReaderType;</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> ReaderType::Pointer reader = ReaderType::New();</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> reader->SetFileName( argv[1] ); //read binary image stored in png</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> reader->Update();</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> </font></div><div><font class="Apple-style-span" face="'courier new', monospace"> VisualizingImageType::Pointer image=reader->GetOutput();</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> typedef itk::SignedMaurerDistanceMapImageFilter<VisualizingImageType, ShortImageType> DistanceMapType;</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> DistanceMapType::Pointer dm=DistanceMapType::New();</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> dm->SetInput(image);</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> dm->SquaredDistanceOff();</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> //dm->SetInsideIsPositive(true);</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> dm->Update();</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"><br></font></div><div><font class="Apple-style-span" face="'courier new', monospace"> typedef itk::RescaleIntensityImageFilter < ShortImageType, UShortImageType > RescaleImageFilterType;</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> RescaleImageFilterType::Pointer rescale = RescaleImageFilterType::New();</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> rescale->SetInput( dm->GetOutput() );</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> rescale->Update();</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> </font></div><div><font class="Apple-style-span" face="'courier new', monospace"> typedef itk::ImageFileWriter<UShortImageType> WriterType;</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> WriterType::Pointer writer1=WriterType::New();</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> writer1->SetFileName("dfBug.png");</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> writer1->SetInput(rescale->GetOutput());</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> writer1->Update();</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"><br></font></div><div><font class="Apple-style-span" face="'courier new', monospace"> return 0;</font></div><div><font class="Apple-style-span" face="'courier new', monospace">}</font></div>