SPATMOD::IMAGE::SAMPLE Class Reference

Define properties of a single sample. More...

#include <spatmod/imagesample.h>

List of all members.

Public Types

enum  TYPE {
  TYPE_Invalid = 0, TYPE_Unknown = 1, TYPE_Index = 2, TYPE_Gray = 3,
  TYPE_Red = 4, TYPE_Green = 5, TYPE_Blue = 6, TYPE_Opacity = 7,
  TYPE_Cyan = 8, TYPE_Magenta = 9, TYPE_Yellow = 10, TYPE_Black = 11,
  TYPE_Hue = 12, TYPE_Saturation = 13, TYPE_ComplexMagnitude = 14, TYPE_ComplexPhase = 15,
  TYPE_ComplexReal = 16, TYPE_ComplexImaginary = 17, TYPE_Validity = 18
}

Public Member Functions

 SAMPLE (TYPE SampleType, DATATYPE DataType, const void *pValue=0)
 SAMPLE (const SAMPLE &rhs)
 SAMPLE ()
 ~SAMPLE ()
int CompareValues (const SAMPLE &rhs) const
void Exchange (SAMPLE &other)
DATATYPE GetDataType () const
UINT32 GetNumBytes () const
UINT16 GetPrecision () const
TYPE GetType () const
double GetValueDouble () const
INT32 GetValueINT32 () const
const void * GetValuePtr () const
bool IsEqual (const SAMPLE &rhs) const
SAMPLEoperator= (const SAMPLE &rhs)
void SetDataType (DATATYPE DataType)
void SetPrecision (int precision)
void SetType (TYPE SampleType)
void SetValue (double value)
void SetValueFromPtr (const void *pValue)
void SetValueMaximum ()
void SetValueMinimum ()
void SetValueNAN ()
void SetValueZero ()

Detailed Description

Define properties of a single sample.

Properties include sample type, data type, value and optional precision. A sample may be attached to an external data buffer for accessing values. A set of one or more SAMPLE instances is used to represent a PIXEL.


Member Enumeration Documentation

Enumeration of what a sample represents.

Enumerator:
TYPE_Invalid 
TYPE_Unknown 
TYPE_Index 

Index into palette or other array.

TYPE_Gray 
TYPE_Red 
TYPE_Green 
TYPE_Blue 
TYPE_Opacity 
TYPE_Cyan 
TYPE_Magenta 
TYPE_Yellow 
TYPE_Black 
TYPE_Hue 
TYPE_Saturation 
TYPE_ComplexMagnitude 

Magnitude component of complex value.

TYPE_ComplexPhase 

Phase component of complex value.

TYPE_ComplexReal 

Real component of complex value.

TYPE_ComplexImaginary 

Imaginary component of complex value.

TYPE_Validity 

Used as validity for following samples.


Constructor & Destructor Documentation

SPATMOD::IMAGE::SAMPLE::SAMPLE (  ) 

Default constructor.

SPATMOD::IMAGE::SAMPLE::SAMPLE ( const SAMPLE rhs  ) 

Copy constructor.

SPATMOD::IMAGE::SAMPLE::SAMPLE ( TYPE  SampleType,
DATATYPE  DataType,
const void *  pValue = 0 
)

Construct sample with specified properties.

Parameters:
SampleType Sample type
DataType Data type
pValue Optional pointer to initial sample value
SPATMOD::IMAGE::SAMPLE::~SAMPLE (  ) 

Destructor.


Member Function Documentation

int SPATMOD::IMAGE::SAMPLE::CompareValues ( const SAMPLE rhs  )  const

Compare sample values.

Handles all appropriate data type conversions.

Returns:
-1 if this value < rhs, 0 if values equal, +1 if this > rhs.
Parameters:
rhs Sample to compare to
void SPATMOD::IMAGE::SAMPLE::Exchange ( SAMPLE other  ) 

Exchange data with another SAMPLE.

Parameters:
other Sample to exchange with
DATATYPE SPATMOD::IMAGE::SAMPLE::GetDataType (  )  const [inline]

Get DATATYPE of sample.

UINT32 SPATMOD::IMAGE::SAMPLE::GetNumBytes (  )  const [inline]

Get number of bytes in sample.

UINT16 SPATMOD::IMAGE::SAMPLE::GetPrecision (  )  const [inline]

Get precision of sample.

Returns:
Number of bits of precision.
TYPE SPATMOD::IMAGE::SAMPLE::GetType (  )  const [inline]

Get SAMPLE::TYPE of sample.

double SPATMOD::IMAGE::SAMPLE::GetValueDouble (  )  const

Get value as double.

Conversion is done by casting, may lose precision for 64-bit integer values.

INT32 SPATMOD::IMAGE::SAMPLE::GetValueINT32 (  )  const

Get value as INT32.

Conversion is done by casting, may overflow for out of range values.

const void* SPATMOD::IMAGE::SAMPLE::GetValuePtr (  )  const [inline]

Get pointer to sample's value.

Caller must cast returned pointer to appropriate type before using.

bool SPATMOD::IMAGE::SAMPLE::IsEqual ( const SAMPLE rhs  )  const

Compare samples for equality of sample type, data type and value.

SAMPLE& SPATMOD::IMAGE::SAMPLE::operator= ( const SAMPLE rhs  ) 

Assignment.

void SPATMOD::IMAGE::SAMPLE::SetDataType ( DATATYPE  DataType  ) 

Set data type of sample.

Value will be reset to 0 and precision will be reset to default.

void SPATMOD::IMAGE::SAMPLE::SetPrecision ( int  precision  ) 

Set precision of sample.

By default the precision is equal to the number of bits in the sample's DATATYPE. Precision may not exceed number of bits in sample's DATATYPE. Supported for integer data types up to 32 bits only. Data value is assumed to occupy the least significant bit(s).

void SPATMOD::IMAGE::SAMPLE::SetType ( TYPE  SampleType  )  [inline]

Set sample type.

void SPATMOD::IMAGE::SAMPLE::SetValue ( double  value  ) 

Set sample value from double.

No range checking is performed.

Parameters:
value Value to set
void SPATMOD::IMAGE::SAMPLE::SetValueFromPtr ( const void *  pValue  ) 

Set sample value using pointer to source value.

The source pointer must point to a value of the sample's datatype, with proper memory alignment if required by processor.

Parameters:
pValue Pointer to value
void SPATMOD::IMAGE::SAMPLE::SetValueMaximum (  ) 

Set sample value to maximum for DATATYPE and current precision.

void SPATMOD::IMAGE::SAMPLE::SetValueMinimum (  ) 

Set sample value to minimum for DATATYPE and current precision.

void SPATMOD::IMAGE::SAMPLE::SetValueNAN (  ) 

Set sample value to "not a number" for float data types.

Has no effect for integer data types.

void SPATMOD::IMAGE::SAMPLE::SetValueZero (  ) 

Set sample value to 0.


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

Generated on Sun Oct 7 21:40:01 2012 for TNTsdk 2012 by  doxygen 1.6.1