[Insight-users] InPlaceOn() requires standard assignment too

Johannes Keustermans johannes.keustermans at esat.kuleuven.be
Tue Nov 29 08:35:35 EST 2011


Hi,


When executing an in-place image filter the input is used as output,
meaning that it gets overwritten (allows to save some memory). However,
it is possible that the input to the in-place filter is used by any
other filters. In this case, not the true input would be used, but the
overwritten version of it. Therefore, the input data is released after
the in place filter has finished computing (see the "ReleaseInputs()"
method in "itk::InPlaceImageFilter"). Whenever the input data is needed
by any of the other filters, it needs to be recalculated.

In case of an "itk::Image", the "ReleaseData()" method results in a call
to "Initialize()" which will reset the buffered region and the pixel
buffer. 


Kind regards,
Johannes

On Tue, 2011-11-29 at 14:11 +0100, Dženan Zukić wrote:
> Hi all,
> 
> in the following code excerpt, the last line seems to be crucial.
> Without it, the resulting image has bufferedRegion=[0,0,0] which
> breaks subsequent filters. Can someone explain why is the last line
> required?
> 
> addFilter->SetInput1(logic.masks);
> addFilter->SetInput2(mask);
> addFilter->InPlaceOn();
> addFilter->Update(); //logic.masks.bufferedRegion==0, other things OK
> logic.masks=addFilter->GetOutput(); //logic.masks.bufferedRegion>0
> (everything OK)
> 
> Regards,
> Dženan




More information about the Insight-users mailing list