MeVisLab Toolbox Reference
mlLUTFBlend.h
Go to the documentation of this file.
1 /*************************************************************************************
2 **
3 ** Copyright 2007, MeVis Medical Solutions AG
4 **
5 ** The user may use this file in accordance with the license agreement provided with
6 ** the Software or, alternatively, in accordance with the terms contained in a
7 ** written agreement between the user and MeVis Medical Solutions AG.
8 **
9 ** For further information use the contact form at https://www.mevislab.de/contact
10 **
11 **************************************************************************************/
12 
13 #ifndef ML_LUTFBLEND_H
14 #define ML_LUTFBLEND_H
15 
16 
18 
19 #include "mlLUTSystem.h"
20 #include "mlLUTFunction.h"
21 
22 
23 
24 ML_START_NAMESPACE
25 
26 
29 {
30 public:
31 
33  LUTFBlend (void);
34 
35 
37  virtual void setInputLUTs (LUTFunction *inLUT1, LUTFunction *inLUT2);
38 
39 
42 
44  virtual void setBlendingSteps (int numBlendingSteps);
45 
47  virtual int getBlendingSteps (void) const { return _numBlendingSteps; }
48 
50 
51 
54 
56  bool isValid (void) const override;
57 
59  LUTDimensionality getDimensionality (void) const override { return _dimensionality; }
60 
62  double getNativeMinIndex (void) const override;
63 
65  double getNativeMaxIndex (void) const override;
66 
68  int getHeight (void) const override;
69 
71  int getDepth (void) const override;
72 
74  double getNativeMinValue (void) const override;
75 
77  double getNativeMaxValue (void) const override;
78 
80 
81 
85 
90  bool render (LUTDataBase *lutData) const override;
91 
98  bool renderRescaled (LUTDataBase *lutData, double minIndex, double maxIndex) const override;
99 
101 
102 
103 
104 protected:
105 
108 
114  LUTVisualType getRenderType (LUTDataBase *lutData) const override { return lutData->getVisualType(); }
115 
120  bool renderLUTNative (LUTDataBase *lutData, LUTIteratorBase *lutIterator) const override;
121 
128  bool renderLUTRescaled (LUTDataBase *lutData, LUTIteratorBase *lutIterator,
129  double minIndex, double maxIndex) const override;
130 
132  virtual bool renderLUT (LUTDataBase *lutData, LUTIteratorBase *lutIterator) const;
133 
135  virtual bool startRender (LUTDataBase *lutData, double minIndex, double maxIndex, bool rescaled) const;
136 
138  virtual void clearLutData (void) const;
139 
141  template <typename T>
142  LUTData<T> *createInputLUTData (LUTData<T> *outLutData, int blendIndex, LUTFunction *lutFunction,
143  double minIndex, double maxIndex, bool rescaled) const;
144 
147  template <typename T>
148  void blendData (LUTData<T> *outLutData, double blendFactor, int inRow, int outRow, int outLayer) const;
149 
151  template <typename T>
152  void copyData (LUTData<T> *outLutData, LUTDataBase *inLutData, int inRow, int outRow, int outLayer) const;
153 
155 
156 
158  LUTFunction *_inLUT1, *_inLUT2;
159 
162 
164  mutable LUTDataBase *_lutData1, *_lutData2;
165 
168 
169 
171 
172 };
173 
174 
175 ML_END_NAMESPACE
176 
177 #endif
178 // __mlLUTFBlend_H
Untyped base class for LUTData template classes.
Definition: mlLUTData.h:64
LUTVisualType getVisualType(void) const
Get visual type.
Definition: mlLUTData.h:110
A LUTData object stores an instance of a LUT, rendered for a specified visual type,...
Definition: mlLUTData.h:243
Generate a 2/3D-LUT by blending two 1/2D-LUTs.
Definition: mlLUTFBlend.h:29
bool renderRescaled(LUTDataBase *lutData, double minIndex, double maxIndex) const override
Render rescaled LUT in (previously initialized) LUTData object.
LUTData< T > * createInputLUTData(LUTData< T > *outLutData, int blendIndex, LUTFunction *lutFunction, double minIndex, double maxIndex, bool rescaled) const
Allocate, initialize and render LUT data object for input LUT.
double getNativeMinIndex(void) const override
Get native minimum index.
LUTDimensionality getDimensionality(void) const override
Get dimensionality (1, 2, or 3)
Definition: mlLUTFBlend.h:59
virtual void setInputLUTs(LUTFunction *inLUT1, LUTFunction *inLUT2)
Set input LUTs, set relative flag to true if both input LUTs are relative.
double getNativeMaxValue(void) const override
Get native maximum LUT value.
int getHeight(void) const override
Get native LUT height (= number of rows, numbering starts at 0)
LUTVisualType getRenderType(LUTDataBase *lutData) const override
Get visual type used for rendering.
Definition: mlLUTFBlend.h:114
virtual bool renderLUT(LUTDataBase *lutData, LUTIteratorBase *lutIterator) const
Perform LUT rendering, return true if successful.
LUTDimensionality _dimensionality
Output LUT dimensionality (1, 2, or 3)
Definition: mlLUTFBlend.h:167
virtual void clearLutData(void) const
Clear LUT data objects after rendering.
ML_CLASS_HEADER(LUTFBlend)
LUTDataBase * _lutData1
Rendered LUT data for original input LUTs, used at first and last blending steps.
Definition: mlLUTFBlend.h:164
bool render(LUTDataBase *lutData) const override
Render LUT in (previously initialized) LUTData object.
bool renderLUTRescaled(LUTDataBase *lutData, LUTIteratorBase *lutIterator, double minIndex, double maxIndex) const override
Render rescaled LUT into lutData using lutIterator to access and increment the LUT pointers.
bool isValid(void) const override
Return true if the LUT function is valid.
int _numBlendingSteps
Number of blending steps.
Definition: mlLUTFBlend.h:161
LUTFBlend(void)
Constructor.
double getNativeMaxIndex(void) const override
Get native maximum index.
LUTFunction * _inLUT1
Input LUTs.
Definition: mlLUTFBlend.h:158
virtual bool startRender(LUTDataBase *lutData, double minIndex, double maxIndex, bool rescaled) const
Initialize LUT data objects for input LUTs for rendering, return true if successful.
double getNativeMinValue(void) const override
Get native minimum LUT value.
void copyData(LUTData< T > *outLutData, LUTDataBase *inLutData, int inRow, int outRow, int outLayer) const
Copy data from inLutData at inRow to outLutData at outRow, outLayer.
virtual void setBlendingSteps(int numBlendingSteps)
Set number of blending steps (= number of rows/layers in output 2/3D-LUT, min = 2)
void blendData(LUTData< T > *outLutData, double blendFactor, int inRow, int outRow, int outLayer) const
Interpolate LUT data between input LUTs 1 and 2 at inRow, store result in outLutData at outRow,...
int getDepth(void) const override
Get native LUT depth (= number of layers, numbering starts at 0)
bool renderLUTNative(LUTDataBase *lutData, LUTIteratorBase *lutIterator) const override
Render the lookup table into lutData using lutIterator to access and increment the LUT pointers.
virtual int getBlendingSteps(void) const
Get number of blending steps.
Definition: mlLUTFBlend.h:47
Common base class for lookup tables.
Definition: mlLUTFunction.h:55
LUT iterator base class with type independent functionality and declarations.
Definition: mlLUTIterator.h:30
#define MLLUT_EXPORT
System specific macro definitions.
Definition: mlLUTSystem.h:25
LUTDimensionality
LUT dimensionality.
Definition: mlLUTBasic.h:78
LUTVisualType
LUT visual type constants to identify the visual interpretation of the individual LUT channels.
Definition: mlLUTBasic.h:30