[vtkusers] vtkImageShiftScale with vtkDICOMImageReader
Cory Quammen
cquammen at cs.unc.edu
Fri Sep 21 09:51:28 EDT 2007
Rob,
Unsigned shorts can represent values from 0 to 65535, but unsigned
chars can represent values from 0 to only 255. If your DICOM image
contains values above 255, these values will "wrap around" to some
value between 0 and 255 (basically, the value in the DICOM image
modulo 255). That would explain why your data looks odd when cast to
unsigned chars. You can use the method ClampOverflowOn() to ensure
that this wrapping doesn't occur, but all values at or above 255 will
be set to 255, which probably isn't what you want.
Instead, you could scale your data using vtkImageShiftScale to scale
your data to the range 0 to 255 before performing the type conversion,
but you should be careful about the affect this has on your data. Some
differing values in the DICOM image will be scaled to the same value
in the unsigned char image.
Cory
On 9/21/07, CLEMENTS, ROBERT <rclement at kent.edu> wrote:
>
>
>
> Hello all, i am trying to use vtkDICOMImageReader then vtkImageShiftScale .
> If i set vtkImageShiftScale's ouput to unsignedshort my data looks fine,
> however if i set the output to unsignedchar my data gets distorted in some
> manner. I attached 2 images displaying the problem. Anybody know what my
> problem is, and how to address this to make the unsignedchar output closely
> match the unsignedshort output?
>
> much obliged
> Rob
>
>
> _______________________________________________
> 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