[vtkusers] Inverting image data
dean.inglis at on.aibn.com
dean.inglis at on.aibn.com
Thu Jun 5 18:07:39 EDT 2003
Steve,
here is a bit of tcl script I used for
inverting image data, the key is the
vtkImageShiftScale filter with which
you can set the output scalar type to
whatever you need:
vtkImageReader v16
v16 SetFileName "mydata.dat"
v16 SetDataScalarTypeToUnsignedShort
v16 SetDataByteOrderToLittleEndian
v16 SetFileDimensionality 3
v16 FileLowerLeftOff
v16 SetDataOrigin 0 0 0
v16 SetDataExtent 0 66 0 66 0 11
v16 SetDataSpacing .1953125 .1953125 0.8
v16 ReleaseDataFlagOn
v16 Update
set tmp [[v16 GetOutput] GetScalarRange]
set min [lindex $tmp 0]
set max [lindex $tmp 1]
vtkImageShiftScale shift
shift SetOutputScalarTypeToUnsignedChar
shift ReleaseDataFlagOn
shift ClampOverflowOn
shift SetScale -1
shift SetShift [expr -1.0*$max]
shift SetInput [v16 GetOutput]
shift Update
hope this helps,
Dean
More information about the vtkusers
mailing list