[vtkusers] Re: Reading 24bit raw images

Goodwin Lawlor goodwin.lawlor at ucd.ie
Tue Oct 24 04:44:26 EDT 2006


Emma Ryan wrote:
> Hi all,
> 
>   When reading 24-bit raw images, should the DataExtent be set as
> (0, 255x3, 0 255x3, 0, 32)  i.e. multiply by 3 to include the R, G and B 
> component ?

Hi Emma,

Here's an example of reading raw 24bit *planar* RGB images from the 
Visible Human Project: 
http://www.bioengineering-research.com/vtk/VHPREADER.TCL

If you have raw 24bit *interleaved* RGB images, there is no need to read 
in each channel separately just use:

vtkImageReader reader
   reader SetFilePrefix c:/path/to/my/file
   reader SetFilePattern %s%d.raw
   reader SetDataExtent 0 255 0 255 0 32
   reader SetNumberOfScalarComponents 3
   reader SetDataByteOrderToLittleEndian
   reader SetDataScalarTypeToUnsignedChar



If the images were created on a Unix machine use 
"SetDataByteOrderToBigEndian"

hth

Goodwin




More information about the vtkusers mailing list