43 #include <QDomDocument>
44 #include <vtkLookupTable.h>
45 #include <vtkImageData.h>
46 #include <vtkColorTransferFunction.h>
47 #include <vtkPiecewiseFunction.h>
97 retval->deepCopy(
this);
103 double smin = image->GetScalarRange()[0];
104 double smax = image->GetScalarRange()[1];
105 double srange = smax - smin;
107 this->
setLevel(smin + srange / 2.0);
114 mOutputLUT = vtkLookupTablePtr::New();
115 this->refreshOutputLUT();
136 this->refreshOutputLUT();
140 std::pair<int,int> ImageLUT2D::getMapsRange()
146 return std::make_pair(imin,imax);
152 return std::make_pair(imin,imax);
158 return std::make_pair(imin,imax);
162 return std::make_pair(0,0);
166 void ImageLUT2D::refreshOutputLUT()
171 std::pair<int,int> range = this->getMapsRange();
172 int imin = range.first;
173 int imax = range.second;
176 int icount = imax - imin + 1;
180 lut->SetNumberOfTableValues(icount);
181 lut->SetTableRange(imin, imax);
186 for (
int i = 0; i < icount; ++i)
188 double* rgb = colorFunc->GetColor(i + imin);
189 double alpha = opacityFunc->GetValue(i + imin);
190 lut->SetTableValue(i, rgb[0], rgb[1], rgb[2], alpha);
201 unsigned char input = 0;
202 lut->MapScalarsThroughTable2(&input, &input, VTK_UNSIGNED_CHAR, 1, 1, 1);
void transferFunctionsChanged()
ImageLUT2DPtr createCopy()
void setFullRangeWinLevel(vtkImageDataPtr image)
Set winlevel spanning the entire range.
vtkColorTransferFunctionPtr generateColorTF() const
vtkSmartPointer< class vtkPiecewiseFunction > vtkPiecewiseFunctionPtr
vtkSmartPointer< class vtkColorTransferFunction > vtkColorTransferFunctionPtr
virtual void internalsHaveChanged()
boost::shared_ptr< class ImageLUT2D > ImageLUT2DPtr
void setWindow(double val)
range [1..scalarMax-scalarMin]
vtkPiecewiseFunctionPtr generateOpacityTF() const
vtkSmartPointer< class vtkLookupTable > vtkLookupTablePtr
void setLevel(double val)
range [scalarMin..scalarMax]
vtkLookupTablePtr getOutputLookupTable()