MeVisLab Toolbox Reference
Loading...
Searching...
No Matches
mlLUTFunction.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_LUTFUNCTION_H
14#define ML_LUTFUNCTION_H
15
16
18
19#include "mlLUTSystem.h"
20#include "mlLUTBasic.h"
21#include "mlLUTData.h"
22#include "mlLUTIterator.h"
23
24// ML includes
25#include "mlBase.h"
26
27
29
32#define ML_LUT_NATIVE_MINMAX_DOUBLE 1
33
55{
56public:
59 : _visualType(vt)
60 , _relative(relative)
61 {}
62
63
66
68 virtual bool isValid(void) const
69 {
70 return true;
71 }
72
74 virtual LUTVisualType getVisualType(void) const
75 {
76 return _visualType;
77 }
78
80 virtual bool isRelative(void) const
81 {
82 return _relative;
83 }
84
86 virtual void setRelative(bool relative)
87 {
88 _relative = relative;
89 changed();
90 }
91
94 {
95 return (getDepth() > 1) ? LUT_3D : (getHeight() > 1) ? LUT_2D : LUT_1D;
96 }
97
99 virtual double getNativeMinIndex(void) const
100 {
101 return 0;
102 }
103
105 virtual double getNativeMaxIndex(void) const
106 {
107 return 1;
108 }
109
111 virtual int getHeight(void) const
112 {
113 return 1;
114 }
115
117 virtual int getDepth(void) const
118 {
119 return 1;
120 }
121
123 virtual double getNativeMinValue(void) const
124 {
125 return 0;
126 }
127
129 virtual double getNativeMaxValue(void) const
130 {
131 return 1;
132 }
133
139 unsigned int getId(void) const
140 {
141 return _id;
142 }
143
145
146
150
155 virtual bool render(LUTDataBase* lutData) const;
156
165 virtual bool renderRescaled(LUTDataBase* lutData, double minIndex, double maxIndex) const;
166
168
171 void changed(void);
172
176 static unsigned int generateUniqueId(void);
177
179 void overwriteUniqueId(unsigned int newId);
180
181protected:
185
192 virtual LUTVisualType getRenderType(LUTDataBase* /*lutData*/) const
193 {
194 return _visualType;
195 }
196
205
219 double maxIndex) const;
220
222
223
229 template <typename T> bool renderT(LUTData<T>* lutData, bool rescaled, double minIndex, double maxIndex) const;
230
235 template <typename T>
237
238
241
244
247 unsigned int _id;
248
249
251 static unsigned int _gNextId;
252
253
255};
256
257
259
260
261#endif
262// __mlLUTFunction_H
Class representing general ML objects that support import/export via strings (setPersistentState() an...
Definition mlBase.h:63
Untyped base class for LUTData template classes.
Definition mlLUTData.h:65
A LUTData object stores an instance of a LUT, rendered for a specified visual type,...
Definition mlLUTData.h:308
Common base class for lookup tables.
virtual bool renderLUTRescaled(LUTDataBase *lutData, LUTIteratorBase *lutIterator, double minIndex, double maxIndex) const
Render a single row of a rescaled LUT into lutData using lutIterator to access and increment the LUT ...
virtual LUTVisualType getVisualType(void) const
Get LUT visual type.
virtual bool render(LUTDataBase *lutData) const
Render LUT in (previously initialized) LUTData object.
virtual int getDepth(void) const
Get native LUT depth (= number of layers, numbering starts at 0)
unsigned int getId(void) const
Get current LUT ID.
virtual LUTVisualType getRenderType(LUTDataBase *) const
Get visual type used for rendering.
static unsigned int generateUniqueId(void)
Generate a unique id (unique for all mlLUTFunctions), this can also be called to get a unique id for ...
void changed(void)
Assign a new LUT ID.
virtual double getNativeMaxIndex(void) const
Get native maximum index.
unsigned int _id
Unique LUT ID, changed by the changed() method whenever a property of the LUT function object is modi...
virtual bool isRelative(void) const
Is LUT relative?
static unsigned int _gNextId
Global storage for next unused LUT ID to ensure uniqueness.
virtual bool renderRescaled(LUTDataBase *lutData, double minIndex, double maxIndex) const
Render rescaled LUT in (previously initialized) LUTData object.
virtual double getNativeMinIndex(void) const
Get native minimum index.
virtual LUTDimensionality getDimensionality(void) const
Get dimensionality (1, 2, or 3), usually depending on height and depth.
virtual bool isValid(void) const
Return true if the LUT function is valid. An invalid LUT function can not be rendered.
virtual double getNativeMinValue(void) const
Get native minimum LUT value.
virtual int getHeight(void) const
Get native LUT height (= number of rows, numbering starts at 0)
void overwriteUniqueId(unsigned int newId)
Overwrites the unique id. NOTE: use this only if you really know what you are doing!
virtual void setRelative(bool relative)
Set/reset relative flag.
bool interpolateLUT(LUTData< T > *lutData, LUTIterator< T > *lutIterator, double minIndex, double maxIndex) const
Perform type-specific rescaled LUT rendering by.
virtual bool renderLUTNative(LUTDataBase *lutData, LUTIteratorBase *lutIterator) const =0
Render a single row of the lookup table into lutData using lutIterator to access and increment the LU...
LUTVisualType _visualType
LUT visual type.
LUTFunction(LUTVisualType vt, bool relative)
Constructor.
bool renderT(LUTData< T > *lutData, bool rescaled, double minIndex, double maxIndex) const
Perform type-specific, native or rescaled (rescaled = true, rescale to range minIndex ....
ML_ABSTRACT_CLASS_HEADER(LUTFunction)
virtual double getNativeMaxValue(void) const
Get native maximum LUT value.
bool _relative
Flag for relative LUT.
LUT iterator base class with type independent functionality and declarations.
The LUTIterator class template is used by a LUTFunction object for rendering into a LUTData object.
#define MLLUT_EXPORT
System specific macro definitions.
Definition mlLUTSystem.h:25
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
LUTDimensionality
LUT dimensionality.
Definition mlLUTBasic.h:78
@ LUT_1D
1D-LUT, consists of a single row
Definition mlLUTBasic.h:79
@ LUT_3D
3D-LUT, consists of multiple layers
Definition mlLUTBasic.h:81
@ LUT_2D
2D-LUT, consists of multiple rows in a single layer
Definition mlLUTBasic.h:80
LUTVisualType
LUT visual type constants to identify the visual interpretation of the individual LUT channels.
Definition mlLUTBasic.h:30