MeVisLab Toolbox Reference
ml::LUTFBlend Class Reference

Generate a 2/3D-LUT by blending two 1/2D-LUTs. More...

#include <mlLUTFBlend.h>

Inheritance diagram for ml::LUTFBlend:
ml::LUTFunction ml::Base

Public Member Functions

 LUTFBlend (void)
 Constructor.
 
virtual void setInputLUTs (LUTFunction *inLUT1, LUTFunction *inLUT2)
 Set input LUTs, set relative flag to true if both input LUTs are relative.
 
Transform parameters
virtual void setBlendingSteps (int numBlendingSteps)
 Set number of blending steps (= number of rows/layers in output 2/3D-LUT, min = 2)
 
virtual int getBlendingSteps (void) const
 Get number of blending steps.
 
LUT properties
bool isValid (void) const override
 Return true if the LUT function is valid.
 
LUTDimensionality getDimensionality (void) const override
 Get dimensionality (1, 2, or 3)
 
double getNativeMinIndex (void) const override
 Get native minimum index.
 
double getNativeMaxIndex (void) const override
 Get native maximum index.
 
int getHeight (void) const override
 Get native LUT height (= number of rows, numbering starts at 0)
 
int getDepth (void) const override
 Get native LUT depth (= number of layers, numbering starts at 0)
 
double getNativeMinValue (void) const override
 Get native minimum LUT value.
 
double getNativeMaxValue (void) const override
 Get native maximum LUT value.
 
LUT rendering

These methods are called by LUT users to obtain a rendering of the LUT function.

bool render (LUTDataBase *lutData) const override
 Render LUT in (previously initialized) LUTData object.
 
bool renderRescaled (LUTDataBase *lutData, double minIndex, double maxIndex) const override
 Render rescaled LUT in (previously initialized) LUTData object.
 
- Public Member Functions inherited from ml::LUTFunction
 LUTFunction (LUTVisualType vt, bool relative)
 Constructor.
 
void changed (void)
 Assign a new LUT ID.
 
void overwriteUniqueId (unsigned int newId)
 Overwrites the unique id. NOTE: use this only if you really know what you are doing!
 
virtual LUTVisualType getVisualType (void) const
 Get LUT visual type.
 
virtual bool isRelative (void) const
 Is LUT relative?
 
virtual void setRelative (bool relative)
 Set/reset relative flag.
 
unsigned int getId (void) const
 Get current LUT ID.
 
- Public Member Functions inherited from ml::Base
 Base ()
 Constructor.
 
virtual ~Base ()
 Destructor.
 
virtual BasedeepCopy () const
 Set addStateToTree version number that can be accessed via getAddStateVersion()
 
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.
 
virtual bool isRefCountedBase () const
 Returns if the instance is derived from RefCountedBase.
 
virtual std::string detailString () const
 Return a string describing this object.
 
virtual bool implementsPersistence (PersistenceInterface) const
 Override this method to declare which persistence interfaces are implemented by your derived class.
 
virtual std::string persistentState () const
 Returns a string describing the object's internal state.
 
virtual void setPersistentState (const std::string &state)
 Restores the object's internal state from a string that had been previously generated using persistentState().
 
virtual void addStateToTree (TreeNode *) const
 Attaches the object state as children of the given parent node.
 
virtual void readStateFromTree (TreeNode *)
 Reads the object state from the children of the given parent node.
 
virtual void writeTo (AbstractPersistenceOutputStream *) const
 Write the objects state to the data stream object.
 
virtual void readFrom (AbstractPersistenceInputStream *, int)
 Read the objects state from the data stream object.
 

Protected Member Functions

 ML_CLASS_HEADER (LUTFBlend)
 
LUT implementation
LUTVisualType getRenderType (LUTDataBase *lutData) const override
 Get visual type used for rendering.
 
bool renderLUTNative (LUTDataBase *lutData, LUTIteratorBase *lutIterator) const override
 Render the lookup table into lutData using lutIterator to access and increment the LUT pointers.
 
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.
 
virtual bool renderLUT (LUTDataBase *lutData, LUTIteratorBase *lutIterator) const
 Perform LUT rendering, return true if successful.
 
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.
 
