15 #include <vtkUnsignedCharArray.h>
16 #include <vtkImageData.h>
17 #include <vtkPointData.h>
18 #include <vtkDoubleArray.h>
22 #include <vtkImageResample.h>
23 #include <vtkImageClip.h>
24 #include "vtkImageShiftScale.h"
43 boost::shared_ptr<UnsignedDerivedImage> retval;
63 this->unsignedImageChangedSlot();
64 this->unsignedTransferFunctionsChangedSlot();
67 void UnsignedDerivedImage::testSlot()
71 void UnsignedDerivedImage::unsignedTransferFunctionsChangedSlot()
80 int shift = this->findShift();
82 ImageTF3DPtr TF3D = base->getTransferFunctions3D()->createCopy();
90 void UnsignedDerivedImage::unsignedImageChangedSlot()
95 int UnsignedDerivedImage::findShift()
102 if (input->GetScalarTypeMin() >= 0)
106 int shift = -input->GetScalarRange()[0];
108 if (base->getModality() ==
imCT)
121 int shift = this->findShift();
125 cast->SetInputData(input);
126 cast->ClampOverflowOn();
128 cast->SetShift(shift);
131 double range = input->GetScalarRange()[1] - input->GetScalarRange()[0];
134 if (range <= VTK_UNSIGNED_SHORT_MAX-VTK_UNSIGNED_SHORT_MIN)
135 cast->SetOutputScalarType(VTK_UNSIGNED_SHORT);
136 else if (range <= VTK_UNSIGNED_INT_MAX-VTK_UNSIGNED_INT_MIN)
137 cast->SetOutputScalarType(VTK_UNSIGNED_INT);
141 cast->SetOutputScalarType(VTK_UNSIGNED_INT);
145 report(QString(
"Converting image %1 from %2 to %3").arg(this->
getName()).arg(input->GetScalarTypeAsString()).arg(cast->GetOutput()->GetScalarTypeAsString()));
146 retval = cast->GetOutput();