[vtkusers] how do I traverse the scalars of a vtkImageData?
Mathieu Malaterre
Mathieu.Malaterre at creatis.insa-lyon.fr
Fri Jun 13 03:43:35 EDT 2003
Nico,
imagedata->Update(); //important
float minmax[2] = imagedata->GetScalarRange();
vtkImageShiftScale::SetShift(-minmax[0]);
vtkImageShiftScale::SetScale(255./(minmax[1]-minmax[0]));
vtkImageShiftScale::SetOutputScalarTypeToUnsignedChar ()
See:
http://www.vtk.org/doc/nightly/html/classvtkImageShiftScale.html
HTH
mathieu
Nico Vermaas wrote:
> Hi,
>
> To make volume rendering possible I want to convert the scalars in an vtkImageData to unsigned chars. I need to change them and make them range from 0 - 255.
>
> I used to use SetScalar, but that doesn't seem to work any longer in VTK4. So what is the best way to traverse the scalar values in a vtkImageData? (getting, changing and setting the values?).
>
> Greetings,
>
> Nico
>
>
> ====================================================
> Nico Vermaas
> ASTRON - Westerbork Synthesis Radio Telescope
> Schattenberg 1 - 9433 TA Zwiggelte - The Netherlands
>
> tel: +31 593 598710
> vermaas at astron.nl
> ====================================================
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>
--
Mathieu Malaterre
CREATIS
28 Avenue du Doyen LEPINE
B.P. Lyon-Montchat
69394 Lyon Cedex 03
http://www.creatis.insa-lyon.fr/~malaterre/
More information about the vtkusers
mailing list