[Insight-developers] Bug in itkSignedMaurerDistanceMapImageFilter class

Nicholas Tustison ntustison at gmail.com
Tue Sep 12 08:37:23 EDT 2006


Hi Karthik,

I attached what you requested.  Thanks for your help.

Nick


-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.patch
Type: application/octet-stream
Size: 2820 bytes
Desc: not available
Url : http://www.itk.org/mailman/private/insight-developers/attachments/20060912/dbe8cd3f/patch.obj
-------------- next part --------------


On Sep 12, 2006, at 8:18 AM, Karthik Krishnan wrote:

> Hi Nicholas,
>
> Could you please send the same as a patch. I am worried that,  
> whoever is transcribing the lines below might make a mistake.
>
> To create the patch :
>
>  cd Code/BasicFilters
>  cvs diff -u -B > patch.patch
>
> Thanks
> -karthik
>
>
> 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