[Insight-users] Problem while disconnecting pipeline

robert tamburo robert.tamburo at gmail.com
Wed Sep 7 15:43:52 EDT 2011


Sorry, I misread your email. I'm assuming that by 'input image' you mean the
output of the reader. To reuse it, set an image to the reader output then
disconnect the image from the pipeline, i.e.  inputImage =
reader->GetOutput(); inputImage->DisconnectPipeline();  That _should_ allow
you to use inputImage in filters and write it to disc with the writer.

On Wed, Sep 7, 2011 at 1:56 PM, robert tamburo <robert.tamburo at gmail.com>wrote:

> Are you calling update on the filter before setting the image to the filter
> output?
>
> On Wed, Sep 7, 2011 at 1:25 PM, Martijn Steenwijk <
> martijnsteenwijk at gmail.com> wrote:
>
>> Dear all,****
>>
>> ** **
>>
>> I would like to use an input image two times, so I have to Disconnect the
>> pipeline. My pipeline is like this…****
>>
>> ** **
>>
>> ReaderType::Pointer reader = ReaderType::New();****
>>
>> reader->SetFileName(myFile);****
>>
>> reader->Update();****
>>
>> ** **
>>
>> // Create a binary mask of the input image****
>>
>> typedef itk::BinaryThresholdImageFilter<ImageType,BinaryImageType>
>> BinaryThresholdImageFilterType;****
>>
>> BinaryThresholdImageFilterType::Pointer thresholdFilter =
>> BinaryThresholdImageFilterType::New();****
>>
>> thresholdFilter->SetInput(reader->GetOutput());****
>>
>> thresholdFilter->SetUpperThreshold(0.0000);****
>>
>> thresholdFilter->SetInsideValue(0);****
>>
>> thresholdFilter->SetOutsideValue(255);****
>>
>> ////****
>>
>> //  some other filters****
>>
>> ////****
>>
>> ImageType::Pointer filteredImage = myFilterN->GetOutput();****
>>
>> filteredImage->DisconnectPipeline();****
>>
>> ** **
>>
>> typedef itk::ImageFileWriter<ImageType>                 ImageWriterType;*
>> ***
>>
>> ImageWriterType::Pointer writer = ImageWriterType::New();****
>>
>> writer->SetFileName(myOutFile);****
>>
>> writer->SetInput(reader->GetOutput());             // for debug purposes,
>> just write the reader->Output();****
>>
>> writer->Update();****
>>
>> ** **
>>
>> Unfortunately the written image does not contain the input image, but the
>> output of myFilterN (filteredImage), which means, something gets wrong with
>> disconnecting the pipeline. How can I fix this?****
>>
>> ** **
>>
>> Best,****
>>
>> Martijn****
>>
>> _____________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Kitware offers ITK Training Courses, for more information visit:
>> http://www.kitware.com/products/protraining.html
>>
>> Please keep messages on-topic and check the ITK FAQ at:
>> http://www.itk.org/Wiki/ITK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.itk.org/mailman/listinfo/insight-users
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110907/8df61d5a/attachment.htm>


More information about the Insight-users mailing list