[vtkusers] vtkImageShiftScale with vtkDICOMImageReader

Cory Quammen cquammen at cs.unc.edu
Fri Sep 21 10:21:07 EDT 2007


Rob,

I'm not well versed in the manipulation of transfer functions. Perhaps
someone else on the list knows how to do this easily.

Cory

On 9/21/07, CLEMENTS, ROBERT <rclement at kent.edu> wrote:
>
>
>
> Cory,
>  Thanks for your reply.  The reason i want to do this is because i have some
> predefined transfer functions based on 0-255 and was hoping that i wouldn't
> have to convert them to 0-65535.  Is there any easy way of doing this
> besides manually adjusting these numbers?
>
>  Rob
>
>
>
>  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
>
>
>
>


-- 
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