[Insight-developers] imageIO questions

Luis Ibanez luis.ibanez@kitware.com
Fri, 22 Mar 2002 19:19:29 -0500


Hi Wilson,

Your code looks fine.
This is the minimal set of operations for normal
reading.

Have you tried this with the MetaImage files
from BrainWeb that are in the ftp server ?

Also Note that the clue that the ImageIO use
for selecting a particular reader out of the ones
registered is the file extension.

Please make sure that the extensions match with
the reader you want to use.

For example MetaImage expects the extensions
to be:    ".mha" or ".mhd"

If you use a custom extension, probaly none of the
registered reader will be considered appropiated
for your file format.


Could you please post the Header text file that
you are using for MetaImage ?


 Thanks

    Luis


===================================

Wilson Chang wrote:

> hi
>
>  
>
> I have been having some problems using the image IO to read in a 
> variety of file types, specifically VTK and Meta data files.  Using 
> the code below to read in 3D data (both VTK and meta files):
>
>  
>
>  
>
> typedef itk::Image<unsigned char, 3> InputITKImageType;
> typedef itk::ImageFileReader<InputITKImageType> ImageFileReaderType;
>
> reader = ImageFileReaderType::New();
> itk::VTKImageIOFactory::RegisterOneFactory();
> itk::MetaImageIOFactory::RegisterOneFactory(); 
> reader->SetFileName(lpszPathName);
>
> try
>
> {
>
>   reader->Update();
>
> }
>
> catch (itk::ImageFileReaderException &e)
>
> .
>
> .
>
> .
>
>  
>
>  
>
> an exception is thrown:
>
> Number of dimensions in file (2) does not match number of dimensions 
> in output (3). 
>
>  
>
> However, i am sure that the files are 3D data.  The code also fails if 
> I force the ImageFileReader to use a specific imageIO such as 
> itkVTKImageIO or itkMetaImageIO.
>
>  
>
> Has anyone else encountered any similar problems? ideas?
>
>  
>
>  
>
> thanks,
>
> wilson
>
>  
>