[Insight-developers] Bug in itkSignedMaurerDistanceMapImageFilter class

Luis Ibanez luis.ibanez at kitware.com
Thu Sep 14 11:28:20 EDT 2006


Hi Nick,

Thanks for posting the fix to this bug.

Your CVS write access has been restored now.

Please feel free to commit the fix to this bug.


   Thanks


      Luis


------------------------
Nicholas Tustison wrote:
> 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];
> 
> 
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Insight-developers mailing list
> Insight-developers at itk.org
> http://www.itk.org/mailman/listinfo/insight-developers




More information about the Insight-developers mailing list