36 #include <vtkUnsignedCharArray.h>
37 #include <vtkImageData.h>
38 #include <vtkPointData.h>
39 #include <vtkDoubleArray.h>
43 #include <vtkImageResample.h>
44 #include <vtkImageClip.h>
45 #include "vtkImageShiftScale.h"
64 boost::shared_ptr<UnsignedDerivedImage> retval;
84 this->unsignedImageChangedSlot();
85 this->unsignedTransferFunctionsChangedSlot();
88 void UnsignedDerivedImage::testSlot()
92 void UnsignedDerivedImage::unsignedTransferFunctionsChangedSlot()
101 int shift = this->findShift();
103 ImageTF3DPtr TF3D = base->getTransferFunctions3D()->createCopy();
104 ImageLUT2DPtr LUT2D = base->getLookupTable2D()->createCopy();
111 void UnsignedDerivedImage::unsignedImageChangedSlot()
116 int UnsignedDerivedImage::findShift()
123 if (input->GetScalarTypeMin() >= 0)
127 int shift = -input->GetScalarRange()[0];
129 if (base->getModality().contains(
"CT", Qt::CaseInsensitive))
142 int shift = this->findShift();
146 cast->SetInputData(input);
147 cast->ClampOverflowOn();
149 cast->SetShift(shift);
152 double range = input->GetScalarRange()[1] - input->GetScalarRange()[0];
155 if (range <= VTK_UNSIGNED_SHORT_MAX-VTK_UNSIGNED_SHORT_MIN)
156 cast->SetOutputScalarType(VTK_UNSIGNED_SHORT);
157 else if (range <= VTK_UNSIGNED_INT_MAX-VTK_UNSIGNED_INT_MIN)
158 cast->SetOutputScalarType(VTK_UNSIGNED_INT);
162 cast->SetOutputScalarType(VTK_UNSIGNED_INT);
166 report(QString(
"Converting image %1 from %2 to %3").arg(this->
getName()).arg(input->GetScalarTypeAsString()).arg(cast->GetOutput()->GetScalarTypeAsString()));
167 retval = cast->GetOutput();
virtual void setTransferFunctions3D(ImageTF3DPtr transferFuntion)
vtkSmartPointer< class vtkImageShiftScale > vtkImageShiftScalePtr
virtual void setVtkImageData(const vtkImageDataPtr &data, bool resetTransferFunctions=true)
void propertiesChanged()
emitted when one of the metadata properties (uid, name etc) changes
#define CALL_IN_WEAK_PTR(weak_base, func, defarg)
virtual void setLookupTable2D(ImageLUT2DPtr imageLookupTable2D)
void transformChanged()
emitted when transform is changed
boost::shared_ptr< class Image > ImagePtr
static ImagePtr create(ImagePtr base)
boost::shared_ptr< class ImageLUT2D > ImageLUT2DPtr
vtkSmartPointer< vtkDoubleArray > vtkDoubleArrayPtr
void transferFunctionsChanged()
emitted when image transfer functions in 2D or 3D are changed.
Identification of a Coordinate system.
Class that holds an unsigned version of a base Image.
virtual QString getName() const
void vtkImageDataChanged()
emitted when the vktimagedata are invalidated and must be retrieved anew.
boost::shared_ptr< class ImageTF3D > ImageTF3DPtr
virtual CoordinateSystem getCoordinateSystem()