[Insight-developers] Can an AddImageFilter have its input and output be the same image?

Williams, Norman K norman-k-williams at uiowa.edu
Fri Oct 14 17:45:05 EDT 2011


This came up in trying to get the Stochastic Tractography application from
the Insight Journal working reliably.

http://www.insight-journal.org/browse/publication/169

The author's were doing this trick whereby they allocate an image of
zeros, graft it onto the output of an AddImageFilter, then set one of the
INPUTS of the AddImageFilter to the OUTPUT of the AddImageFilter.

What I'm wondering is this: Is this nuts? Is there a better way to
accumulate the results of a filter like this?

typedef itk::Image< unsigned int,3 > CImageType;
typedef itk::AddImageFilter<CImageType,CImageType,CImageType>
AddImageFilterType;

CImageType::Pointer accumulatedcimagePtr = CImageType::New();
  accumulatedcimagePtr->CopyInformation( dwireaderPtr->GetOutput() );
  accumulatedcimagePtr->SetBufferedRegion(
dwireaderPtr->GetOutput()->GetBufferedRegion() );
  accumulatedcimagePtr->SetRequestedRegion(
dwireaderPtr->GetOutput()->GetRequestedRegion() );
  accumulatedcimagePtr->Allocate();
  accumulatedcimagePtr->FillBuffer(0);

AddImageFilterType::Pointer acccumlatorFilter = AddImageFilterType::New();

accumulator->GraftOutput(accumulatedcimagePtr);
accumulator->SetInput1(stochasticFilter->GetOutput());
accumulator->SetInput2(accumulator->GetOutput()); //
<-----------------WHHAAAAT?

for(;;)
{
        // Š run step of computation with the stochasticFilter
        accumulator->Update();  // I THINK Š add output of stochasticFilter to
accumulator image???
}



--
Kent Williams norman-k-williams at uiowa.edu






________________________________
Notice: This UI Health Care e-mail (including attachments) is covered by the Electronic Communications Privacy Act, 18 U.S.C. 2510-2521, is confidential and may be legally privileged.  If you are not the intended recipient, you are hereby notified that any retention, dissemination, distribution, or copying of this communication is strictly prohibited.  Please reply to the sender that you have received the message in error, then delete it.  Thank you.
________________________________


More information about the Insight-developers mailing list