[Insight-users] really truly cleaving output from a filter's tender mercies.

Luis Ibanez luis.ibanez at kitware.com
Mon Sep 3 09:53:32 EDT 2007


Hi Julia,


      The scenario that you describe shouldn't be happening.


Your expectation was correct. If you disconnect an image from its source
filter, the image should become fully independent and its values should
not change due to subsequent executions of the filter.


For example:


     ReaderType::Pointer reader = ReaderType::New();
     FilterType::Pointer filter = FilterType::New();

     filter->SetInput( reader->GetOutput() )

     // Process a first Image
     reader->SetFileName( "InputImage1.mhd" );
     filter->Update();
     ImageType::ConstPointer image1 = filter->GetOutput();
     image1->DisconnectPipeline();

     // Process a second Image
     reader->SetFileName( "InputImage2.mhd" );
     filter->Update();
     ImageType::ConstPointer image2 = filter->GetOutput();
     image2->DisconnectPipeline();


Should give you image1 and image2, that are completely
independent.  The content of image1 shouldn't change
when you run the filter again in order to get image2.


     Something else is going on with your code....


We may need additional information in order to track
the real problem.


    Thanks


       Luis



--------------------
Julia Smith wrote:
> I have a bit of code that (was) reusing a filter to interpolate between 
> two 2d images. I had thought that if I Disconnect()-ed an image from 
> it's source that the image was now fully independent of it's originating 
> filter, but this does not seem to be the case.
> 
> While the image may no longer cause the pipeline to update, the source 
> filter is still writing to the image's _data_ when it is updated. Hence 
> if I generate "two" images from the same filter, each with a different 
> mixing value, the two images point to the same data.
> 
> o_O Is it really possible to truly cleave a filter from the image it 
> outputs, essentially forcing it to reallocate image data on a subsequent 
> call?
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users


More information about the Insight-users mailing list