[Insight-users] howto reuse pipeline with another image
Bradley Lowekamp
blowekamp at mail.nih.gov
Mon Jan 11 10:15:58 EST 2010
Hello,
Give this a try:
On Jan 9, 2010, at 1:34 PM, Maquette wrote:
> hi all,
>
> Sorry in advance, that this might be a rather frequent question. But I
> didn't find out much about whether/how an image pipeline can be reused
> after the first Image has been read, and Update() has been called on a
> concluding writer. The purpose is to build an interactive tool, where
> new image Files can be read and processed, and a smaller Region of
> Interest can be selected/changed to have a quick preview written as
> .mha. After a new file has been selected the ROI should default to that
> files whole extend. (
>
> I try to achieve this by a pipeline connected like that:
>
> itk::ImageFileReader<I> reader
> ->
> itk::RegionOfInterestImageFilter<I,I> roi
> ->
> itk::FancyFilter1<I,I> filter1
> ->
> ...
> ->
> itk::FancyFilterN<I,I> filterN
> ->
> itk::ImageFileWriter<I> writer0
>
>
> How can it be reused (let writer0 write out the new result) after one of
> the follwing events:
>
> - The first Image loaded with
> reader->SetFileName("first.mha");
> writer0->Update();
> always works fine. The whole pipeline seems to adjust to the extends
> of first.mha One can nicely adjust Filter parameters in an interactive
> program and by one call to writer0->Update() gets the new result.
>
> - What do I have to do after setting reader->SetFileName("second.mha")
> in order to have the pipeline process the new image in its probably new
> extends. writer0->Update() throws some "requested region out of
> possible region". Of course! but how to tell writer0 what to request next?
To reuse the pipeline to that then entire image is updated, and the ROI is the largest try this:
reader->GenerateOutputInformation()
set ROI::RegionOfInterest to reader::LargestPossibleRegion
writer::Update()
What this will do is update the output information in the image file reader to the new image, so that you have the new largest possible region (actual size of the image). This is my guess as to what you problem is with out the specifics.
Brad
>
> - What is to be done to change the region of interest? Would
> roi->SetRegionOfInterest();
> be sufficient? Lets say the new ROI is kept within the bounds given by
> reader->GetOutput()->GetLargestPossibleRegion(). Changing roi leads to
> the same exception by writer0->Update(). Perhaps
> RegionOfInterestImageFilter is not even needed, and one has to tell
> writer0 what subregion to request/use. (meaning one has to tell it to
> each leaf in the pipeline jungle)
>
>
> I hope the issue can be discussed on that rather abstract level. The
> sources have already grown > 1200 LOCs when I tried to make it
> "reloadable" and "ROI selectable".
> _____________________________________
> 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
========================================================
Bradley Lowekamp
Lockheed Martin Contractor for
Office of High Performance Computing and Communications
National Library of Medicine
blowekamp at mail.nih.gov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100111/54747fc0/attachment.htm>
More information about the Insight-users
mailing list