[Insight-developers] image reader standard practice

Miller, James V (Research) millerjv@crd.ge.com
Mon, 22 Apr 2002 13:07:40 -0400


It sounds like the MetaImageIO reader is not properly setting 
the LargestPossibleRegion.

-----Original Message-----
From: Damion Shelton [mailto:dmshelto@andrew.cmu.edu]
Sent: Monday, April 22, 2002 1:01 PM
To: insight-developers@public.kitware.com
Subject: [Insight-developers] image reader standard practice


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