[Insight-users] Problem while disconnecting pipeline
Martijn Steenwijk
martijnsteenwijk at gmail.com
Wed Sep 7 18:17:29 EDT 2011
Dear Robert,
Thanks for your help. This was - off course - also how I thought it should
be, but it didn't work out. However, looking further, I just discovered that
my input file has become disrupted. It contains the output of the series of
filters, which gave rise to the wrong output :o).
Anyway, I restored the original input image and all works fine. Thanks for
thinking with me!
Best,
Martijn
Van: robert tamburo [mailto:robert.tamburo at gmail.com]
Verzonden: woensdag 7 september 2011 21:44
Aan: martijnsteenwijk at gmail.com
CC: insight-users at itk.org
Onderwerp: Re: [Insight-users] Problem while disconnecting pipeline
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/20110908/54cda3dc/attachment.htm>
More information about the Insight-users
mailing list