[Insight-users] GetLargestPossibleRegion() and GetBufferedRegion()

Andrew Li andrew.li at synarc.com
Wed Nov 16 20:42:41 EST 2005


Hi, Luis:

Based on your advice, I read the SW guide more carefully and fixed
several problems.
The code is running. Thank you very much for your help!

But I do have two more questions as described in the following example:

	....
	<a filter>.update();

	//
	// an 3D image pointer to an output buffer of a filer.
	//
	// at this stage, after update, the
	// LargestPossibleRegion and BufferedRegion may or may not be
the same
	//
	// in the case we currently have, start/size of both regions are
the same.
	// They are:
	//     {0, 0, 0} and
	//     {256, 256, 160}
	//
	img3D = <a filter>.GetOutput();
	saved_buffered_region = img3D->GetBufferedRegion();

	//
	// By following SW guide on page 269 (Extracting Slices)
	// we use GetLargestPossibleRegion() to setup a desiredRegion
and
	// say to extract the first slice
	// ,that is, the desiredRegion start/size is set as:
	//     {0, 0, 0}
	//     {256, 256, 0}
	// 
	....
	extractFilter->SetInput (img3D);
	extractFilter->SetExtractionRegion (desiredRegion);
	extractFilter->update();
	....

	//
	// At this stage, the size of buffered region of img3D is
modified
	// by the extractFilter to	
	//  {256, 256, 1}
	// 
	// Q1: Is it expected?
	// We are surprised since img3D has been carefully specified as
a const pointer.
	//
	// It causes some problems for us, say, to save the original 3D
vol pointed
	// by img3D to disk since wirteFilter will check the buffered
region of
	// img3D and it is expecting 160 slices but only one in the
buffer or
	// specified by img3D->GerBufferedRegion().
	//
	// Q2:
	// If it is an expected behavior, how should we continue the
processing
	// after some slices are extracted (,in fact, copied) for other
purpose?
	//
	// Do we have to save a complete copy before extraction?
	// Is any standard way to reset buffered region back?
	//
	// I currently save a copy of original Start/Size of the
bufferedRegion and
	// reset img3D region as following and it works.
	//  
	// 	But just out of curiosity, what about when
largest-possible-region 
	// 	is different from the buffered-region?
	//    Should there be a function called SetBufferedRegion() ? Or
	//    ResetBufferedRegion() ?
	//
	
	img3D->SetRegions ( saved_buffered_region );
	....

Thank you again for your help.

-Andrew
CC: ITK users
 

-----Original Message-----
From: Luis Ibanez [mailto:luis.ibanez at kitware.com] 
Sent: Monday, November 14, 2005 3:45 AM
To: Andrew Li
Cc: insight-users at itk.org
Subject: Re: [Insight-users] GetLargestPossibleRegion() and
GetBufferedRegion()

Hi Andrew,

Please read the ITK Software Guide

   http://www.itk.org/ItkSoftwareGuide.pdf

where the difference between the regions is explained in detail.

---

In summary:

* LargestPossibleRegion is the total size of the image

* BufferedRegion is the portion of the image that is
                  currently loaded in memory
* RequestedRegion is the portion that the pipeline
                  request from a filter at the moment
                  of execution.


If you are writing a filter, you should only generate the
RequestedRegion.

If you are planning to visit pixels with Image Iterators you should use
*at most* the BufferedRegion

If you are computing features from the entire image geometry, then you
should use the LargestPossibleRegion.


The concepts of these three regions are closely related to streaming.


Regards,


    Luis



----------------
Andrew Li wrote:
> Dear ITK users:
> 
> It seems to me that both GetLargestPossibleRegion() and 
> GetBufferedRegion()are available to some (if not all) image filter 
> classes. They are both mentioned in itkSoftwareGuide and they are both

> used in our current code.
> 
> Is there any difference between those two functions? 
> 
> If they are different in some cases, is there a way to decide which 
> one to use?
> For example, the input to a function is a pointer to <a
> filter>.GetOutput(). Could and how this function choose which one to
> use?
> 
> I appreciate your help. 
> 
> -Andrew
>  
> --------------------------------------------------------
> 
> This email message is for the sole use of the intended recipient(s)
and may contain confidential and privileged information.Any unauthorized
review, use, disclosure or distribution is prohibited. If you are not
the intended recipient, please contact the sender by reply email and
destroy all copies of the original message. If you are the intended
recipient, please be advised that the content of this message is subject
to access, review and disclosure by the sender's Email System
Administrator.
> --------------------------------------------------------
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
> 
>
 
--------------------------------------------------------

This email message is for the sole use of the intended recipient(s) and may contain confidential and privileged information.Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. If you are the intended recipient, please be advised that the content of this message is subject to access, review and disclosure by the sender's Email System Administrator.
--------------------------------------------------------


More information about the Insight-users mailing list