[Insight-users] Dimensions of an image

Luis Ibanez luis . ibanez at kitware . com
Wed, 07 Aug 2002 10:12:52 -0400


Hi Samuel,

ITK images use three types of regions that are size related.

This is done in order to support streaming (processing very
large image by passing small pieces through the pipeline).

Please keep in mind also that ITK images are N-Dimensional,
so sizes and positions are managed in generic N-D arrays.

The three regions in question are:

1) LargestPossibleRegion (the actual total size of the image)
2) BufferedRegion (the size of the image currently in memory)
3) RequestedRegion (the size of the image to be processed by
            a filter - this represent one of the small pieces)


Regions are a class in itself that holds the size of an image
region in N-D:
http://www.itk.org/Insight/Doxygen/html/classitk_1_1ImageRegion.html


For example, you can do for a 3D image:

typedef  itk::Image<char,3>   myImagerType;

myImageType::Pointer image = GetImageSomeHow();

typedef myImageType::RegionType  RegionType;

RegionType  region1 = image->GetLargestPossibleRegion();
RegionType  region2 = image->GetBufferedRegion();
RegionType  region3 = image->GetRequestedRegion();

const int width  = region2[0]; // first dimension
const int height = region2[1]; // second dimension
const int dept   = region2[2]; // third dimension

For small images, the values of region1, region2 and region3
will probably be the same.

This is mostly a matter of concern if you are writing an
ImageFilter but if you are just using an image that you
instantiated and allocated by yourself, GetBufferedRegion()
is probably the safest way to go.

A nice description of the Streaming concepts can be seen in:
http://www.itk.org/Insight/Doxygen/html/StreamingPage.html

Further description of the ImageRegions is available in the
InsightDocuments checkout under:

      InsightDocuments/Developer/General/itkImage.ppt



Please let us know if this helps to answer your question.


   Thanks

     Luis



=================================================================


Samuel Rodríguez Bescos wrote:
> Hello everybody,
> 
>  
> 
> does anybody know a way to get the size of  an image (width,height, etc..)?
> 
>  
> 
> Thanks in advance,
> 
>  
> 
> Samuel
> 
>  
>