[Insight-users] Re: metrics and image masks
Stefan Klein
stefan at isi.uu.nl
Tue Aug 22 08:32:18 EDT 2006
Hi,
Related to this subject I have two questions:
- ImageSpatialObject.txx line 177: why is the index computed by a cast, and
not using a 'round'? the ITK software guide says the value of the closest
pixels is returned, so nearestneighbour interpolation. A round operation
sounds then more logical to me. The same applies to line 62 of
ImageMaskSpatialObject by the way.
- ImageSpatialObject.txx line 219: why is "size[i]" used and not "size[i] -
1" ? Isn't this the underlying cause of the troubles Christoph has?
Alternatively,
pointLow[i] = -0.5 + epsilon;
pointHigh[i] = size[i] - 0.5 - epsilon;
may make more sense, if you consider Figure 4.1 in the software guide. But
this is only allowed if you use a round operation in line 177.
Best regards,
Stefan.
At 11:53 21/08/06, Luis Ibanez wrote:
>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
>
>
>_______________________________________________
>Insight-users mailing list
>Insight-users at itk.org
>http://www.itk.org/mailman/listinfo/insight-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20060822/6d1fc584/attachment.html
More information about the Insight-users
mailing list