[Insight-users] reading raw data from a stack of images

Sven Prevrhal sven . prevrhal at oarg . ucsf . edu
Wed, 28 May 2003 20:01:02 -0700


Hi,
I am trying to read a 3D image volume from a stack of (VTKData) images. My
code is

	typedef itk::RawImageIO<unsigned short,3> IOType;
	IOType::Pointer io = IOType::New();
	io->SetDimensions(0,64);
	io->SetDimensions(1,64);
	io->SetDimensions(2,93);
	io->SetFilePrefix("C:\\Documents and Settings\\SPrevrhal.RORG\\My
Documents\\data\\VTKData\\Data\\headsq\\quarter");
	io->SetFileDimensionality(2);
	io->SetByteOrderToLittleEndian();
	io->SetPixelType(itk::ImageIOBase::USHORT);
	io->SetComponentType(itk::ImageIOBase::USHORT);
	io->SetNumberOfComponents(1);
	std::cerr << "IO: " << io << std::endl;
  
	typedef itk::Image< unsigned short, 3 > ImageType;
    	typedef itk::ImageFileReader< ImageType > VolumeReaderType;
	VolumeReaderType::Pointer reader = VolumeReaderType::New();
	reader->SetImageIO(io);
	reader->Update();

and I get an exception at the last line! The data are there, a
vtkImageReader works fine.

:-) sven
--