get max color value

John Biddiscombe j.biddiscombe at rl.ac.uk
Fri Nov 26 09:21:47 EST 1999


>> how can I get the max. color value from a vtkImageData (16bit grayscale).
>
>Iterate over the data.

if the colours are 16 bits with black being zero and white 65536, then 

vtkImageData *data = get the pointer
float range[2];
data->GetScalarRange(range);
will return the min and max values in the scalar colour values.

it effectively does the iteration for you.

if the values are being mapped though a lookuptable such that 0 isn't black
65536 isn't white or they don't follow a linear sequence, you'll need to
use map scalars through lookuptable to be sure - but if max and min numbers
are all you want, then you're away.

NB : line above might be
data->GetPointData()->GetScalars()->GetScalarRange(range);

John B






-----------------------------------------------------------------------------
This is the private VTK discussion list.  Please keep messages on-topic.
Check the FAQ at: <http://www.automatrix.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at gsao.med.ge.com>.  For help, send message body containing
"info vtkusers" to the same address.     Live long and prosper.
-----------------------------------------------------------------------------




More information about the vtkusers mailing list