OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimNormalizedU11RemapTable.h
Go to the documentation of this file.
1 //*******************************************************************
2 //
3 // License: MIT
4 //
5 // See LICENSE.txt file in the top level directory for more details.
6 //
7 // Description:
8 //
9 // Contains class declaration for ossimNormalizedU11RemapTable. Table for
10 // normalizing unsigned 11 bit data.
11 //
12 //*******************************************************************
13 // $Id: ossimNormalizedU11RemapTable.h 16034 2009-12-03 14:49:25Z dburken $
14 
15 #ifndef ossimNormalizedU11RemapTable_HEADER
16 #define ossimNormalizedU11RemapTable_HEADER
17 
19 #include <ossim/base/ossimCommon.h> /* for round */
20 
28 {
29 public:
30 
35 
36 
37  enum
38  {
39  TABLE_ENTRIES = 2048 // 2^11
40  };
41 
46  virtual ossim_int32 getEntries() const;
47 
54  virtual ossim_float64 operator[](ossim_int32 pix) const;
55 
62  virtual ossim_float64 normFromPix(ossim_int32 pix) const;
63 
69  virtual ossim_int32 pixFromNorm(ossim_float64 normPix) const;
70 
71 private:
72 
73  static ossim_float64 theTable[TABLE_ENTRIES];
74  static bool theTableIsInitialized;
75 
76 };
77 
79 {
80  return TABLE_ENTRIES;
81 }
82 
84  ossim_int32 pix) const
85 {
86  return ( (pix < TABLE_ENTRIES) ? (pix >= 0 ? theTable[pix] : 0.0) : 1.0);
87 }
88 
90  ossim_int32 pix) const
91 {
92  return ( (pix < TABLE_ENTRIES) ? (pix >= 0 ? theTable[pix] : 0.0) : 1.0);
93 }
94 
96  ossim_float64 normPix) const
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 }
116 
117 #endif
virtual ossim_float64 normFromPix(ossim_int32 pix) const =0
Gets a normalized value (between &#39;0.0&#39; and &#39;1.0&#39;) from a pixel value.
virtual ossim_int32 pixFromNorm(ossim_float64 normPix) const
Returns an pixel value as an int from a normalized value.
double ossim_float64
virtual ossim_float64 normFromPix(ossim_int32 pix) const
Gets a normalized value (between &#39;0.0&#39; and &#39;1.0&#39;) from a pixel value.
virtual ossim_int32 getEntries() const
Gets the number of table entries.
Eleven bit normalized remap table to go to/from normalized value to pixel value.
virtual ossim_int32 getEntries() const =0
Pure virtual method to get the number of table entries.
virtual ossim_float64 operator[](ossim_int32 pix) const
Gets a normalized value (between &#39;0.0&#39; and &#39;1.0&#39;) from a pixel value.
virtual ossim_int32 pixFromNorm(ossim_float64 normPix) const =0
Returns an pixel value as an int from a normalized value.
static ossim_float64 theTable[TABLE_ENTRIES]
Base class implemetation of normalized remap tables to go to/from normalized value to pixel value...
#define OSSIM_DLL
virtual ossim_float64 getNormalizer() const
Get the value used to normalize and un-normalize table entries.
virtual ossim_float64 operator[](ossim_int32 pix) const =0
Gets a normalized value (between &#39;0.0&#39; and &#39;1.0&#39;) from a pixel value.
int ossim_int32