[vtkusers] Is there a filter to convert float volume to unsigned int ?

Lisa S. Avila lisa.avila at kitware.com
Tue Mar 20 15:30:31 EST 2001

Hello Zsolt,

vtkImageShiftScale should do what you want. Set the shift value so that is 
moves your min scalar value to 0, set the scale so that the max scalar 
value (after being shifted) will become 65535. Then set the output scalar 
type to unsigned short.


At 03:17 PM 3/20/2001, Zsolt Zsoldos wrote:
>Hi All,
>I would like to visualize a volume of floating point data using 2D texture
>mapping (vtkVolumeTextureMapper2D). This only supports unsigned integer data,
>either 8 or 16 bit. My data usually falls into a quite small range, e.g.
>between -5.2 and +9.9, but there are lots of variations. If I simply call
>SetDataTypeToUnsignedShort() on the scalar data, then it works but
>it is a simple 'casting' conversion, so I end up with integers between
>0 and 10 and all fine (fractional) data differences disappear (as well as
>all negative values).
>I would like to apply a filter, which would map my floating data linearly
>to the full UnsignedShort range, e.g. in the above example -5.2 should map to
>0 and +9.9 should map to 65535.
>Is there any filter, which could be applied to a volume to do such mapping
>(basicly a linear interpolation for each value in the volume) ?
>I know it is not a big deal, I could write one, but if there is already one
>that I do not know about, then why should I reinvent the wheel...
>Thanks a lot in advance,
>Zsolt Zsoldos, zsolt at simbiosys.ca, http://www.simbiosys.ca/
>This is the private VTK discussion list.
>Please keep messages on-topic. Check the FAQ at: 
>Follow this link to subscribe/unsubscribe:

More information about the vtkusers mailing list