[vtkusers] Rescale 16-bit volume image data to 8-bit in VTK

Cory Quammen cquammen at cs.unc.edu
Mon Sep 24 15:34:14 EDT 2007


Shuzai,

You can use vtkImageCast to do this. Something like:

vtkImageCast *caster = vtkImageCast::New();
caster->SetOutputScalarTypeToUnsignedChar();
caster->SetInput(image16bit);

If you need to scale the values to the range [0,255], you can use
vtkImageShiftScale:

double scale = <whatever you need to scale to [0,255]>;
vtkImageShiftScale *scaler = vtkImageShiftScale::New();
scaler->SetOutputScalarTypeToUnsignedChar();
scaler->SetScale(scale);
scaler->SetInput(image16bit);

-Cory

On 9/24/07, Shuzai Fan <fanshuzai at gmail.com> wrote:
> Dear All,
>
> Does anyone know how to convert 16-bit volume image data to 8-bit in VTK? I
> know how to do it in ITK, but it seems not straightforward in VTK.
>
> Thanks a lot,
>
> Shuzai
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>


-- 
Cory Quammen
Department of Computer Science
University of North Carolina at Chapel Hill
http://www.cs.unc.edu/~cquammen



More information about the vtkusers mailing list