MeVisLabToolboxReference
MeVisLab/Standard/Sources/Shared/MLLUT/mlLUTBasic.h
Go to the documentation of this file.
00001 // **InsertLicense** code
00002 //----------------------------------------------------------------------------------
00004 
00010 //----------------------------------------------------------------------------------
00011 
00012 
00013 #ifndef __mlLUTBasic_H
00014 #define __mlLUTBasic_H
00015 
00016 // Local includes
00017 #ifndef __mlLUTSystem_H
00018 #include "mlLUTSystem.h"
00019 #endif
00020 
00021 // ML includes
00022 #include <mlTypeTraits.h>
00023 
00024 
00025 ML_START_NAMESPACE
00026 
00027 
00030 typedef enum {
00031   LUT_L = 0,  
00032   LUT_LA,     
00033   LUT_RGB,    
00034   LUT_RGBA,   
00035 
00036   // Reordered variants of the above, used in LUTData
00037   LUT_BGR,    
00038   LUT_ABGR,   
00039 
00040   // Constant counts
00041   LUT_NUM_VISUAL_TYPE_LAYOUTS,         
00042   LUT_NUM_VISUAL_TYPES = LUT_RGBA+1    
00043 
00044 } LUTVisualType;
00045 
00046 
00048 MLLUT_EXPORT extern const char *LUTVisualTypeName[LUT_NUM_VISUAL_TYPE_LAYOUTS];
00049 
00050 
00052 MLLUT_EXPORT int LUTNumberOfChannels (LUTVisualType visualType);
00053 
00055 MLLUT_EXPORT LUTVisualType LUTReducedVisualType (LUTVisualType visualType);
00056 
00058 MLLUT_EXPORT int LUTAlphaChannelIndex (LUTVisualType visualType);
00059 
00061 MLLUT_EXPORT double LUTConvertRGBtoL (double r, double g, double b);
00062 
00063 
00066 template <typename T>
00067 inline T LUTCastFromDouble(double value) {
00068   if (TypeTraits<T>::isBuiltInIntegerType) {
00069     return static_cast<T>(floor(value+0.5));
00070   } else {
00071     return static_cast<T>(value);
00072   }
00073 }
00074 
00075 
00076 
00078 typedef enum {
00079   LUT_1D = 1, 
00080   LUT_2D,     
00081   LUT_3D      
00082 } LUTDimensionality;
00083 
00084 
00085 ML_END_NAMESPACE
00086 
00087 
00088 #endif
00089 // __mlLUTBasic_H
00090