Fraxinus  18.10
An IGT application
cxImageTFData.h
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) SINTEF Department of Medical Technology.
5 All rights reserved.
6 
7 CustusX is released under a BSD 3-Clause license.
8 
9 See Lisence.txt (https://github.com/SINTEFMedtek/CustusX/blob/master/License.txt) for details.
10 =========================================================================*/
11 
12 
13 /*
14  * Created on: Mar 15, 2011
15  * Author: christiana
16  */
17 
18 #ifndef CXIMAGETFDATA_H_
19 #define CXIMAGETFDATA_H_
20 
21 #include "cxResourceExport.h"
22 #include "cxPrecompiledHeader.h"
23 
24 #include <map>
25 #include <boost/shared_ptr.hpp>
26 #include <QObject>
27 #include <QColor>
28 #include "vtkForwardDeclarations.h"
29 class QDomNode;
30 
31 namespace cx
32 {
33 typedef std::map<int, int> IntIntMap;
34 typedef std::map<int, QColor> ColorMap;
35 typedef boost::shared_ptr<IntIntMap> OpacityMapPtr;
36 typedef boost::shared_ptr<ColorMap> ColorMapPtr;
37 
38 typedef boost::shared_ptr<class ImageTFData> ImageTFDataPtr;
39 
40 
76 class cxResource_EXPORT ImageTFData: public QObject
77 {
78 Q_OBJECT
79 public:
80  ImageTFData();
81  virtual ~ImageTFData();
82 
83  void setAlpha(double val);
84  double getAlpha() const;
85  void setLLR(double val);
86  double getLLR() const;
87  void setWindow(double val);
88  double getWindow() const;
89  void setLevel(double val);
90  double getLevel() const;
91 
92  IntIntMap getOpacityMap();
93  ColorMap getColorMap();
94 
95  void resetAlpha(IntIntMap val);
96  void addAlphaPoint(int alphaPosition, int alphaValue);
97  void removeAlphaPoint(int alphaPosition);
98  void moveAlphaPoint(int oldpos, int newpos, int alphaValue);
99 
100  void resetColor(ColorMap val);
101  void addColorPoint(int colorPosition, QColor colorValue);
102  void removeColorPoint(int colorPosition);
103  void moveColorPoint(int oldpos, int newpos, QColor colorValue);
104 
105  virtual void addXml(QDomNode dataNode);
106  virtual void parseXml(QDomNode dataNode);
107 
108  void unsignedCT(bool onLoad);
109  void shift(int val);
110 
111  vtkColorTransferFunctionPtr generateColorTF() const;
112  vtkPiecewiseFunctionPtr generateOpacityTF() const;
113 
114 signals:
115  void transferFunctionsChanged();
116 
117 protected:
118  void deepCopy(ImageTFData* source);
119  virtual void internalsHaveChanged() {}
120 
121  void fillOpacityTFFromMap(vtkPiecewiseFunctionPtr tf) const;
122  void fillColorTFFromMap(vtkColorTransferFunctionPtr tf) const;
123  void shiftColor(int shift, double center, double scale);
124  void shiftOpacity(int shift);
125 
126  IntIntMap mOpacityMap;
127  ColorMap mColorMap;
128 };
129 
130 }
131 
132 #endif /* CXIMAGETFDATA_H_ */
IntIntMap mOpacityMap
boost::shared_ptr< ColorMap > ColorMapPtr
Definition: cxImageTFData.h:36
vtkSmartPointer< class vtkPiecewiseFunction > vtkPiecewiseFunctionPtr
vtkSmartPointer< class vtkColorTransferFunction > vtkColorTransferFunctionPtr
boost::shared_ptr< IntIntMap > OpacityMapPtr
Definition: cxImageTFData.h:35
std::map< int, QColor > ColorMap
Definition: cxImage.h:36
virtual void internalsHaveChanged()
std::map< int, int > IntIntMap
Definition: cxImage.h:35
Data class for Transfer Function info, either 2D or 3D.
Definition: cxImageTFData.h:76
ColorMap mColorMap
boost::shared_ptr< class ImageTFData > ImageTFDataPtr
Namespace for all CustusX production code.