<html>
<body>
<font size=3>Hi, <br><br>
Related to this subject I have two questions:<br><br>
- 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.<br><br>
- 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,<br>
pointLow[i] = -0.5 +
epsilon;<br>
pointHigh[i] = size[i] - 0.5 -
epsilon;<br>
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.<br><br>
Best regards,<br>
Stefan.<br><br>
<br>
At 11:53 21/08/06, Luis Ibanez wrote:<br><br>
<blockquote type=cite class=cite cite>Hi Christoph,<br><br>
Thanks for posting all the details of the traceback.<br><br>
This illustrates that there is a bug in the
ImageMaskSpatialObject.<br><br>
The class is using the index without first verifying if it is
inside<br>
the BufferedRegion or not.<br><br>
This issue has been entered as bug #3645 in the phpBugTracker<br>
<a href="http://public.kitware.com/Bug/bug.php?op=show&bugid=3645&pos=0" eudora="autourl">http://public.kitware.com/Bug/bug.php?op=show&bugid=3645&pos=0</a><br><br>
A fix has been committed to CVS<br>
<a href="http://www.itk.org/cgi-bin/viewcvs.cgi/Code/SpatialObject/itkImageMaskSpatialObject.txx?root=Insight&sortby=date&r2=1.10&r1=1.9" eudora="autourl">http://www.itk.org/cgi-bin/viewcvs.cgi/Code/SpatialObject/itkImageMaskSpatialObject.txx?root=Insight&sortby=date&r2=1.10&r1=1.9</a><br><br>
Please update your CVS checkout of ITK and let us know if you<br>
continue experiencing any problems.<br><br>
<br>
Thanks<br><br>
<br>
Luis<br><br>
<br><br>
------------------------------<br>
Christoph Niedermayr wrote:<br>
<blockquote type=cite class=cite cite>Am Donnerstag, den 17.08.2006,
15:13 +0200 schrieb Christoph Niedermayr:<br><br>
<blockquote type=cite class=cite cite>Am Donnerstag, den 17.08.2006,
08:39 -0400 schrieb Luis Ibanez:</blockquote><br>
<blockquote type=cite class=cite cite><blockquote type=cite class=cite cite>What
version of ITK are you using ?</blockquote><br>
2.6<br><br>
<br>
<blockquote type=cite class=cite cite>There are no calls to GetPixel()
inside the file<br>
Insight/Code/Algorithms/<br>
itkMattesMutualInformationImageToImageMetric.txx<br>
What the metric calls is the method "IsInside" in lines<br>
457 and 526.</blockquote><br>
you're right, i got that confused. But "IsInside" then calls
"GetPixel",<br>
if the sample is considered inside the SpacialObject, in my case with
an<br>
invald index.</blockquote><br>
Hi Luis!<br>
here's whats happening exactly, values are taken from gdb:<br>
the image i use as mask has the following properties:<br>
origin = [-150, -113, -231]<br>
index = [0, 0, 0]<br>
size = [60, 42, 60]<br>
spacing= [5, 5, 5]<br>
the point that is given to "IsInside" has the coordinates<br>
[30, -88, 69]<br>
and is considered inside (because the upper z bound of the
spacialobject<br>
is 69, and only values exceeding the bound are considered outside)<br>
z-distance between origin and the point is 300.<br>
z-index is then calculated as 60 (invalid), causing SIGSEV when
calling<br>
"GetPixel"<br>
below you find a code sample which causes this error. of course,
SIGSEV<br>
only occurs if the accessed memory location is indeed off limits to
the<br>
program. eg. using a 2D image of size 10x10 queries the image buffer
at<br>
110, but did not cause SIGSEV..<br>
best regards,<br>
chris<br>
_____<br>
#include "itkImage.h"<br>
#include "itkImageMaskSpatialObject.h"<br>
// create 123x123x123 image<br>
typedef itk::Image<unsigned char,3> ImageType;<br>
ImageType::Pointer img = ImageType::New();<br>
ImageType::RegionType region;<br>
ImageType::SizeType size;<br>
ImageType::IndexType index;<br>
ImageType::PointType origin;<br>
ImageType::SpacingType spacing;<br>
size.Fill(123);<br>
index.Fill(0);<br>
origin.Fill(0);<br>
spacing.Fill(1);<br>
region.SetSize(size);<br>
region.SetIndex(index);<br>
img->SetRegions(region);<br>
img->SetOrigin(origin);<br>
img->SetSpacing(spacing);<br>
img->Allocate();<br>
// create mask from image<br>
itk::ImageMaskSpatialObject<3>::Pointer mask =<br>
itk::ImageMaskSpatialObject<3>::New();<br>
mask->SetImage(img);<br>
// check if borderpoint is inside<br>
ImageType::PointType testPoint;<br>
testPoint.Fill(123);<br>
mask->IsInside(testPoint);<br>
_______________________________________________<br>
Insight-users mailing list<br>
Insight-users@itk.org<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" eudora="autourl">http://www.itk.org/mailman/listinfo/insight-users</a><br>
</blockquote><br><br>
_______________________________________________<br>
Insight-users mailing list<br>
Insight-users@itk.org<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" eudora="autourl">http://www.itk.org/mailman/listinfo/insight-users</a></font></blockquote></body>
<br>
</html>