MeVisLab Toolbox Reference
ml::LUTFLinear Class Reference

A color/gray LUT with sampling points and linear, nearest neighbor or truncated interpolation inbetween. More...

#include <mlLUTFLinear.h>

Inheritance diagram for ml::LUTFLinear:
ml::LUTFunction ml::Base

Public Types

enum  ColorInterpolation {
  InterpolateRGB , InterpolateHLS , InterpolateHLSpos , InterpolateHLSneg ,
  InterpolateConstant , InterpolateSRGB
}
 Color interpolation constants. More...
 
- Public Types inherited from ml::Base
enum  PersistenceInterface { PersistenceByString , PersistenceByTreeNode , PersistenceByStream }
 This enum describes the different persistence interfaces available. More...
 

Public Member Functions

 ML_SET_ADDSTATE_VERSION (1)
 
 LUTFLinear (void)
 Constructor. More...
 
LUT parameters
virtual bool setPoints (const LUTRGBAPointList &points)
 Set table with sampling points, data is copied to internal storage. More...
 
const LUTRGBAPointListgetPoints () const
 Get sampling point table as a const reference. More...
 
LUTRGBAPointListgetModifiablePoints ()
 Get modifiable sampling point table. More...
 
void setVisualType (LUTVisualType visualType)
 Set the visual type of the table (this affects how the points in the list are handled) More...
 
int insertPoint (const LUTRGBAPoint &point)
 Insert a given point and return the resulting index in the sampling point table. More...
 
void removePoint (int idx)
 Remove the point at the given index. More...
 
const LUTRGBAPointgetPoint (int idx) const
 Get a point at given index. More...
 
void setPoint (int idx, const LUTRGBAPoint &point)
 Set a point at given index, does not check if position is correct! More...
 
virtual double getStartIndex (void) const
 Get start index. More...
 
virtual double getEndIndex (void) const
 Get end index. More...
 
virtual ColorInterpolation getColorInterpolation (void) const
 Get color interpolation mode. More...
 
virtual void setColorInterpolation (ColorInterpolation c)
 Set color interpolation mode. More...
 
void setAlphaFactor (float factor)
 Set the global alpha factor (default is 1.) More...
 
float getAlphaFactor () const
 Get the global alpha factor. More...
 
bool relativeUsesNativeRange () const
 Return true if the native index range (given by the first and last index position in the sampling point table) is used as the range for relative mapping, If set to false, [0,1] is used (default is false). More...
 
void setRelativeUsesNativeRange (bool flag)
 Specify whether the native index range (given by the first and last index position in the sampling point table) is used as the range for relative mapping, If set to false, [0,1] is used (default is false). More...
 
LUT properties
bool isValid (void) const override
 Return true if the LUT function is valid. More...
 
double getNativeMinIndex (void) const override
 Get native minimum index. More...
 
double getNativeMaxIndex (void) const override
 Get native maximum index. More...
 
- Public Member Functions inherited from ml::LUTFunction
 LUTFunction (LUTVisualType vt, bool relative)
 Constructor. More...
 
void changed (void)
 Assign a new LUT ID. More...
 
void overwriteUniqueId (unsigned int newId)
 Overwrites the unique id. NOTE: use this only if you really know what you are doing! More...
 
virtual LUTVisualType getVisualType (void) const
 Get LUT visual type. More...
 
virtual bool isRelative (void) const
 Is LUT relative? More...
 
virtual void setRelative (bool relative)
 Set/reset relative flag. More...
 
virtual LUTDimensionality getDimensionality (void) const
 Get dimensionality (1, 2, or 3), usually depending on height and depth. More...
 
virtual int getHeight (void) const
 Get native LUT height (= number of rows, numbering starts at 0) More...
 
virtual int getDepth (void) const
 Get native LUT depth (= number of layers, numbering starts at 0) More...
 
virtual double getNativeMinValue (void) const
 Get native minimum LUT value. More...
 
virtual double getNativeMaxValue (void) const
 Get native maximum LUT value. More...
 
unsigned int getId (void) const
 Get current LUT ID. More...
 
virtual bool render (LUTDataBase *lutData) const
 Render LUT in (previously initialized) LUTData object. More...
 