virtual void clearLutData (void) const
 Clear LUT data objects after rendering.
 
template<typename T >
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.
 
template<typename T >
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, outLayer.
 
template<typename T >
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.
 
- 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 ... maxIndex) LUT rendering by.
 
template<typename T >
bool interpolateLUT (LUTData< T > *lutData, LUTIterator< T > *lutIterator, double minIndex, double maxIndex) const
 Perform type-specific rescaled LUT rendering by.
 
 ML_ABSTRACT_CLASS_HEADER (LUTFunction)
 

Protected Attributes

LUTFunction_inLUT1
 Input LUTs.
 
LUTFunction_inLUT2
 
int _numBlendingSteps
 Number of blending steps.
 
LUTDataBase_lutData1
 Rendered LUT data for original input LUTs, used at first and last blending steps.
 
LUTDataBase_lutData2
 
LUTDimensionality _dimensionality
 Output LUT dimensionality (1, 2, or 3)
 
- Protected Attributes inherited from ml::LUTFunction
LUTVisualType _visualType
 LUT visual type.
 
bool _relative
 Flag for relative LUT.
 
unsigned int _id
 Unique LUT ID, changed by the changed() method whenever a property of the LUT function object is modified.
 

Additional Inherited Members

- Public Types inherited from ml::Base
enum  PersistenceInterface { PersistenceByString , PersistenceByTreeNode , PersistenceByStream }
 This enum describes the different persistence interfaces available. 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.
 
- Static Protected Attributes inherited from ml::LUTFunction
static unsigned int _gNextId
 Global storage for next unused LUT ID to ensure uniqueness.
 

Detailed Description

Generate a 2/3D-LUT by blending two 1/2D-LUTs.

Definition at line 28 of file mlLUTFBlend.h.

Constructor & Destructor Documentation

◆ LUTFBlend()

ml::LUTFBlend::LUTFBlend ( void )

Constructor.

Member Function Documentation

◆ blendData()

template<typename T >
void ml::LUTFBlend::blendData ( LUTData< T > * outLutData,
double blendFactor,
int inRow,
int outRow,
int outLayer ) const
protected

Interpolate LUT data between input LUTs 1 and 2 at inRow, store result in outLutData at outRow, outLayer.

◆ clearLutData()

virtual void ml::LUTFBlend::clearLutData ( void ) const
protectedvirtual

Clear LUT data objects after rendering.

◆ copyData()

template<typename T >
void ml::LUTFBlend::copyData ( LUTData< T > * outLutData,
LUTDataBase * inLutData,
int inRow,
int outRow,
int outLayer ) const
protected

Copy data from inLutData at inRow to outLutData at outRow, outLayer.

◆ createInputLUTData()

template<typename T >
LUTData< T > * ml::LUTFBlend::createInputLUTData ( LUTData< T > * outLutData,
int blendIndex,
LUTFunction * lutFunction,
double minIndex,
double maxIndex,
bool rescaled ) const
protected

Allocate, initialize and render LUT data object for input LUT.

◆ getBlendingSteps()

virtual int ml::LUTFBlend::getBlendingSteps ( void ) const
inlinevirtual

Get number of blending steps.

Definition at line 47 of file mlLUTFBlend.h.

◆ getDepth()

int ml::LUTFBlend::getDepth ( void ) const
overridevirtual

Get native LUT depth (= number of layers, numbering starts at 0)

Reimplemented from ml::LUTFunction.

◆ getDimensionality()

LUTDimensionality ml::LUTFBlend::getDimensionality ( void ) const
inlineoverridevirtual

Get dimensionality (1, 2, or 3)

Reimplemented from ml::LUTFunction.

Definition at line 59 of file mlLUTFBlend.h.

◆ getHeight()

int ml::LUTFBlend::getHeight ( void ) const
overridevirtual

Get native LUT height (= number of rows, numbering starts at 0)

Reimplemented from ml::LUTFunction.

◆ getNativeMaxIndex()

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

Get native maximum index.

Reimplemented from ml::LUTFunction.

