[vtkusers] Problem with vtkImageCast

Oliver Vidovic ovidovic at medipattern.com
Thu Feb 21 15:51:08 EST 2002


 Hi vtk users,

 I am using vtkImageMapToColors class to map structured points input (of
unsigned char type) into colors. Then I want to cast the output back to
unsigned char. I am using vtkImageCast, but the output stays of type float,
no matter what I set as output scalar type on vtkImageCast.
 I don't care if I lose precision because of rounding floats to unsigned
chars.
 Anyone knows what's the problem?


-- begin tcl code snippet
vtkStructuredPointsReader reader
# reader reads some file where scalars are of unsigned char type

vtkLookupTable lut
# set up lookup table

# assign lookup table to image/mapper
vtkImageMapToColors mapToRGBA
	mapToRGBA SetInput [reader GetOutput]
	mapToRGBA SetOutputFormatToRGBA
	mapToRGBA SetLookupTable lut

# cast back to unsigned char
vtkImageCast cast
	cast SetInput [mapToRGBA GetOutput]
	cast SetOutputScalarTypeToUnsignedChar

- end tcl code snippet


 thanks
 oliver





More information about the vtkusers mailing list