[Insight-users] Error reading NRRD file

Ariel Hernán Curiale curiale at gmail.com
Thu Feb 7 07:28:39 EST 2013


Hi,

I usually use itk to read and write nrrd but in this case I use ITK+VTK+QT to read this nrrd file:
NRRD0004
# Complete NRRD file format specification at:
# http://teem.sourceforge.net/nrrd/format.html
content: exists(MyNrrd.raw,0)
type: short
dimension: 4
space: left-posterior-superior-time
sizes: 208 224 208 17
space directions: (0.822352,0,0,0) (0,0.834496,0,0) (0,0,0.725577,0) (0,0,0,170.000000)
centerings: cell cell cell cell
kinds: space space space time
endian: little



To read this file I used this code:

typedef itk::Image<short, 4>                ITKImage4DType;
typedef itk::ImageFileReader<ITKImage4DType > TReader;
    TReader::Pointer reader = TReader::New();

    reader->SetFileName(argv[1]);
    try
      {
      reader->Update();
      }
    catch( itk::ExceptionObject& err )
      {
      std::cerr << "Could not read the fixed image information." << std::endl;
      std::cerr << err << std::endl;
      }




This code gets the following exception:
Could not read the fixed image information.

itk::ExceptionObject (0x7f883a015198)
Location: "unknown" 
File: /Users/ariel/Applications/InsightToolkit-4.2.1/Modules/Core/Common/include/itkImageBase.hxx
Line: 189
Description: itk::ERROR: Image(0x7f883a023f10): A spacing of 0 is not allowed: Spacing is [0, 0, 0, 170]



I don't know why the exception says that the spacing is 0.  This exception occurs with ITK-4.3 too.


Also, this code works perfectly If I use only ITK. This are the results of reading the same image:

/Users/ariel/Uva/LPI/Proyectos/Datos/IM_0001A.nrrd
Pixel Type is short
numDimensions: 4
component size: 2
pixel type (string): scalar
pixel type: 1


I'm using this compiler:
i686-apple-darwin11-llvm-g++-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)

Any help would be appreciated.
Thanks,
__________________________________
| Ariel Hernán Curiale Ph.D Student
| ETSI Telecomunicación
| Universidad de Valladolid
| Campus Miguel Delibes
| 47011 Valladolid, Spain
| Phone: 983-423000 ext. 5590
| Web: www.curiale.com.ar
|_________________________________

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20130207/705f2ee9/attachment.htm>


More information about the Insight-users mailing list