Isis 3 Programmer Reference
Pixel.h
Go to the documentation of this file.
1 #ifndef Pixel_h
2 #define Pixel_h
3 
24 #include "SpecialPixel.h"
25 
26 namespace Isis {
63  class Pixel {
64  public:
65  Pixel();
66  Pixel(int sample, int line, int band, double DN);
67  Pixel(const Pixel& pixel);
68  virtual ~Pixel();
69 
70 
71  Pixel &operator=(const Pixel& other);
72 
73  int line() const;
74  int sample() const;
75  int band() const;
76  double DN() const;
77 
78  static unsigned char To8Bit(const double d);
79  unsigned char To8Bit();
80  static short int To16Bit(const double d);
81  short int To16Bit();
82  static short unsigned int To16UBit(const double d);
83  short unsigned int To16Ubit();
84  static float To32Bit(const double d);
85  float To32Bit();
86 
87  static double ToDouble(const unsigned char t);
88  static double ToDouble(const short int t);
89  static double ToDouble(const short unsigned int t);
90  static double ToDouble(const float t);
91  double ToDouble();
92 
93  static float ToFloat(const unsigned char d);
94  static float ToFloat(const short int d);
95  static float ToFloat(const short unsigned int d);
96  static float ToFloat(const double d);
97  float ToFloat();
98 
99  static std::string ToString(double d);
100  std::string ToString();
101 
110  static inline bool IsSpecial(const double d) {
111  return(d < VALID_MIN8);
112  }
113 
120  bool IsSpecial() {
121  return IsSpecial(m_DN);
122  }
123 
133  static inline bool IsSpecial(const float f) {
134  return(f < VALID_MIN4);
135  }
136 
145  static inline bool IsValid(const double d) {
146  return(d >= VALID_MIN8);
147  }
148 
155  bool IsValid() {
156  return IsValid(m_DN);
157  }
158 
166  static inline bool IsNull(const double d) {
167  return(d == NULL8);
168  }
169 
175  bool IsNull() {
176  return IsNull(m_DN);
177  }
178 
186  static inline bool IsHigh(const double d) {
187  return(d == HIGH_REPR_SAT8) || (d == HIGH_INSTR_SAT8);
188  }
189 
195  bool IsHigh() {
196  return IsHigh(m_DN);
197  }
198 
206  static inline bool IsLow(const double d) {
207  return(d == LOW_REPR_SAT8) || (d == LOW_INSTR_SAT8);
208  }
209 
215  bool IsLow() {
216  return IsLow(m_DN);
217  }
218 
226  static inline bool IsHrs(const double d) {
227  return(d == HIGH_REPR_SAT8);
228  }
229 
235  bool IsHrs() {
236  return IsHrs(m_DN);
237  }
238 
246  static inline bool IsHis(const double d) {
247  return(d == HIGH_INSTR_SAT8);
248  }
249 
255  bool IsHis() {
256  return IsHis(m_DN);
257  }
258 
266  static inline bool IsLis(const double d) {
267  return(d == LOW_INSTR_SAT8);
268  }
269 
275  bool IsLis() {
276  return IsLis(m_DN);
277  }
278 
286  static inline bool IsLrs(const double d) {
287  return(d == LOW_REPR_SAT8);
288  }
289 
295  bool IsLrs() {
296  return IsLrs(m_DN);
297  }
298 
299  private:
301  int m_line;
302 
304  int m_sample;
305 
307  int m_band;
308 
310  double m_DN;
311 
312  }; // end of pixel class
313 }
314 #endif
float To32Bit()
Converts internal pixel value to float with special pixel translations.
Definition: Pixel.cpp:283
static bool IsValid(const double d)
Returns true if the input pixel is valid.
Definition: Pixel.h:145
virtual ~Pixel()
Default destructor.
Definition: Pixel.cpp:92
bool IsValid()
Returns true if the input pixel is valid.
Definition: Pixel.h:155
static bool IsNull(const double d)
Returns true if the input pixel is null.
Definition: Pixel.h:166
static bool IsHigh(const double d)
Returns true if the input pixel is one of the high saturation types.
Definition: Pixel.h:186
bool IsHis()
Returns true if the input pixel is high instrument saturation.
Definition: Pixel.h:255
int m_band
band coordinate of pixel
Definition: Pixel.h:307
short int To16Bit()
Converts internal pixel value to a short int pixel with special pixel translations.
Definition: Pixel.cpp:205
bool IsLrs()
Returns true if the input pixel is low representation saturation.
Definition: Pixel.h:295
short unsigned int To16Ubit()
Converts internal pixel value to a short int pixel with special pixel translations.
Definition: Pixel.cpp:253
static bool IsHis(const double d)
Returns true if the input pixel is high instrument saturation.
Definition: Pixel.h:246
double ToDouble()
Converts stored pixel value to a double.
Definition: Pixel.cpp:375
bool IsNull()
Returns true if the input pixel is null.
Definition: Pixel.h:175
int m_sample
sample coordinate of pixel
Definition: Pixel.h:304
static bool IsLow(const double d)
Returns true if the input pixel is one of the low saturation types.
Definition: Pixel.h:206
static bool IsHrs(const double d)
Returns true if the input pixel is high representation saturation.
Definition: Pixel.h:226
unsigned char To8Bit()
Converts internal pixel value to an unsigned char pixel with special pixel translations.
Definition: Pixel.cpp:156
int sample() const
Definition: Pixel.cpp:102
bool IsHigh()
Returns true if the input pixel is one of the high saturation types.
Definition: Pixel.h:195
static bool IsSpecial(const float f)
Returns true if the input pixel is special.
Definition: Pixel.h:133
static bool IsSpecial(const double d)
Returns true if the input pixel is special.
Definition: Pixel.h:110
static bool IsLis(const double d)
Returns true if the input pixel is low instrument saturation.
Definition: Pixel.h:266
bool IsHrs()
Returns true if the input pixel is high representation saturation.
Definition: Pixel.h:235
bool IsSpecial()
Returns true if the input pixel is special.
Definition: Pixel.h:120
double m_DN
DN of pixel.
Definition: Pixel.h:310
Store and/or manipulate pixel values.
Definition: Pixel.h:63
int band() const
Definition: Pixel.cpp:108
bool IsLow()
Returns true if the input pixel is one of the low saturation types.
Definition: Pixel.h:215
static bool IsLrs(const double d)
Returns true if the input pixel is low representation saturation.
Definition: Pixel.h:286
int line() const
Definition: Pixel.cpp:96
double DN() const
Definition: Pixel.cpp:114
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
static short unsigned int To16UBit(const double d)
Converts double pixels to short unsigned int pixels with special pixel translations.
Definition: Pixel.cpp:216
int m_line
line coordinate of pixel
Definition: Pixel.h:301
Pixel()
Constructs an empty Pixel.
Definition: Pixel.cpp:34
bool IsLis()
Returns true if the input pixel is low instrument saturation.
Definition: Pixel.h:275
Pixel & operator=(const Pixel &other)
Copy assignment operator.
Definition: Pixel.cpp:82
float ToFloat()
Converts internal pixel value to float with pixel translations and care for overflows (underflows are...
Definition: Pixel.cpp:473
std::string ToString()
Returns the name of the pixel type as a string.
Definition: Pixel.cpp:504