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

Luis Ibanez luis . ibanez at kitware . com
Wed, 28 May 2003 23:58:38 -0400


This is a multi-part message in MIME format.
--------------090606090600040701030905
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit


Hi Sven,

Please dont use RAW files. They are incomplete
and henceforth dangerous.

Here is attached the MetaImage header for the
quarter head data set of VTKData.

Just copy it in the same directory where the
slices are.

Now you can simply use the ImageFileReader
to read the image. Just set the file name
to "quarter.mhd".

You may want to verify the spacing values
in the quarter.mhd file. I just put 1.0
but they are probably different.

----

Whenever you encounter a RAW file, the best
thing to do is to create a header for it.

It can be a MetaImage header, or GIPL, or
Analyze...



Regards,


    Luis


--------------------------------------
Sven Prevrhal wrote:
> 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
> --
> 
> 
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at public . kitware . com
> http://public . kitware . com/mailman/listinfo/insight-users
> 


-------------------------------------------------------------------

--------------090606090600040701030905
Content-Type: text/plain;
 name="quarter.mhd"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="quarter.mhd"

NDims = 3
DimSize = 64 64 93
ElementSpacing = 1 1 1
Position = 0 0 0
ElementByteOrderMSB = False
ElementType = MET_USHORT
ElementDataFile = quarter.%d 1 93 1

--------------090606090600040701030905--