[Insight-users] howto reuse pipeline with another image

Maquette maquette at lavabit.com
Sat Jan 9 13:34:21 EST 2010


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?

- 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".


More information about the Insight-users mailing list