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

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

#include <ossimNormalizedU13RemapTable.h>

Inheritance diagram for ossimNormalizedU13RemapTable:
ossimNormalizedRemapTable

Public Types

enum  { TABLE_ENTRIES = 8192 }
 

Public Member Functions

 ossimNormalizedU13RemapTable ()
 default constructor More...
 
virtual ~ossimNormalizedU13RemapTable ()
 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 Private Attributes

static ossim_float64 theTable [TABLE_ENTRIES]
 
static bool theTableIsInitialized = false
 

Detailed Description

Thirteen bit normalized remap table to go to/from normalized value to pixel value.

Definition at line 27 of file ossimNormalizedU13RemapTable.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
TABLE_ENTRIES 

Definition at line 37 of file ossimNormalizedU13RemapTable.h.

Constructor & Destructor Documentation

◆ ossimNormalizedU13RemapTable()

ossimNormalizedU13RemapTable::ossimNormalizedU13RemapTable ( )

default constructor

Definition at line 19 of file ossimNormalizedU13RemapTable.cpp.

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

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

◆ ~ossimNormalizedU13RemapTable()

ossimNormalizedU13RemapTable::~ossimNormalizedU13RemapTable ( )
virtual

virtual destructor

Definition at line 40 of file ossimNormalizedU13RemapTable.cpp.

41 {}

Member Function Documentation

◆ getEntries()

ossim_int32 ossimNormalizedU13RemapTable::getEntries ( ) const
inlinevirtual

Gets the number of table entries.

Returns
The number of entries in a table.

Implements ossimNormalizedRemapTable.

Definition at line 78 of file ossimNormalizedU13RemapTable.h.

References TABLE_ENTRIES.

Referenced by ossimNormalizedU13RemapTable().

◆ normFromPix()

ossim_float64 ossimNormalizedU13RemapTable::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 89 of file ossimNormalizedU13RemapTable.h.

References TABLE_ENTRIES, and theTable.

Referenced by ossimU13ImageData::convertToNormalizedDouble(), ossimU13ImageData::copyTileToNormalizedBuffer(), and ossimU13ImageData::getNormalizedFloat().

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

◆ operator[]()

ossim_float64 ossimNormalizedU13RemapTable::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 83 of file ossimNormalizedU13RemapTable.h.

References TABLE_ENTRIES, and theTable.

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

◆ pixFromNorm()

ossim_int32 ossimNormalizedU13RemapTable::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 95 of file ossimNormalizedU13RemapTable.h.

References ossimNormalizedRemapTable::getNormalizer().

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

97 {
98  if(normPix <= 0.0) return 0;
99 
100  // un-normalize...
101  ossim_float64 p = normPix * getNormalizer();
102 
103  // Ensure pixel is in range.
104  p = ( (p < TABLE_ENTRIES) ? (p >= 0.0 ? p : 0.0) : getNormalizer());
105 
106  // Since going from double to int round...
107  p = ossim::round<ossim_int32>(p);
108 
109  if(p == 0.0)
110  {
111  p = 1.0;
112  }
113 
114  return static_cast<ossim_int32>(p);
115 }
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 ossimNormalizedU13RemapTable::theTable
staticprivate

◆ theTableIsInitialized

bool ossimNormalizedU13RemapTable::theTableIsInitialized = false
staticprivate

Definition at line 74 of file ossimNormalizedU13RemapTable.h.

Referenced by ossimNormalizedU13RemapTable().


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