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. <div>
<div><br><div class="gmail_quote">On Wed, Sep 7, 2011 at 1:56 PM, robert tamburo <span dir="ltr"><<a href="mailto:robert.tamburo@gmail.com">robert.tamburo@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><span style="background-color:rgb(255, 255, 255)">Are you calling update on the filter before setting the image to the filter output<font face="arial, sans-serif">?</font></span></div>
<br><div class="gmail_quote">On Wed, Sep 7, 2011 at 1:25 PM, Martijn Steenwijk <span dir="ltr"><<a href="mailto:martijnsteenwijk@gmail.com" target="_blank">martijnsteenwijk@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="EN-US" link="blue" vlink="purple"><div><p class="MsoNormal">Dear all,<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">I would like to use an input image two times, so I have to Disconnect the pipeline. My pipeline is like this…<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">ReaderType::Pointer reader = ReaderType::New();<u></u><u></u></p><p class="MsoNormal">reader->SetFileName(myFile);<u></u><u></u></p><p class="MsoNormal">reader->Update();<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">// Create a binary mask of the input image<u></u><u></u></p><p class="MsoNormal">typedef itk::BinaryThresholdImageFilter<ImageType,BinaryImageType> BinaryThresholdImageFilterType;<u></u><u></u></p>
<p class="MsoNormal">BinaryThresholdImageFilterType::Pointer thresholdFilter = BinaryThresholdImageFilterType::New();<u></u><u></u></p><p class="MsoNormal">thresholdFilter->SetInput(reader->GetOutput());<u></u><u></u></p>
<p class="MsoNormal">thresholdFilter->SetUpperThreshold(0.0000);<u></u><u></u></p><p class="MsoNormal">thresholdFilter->SetInsideValue(0);<u></u><u></u></p><p class="MsoNormal">thresholdFilter->SetOutsideValue(255);<u></u><u></u></p>
<p class="MsoNormal">////<u></u><u></u></p><p class="MsoNormal">// some other filters<u></u><u></u></p><p class="MsoNormal">////<u></u><u></u></p><p class="MsoNormal">ImageType::Pointer filteredImage = myFilterN->GetOutput();<u></u><u></u></p>
<p class="MsoNormal">filteredImage->DisconnectPipeline();<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">typedef itk::ImageFileWriter<ImageType> ImageWriterType;<u></u><u></u></p>
<p class="MsoNormal">ImageWriterType::Pointer writer = ImageWriterType::New();<u></u><u></u></p><p class="MsoNormal">writer->SetFileName(myOutFile);<u></u><u></u></p><p class="MsoNormal">writer->SetInput(reader->GetOutput()); // for debug purposes, just write the reader->Output();<u></u><u></u></p>
<p class="MsoNormal">writer->Update();<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">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?<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Best,<u></u><u></u></p><p class="MsoNormal">Martijn<u></u><u></u></p></div></div><br>_____________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.html" target="_blank">http://www.kitware.com/products/protraining.html</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
<br></blockquote></div><br>
</blockquote></div><br></div></div>