[Insight-users] Problem with re-using a filter -- how do I get the filter to generate new outputs per update?

Kent Williams kent at psychiatry.uiowa.edu
Mon Mar 27 10:26:40 EST 2006


This is a simple problem -- I think.

We have ITK code that takes a 4D image, and re-orients each of it's 
constituent 3D images.  We re-wrote it to use the itk::TileImageFilter, 
because it is more concise, and probably not that much slower than the 
triply nested loop in-line.

The problem is this:  itk::OrientImageFilter -- and I suspect nearly 
every descendant of itk::ImageToImageFilter -- allocates its outputs 
once, and re-uses them.  So if I loop through the time dimension, and 
call itk::TileImageFilter->SetInput(i, orientFilter->GetOutput()) for 
each sub-volume, every one of itk::TileImageFilter's inputs points to 
the same itk::Image, and the image data comes from the last volume 
extracted.

Is there any way, aside from NOT re-using the same instance of 
itk::OrientImageFilter, to force a filter to allocate new outputs, 
rather than re-use the same ones? Setting ReleaseDataBeforeUpdateFlag 
doesn't work because it just calls m_Outputs[idx]->PrepareForNewData.



More information about the Insight-users mailing list