[Insight-developers] Streaming and minipipelines

Bradley Lowekamp blowekamp at mail.nih.gov
Thu Jul 14 10:33:12 EDT 2011


Hello Cory,

Currently best documentation on streaming is section 13.3 of the Software Guide and your text editor with the core pipeline objects open, and a good streaming filter.

Streaming a mini-pipeline is a little clunky. With this filter currently there are a couple subtle issues that can cause excess pipeline execution. Streaming correctly is not only compute the correct output, but also no causing the upstream filters to execute extra-times that aren't needed, or other extra computation. In generally when you are streaming you have very large images, this extra computation is not productive. As your filter currently is, this may occur.

The following is what I think is the preferred way for mini-pipelines.

In GenerateInputRequestedRegion() compute exactly what the RR's for the mini-pipeline will be and set the input images to that. 

In the generate data method, insulate the mini-pipline from being connected to the exterior pipeline with a graft:

  // Create an internal image to protect the input image's metdata
  // (e.g. RequestedRegion). The StreamingImageFilter changes the
  // requested region as part of its normal processing.
  typename TInputImage::Pointer localInput = TInputImage::New();
  localInput->Graft( this->GetInput() );

by doing this you will minimize chatter in the pipeline and subtle bugs will be readily apparent.


For your case, for input1 you want to mimic itk::DiscreteGaussianImage::GenerateInputRequestedRegion. then add setting the kernel input to the largest possible region ( DataObject::SetRequestedRegionToLargestPossibleRegion ).



On Jul 14, 2011, at 9:36 AM, Cory Quammen wrote:

> Dear streaming experts,
> 
> I am working on a filter with a minipipeline (ConvolutionImageFilter),
> and I want to make sure it supports streaming. For a given output
> request region, this filter needs to request a slightly larger input
> region from the image input and the largest possible region from the
> kernel image input.
> 
> Now, assuming all the filters in the minipipeline support streaming,
> what should ConvolutionImageFilter::GenerateInputRequestedRegion() do?
> It seems to me that the minipipeline filters will handle generating
> the proper regions in the input for a given requested output region.
> If I do not override GenerateInputRequestedRegion(), my tests fail.
> However, if I do override GenerateInputRequestedRegion() and set the
> input requested regions for both inputs (image and kernel image) to
> have zero size, everything seems to work.
> 
> If there is a presentation or wiki page on the particulars of
> streaming involving filters with minipipelines, I'm happy to be told
> to go read that. A few minutes of Googling didn't reveal anything.
> 
> Thanks much!
> Cory
> 
> -- 
> Cory Quammen
> Research Associate
> Department of Computer Science
> University of North Carolina at Chapel Hill
> http://www.cs.unc.edu/~cquammen



More information about the Insight-developers mailing list