[Insight-users] Suspected Bug in Danielsson's Distance map.
Satyananda Kashyap
ksatyananda at gmail.com
Mon Sep 23 12:12:43 EDT 2013
Hi,
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.
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.
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.
//All typedef's here
typedef itk::Offset< 3 > Offset3DType;
typedef itk::Image<Offset3DType, 3> Image3DOffsetType;
typedef Image3DOffsetType::Pointer Image3DOffsetPointerType;
typedef itk::Image<short, 3> Image3DShortType;
typedef itk::Image<float, 3> Image3DFloatType;
typedef Image3DFloatType::Pointer Image3DFloatPointerType;
typedef Image3DShortType::Pointer Image3DShortPointerType;
Image3DFloatPointerType dist_map_image;
Image3DOffsetPointerType offset_image;
//typedef itk::SignedDanielssonDistanceMapImageFilter< Image3DShortType,
Image3DFloatType > FilterType;
typedef itk::DanielssonDistanceMapImageFilter< Image3DShortType,
Image3DFloatType > FilterType;
FilterType::Pointer filter = FilterType::New();
filter->SetInput(square_image);
filter->SetUseImageSpacing(true);
filter->Update();
dist_map_image = filter->GetOutput();
offset_image = filter->GetVectorDistanceMap();
typedef DataTypeTraits<Image3DOffsetPointerType>::DataIteratorType
offsetIterator;
typedef DataTypeTraits<Image3DFloatPointerType>::DataIteratorType
distanceIterator;
distanceIterator
dist_it(dist_map_image,dist_map_image->GetLargestPossibleRegion());
offsetIterator
offset_it(offset_image,offset_image->GetLargestPossibleRegion());
Image3DFloatType::PointType physical_point;
Image3DFloatType::IndexType index_point;
//Write out text file with values.
std::ofstream value; value.open("diagnostics.txt");
for(int i =0; i<20; ++i){
index_point[0] = 140+i; index_point[1] = 140+i; index_point[2] = 1;
dist_it.SetIndex(index_point);
offset_it.SetIndex(index_point);
value<<"Index,"<<index_point.GetIndex()[0]<<","<<index_point.GetIndex()[1]<<","<<index_point.GetIndex()[2]<<",";
value<<"Offset,"<<offset_it.Get()[0]<<","<<offset_it.Get()[1]<<","<<offset_it.Get()[2]<<",";
value<<"error,"<<(dist_it.Get())<<std::endl;
}
value.close();
Thank you,
Regards,
Kashyap
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20130923/9604c170/attachment.htm>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20130923/9604c170/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: square_image.rar
Type: application/rar
Size: 32499 bytes
Desc: not available
URL: <http://www.itk.org/pipermail/insight-users/attachments/20130923/9604c170/attachment.rar>
More information about the Insight-users
mailing list