[Insight-users] If you use mini-pipeline/GraftOutput in an itk ImageToImageFilter, do you need to allocate the output?

kent williams nkwmailinglists at gmail.com
Fri Jul 24 14:55:02 EDT 2009


I'm writing an filter derived from itk::ImageToImageFilter.  It's
adapted from a function already written.  In other words I'm going
from

itk::Image::Pointer DoesSomething(...) { // do something and return a
pointer to an image }

to a filter which has the code from DoesSomething pulled into the
filter's GenerateData method.

The way I implemented this was pretty simple:

template <class TInputImage, class TOutputImage>
void
MyFilter<TInputImage,TOutputImage>
::GenerateData()
{
   this->AllocateOutputs()
   // code from original function
   this->GraftOutput(lastFilter->GetOutput();
}

My question is this, since I'm using GraftOutput to use the output of
the last filter in my mini-pipeline, do I even need to call
AllocateOutputs?


More information about the Insight-users mailing list