[vtkusers] Rendering RAW image format
anast.jm at pg.com
anast.jm at pg.com
Mon Nov 11 18:26:25 EST 2002
I'm not sure (I've not read color images before) but maybe the color components
are the problem. Try SetNumberOfScalarComponents (int) to 3 (this is a super
class method of ImageReader2)?? ....john
Internet Mail Message
Received from host: public.kitware.com
[24.97.130.19]
From: "Stephen Reilly" <stephen.reilly at ntlworld.com>@public.kitware.com on
11/11/2002 09:25 PM GMT
"Stephen Reilly" <stephen.reilly at ntlworld.com> To: "VTK-Users"
@public.kitware.com <vtkusers at public.kitware.com>
Cc: (bcc: John Anast-JM/PGI)
Subject: [vtkusers] Rendering RAW image
Sent by: vtkusers-admin at public.kitware.com format
11/11/2002 04:25 PM
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
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
More information about the vtkusers
mailing list