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

Zsolt Zsoldos zsolt at simbiosys.ca
Tue Mar 20 15:17:38 EST 2001


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

-- 
Zsolt Zsoldos, zsolt at simbiosys.ca, http://www.simbiosys.ca/




More information about the vtkusers mailing list