<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="&#39;courier new&#39;, monospace">bugTester.cpp</font> (uses ITK 3.20):</div>

<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">#include &quot;itkImageFileReader.h&quot;</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">#include &quot;itkImageFileWriter.h&quot;</font></div>

<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">#include &quot;itkImage.h&quot;</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">#include &quot;itkContinuousIndex.h&quot;</font></div>

<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">#include &quot;itkSignedMaurerDistanceMapImageFilter.h&quot;</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">#include &quot;itkRescaleIntensityImageFilter.h&quot;</font></div>

<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">#include &lt;iostream&gt;</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">using namespace std;</font></div>

<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">int main( int argc, char ** argv )</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">{</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">    typedef itk::Image&lt;short, 2&gt; ShortImageType;</font></div>

<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">    typedef itk::Image&lt;unsigned short, 2&gt; UShortImageType;</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">    typedef itk::Image&lt;unsigned char, 2&gt; VisualizingImageType;</font></div>

<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">    typedef itk::ImageFileReader&lt; VisualizingImageType &gt;  ReaderType;</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">    ReaderType::Pointer reader = ReaderType::New();</font></div>

<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">    reader-&gt;SetFileName( argv[1]  ); //read binary image stored in png</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">    reader-&gt;Update();</font></div>

<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">    </font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">    VisualizingImageType::Pointer image=reader-&gt;GetOutput();</font></div>

<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">    typedef itk::SignedMaurerDistanceMapImageFilter&lt;VisualizingImageType, ShortImageType&gt; DistanceMapType;</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">    DistanceMapType::Pointer dm=DistanceMapType::New();</font></div>

<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">    dm-&gt;SetInput(image);</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">    dm-&gt;SquaredDistanceOff();</font></div>

<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">    //dm-&gt;SetInsideIsPositive(true);</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">    dm-&gt;Update();</font></div>

<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><br></font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">    typedef itk::RescaleIntensityImageFilter &lt; ShortImageType, UShortImageType &gt; RescaleImageFilterType;</font></div>

<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">    RescaleImageFilterType::Pointer rescale = RescaleImageFilterType::New();</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">    rescale-&gt;SetInput( dm-&gt;GetOutput() );</font></div>

<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">    rescale-&gt;Update();</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">    </font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">    typedef itk::ImageFileWriter&lt;UShortImageType&gt; WriterType;</font></div>

<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">    WriterType::Pointer writer1=WriterType::New();</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">    writer1-&gt;SetFileName(&quot;dfBug.png&quot;);</font></div>

<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">    writer1-&gt;SetInput(rescale-&gt;GetOutput());</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">    writer1-&gt;Update();</font></div>

<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><br></font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">    return 0;</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">}</font></div>