[Insight-developers] image reader standard practice

Joshua Cates cates@poblano.sci.utah.edu
Mon, 22 Apr 2002 11:02:50 -0600 (MDT)


Hi Damion,

This is a bug that I believe Will is already looking into.

Josh.

______________________________
 Josh Cates
 School of Computer Science
 University of Utah
 Email: cates@sci.utah.edu
 Phone: (801) 587-7697
 URL:   www.cs.utk.edu/~cates


On Mon, 22 Apr 2002, Damion Shelton wrote:

> Hi,
>
> Looks like the standard way of using an image reader is the following
> (grabbed from tripletkmain.cxx, but present in other examples in a similar
> fashion):
>
>
>   //set mh* file
>   loader->SetFileName(metaImageFileName);
>   loader->Update();
>   input_image  = loader->GetOutput();
>
> Unlike a "normal" pipeline, Update() is called explicitly and the output
> retrieved after the reader updates.
>
> In our code, the syntax is as follows:
>
>   reader = ImageFileReaderType::New();
>   reader->DebugOn();
>   itk::MetaImageIOFactory::RegisterOneFactory();
>   reader->SetFileName("d:/brainweb/brainweb1.mha");
>   reader->Update();
>
> This works fine. If we remove "reader->Update();", and instead add a filter
> to the pipeline:
>
> fooFilter->SetInput( reader->GetOutput() );
>
> and call Update() on the filter rather than the reader, the program
> crashes. Given that all other examples explicitly update the reader, is
> that the correct way of doing things? If so, why? This seems to be
> different than the way pipelining is handled elsewhere, and makes it
> somewhat awkward to construct a pipeline (including a reader) without
> actually executing the pipeline.
>
> Thanks,
> -Damion-
> _______________________________________________
> Insight-developers mailing list
> Insight-developers@public.kitware.com
> http://public.kitware.com/mailman/listinfo/insight-developers
>