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();
Image(const QString &uid, const vtkImageDataPtr &data, const QString &name="")
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(QString uid=QString())
emitted when the vktimagedata are invalidated and must be retrieved anew.
boost::shared_ptr< class ImageTF3D > ImageTF3DPtr
virtual CoordinateSystem getCoordinateSystem()
Namespace for all CustusX production code.