[Insight-users] Re: metrics and image masks

Luis Ibanez luis.ibanez at kitware.com
Mon Aug 21 11:53:27 EDT 2006


Hi Christoph,

Thanks for posting all the details of the traceback.

This illustrates that there is a bug in the ImageMaskSpatialObject.

The class is using the index without first verifying if it is inside
the BufferedRegion or not.

This issue has been entered as bug #3645 in the phpBugTracker
http://public.kitware.com/Bug/bug.php?op=show&bugid=3645&pos=0

A fix has been committed to CVS
http://www.itk.org/cgi-bin/viewcvs.cgi/Code/SpatialObject/itkImageMaskSpatialObject.txx?root=Insight&sortby=date&r2=1.10&r1=1.9

Please update your CVS checkout of ITK and let us know if you
continue experiencing any problems.


     Thanks


        Luis



------------------------------
Christoph Niedermayr wrote:
> Am Donnerstag, den 17.08.2006, 15:13 +0200 schrieb Christoph Niedermayr:
> 
>>Am Donnerstag, den 17.08.2006, 08:39 -0400 schrieb Luis Ibanez:
> 
> 
>>>What version of ITK are you using ?
>>
>>2.6
>>
>>
>>>There are no calls to GetPixel() inside the file
>>>    Insight/Code/Algorithms/
>>>      itkMattesMutualInformationImageToImageMetric.txx
>>>What the metric calls is the method "IsInside" in lines
>>>457 and 526.
>>
>>you're right, i got that confused. But "IsInside" then calls "GetPixel",
>>if the sample is considered inside the SpacialObject, in my case with an
>>invald index.
> 
> 
> Hi Luis!
> 
> here's whats happening exactly, values are taken from gdb:
> 
> the image i use as mask has the following properties:
> origin = [-150, -113, -231]
> index  = [0, 0, 0]
> size   = [60, 42, 60]
> spacing= [5, 5, 5]
> 
> the point that is given to "IsInside" has the coordinates
> [30, -88, 69]
> and is considered inside (because the upper z bound of the spacialobject
> is 69, and only values exceeding the bound are considered outside)
> z-distance between origin and the point is 300.
> 
> z-index is then calculated as 60 (invalid), causing SIGSEV when calling
> "GetPixel"
> 
> below you find a code sample which causes this error. of course, SIGSEV
> only occurs if the accessed memory location is indeed off limits to the
> program. eg. using a 2D image of size 10x10 queries the image buffer at
> 110, but did not cause SIGSEV..
> 
> best regards,
> chris
> 
> _____
> #include "itkImage.h"
> #include "itkImageMaskSpatialObject.h"
>   // create 123x123x123 image
>   typedef itk::Image<unsigned char,3> ImageType;
>   ImageType::Pointer img = ImageType::New();
>   ImageType::RegionType region;
>   ImageType::SizeType size;
>   ImageType::IndexType index;
>   ImageType::PointType origin;
>   ImageType::SpacingType spacing;
> 
>   size.Fill(123);
>   index.Fill(0);
>   origin.Fill(0);
>   spacing.Fill(1);
> 
>   region.SetSize(size);
>   region.SetIndex(index);
>   img->SetRegions(region);
>   img->SetOrigin(origin);
>   img->SetSpacing(spacing);
>   img->Allocate();
> 
>   // create mask from image
>   itk::ImageMaskSpatialObject<3>::Pointer mask =
> itk::ImageMaskSpatialObject<3>::New();
>   mask->SetImage(img);
> 
>   // check if borderpoint is inside
>   ImageType::PointType testPoint;
>   testPoint.Fill(123);
>   mask->IsInside(testPoint);
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
> 
> 




More information about the Insight-users mailing list