[vtkusers] Reandering Raw Data

David Gobbi dgobbi at irus.rri.ca
Tue Apr 30 01:13:02 EDT 2002


Hi Marwan,

Use the vtkImageReader to read the data.  You will have to guess the
data type and image dimensions.  It is a good bet that, if it is a
medical image volume, the data type will be either Short or
UnsignedShort or UnsignedChar and the dimensions will be 256x256xN
or 512x512xN where N is the number of slices in the data set.

To figure out the number of slices, find the number of bytes per slice
(e.g. 256*256*2 if the data is Short and the slices are 256x256) and
then divide the size of the file by the number of bytes per slice.

Some trial and error will be needed.  Just keep tweaking vtkImageReader
parameters until the image looks right when it is rendered via e.g.
vtkImageViewer.  Each of the possible errors in setting up the ImageReader
(e.g. getting the data type wrong, getting the signedness wrong, getting
the endianness wrong, getting the slice dimensions wrong) will result in a
very distinctive error in the final rendered image.

 - David

--
  David Gobbi, MSc                       dgobbi at irus.rri.ca
  Advanced Imaging Research Group
  Robarts Research Institute, University of Western Ontario

On Mon, 29 Apr 2002, Marwan wrote:

> Hi there,
> I have a Raw volume data which doesn't have a header in it.  I am trying to render it but I could not figure out a way to read the file into the vtkDataSet and render it; Any Ideas?
> Thanks in advance
> Marwan
>




More information about the vtkusers mailing list