[Insight-developers] Bug in itkSignedMaurerDistanceMapImageFilter
class
Nicholas Tustison
ntustison at gmail.com
Mon Sep 11 19:57:46 EDT 2006
Hi Luis,
I found a bug in the itkSignedMaurerDistanceMapImageFilter class.
Since I was the contributing author, I feel like I owe somebody (or
perhaps the ITK masses) an apology. Anyway, the code throws an
exception when the requested region has non-zero index values. The
fix requires the four changes given below to take into account non-
zero index values. I don't remember if the freeze is still in place
which is why I'm sending the fixes to you.
Thanks,
Nick Tustison
1. Current version 1.4 (lines 175-176):
InputRegionType region = this->GetInput()->GetRequestedRegion();
InputSizeType size = region.GetSize();
Proposed fix:
InputRegionType region = this->GetInput()->GetRequestedRegion();
InputSizeType size = region.GetSize();
typename InputImageType::RegionType::IndexType startIndex;
startIndex = this->GetInput()->GetRequestedRegion().GetIndex();
2. Current version 1.4 (lines 210-213):
idx[ d % InputImageDimension ] =
static_cast<unsigned int>(
static_cast<double>( index ) /
static_cast<double>( k[count] ) );
Proposed fix:
idx[ d % InputImageDimension ] =
static_cast<unsigned int>(
static_cast<double>( index ) /
static_cast<double>( k[count] ) )
+ startIndex[ d % InputImageDimension ];
3. Current version 1.4 (lines 285-294)
vnl_vector<OutputPixelType> g(nd); g = 0;
vnl_vector<OutputPixelType> h(nd); h = 0;
OutputPixelType di;
int l = -1;
for( unsigned int i = 0; i < nd; i++ )
{
idx[d] = i;
Proposed fix:
vnl_vector<OutputPixelType> g(nd); g = 0;
vnl_vector<OutputPixelType> h(nd); h = 0;
typename InputImageType::RegionType::IndexType startIndex;
startIndex = this->GetInput()->GetRequestedRegion().GetIndex();
OutputPixelType di;
int l = -1;
for( unsigned int i = 0; i < nd; i++ )
{
idx[d] = i + startIndex[d];
4. Current version 1.4 (line 363)
idx[d] = i;
Proposed Fix:
idx[d] = i + startIndex[d];
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.itk.org/mailman/private/insight-developers/attachments/20060911/228949b9/attachment.html
More information about the Insight-developers
mailing list