[vtkusers] Rendering RAW image format

Stephen Reilly stephen.reilly at ntlworld.com
Mon Nov 11 16:25:41 EST 2002


Dear VTK-users,

I have a series of RAW images I wish to render. I know their sizes, how they are laid out, and can open them in Paintshop Pro, but I can not get them to render in VTK. I think that this may have something to do with the vtkImageReader I am using.

The pictures are color bit mapped, RGB 24 bit planar images, with a pixel size of 0.33.

I have used the code below to read in images before, and successfully rendered them, but this format seems to be causing some difficulty as all that is rendering is a black rectangle.

Any help you can provide would be greatly appreciated,
Stephen


Please find the code attached:

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

#Set the origins to the corners - since we are setting the 
set origin_x [expr ( 1216 / 2.0 ) * $PIXEL_SIZE * -1.0]
set origin_y [expr ( 2048 / 2.0 ) * $PIXEL_SIZE * -1.0]

vtkImageReader reader
    reader SetDataExtent 0 1215 0 2048 1 5
    reader SetDataVOI 0 1215 0 2048 1 5
    reader SetFilePrefix $BASENAME
    reader SetDataSpacing 0.33 0.33 1.0
    reader SetDataOrigin $origin_x $origin_y 0
    reader SetHeaderSize 0
    reader SetDataByteOrderToBigEndian
    reader SetDataScalarTypeToUnsignedShort
    reader SetDataMask 0x7fff
    [reader GetOutput] GlobalReleaseDataFlagOn;

vtkImageCast cast
    cast SetInput [reader GetOutput]
    cast SetOutputScalarTypeToUnsignedChar
    
vtkVolumeRayCastCompositeFunction  compositeFunction

vtkVolumeRayCastMapper volumeMapper
    volumeMapper SetVolumeRayCastFunction compositeFunction
    volumeMapper SetInput [cast GetOutput]

vtkVolume volume
    volume SetMapper volumeMapper


I then go on to render it as normal.
I have also tried setting the reader as UnsignedChar to no avail.

Thanks for reading this far,
Stephen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20021111/86a76056/attachment.htm>


More information about the vtkusers mailing list