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

Luis Ibanez ibanez@cs.unc.edu
Tue, 30 Jan 2001 17:18:38 -0500


Hi,


I'm having trouble with the GenerateData() method in filters.
Should we allocate the output or not ?

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.

----

Most filters are doing this now, but that seems to
be conflicting with the streaming requirements.

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 ?

Shouldn't be some kind of supervising class doing this,
allocation in order to support streaming ?

What happens now is that filters that don't call Allocate()
on the output are faced with zero size images and their
iterators produce segmentation faults.

----

What is the right thing to do ?



Thanks,

Luis