iflLut(3) Image Format Library C++ Reference Manual iflLut(3)NAMEiflLut - base class for defining look-up tables
INHERITS FROM
This is a base class with no inheritance.
HEADER FILE
#include <il/ilCdefs.h>
CLASS DESCRIPTIONiflLut is a base class used for accessing and manipulating look-up
tables. The class definition provides the necessary data structure for
defining and accessing the look-up table.
A look-up table is defined by the number of channels, the range of input
values it expects (the domain), the data type, and the actual look-up
table data. There is a table for each channel and the size and data type
of each table is the same. The look-up table data is stored in
iflSequential format. In other words, the table for each channel is
stored contiguously. The tables for each channel are packed together
into a single array.
Using iflLut
The iflLut object can either be used to allocate a look-up table whose
values are filled in by calls to the setVal() function, or it can be used
to wrap an object definition around an existing array of lut values.
Constructors are provided for both of these usages. When the iflLut
allocates the tables, it frees them when it is deleted. If the tables
are passed to the constructor, then the caller is responsible for the
management of the table memory. Once an iflLut is constructed, its table
can be completely replaced using the setData() function, or it can be
modified an entry at a time with setVal().
The values in the lut can be accesed by getting a pointer to the table
with getData(), getChan() or getOrigin(). The pointer returned must be
cast to match the internal type of the table as returned by
getDataType(). Alternatively, individual entries in the table can be
accesed using the getVal() function. While less efficient, this function
is easier to use since getVal() automatically converts to double so that
the data type of the table can be ignored. It also automatically deals
with and scaling necessary to deal with a domain that is not a one to one
mapping onto the number of entries in the look up tables.
The range of values contained in the tables can be interrogated by
getRange(). The range of values the lut expects as input can be accessed
with getDomain().
Page 1
iflLut(3) Image Format Library C++ Reference Manual iflLut(3)CLASS MEMBER FUNCTION SUMMARY
Constructor
iflLut* iflLutCreate(int numChan, iflDataType dtype, double min,
double max, int length)
iflLut* iflLutNoAlloc(void* table, int numChan, iflDataType dtype,
double min, double max, int length)
iflLut* iflLutCopy(const iflLut* other)
Destructor
void iflLutDelete(iflLut* obj)
Basic attributes
int iflLutGetNumChans(iflLut *obj)
iflDataType iflLutGetDataType(iflLut *obj)
int iflLutGetLength(iflLut *obj)
Entry access
double iflLutGetVal(iflLut *obj, double domainIdx, int chan)
iflStatus iflLutSetVal(iflLut *obj, double val, double domainIdx,
int chan)
Direct table access
void* iflLutGetOrigin(iflLut *obj, int chan)
void* iflLutGetChan(iflLut *obj, int chan)
void* iflLutGetData(iflLut *obj)
void iflLutSetData(iflLut *obj, void* dataPnt)
Domain and range control
void iflLutGetDomain(iflLut *obj, double* min, double* max)
double iflLutGetDomainMin(iflLut *obj)
double iflLutGetDomainMax(iflLut *obj)
double iflLutGetDomainStep(iflLut *obj)
void iflLutGetRange(iflLut *obj, double* min, double* max)
iflStatus iflLutSetDomain(iflLut *obj, double min, double max)
Comparison
int iflLutIsDiff(iflLut *obj, const iflLut* from)
FUNCTION DESCRIPTIONSiflLut()
Page 2
iflLut(3) Image Format Library C++ Reference Manual iflLut(3)
iflLut* iflLutCopy(const iflLut* other)
iflLut* iflLutCreate(int numChan, iflDataType dtype, double min,
double max, int length)
iflLut* iflLutNoAlloc(void* table, int numChan, iflDataType dtype,
double min, double max, int length)
Constructors for the iflLut class. The number of tables or channels
in the lut is specified by numChan and the LUT data type is
specified by dtype. The domain of values the table handles is from
min to max. The length of each table is either max-min+1 if length
is 0, otherwise it is given by length. A constructor is also
provided that creates an iflLut whose look-up table data is pointed
to by table. Another constructor is provided that copies the tables
and attributes from the iflLut specified by other into this object
iflLutDelete()
void iflLutDelete(iflLut *obj)
Deletes an object of class iflLut, thus freeing any associated
resources.
getChan()
void* iflLutGetChan(iflLut *obj, int chan)
Returns a pointer to the beginning of the table for channel number
chan.
getData()
void* iflLutGetData(iflLut *obj)
Returns a pointer to the overall beginning of the tables for all
channels. If returns the same value as getChan(0).
getDataType()
iflDataType iflLutGetDataType(iflLut *obj)
Returns the data type of the entries in the look-up table.
getDomain()
void iflLutGetDomain(iflLut *obj, double* min, double* max)
Page 3
iflLut(3) Image Format Library C++ Reference Manual iflLut(3)
Returns the domain, in min and max, that the look-up table handles
as input.
getDomainMax()
double iflLutGetDomainMax(iflLut *obj)
Returns the maximum value that the look-up table handles as input.
getDomainMin()
double iflLutGetDomainMin(iflLut *obj)
Returns the minimum value that the look-up table handles as input.
getDomainStep()
double iflLutGetDomainStep(iflLut *obj)
Returns the incremental step in the domain space between adjacent
entries in the look-up table.
getLength()
int iflLutGetLength(iflLut *obj)
Returns the length of a table for an individual channel.
getNumChans()
int iflLutGetNumChans(iflLut *obj)
Returns the number of channels in the look-up table.
getOrigin()
void* iflLutGetOrigin(iflLut *obj, int chan)
Returns a pointer to the entry for value zero of the table for
channel number chan.
getRange()
void iflLutGetRange(iflLut *obj, double* min, double* max)
Page 4
iflLut(3) Image Format Library C++ Reference Manual iflLut(3)
Returns the range of values that the look-up table contains in min
and max.
getVal()
double iflLutGetVal(iflLut *obj, double domainIdx, int chan)
Returns the look-up table entry for channel, chan, and input value,
domainidx. The domain index is scaled as needed to map onto the
actual table entries when the table length does not map one to one
onto the domain.
int iflLutIsDiff(iflLut *obj, const iflLut* from)
The method returns TRUE if the the this lut is not identical, in
attributes and tables contents, to the lut specified by from; FALSE is
returned if the luts are the same.
void iflLutSetData(iflLut *obj, void* dataPnt)
This function replaces the array of all the tables in the lut with the
data pointed to be data. The array of data is not copied, nor is it
deallocated when the iflLut is deleted. The format of the data must
match the data type, length, and number of channels in the iflLut. See
the Class Description section for details on the layout of the look-up
table data.
setDomain()
iflStatus iflLutSetDomain(iflLut *obj, double min, double max)
Sets the range of values that this lut expects to min and max. If
max-min+1 exceeds the current length of the table, a status of
iflBADPARAMS is returned; iflOKAY is returned if the operation is
successful.
setVal()
iflStatus iflLutSetVal(iflLut *obj, double val, double domainIdx,
int chan)
This function sets the look-up table entry for channel, chan, and
input value, domainidx. The value given by val is converted to the
internal data type of the table. If the entry indicated is not
contained in the iflLut, a value of iflBADPARAMS is returned;
Page 5
iflLut(3) Image Format Library C++ Reference Manual iflLut(3)
iflOKAY is returned if the operation is successful. The domain
index is scaled as needed to map onto the actual table entries when
the table length does not map one to one onto the domain.
SEE ALSO
iflColormap, iflSGIColormap
Page 6