◆ getNativeMaxValue()

double ml::LUTFBlend::getNativeMaxValue ( void ) const
overridevirtual

Get native maximum LUT value.

Reimplemented from ml::LUTFunction.

◆ getNativeMinIndex()

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

Get native minimum index.

Reimplemented from ml::LUTFunction.

◆ getNativeMinValue()

double ml::LUTFBlend::getNativeMinValue ( void ) const
overridevirtual

Get native minimum LUT value.

Reimplemented from ml::LUTFunction.

◆ getRenderType()

LUTVisualType ml::LUTFBlend::getRenderType ( LUTDataBase * lutData) const
inlineoverrideprotectedvirtual

Get visual type used for rendering.

This method is called by render() and renderRescaled() to initialize the LUT iterator object appropriate for a pair of source/target visual types. By returning the visual type of lutData, we always render directly in the visual type requested.

Reimplemented from ml::LUTFunction.

Definition at line 114 of file mlLUTFBlend.h.

References mlrange_cast().

◆ isValid()

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

Return true if the LUT function is valid.

Reimplemented from ml::LUTFunction.

◆ ML_CLASS_HEADER()

ml::LUTFBlend::ML_CLASS_HEADER ( LUTFBlend )
protected

◆ render()

bool ml::LUTFBlend::render ( LUTDataBase * lutData) const
overridevirtual

Render LUT in (previously initialized) LUTData object.

Return true if successful.

Overloaded here to perform initialization and cleanup

Reimplemented from ml::LUTFunction.

◆ renderLUT()

virtual bool ml::LUTFBlend::renderLUT ( LUTDataBase * lutData,
LUTIteratorBase * lutIterator ) const
protectedvirtual

Perform LUT rendering, return true if successful.

◆ renderLUTNative()

bool ml::LUTFBlend::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::LUTFBlend::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.

◆ renderRescaled()

bool ml::LUTFBlend::renderRescaled ( LUTDataBase * lutData,
double minIndex,
double maxIndex ) const
overridevirtual

Render rescaled LUT in (previously initialized) LUTData object.

LUT is rendered for range minIndex .. maxIndex, but resampled to the index range specified in lutData. Return true if successful

Overloaded here to perform initialization and cleanup

Reimplemented from ml::LUTFunction.

◆ setBlendingSteps()

virtual void ml::LUTFBlend::setBlendingSteps ( int numBlendingSteps)
virtual

Set number of blending steps (= number of rows/layers in output 2/3D-LUT, min = 2)

◆ setInputLUTs()

virtual void ml::LUTFBlend::setInputLUTs ( LUTFunction * inLUT1,
LUTFunction * inLUT2 )
virtual

Set input LUTs, set relative flag to true if both input LUTs are relative.

◆ startRender()

virtual bool ml::LUTFBlend::startRender ( LUTDataBase * lutData,
double minIndex,
double maxIndex,
bool rescaled ) const
protectedvirtual

Initialize LUT data objects for input LUTs for rendering, return true if successful.

Member Data Documentation

◆ _dimensionality

LUTDimensionality ml::LUTFBlend::_dimensionality
protected

Output LUT dimensionality (1, 2, or 3)

Definition at line 167 of file mlLUTFBlend.h.

◆ _inLUT1

LUTFunction* ml::LUTFBlend::_inLUT1
protected

Input LUTs.

Definition at line 158 of file mlLUTFBlend.h.

◆ _inLUT2

LUTFunction * ml::LUTFBlend::_inLUT2
protected

Definition at line 158 of file mlLUTFBlend.h.

◆ _lutData1

LUTDataBase* ml::LUTFBlend::_lutData1
mutableprotected

Rendered LUT data for original input LUTs, used at first and last blending steps.

Definition at line 164 of file mlLUTFBlend.h.

◆ _lutData2

LUTDataBase * ml::LUTFBlend::_lutData2
protected

Definition at line 164 of file mlLUTFBlend.h.

◆ _numBlendingSteps

int ml::LUTFBlend::_numBlendingSteps
protected

Number of blending steps.

Definition at line 161 of file mlLUTFBlend.h.


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