[Insight-developers] Filters : GenerateData() : when to Allocate ?

Paul Hughett hughett@mercur.uphs.upenn.edu
Wed, 31 Jan 2001 11:22:57 -0500


Luis has said:

> Something  like:

> m_OutputImage->SetLargestPossibleRegion(
>   m_InputImage->GetLargestPossibleRegion() );

> m_OutputImage->SetBufferedRegion(
>   m_InputImage->GetBufferedRegion() );

> m_OutputImage->SetRequestedRegion(
>   m_InputImage->GetRequestedRegion() );

> m_OutputImage->Allocate();.

> ... and then process the pixels in RequestedRegion.


This particular protocol will work correctly only for point operations
on images.  Some other possibilities that need to be handled correctly:

neighborhood operations (convolution, dilation, etc): the source region
needs to be enough bigger than the destination to account for the
neighborhood of the operation

resampling: the source region needs to be determined by backprojecting
the destination through the transform, and enlarged enough to account
for the interpolation neighborhood

reductions (histogram, image moments, etc. that reduce the total number 
of pixels or data elements):  The source must be the entire image.


> According to the streaming policy, the output is the one
> that define the size of the region to compute,  and the
> input should be asked to produce this chunk of data,
> isn't it ?

> What is the right thing to do ?

We might want to actually write down a description of the architecture
and policies, so that latecomers like me have at least a fighting chance
of understanding it.  And I don't mean a PowerPoint presentation; I want
something complete and detailed enough that I can actually use it to
design code.

Paul Hughett