Fraxinus  16.5.0-fx-rc3
An IGT application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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) 2008-2014, SINTEF Department of Medical Technology
5 All rights reserved.
6 
7 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions are met:
9 
10 1. Redistributions of source code must retain the above copyright notice,
11  this list of conditions and the following disclaimer.
12 
13 2. Redistributions in binary form must reproduce the above copyright notice,
14  this list of conditions and the following disclaimer in the documentation
15  and/or other materials provided with the distribution.
16 
17 3. Neither the name of the copyright holder nor the names of its contributors
18  may be used to endorse or promote products derived from this software
19  without specific prior written permission.
20 
21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 =========================================================================*/
32 
33 
34 /*
35  * Created on: Mar 15, 2011
36  * Author: christiana
37  */
38 
39 #ifndef CXIMAGETFDATA_H_
40 #define CXIMAGETFDATA_H_
41 
42 #include "cxResourceExport.h"
43 #include "cxPrecompiledHeader.h"
44 
45 #include <map>
46 #include <boost/shared_ptr.hpp>
47 #include <QObject>
48 #include <QColor>
49 #include "vtkForwardDeclarations.h"
50 class QDomNode;
51 
52 namespace cx
53 {
54 typedef std::map<int, int> IntIntMap;
55 typedef std::map<int, QColor> ColorMap;
56 typedef boost::shared_ptr<IntIntMap> OpacityMapPtr;
57 typedef boost::shared_ptr<ColorMap> ColorMapPtr;
58 
59 typedef boost::shared_ptr<class ImageTFData> ImageTFDataPtr;
60 
61 
97 class cxResource_EXPORT ImageTFData: public QObject
98 {
99 Q_OBJECT
100 public:
101  ImageTFData();
102  virtual ~ImageTFData();
103 
104  void setAlpha(double val);
105  double getAlpha() const;
106  void setLLR(double val);
107  double getLLR() const;
108  void setWindow(double val);
109  double getWindow() const;
110  void setLevel(double val);
111  double getLevel() const;
112 
113  IntIntMap getOpacityMap();
114  ColorMap getColorMap();
115 
116  void resetAlpha(IntIntMap val);
117  void addAlphaPoint(int alphaPosition, int alphaValue);
118  void removeAlphaPoint(int alphaPosition);
119  void moveAlphaPoint(int oldpos, int newpos, int alphaValue);
120 
121  void resetColor(ColorMap val);
122  void addColorPoint(int colorPosition, QColor colorValue);
123  void removeColorPoint(int colorPosition);
124  void moveColorPoint(int oldpos, int newpos, QColor colorValue);
125 
126  virtual void addXml(QDomNode dataNode);
127  virtual void parseXml(QDomNode dataNode);
128 
129  void unsignedCT(bool onLoad);
130  void shift(int val);
131 
132  vtkColorTransferFunctionPtr generateColorTF() const;
133  vtkPiecewiseFunctionPtr generateOpacityTF() const;
134 
135 signals:
136  void transferFunctionsChanged();
137 
138 protected:
139  void deepCopy(ImageTFData* source);
140  virtual void internalsHaveChanged() {}
141 
142  void fillOpacityTFFromMap(vtkPiecewiseFunctionPtr tf) const;
143  void fillColorTFFromMap(vtkColorTransferFunctionPtr tf) const;
144  void shiftColor(int shift, double center, double scale);
145  void shiftOpacity(int shift);
146 
149 };
150 
151 }
152 
153 #endif /* CXIMAGETFDATA_H_ */
IntIntMap mOpacityMap
boost::shared_ptr< ColorMap > ColorMapPtr
Definition: cxImageTFData.h:57
vtkSmartPointer< class vtkPiecewiseFunction > vtkPiecewiseFunctionPtr
vtkSmartPointer< class vtkColorTransferFunction > vtkColorTransferFunctionPtr
boost::shared_ptr< IntIntMap > OpacityMapPtr
Definition: cxImageTFData.h:56
std::map< int, QColor > ColorMap
Definition: cxImage.h:57
virtual void internalsHaveChanged()
std::map< int, int > IntIntMap
Definition: cxImage.h:56
Data class for Transfer Function info, either 2D or 3D.
Definition: cxImageTFData.h:97
ColorMap mColorMap
boost::shared_ptr< class ImageTFData > ImageTFDataPtr