[Insight-developers] update problem with ImageFileReader?

Joshua Cates cates@cs.utah.edu
Mon, 4 Mar 2002 14:43:13 -0700 (MST)


Hi,

I am not able to get itk::ImageFileReader to update properly as the source
of a pipeline.  I find that I have to call Update() explicitly on
ImageFileReader.

For example, the code below works as I would expect it to, but if I remove
line 15, the reader does execute.


1  itk::CastImageFilter< SourceImageType, FloatImageType >::Pointer 
2       caster;
2
3  itk::ImageFileReader< SourceImageType >::Pointer reader;
4  itk::RawImageIO<TDataType, VDimensions>::Pointer io;
5 
6  io = itk::RawImageIO<TDataType, VDimensions>::New();
8  for (unsigned d = 0; d < VDimensions; d++)
9      {
10        io->SetDimensions(d, some_parameters.size[d]);
11     }
12 reader = itk::ImageFileReader< SourceImageType >::New();
13 reader->SetImageIO(io);
14 reader->SetFileName(some_parameters.input_filename.c_str());
15 reader->Update();
16    
17 caster = itk::CastImageFilter< SourceImageType, FloatImageType>::New();
18 caster->SetInput( reader->GetOutput() );
19 caster->Update();


Can someone take a look at this?  Perhaps I'm using the ImageFileReader 
incorrectly.

Thanks,

Josh.

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