| 2 Aug 2012 05:10
Picon

A problem about extract the region of interest

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

_____________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://www.itk.org/mailman/listinfo/insight-users
David Doria | 2 Aug 2012 13:27
Picon
Gravatar

Re: A problem about extract the region of interest

On Wed, Aug 1, 2012 at 11:10 PM, 龍龍 <anjingdelonglong-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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 
_____________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://www.itk.org/mailman/listinfo/insight-users

Gmane