VIPER REFERENCE MANUAL


NAME
iflConfig - class for pixel abstraction

HEADER FILE
#include <ifl/iflConfig.h>

PUBLIC METHOD SUMMARY

   Creating and destroying
iflConfig (  );
iflConfig ( iflDataType type, iflOrder ord=iflInterleaved, int nchan=0, int* chanList=NULL, int chanOff=0, iflOrientation ori=iflOrientation(0));
~iflConfig (  );

   Channel list manipulations
void invert ( int nc, int* chanList) const;
int isInvertable (  ) const;
void compose ( int nc, int* in, int* out) const;
int mapChan ( int idx) const;
int operator[] ( int idx) const;

PUBLIC MEMBER SUMMARY
iflDataType dtype;
iflOrder order;
iflOrientation orientation;
int nchans;
int choff;
int* channels;

CLASS DESCRIPTION
The iflConfig class is used to describe the configuration of pixel data. It is used in functions such as iflFile::getTile() and iflFile::setTile() to describe the configuration of data in the user's buffer.

   Using iflConfig
The iflConfig object contains a list that maps channels from one collection to another. In this code fragment,
    unsigned char buffer[10*10*3];
    static int list[] = { 2, 1, 0 };
    iflConfig cfg(iflUChar, iflInterleaved, 3, list);

    someFile.getTile(0, 0, 0, 10, 10, 1, buffer, &cfg);
cfg is used to indicate that buffer is going to receive a 10-by-10 array of three-component pixels stored in interleaved order with an unsigned char data type. This would override the actual configuration of the data in someFile.

The channel list provides the buffer's channel information. The first channel of the buffer receives data from channel 2 of someFile. The second channel is from someFile's channel 1. The third buffer channel gets channel 0 of someFile. In general, when an iflConfig is defaulted, the operation being performed assumes that the source and destination configurations match. If someFile was actually a four-channel float image stored in separate order, then
    someFile.getTile(0, 0, 0, 10, 10, 1, buffer);
would require a buffer declared as
    float buffer[10*10*4];
and would receive a verbatim copy of the requested section of someFile.

METHOD DESCRIPTIONS

   iflConfig()
iflConfig (  );
iflConfig ( iflDataType type, iflOrder ord=iflInterleaved, int nchan=0, int* chanList=NULL, int chanOff=0, iflOrientation ori=iflOrientation(0));

The first constructor creates an unitialized iflConfig.

The second constructor creates an iflConfig with data type, type; data ordering, order; and channel list defined by chanList of nc channels. If chanList is omitted, all nchan channels are used in ascending order. Optionally, the orientation is set to ori. If omitted, the orientation matches that of the image being accessed.

   ~iflConfig()
~iflConfig (  );

Destroys the object but not the channel list that it points at (if any).

   compose()
void compose ( int nc, int* in, int* out) const;

This function composes the channel list in the iflConfig object with the channel list of nc channels specified by in. The composed list is written to out.

   invert()
void invert ( int nc, int* chanList) const;

This function inverts the channel list in the iflConfig object to perform the mapping in the opposite direction. The result is written to nc entries of chanlist.

   isInvertable()
int isInvertable (  ) const;

This function returns whether the mapping described by the channel list has an inverse.

   mapChan()
int mapChan ( int idx) const;

This function returns the channel on the list in the iflConfig object that maps to idx. It takes into account the offset specified by choff, or just the offseted index, if the channel list is NULL. If idx is more than nchans or less than 0, it returns -1.

   operator[]()
int operator[] ( int idx) const;

This operator returns the channel on the list in the iflConfig object that maps to idx. It takes into account the offset specified by choff, or just the offseted index, if the channel list is NULL. If idx is more than nchans or less than 0, it returns -1.

MEMBER DESCRIPTIONS

   channels
int* channels;

A list that maps channels from one collection to another. This array is not maintained by this object, the data pointed to must persist while the object is in use.

   
choff
int choff;

An offset into the channel list for the purpose of mapping from one collection of channels to another.

   
dtype
iflDataType dtype;

The data type of the pixels.

   
nchans
int nchans;

The number of data channels the pixels contain.

   
order
iflOrder order;

The dimension order of the pixels.

   
orientation
iflOrientation orientation;

The orientation of the pixels.

SEE ALSO
iflFile