VIPER REFERENCE MANUAL


NAME
iflLut - base class for defining look-up tables

HEADER FILE
#include <ifl/iflLut.h>

PUBLIC METHOD SUMMARY

   Creating and destroying
iflLut (  );
iflLut ( int numChan, iflDataType dtype, double min, double max, int length=0);
iflLut ( void* table, int numChan, iflDataType dtype, double min, double max, int length=0);
iflLut ( const iflLut& other);
virtual ~iflLut (  );

   Basic attributes
int getNumChans (  ) const;
iflDataType getDataType (  ) const;
int getLength (  ) const;

   Entry access
double getVal ( double domainIdx, int chan=0) const;
iflStatus setVal ( double val, double domainIdx, int chan=0);

   Direct table access
void* getOrigin ( int chan) const;
void* getChan ( int chan) const;
void* getData (  ) const;
void setData ( void* data);

   Domain and range control
void getDomain ( double& min, double& max) const;
double getDomainMin (  ) const;
double getDomainMax (  ) const;
double getDomainStep (  ) const;
void getRange ( double& min, double& max) const;
iflStatus setDomain ( double min, double max);

   Comparison
int isDiff ( const iflLut& from) const;

   Copying
void operator= ( const iflLut& from);

PROTECTED METHOD SUMMARY

   Initialization
void init ( void* table, int tabChannels, iflDataType tabType, double min, double max, int length=0);

CLASS DESCRIPTION
iflLut 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().

METHOD DESCRIPTIONS

   iflLut()
iflLut (  );
iflLut ( int numChan, iflDataType dtype, double min, double max, int length=0);
iflLut ( void* table, int numChan, iflDataType dtype, double min, double max, int length=0);
iflLut ( const iflLut& other);

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 The default constructor generates an empty iflLut. This can be useful in conjuction with the assigment operator.

   ~iflLut()
virtual ~iflLut (  );

Destroys all memory allocated by this class. If the table data was passed to the constructor then that data is not affected.

   getChan()
void* getChan ( int chan) const;

Returns a pointer to the beginning of the table for channel number chan.

   getData()
void* getData (  ) const;

Returns a pointer to the overall beginning of the tables for all channels. If returns the same value as getChan()(0).

   getDataType()
iflDataType getDataType (  ) const;

Returns the data type of the entries in the look-up table.

   getDomain()
void getDomain ( double& min, double& max) const;

Returns the domain, in min and max, that the look-up table handles as input.

   getDomainMax()
double getDomainMax (  ) const;

Returns the minimum value that the look-up table handles as input.

   getDomainMin()
double getDomainMin (  ) const;

Returns the maximum value that the look-up table handles as input.

   getDomainStep()
double getDomainStep (  ) const;

Returns the incremental step in the domain space between adjacent entries in the look-up table.

   getLength()
int getLength (  ) const;

Returns the length of a table for an individual channel.

   getNumChans()
int getNumChans (  ) const;

Returns the number of channels in the look-up table.

   getOrigin()
void* getOrigin ( int chan) const;

Returns a pointer to the entry for value zero of the table for channel number chan.

   getRange()
void getRange ( double& min, double& max) const;

Returns the range of values that the look-up table contains in min and max.

   getVal()
double getVal ( double domainIdx, int chan=0) const;

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.

   init()
void init ( void* table, int tabChannels, iflDataType tabType, double min, double max, int length=0);

This method fully initializes this object with the specified attributes, the interpreation of the parameters is the same as for the iflLut() constructors.

   isDiff()
int isDiff ( const iflLut& from) const;

The method returns TRUE if 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.

   operator=()
void operator= ( const iflLut& from);

This function makes a copy of the look-up table (including all of its tables) specified by from.

   setData()
void setData ( void* data);

This function replaces the array of all the tables in the lut with the data pointed to by 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 setDomain ( 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 setVal ( double val, double domainIdx, int chan=0);

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; 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