MeVisLabToolboxReference
|
00001 // **InsertLicense** code 00002 //---------------------------------------------------------------------------------- 00004 00010 //---------------------------------------------------------------------------------- 00011 00012 00013 #ifndef __mlLUTFunction_H 00014 #define __mlLUTFunction_H 00015 00016 // Local includes 00017 #ifndef __mlLUTSystem_H 00018 #include "mlLUTSystem.h" 00019 #endif 00020 #ifndef __mlLUTBasic_H 00021 #include "mlLUTBasic.h" 00022 #endif 00023 #ifndef __mlLUTData_H 00024 #include "mlLUTData.h" 00025 #endif 00026 #ifndef __mlLUTIterator_H 00027 #include "mlLUTIterator.h" 00028 #endif 00029 00030 // ML includes 00031 #ifndef __mlBase_H 00032 #include "mlBase.h" 00033 #endif 00034 00035 00036 ML_START_NAMESPACE 00037 00038 00062 class MLLUT_EXPORT LUTFunction : public Base 00063 { 00064 public: 00065 00067 LUTFunction (LUTVisualType vt, bool relative) 00068 : _visualType(vt), _relative(relative) {} 00069 00070 00072 00073 00075 virtual bool isValid (void) const { return true; } 00076 00078 virtual LUTVisualType getVisualType (void) const { return _visualType; } 00079 00081 virtual bool isRelative (void) const { return _relative; } 00082 00084 virtual void setRelative (bool relative) { _relative = relative; changed(); } 00085 00087 virtual LUTDimensionality getDimensionality (void) const 00088 { return (getDepth() > 1) ? LUT_3D : (getHeight() > 1) ? LUT_2D : LUT_1D; } 00089 00091 virtual int getNativeMinIndex (void) const { return 0; } 00092 00094 virtual int getNativeMaxIndex (void) const { return 1; } 00095 00097 virtual int getHeight (void) const { return 1; } 00098 00100 virtual int getDepth (void) const { return 1; } 00101 00103 virtual double getNativeMinValue (void) const { return 0; } 00104 00106 virtual double getNativeMaxValue (void) const { return 1; } 00107 00113 unsigned int getId (void) const { return _id; } 00114 00116 00117 00120 00121 00126 virtual bool render (LUTDataBase *lutData) const; 00127 00136 virtual bool renderRescaled (LUTDataBase *lutData, double minIndex, double maxIndex) const; 00137 00139 00142 void changed (void); 00143 00147 static unsigned int generateUniqueId (void); 00148 00150 void overwriteUniqueId(unsigned int newId); 00151 00152 protected: 00153 00156 00157 00164 virtual LUTVisualType getRenderType (LUTDataBase * /*lutData*/) const { return _visualType; } 00165 00173 virtual bool renderLUTNative (LUTDataBase *lutData, LUTIteratorBase *lutIterator) const = 0; 00174 00187 virtual bool renderLUTRescaled (LUTDataBase *lutData, LUTIteratorBase *lutIterator, 00188 double minIndex, double maxIndex) const; 00189 00191 00192 00198 template <typename T> 00199 bool renderT (LUTData<T> *lutData, bool rescaled, double minIndex, double maxIndex) const; 00200 00205 template <typename T> 00206 bool interpolateLUT (LUTData<T> *lutData, LUTIterator<T> *lutIterator, 00207 double minIndex, double maxIndex) const; 00208 00209 00210 00212 LUTVisualType _visualType; 00213 00215 bool _relative; 00216 00219 unsigned int _id; 00220 00221 00223 static unsigned int _gNextId; 00224 00225 00226 ML_ABSTRACT_CLASS_HEADER(LUTFunction); 00227 00228 }; 00229 00230 00231 ML_END_NAMESPACE 00232 00233 00234 #endif 00235 // __mlLUTFunction_H