Reading raw 24bit images...

David Gobbi dgobbi at irus.rri.on.ca
Thu Oct 7 13:47:25 EDT 1999


Hi Goodwin,

The vtkImageReader only supports packed color images.   If you
want to read 24-bit planar, you'll have to read the file as
a single-component image, use vtkImageClip to cut it into 
three pieces, and then use vtkImageAppendComponents to 
combine the three pieces into a 3-component RGB image.

All in all, it might be easiest to write a short C program
to convert the planar RGB file to packed format.

 - David

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

On Thu, 7 Oct 1999, Goodwin Lawlor wrote:

> I want to read in a raw 24bit color image (2048x1216, three channels, planar RGB). The tcl code below produces a tiled gray-scale image. Should I have some sort a lut in between the reader and the viewer?
> 
> Thanks,
> 
> Goodwin
> 
> 
> vtkImageReader reader
>  reader SetFilePrefix "../image"
>  reader SetFilePattern "%s%d.raw"
>  reader SetDataExtent 1 2048 1 1216 1550 1550
>  reader SetDataSpacing 0.33 0.33 1.0
>  reader SetNumberOfScalarComponents 3
>  reader SetDataScalarTypeToUnsignedChar
>  reader SetDataByteOrderToBigEndian
> 
> vtkImageViewer viewer
>     viewer SetInput [reader GetOutput]
>     viewer SetColorWindow 255
>     viewer SetColorLevel 127.5
>     viewer Render
> 
> 



-----------------------------------------------------------------------------
This is the private VTK discussion list.  Please keep messages on-topic.
Check the FAQ at: <http://www.automatrix.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at gsao.med.ge.com>.  For help, send message body containing
"info vtkusers" to the same address.     Live long and prosper.
-----------------------------------------------------------------------------




More information about the vtkusers mailing list