virtual bool renderRescaled (LUTDataBase *lutData, double minIndex, double maxIndex) const
 Render rescaled LUT in (previously initialized) LUTData object. More...
 
- Public Member Functions inherited from ml::Base
 Base ()
 Constructor. More...
 
virtual ~Base ()
 Destructor. More...
 
virtual BasedeepCopy () const
 Set addStateToTree version number that can be accessed via getAddStateVersion() More...
 
bool isOfAllowedType (const std::vector< const RuntimeType * > &types) const
 Check if this object's type is equal to or derived from one of the types given in the argument. More...
 
virtual bool isRefCountedBase () const
 Returns if the instance is derived from RefCountedBase. More...
 
virtual std::string detailString () const
 Return a string describing this object. More...
 
virtual bool implementsPersistence (PersistenceInterface) const
 Override this method to declare which persistence interfaces are implemented by your derived class. More...
 
virtual std::string persistentState () const
 Returns a string describing the object's internal state. More...
 
virtual void setPersistentState (const std::string &state)
 Restores the object's internal state from a string that had been previously generated using persistentState(). More...
 
virtual void writeTo (AbstractPersistenceOutputStream *) const
 Write the objects state to the data stream object. More...
 
virtual void readFrom (AbstractPersistenceInputStream *, int)
 Read the objects state from the data stream object. More...
 

Static Public Member Functions

static EnumValues< ColorInterpolationgetColorInterpolationValues ()
 Color interpolation values. More...
 
- Static Public Member Functions inherited from ml::LUTFunction
static unsigned int generateUniqueId (void)
 Generate a unique id (unique for all mlLUTFunctions), this can also be called to get a unique id for a LUTData object manually. More...
 

Protected Member Functions

void addStateToTree (TreeNode *parent) const override
 Attaches the object state as children of the given parent node. More...
 
void readStateFromTree (TreeNode *parent) override
 Reads the object state from the children of the given parent node. More...
 
void copyPoint (int idx, double *array) const
 Copy the point at table index idx to the given array (ordered like in the LUTIterator) More...
 
 ML_CLASS_HEADER (LUTFLinear)
 
LUT implementation
bool renderLUTNative (LUTDataBase *lutData, LUTIteratorBase *lutIterator) const override
 Render the lookup table into lutData using lutIterator to access and increment the LUT pointers. More...
 
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. More...
 
template<typename T >
bool renderLUT (LUTData< T > *lutData, LUTIterator< T > *lutIterator, double startIndex, double endIndex) const
 Render the LUT table between startIndex and endIndex into lutData using lutIterator to access and increment the LUT pointers. More...
 
