<div dir="ltr">Hi, <div>I think there is a bug in the Danielsson&#39;s distance map function. To Test this I built a square phantom in 3D (Just the same square in all slices of the volume). The spacing was casted from an actual MRI Volume. (Spacing - 0.365mm X 0.365mm X 0.7mm). I have attached the square volume with the image. </div>


<div><br></div><div>The square phantom has two labels one for the outer square and the other for the inner. When taking the distance map I observe that when the query point is outside of the label the distance map is correct. But on the inside there are two scenarios. The signed Danielsson distance function gives me the correct distance map values (compared with the Maurer&#39;s distance map function) but the offset is all zero. The unsigned Danielsson distance function gives me the correct distance map values when on the outside of the contour of the object. But on the inside both the offset and the distance values are zero. </div>


<div><br></div><div>I am outputting the euclidian distance map values as a float image and the offset image. I am attaching a table with the comparitive results to show what I meant. Attached below is a snippet of the code which would replicate the error. Can someone comment on if this is a bug or not.</div>


<div><br></div><div><br></div><div><div>//All typedef&#39;s here </div><div>typedef itk::Offset&lt; 3 &gt; Offset3DType;</div><div>typedef itk::Image&lt;Offset3DType, 3&gt; Image3DOffsetType;</div><div>typedef Image3DOffsetType::Pointer Image3DOffsetPointerType;</div>

<div><br></div><div>typedef itk::Image&lt;short, 3&gt; Image3DShortType;</div><div>typedef itk::Image&lt;float, 3&gt; Image3DFloatType;</div><div><br></div><div>typedef Image3DFloatType::Pointer Image3DFloatPointerType;</div>

<div>typedef Image3DShortType::Pointer Image3DShortPointerType;</div><div><br></div><div>Image3DFloatPointerType dist_map_image;</div><div>Image3DOffsetPointerType offset_image; </div><div><br></div><div>//typedef itk::SignedDanielssonDistanceMapImageFilter&lt; Image3DShortType, Image3DFloatType &gt; FilterType;</div>

<div>typedef itk::DanielssonDistanceMapImageFilter&lt; Image3DShortType, Image3DFloatType &gt; FilterType;</div><div>FilterType::Pointer filter = FilterType::New(); </div><div>filter-&gt;SetInput(square_image); </div><div>

filter-&gt;SetUseImageSpacing(true);</div><div>filter-&gt;Update(); </div><div><br></div><div><br></div><div>dist_map_image = filter-&gt;GetOutput(); </div><div>offset_image = filter-&gt;GetVectorDistanceMap(); </div><div>

<br></div><div>typedef DataTypeTraits&lt;Image3DOffsetPointerType&gt;::DataIteratorType offsetIterator; </div><div>typedef DataTypeTraits&lt;Image3DFloatPointerType&gt;::DataIteratorType distanceIterator; </div><div><br>
</div>
<div>distanceIterator dist_it(dist_map_image,dist_map_image-&gt;GetLargestPossibleRegion()); </div><div>offsetIterator offset_it(offset_image,offset_image-&gt;GetLargestPossibleRegion()); </div><div><br></div><div>Image3DFloatType::PointType physical_point; </div>

<div>Image3DFloatType::IndexType index_point; </div><div><br></div><div>//Write out text file with values. </div><div>std::ofstream value; value.open(&quot;diagnostics.txt&quot;); </div><div><br></div><div>for(int i =0; i&lt;20; ++i){<span class="" style="white-space:pre">                </span></div>

<div><span class="" style="white-space:pre">        </span>index_point[0] = 140+i; index_point[1] = 140+i; index_point[2] = 1;</div><div><span class="" style="white-space:pre">        </span>dist_it.SetIndex(index_point); </div><div><span class="" style="white-space:pre">        </span>offset_it.SetIndex(index_point); </div>

<div><span class="" style="white-space:pre">        </span></div><div><span class="" style="white-space:pre">        </span>value&lt;&lt;&quot;Index,&quot;&lt;&lt;index_point.GetIndex()[0]&lt;&lt;&quot;,&quot;&lt;&lt;index_point.GetIndex()[1]&lt;&lt;&quot;,&quot;&lt;&lt;index_point.GetIndex()[2]&lt;&lt;&quot;,&quot;; </div>

<div><span class="" style="white-space:pre">        </span>value&lt;&lt;&quot;Offset,&quot;&lt;&lt;offset_it.Get()[0]&lt;&lt;&quot;,&quot;&lt;&lt;offset_it.Get()[1]&lt;&lt;&quot;,&quot;&lt;&lt;offset_it.Get()[2]&lt;&lt;&quot;,&quot;; </div>

<div><span class="" style="white-space:pre">        </span>value&lt;&lt;&quot;error,&quot;&lt;&lt;(dist_it.Get())&lt;&lt;std::endl; </div><div>}</div><div><br></div><div>value.close(); </div></div><div><br></div><div><br></div>
<div>
<div><div dir="ltr">Thank you, </div><div dir="ltr">Regards,<br><div>Kashyap</div></div></div>
</div></div>