<div dir="ltr">Hi, <div>I think there is a bug in the Danielsson'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'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's here </div><div>typedef itk::Offset< 3 > Offset3DType;</div><div>typedef itk::Image<Offset3DType, 3> Image3DOffsetType;</div><div>typedef Image3DOffsetType::Pointer Image3DOffsetPointerType;</div>
<div><br></div><div>typedef itk::Image<short, 3> Image3DShortType;</div><div>typedef itk::Image<float, 3> 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< Image3DShortType, Image3DFloatType > FilterType;</div>
<div>typedef itk::DanielssonDistanceMapImageFilter< Image3DShortType, Image3DFloatType > FilterType;</div><div>FilterType::Pointer filter = FilterType::New(); </div><div>filter->SetInput(square_image); </div><div>
filter->SetUseImageSpacing(true);</div><div>filter->Update(); </div><div><br></div><div><br></div><div>dist_map_image = filter->GetOutput(); </div><div>offset_image = filter->GetVectorDistanceMap(); </div><div>
<br></div><div>typedef DataTypeTraits<Image3DOffsetPointerType>::DataIteratorType offsetIterator; </div><div>typedef DataTypeTraits<Image3DFloatPointerType>::DataIteratorType distanceIterator; </div><div><br>
</div>
<div>distanceIterator dist_it(dist_map_image,dist_map_image->GetLargestPossibleRegion()); </div><div>offsetIterator offset_it(offset_image,offset_image->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("diagnostics.txt"); </div><div><br></div><div>for(int i =0; i<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<<"Index,"<<index_point.GetIndex()[0]<<","<<index_point.GetIndex()[1]<<","<<index_point.GetIndex()[2]<<","; </div>
<div><span class="" style="white-space:pre">        </span>value<<"Offset,"<<offset_it.Get()[0]<<","<<offset_it.Get()[1]<<","<<offset_it.Get()[2]<<","; </div>
<div><span class="" style="white-space:pre">        </span>value<<"error,"<<(dist_it.Get())<<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>