OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Public Types | Public Member Functions | Static Protected Attributes | List of all members
ossimNormalizedU16RemapTable Class Reference

Unsigned 16 bit normalized remap table to go to/from normalized value to pixel value. More...

#include <ossimNormalizedU16RemapTable.h>

Inheritance diagram for ossimNormalizedU16RemapTable:
ossimNormalizedRemapTable

Public Types

enum  { TABLE_ENTRIES = 65536 }
 

Public Member Functions

 ossimNormalizedU16RemapTable ()
 default constructor More...
 
virtual ~ossimNormalizedU16RemapTable ()
 virtual destructor More...
 
virtual ossim_int32 getEntries () const
 Gets the number of table entries. More...
 
virtual ossim_float64 operator[] (ossim_int32 pix) const
 Gets a normalized value (between '0.0' and '1.0') from a pixel value. More...
 
virtual ossim_float64 normFromPix (ossim_int32 pix) const
 Gets a normalized value (between '0.0' and '1.0') from a pixel value. More...
 
virtual ossim_int32 pixFromNorm (ossim_float64 normPix) const
 Returns an pixel value as an int from a normalized value. More...
 
- Public Member Functions inherited from ossimNormalizedRemapTable
 ossimNormalizedRemapTable ()
 default constructor More...
 
virtual ~ossimNormalizedRemapTable ()
 virtual destructor More...
 
virtual ossim_float64 getNormalizer () const
 Get the value used to normalize and un-normalize table entries. More...
 

Static Protected Attributes

static ossim_float64 theTable [TABLE_ENTRIES]
 
static bool theTableIsInitialized = false
 

Detailed Description

Unsigned 16 bit normalized remap table to go to/from normalized value to pixel value.

Definition at line 27 of file ossimNormalizedU16RemapTable.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
TABLE_ENTRIES 

Definition at line 36 of file ossimNormalizedU16RemapTable.h.

Constructor & Destructor Documentation

◆ ossimNormalizedU16RemapTable()

ossimNormalizedU16RemapTable::ossimNormalizedU16RemapTable ( )

default constructor

Definition at line 20 of file ossimNormalizedU16RemapTable.cpp.

References getEntries(), ossimNormalizedRemapTable::getNormalizer(), theTable, and theTableIsInitialized.

22 {
24  {
25  const ossim_int32 ENTRIES = getEntries();
26  const ossim_float64 DENOMINATOR = getNormalizer();
27 
28  //---
29  // Initialize the remap table.
30  //---
31  theTable[0] = 0.0; // Index zero always for null.
32  for (ossim_int32 i = 1; i < ENTRIES; ++i)
33  {
34  theTable[i] = static_cast<ossim_float64>(i)/DENOMINATOR;
35  }
36 
37  theTableIsInitialized = true;
38  }
39 }
static ossim_float64 theTable[TABLE_ENTRIES]
virtual ossim_int32 getEntries() const
Gets the number of table entries.
double ossim_float64
ossimNormalizedRemapTable()
default constructor
virtual ossim_float64 getNormalizer() const
Get the value used to normalize and un-normalize table entries.
int ossim_int32

◆ ~ossimNormalizedU16RemapTable()

ossimNormalizedU16RemapTable::~ossimNormalizedU16RemapTable ( )
virtual

virtual destructor

Definition at line 41 of file ossimNormalizedU16RemapTable.cpp.

42 {}

Member Function Documentation

◆ getEntries()

ossim_int32 ossimNormalizedU16RemapTable::getEntries ( ) const
inlinevirtual

Gets the number of table entries.

Returns
The number of entries in a table.

Implements ossimNormalizedRemapTable.

Definition at line 77 of file ossimNormalizedU16RemapTable.h.

References TABLE_ENTRIES.

Referenced by ossimNormalizedU16RemapTable().

◆ normFromPix()

ossim_float64 ossimNormalizedU16RemapTable::normFromPix ( ossim_int32  pix) const
inlinevirtual

Gets a normalized value (between '0.0' and '1.0') from a pixel value.

Returns
Value between 0.0 and 1.0.

Implements ossimNormalizedRemapTable.

Definition at line 88 of file ossimNormalizedU16RemapTable.h.

References TABLE_ENTRIES, and theTable.

Referenced by ossimU16ImageData::convertToNormalizedDouble(), and ossimU16ImageData::getNormalizedFloat().

90 {
91  return ( (pix < TABLE_ENTRIES) ? (pix >= 0 ? theTable[pix] : 0.0) : 1.0);
92 }
static ossim_float64 theTable[TABLE_ENTRIES]

◆ operator[]()

ossim_float64 ossimNormalizedU16RemapTable::operator[] ( ossim_int32  pix) const
inlinevirtual

Gets a normalized value (between '0.0' and '1.0') from a pixel value.

Returns
Value between 0.0 and 1.0.

Implements ossimNormalizedRemapTable.

Definition at line 82 of file ossimNormalizedU16RemapTable.h.

References TABLE_ENTRIES, and theTable.

84 {
85  return ( (pix < TABLE_ENTRIES) ? (pix >= 0 ? theTable[pix] : 0.0) : 1.0);
86 }
static ossim_float64 theTable[TABLE_ENTRIES]

◆ pixFromNorm()

ossim_int32 ossimNormalizedU16RemapTable::pixFromNorm ( ossim_float64  normPix) const
inlinevirtual

Returns an pixel value as an int from a normalized value.

Returns
Value between scalar range of remap table.

Implements ossimNormalizedRemapTable.

Definition at line 94 of file ossimNormalizedU16RemapTable.h.

References ossimNormalizedRemapTable::getNormalizer().

Referenced by ossimU16ImageData::copyNormalizedBufferToTile(), and ossimU16ImageData::setNormalizedFloat().

96 {
97  if(normPix <= 0.0) return 0;
98 
99  // un-normalize...
100  ossim_float64 p = normPix * getNormalizer();
101 
102  // Ensure pixel is in range.
103  p = ( (p < TABLE_ENTRIES) ? (p >= 0.0 ? p : 0.0) : getNormalizer());
104 
105  // Since going from double to int round...
106  p = ossim::round<ossim_int32>(p);
107 
108  if(p == 0.0)
109  {
110  p = 1.0;
111  }
112 
113  return static_cast<ossim_int32>(p);
114 }
double ossim_float64
virtual ossim_float64 getNormalizer() const
Get the value used to normalize and un-normalize table entries.
int ossim_int32

Member Data Documentation

◆ theTable

ossim_float64 ossimNormalizedU16RemapTable::theTable
staticprotected

◆ theTableIsInitialized

bool ossimNormalizedU16RemapTable::theTableIsInitialized = false
staticprotected

Definition at line 73 of file ossimNormalizedU16RemapTable.h.

Referenced by ossimNormalizedU16RemapTable().


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