[vtkusers] Re: Reading Structured Points using ImageReader
Ken Martin
ken.martin at kitware.com
Fri Oct 27 08:50:40 EDT 2000
At 02:19 PM 10/26/2000 +0200, Sathya Krishnamurthy (CSCS) wrote:
>Hello Everybody
>
>I am trying to read a structured points data file using ImageReader. The
>data file is organized as follows:
>
><.. FileHeader...> 44bytes containing Dimensions x,y,z
>4 bytes space
><X - Scalar Data ...> <which is x*y*z sizeof float
>4 bytes space
><Y - Scalar Data ...> <which is x*y*z sizeof float
>4 bytes space
><Z - Scalar Data ...> <which is x*y*z sizeof float
>
>I have constructed the Reader sub-classing from vtkImageReader. In the
>ExecuteInformation I have read the header and put all the information in
>
>DataVOI, DataExtent , FileDimensionality, NumberOfScalarComponents and
>the HeaderSize
You also must specify the ScalarType to be float. Once all that
information is specified you should be able to rely on vtkImageReader's
methods to actually read in the data and support streaming etc. The only
problem I see is your mentioning "4 bytes space". If you mean that each row
must be a multiple of 4 bytes that is no problem since you are using float.
If you mean that between each row there are always 4 empty bytes, and then
between each slice an additional 4 empty bytes, then you must write your
own method to read in the data since ImageReader doesn't support such an
arrangement. You can look at vtkBMPReader which does something very similar
to what you are looking for.
- Ken
More information about the vtkusers
mailing list