- Protected Member Functions inherited from ml::LUTFunction
template<typename T >
bool renderT (LUTData< T > *lutData, bool rescaled, double minIndex, double maxIndex) const
 Perform type-specific, native or rescaled (rescaled = true, rescale to range minIndex ... More...
 
template<typename T >
bool interpolateLUT (LUTData< T > *lutData, LUTIterator< T > *lutIterator, double minIndex, double maxIndex) const
 Perform type-specific rescaled LUT rendering by. More...
 
 ML_ABSTRACT_CLASS_HEADER (LUTFunction)
 
virtual LUTVisualType getRenderType (LUTDataBase *) const
 Get visual type used for rendering. More...
 
- Protected Member Functions inherited from ml::Base
virtual char * getPersistentState () const
 Returns a C string describing the object's internal state. More...
 
virtual void setPersistentState (const char *)
 Restores the object's internal state from a string that had been previously generated using getPersistentState(). More...
 
virtual void clearPersistentState (char *) const
 Disposes a string previously allocated by getPersistentState(). More...
 

Protected Attributes

LUTRGBAPointList _points
 LUT sampling point table. More...
 
float _alphaFactor
 Global alpha factor. More...
 
bool _relativeUsesNativeRange
 Flag specifying whether the native index range is used as the range for relative mapping, If set to false, [0,1] is used (default is false). More...
 
ColorInterpolation _colorInterpolation
 Color interpolation mode. More...
 
- Protected Attributes inherited from ml::LUTFunction
LUTVisualType _visualType
 LUT visual type. More...
 
bool _relative
 Flag for relative LUT. More...
 
unsigned int _id
 Unique LUT ID, changed by the changed() method whenever a property of the LUT function object is modified. More...
 

Additional Inherited Members

- Static Protected Attributes inherited from ml::LUTFunction
static unsigned int _gNextId
 Global storage for next unused LUT ID to ensure uniqueness. More...
 

Detailed Description

A color/gray LUT with sampling points and linear, nearest neighbor or truncated interpolation inbetween.

Definition at line 114 of file mlLUTFLinear.h.

Member Enumeration Documentation

◆ ColorInterpolation

Color interpolation constants.

Enumerator
InterpolateRGB 

Interpolation in RGB space.

InterpolateHLS 

Interpolation in HLS space, closest H direction.

InterpolateHLSpos 

Interpolation in HLS space, positive H direction.

InterpolateHLSneg 

Interpolation in HLS space, negative H direction.

InterpolateConstant 

Interpolation by floor() truncation.

InterpolateSRGB 

Convert to linear RGB, interpolate and convert back.

Definition at line 122 of file mlLUTFLinear.h.

Constructor & Destructor Documentation

◆ LUTFLinear()

ml::LUTFLinear::LUTFLinear ( void  )

Constructor.

Member Function Documentation

◆ addStateToTree()

void ml::LUTFLinear::addStateToTree ( TreeNode ) const
overrideprotectedvirtual

Attaches the object state as children of the given parent node.

Reimplemented from ml::Base.

◆ copyPoint()

void ml::LUTFLinear::copyPoint ( int  idx,
double *  array 
) const
protected

Copy the point at table index idx to the given array (ordered like in the LUTIterator)

◆ getAlphaFactor()

float ml::LUTFLinear::getAlphaFactor ( ) const
inline

Get the global alpha factor.

Definition at line 187 of file mlLUTFLinear.h.

◆ getColorInterpolation()

virtual ColorInterpolation ml::LUTFLinear::getColorInterpolation ( void  ) const
inlinevirtual

Get color interpolation mode.

Definition at line 175 of file mlLUTFLinear.h.

◆ getColorInterpolationValues()

static EnumValues<ColorInterpolation> ml::LUTFLinear::getColorInterpolationValues ( )
static

Color interpolation values.

◆ getEndIndex()

virtual double ml::LUTFLinear::getEndIndex ( void  ) const
virtual

Get end index.

◆ getModifiablePoints()

LUTRGBAPointList& ml::LUTFLinear::getModifiablePoints ( )
inline

Get modifiable sampling point table.

Make sure that you keep the order of the points and that you call changed() after each change to the table.

Definition at line 151 of file mlLUTFLinear.h.

◆ getNativeMaxIndex()

double ml::LUTFLinear::getNativeMaxIndex ( void  ) const
overridevirtual

Get native maximum index.

Reimplemented from ml::LUTFunction.

◆ getNativeMinIndex()

double ml::LUTFLinear::getNativeMinIndex ( void  ) const
overridevirtual

Get native minimum index.

Reimplemented from ml::LUTFunction.

◆ getPoint()

const LUTRGBAPoint& ml::LUTFLinear::getPoint ( int  idx) const

Get a point at given index.

◆ getPoints()

const LUTRGBAPointList& ml::LUTFLinear::getPoints ( ) const
inline

Get sampling point table as a const reference.

Definition at line 147 of file mlLUTFLinear.h.

◆ getStartIndex()

virtual double ml::LUTFLinear::getStartIndex ( void  ) const
virtual

Get start index.

◆ insertPoint()

int ml::LUTFLinear::insertPoint ( const LUTRGBAPoint point)

Insert a given point and return the resulting index in the sampling point table.

◆ isValid()

bool ml::LUTFLinear::isValid ( void  ) const
overridevirtual

Return true if the LUT function is valid.

Reimplemented from ml::LUTFunction.

◆ ML_CLASS_HEADER()

ml::LUTFLinear::ML_CLASS_HEADER ( LUTFLinear  )
protected

◆ ML_SET_ADDSTATE_VERSION()

ml::LUTFLinear::ML_SET_ADDSTATE_VERSION ( )

◆ readStateFromTree()

void ml::LUTFLinear::readStateFromTree ( TreeNode )
overrideprotectedvirtual

Reads the object state from the children of the given parent node.

Reimplemented from ml::Base.

◆ relativeUsesNativeRange()

bool ml::LUTFLinear::relativeUsesNativeRange ( ) const
inline

Return true if the native index range (given by the first and last index position in the sampling point table) is used as the range for relative mapping, If set to false, [0,1] is used (default is false).

Definition at line 193 of file mlLUTFLinear.h.

◆ removePoint()

void ml::LUTFLinear::removePoint ( int  idx)

Remove the point at the given index.

◆ renderLUT()

template<typename T >
bool ml::LUTFLinear::renderLUT ( LUTData< T > *  lutData,
LUTIterator< T > *  lutIterator,
double  startIndex,
double  endIndex 
) const
protected

Render the LUT table between startIndex and endIndex into lutData using lutIterator to access and increment the LUT pointers.

Return true if successful.

◆ renderLUTNative()

bool ml::LUTFLinear::renderLUTNative ( LUTDataBase lutData,
LUTIteratorBase lutIterator 
) const
overrideprotectedvirtual

Render the lookup table into lutData using lutIterator to access and increment the LUT pointers.

Both lutData and lutIterator should be type-cast to a derived, type specific class pointer, according to lutData->getDataType(). Return true if successful.

Implements ml::LUTFunction.

◆ renderLUTRescaled()

bool ml::LUTFLinear::renderLUTRescaled ( LUTDataBase lutData,
LUTIteratorBase lutIterator,
double  minIndex,
double  maxIndex 
) const
overrideprotectedvirtual

Render rescaled LUT into lutData using lutIterator to access and increment the LUT pointers.

Both lutData and lutIterator should be type-cast to a derived, type specific class pointer, according to lutData->getDataType(). The LUT is rendered for range minIndex .. maxIndex, but resampled to the index range specified in lutData. Return true if successful.

Reimplemented from ml::LUTFunction.

◆ setAlphaFactor()

void ml::LUTFLinear::setAlphaFactor ( float  factor)
inline

Set the global alpha factor (default is 1.)

Definition at line 181 of file mlLUTFLinear.h.

◆ setColorInterpolation()

virtual void ml::LUTFLinear::setColorInterpolation ( ColorInterpolation  c)
inlinevirtual

Set color interpolation mode.

Definition at line 178 of file mlLUTFLinear.h.

◆ setPoint()

void ml::LUTFLinear::setPoint ( int  idx,
const LUTRGBAPoint point 
)

Set a point at given index, does not check if position is correct!

◆ setPoints()

virtual bool ml::LUTFLinear::setPoints ( const LUTRGBAPointList points)
virtual

Set table with sampling points, data is copied to internal storage.

Returns true if successful.

◆ setRelativeUsesNativeRange()

void ml::LUTFLinear::setRelativeUsesNativeRange ( bool  flag)
inline

Specify whether the native index range (given by the first and last index position in the sampling point table) is used as the range for relative mapping, If set to false, [0,1] is used (default is false).

Definition at line 197 of file mlLUTFLinear.h.

◆ setVisualType()

void ml::LUTFLinear::setVisualType ( LUTVisualType  visualType)
inline

Set the visual type of the table (this affects how the points in the list are handled)

Definition at line 154 of file mlLUTFLinear.h.

Member Data Documentation

◆ _alphaFactor

float ml::LUTFLinear::_alphaFactor
protected

Global alpha factor.

Definition at line 258 of file mlLUTFLinear.h.

◆ _colorInterpolation

ColorInterpolation ml::LUTFLinear::_colorInterpolation
protected

Color interpolation mode.

Definition at line 265 of file mlLUTFLinear.h.

◆ _points

LUTRGBAPointList ml::LUTFLinear::_points
protected

LUT sampling point table.

Definition at line 255 of file mlLUTFLinear.h.

◆ _relativeUsesNativeRange

bool ml::LUTFLinear::_relativeUsesNativeRange
protected

Flag specifying whether the native index range is used as the range for relative mapping, If set to false, [0,1] is used (default is false).

Definition at line 262 of file mlLUTFLinear.h.


The documentation for this class was generated from the following file: