[Insight-users] A problem about extract the region of interest

David Doria daviddoria at gmail.com
Thu Aug 2 07:27:55 EDT 2012


On Wed, Aug 1, 2012 at 11:10 PM, 龍龍 <anjingdelonglong at gmail.com> wrote:

> HI ALL
>
> i'm doing my project using ITK. but i got a problem about the extract of
> 3D image.
>
> i'm using vtkRegionofInterestImageFilter. follow the example:
>
> ImageType::IndexType start;
> start[0] = …
> start[1] = …
> start[2] = …
>
> ImageType::SizeType size;
> size[0] = …
> size[1] = …
> size[2] = …
>
> ImageType::RegionType desiredRegion;
> desiredRegion.SetSize(size);
> desiredRegion.SetIndex(start);
>
> BUT, i hope that the start point that i gave can be the center point of
> the cube. not the cornor.
>
> what should i do . thank u.
>
> --
> Ryuu
>

You just have to subtract half of the 'size' from the 'center' you want so
you can pass 'start' as the corner:

itk::Index<2> corner = center - size/2; (I think you'll have to do this
element-wise)
ImageType::RegionType desiredRegion(corner, size);

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20120802/ea02fa55/attachment.htm>


More information about the Insight-users mailing list