Isis 3.0 Programmer Reference
Back | Home
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  Pixel &operator=(const Pixel& other);
71 
72  int line() const;
73  int sample() const;
74  int band() const;
75  double DN() const;
76 
77  static unsigned char To8Bit(const double d);
78  unsigned char To8Bit();
79  static short int To16Bit(const double d);
80  short int To16Bit();
81  static short unsigned int To16UBit(const double d);
82  short unsigned int To16Ubit();
83  static float To32Bit(const double d);
84  float To32Bit();
85 
86  static double ToDouble(const unsigned char t);
87  static double ToDouble(const short int t);
88  static double ToDouble(const short unsigned int t);
89  static double ToDouble(const float t);
90  double ToDouble();
91 
92  static float ToFloat(const unsigned char d);
93  static float ToFloat(const short int d);
94  static float ToFloat(const short unsigned int d);
95  static float ToFloat(const double d);
96  float ToFloat();
97 
98  static std::string ToString(double d);
99  std::string ToString();
100 
109  static inline bool IsSpecial(const double d) {
110  return(d < VALID_MIN8);
111  }
112 
119  bool IsSpecial() {
120  return IsSpecial(m_DN);
121  }
122 
132  static inline bool IsSpecial(const float f) {
133  return(f < VALID_MIN4);
134  }
135 
144  static inline bool IsValid(const double d) {
145  return(d >= VALID_MIN8);
146  }
147 
154  bool IsValid() {
155  return IsValid(m_DN);
156  }
157 
165  static inline bool IsNull(const double d) {
166  return(d == NULL8);
167  }
168 
174  bool IsNull() {
175  return IsNull(m_DN);
176  }
177 
185  static inline bool IsHigh(const double d) {
186  return(d == HIGH_REPR_SAT8) || (d == HIGH_INSTR_SAT8);
187  }
188 
194  bool IsHigh() {
195  return IsHigh(m_DN);
196  }
197 
205  static inline bool IsLow(const double d) {
206  return(d == LOW_REPR_SAT8) || (d == LOW_INSTR_SAT8);
207  }
208 
216  bool IsLow() {
217  return IsLow(m_DN);
218  }
219 
227  static inline bool IsHrs(const double d) {
228  return(d == HIGH_REPR_SAT8);
229  }
230 
236  bool IsHrs() {
237  return IsHrs(m_DN);
238  }
239 
247  static inline bool IsHis(const double d) {
248  return(d == HIGH_INSTR_SAT8);
249  }
250 
256  bool IsHis() {
257  return IsHis(m_DN);
258  }
259 
267  static inline bool IsLis(const double d) {
268  return(d == LOW_INSTR_SAT8);
269  }
270 
276  bool IsLis() {
277  return IsLis(m_DN);
278  }
279 
287  static inline bool IsLrs(const double d) {
288  return(d == LOW_REPR_SAT8);
289  }
290 
296  bool IsLrs() {
297  return IsLrs(m_DN);
298  }
299 
300  private:
302  int m_line;
303 
305  int m_sample;
306 
308  int m_band;
309 
311  double m_DN;
312 
313  }; // end of pixel class
314 }
315 #endif
float To32Bit()
Converts internal pixel value to float with special pixel translations.
Definition: Pixel.cpp:277
static bool IsValid(const double d)
Returns true if the input pixel is valid.
Definition: Pixel.h:144
virtual ~Pixel()
Default destructor.
Definition: Pixel.cpp:86
bool IsValid()
Returns true if the input pixel is valid.
Definition: Pixel.h:154
static bool IsNull(const double d)
Returns true if the input pixel is null.
Definition: Pixel.h:165
static bool IsHigh(const double d)
Returns true if the input pixel is one of the high saturation types.
Definition: Pixel.h:185
bool IsHis()
Returns true if the input pixel is high instrument saturation.
Definition: Pixel.h:256
int m_band
band coordinate of pixel
Definition: Pixel.h:308
short int To16Bit()
Converts internal pixel value to a short int pixel with special pixel translations.
Definition: Pixel.cpp:199
bool IsLrs()
Returns true if the input pixel is low representation saturation.
Definition: Pixel.h:296
short unsigned int To16Ubit()
Converts internal pixel value to a short int pixel with special pixel translations.
Definition: Pixel.cpp:247
static bool IsHis(const double d)
Returns true if the input pixel is high instrument saturation.
Definition: Pixel.h:247
double ToDouble()
Converts stored pixel value to a double.
Definition: Pixel.cpp:369
bool IsNull()
Returns true if the input pixel is null.
Definition: Pixel.h:174
int m_sample
sample coordinate of pixel
Definition: Pixel.h:305
static bool IsLow(const double d)
Returns true if the input pixel is one of the low saturation types.
Definition: Pixel.h:205
static bool IsHrs(const double d)
Returns true if the input pixel is high representation saturation.
Definition: Pixel.h:227
unsigned char To8Bit()
Converts internal pixel value to an unsigned char pixel with special pixel translations.
Definition: Pixel.cpp:150
bool IsHigh()
Returns true if the input pixel is one of the high saturation types.
Definition: Pixel.h:194
static bool IsSpecial(const float f)
Returns true if the input pixel is special.
Definition: Pixel.h:132
static bool IsSpecial(const double d)
Returns true if the input pixel is special.
Definition: Pixel.h:109
static bool IsLis(const double d)
Returns true if the input pixel is low instrument saturation.
Definition: Pixel.h:267
bool IsHrs()
Returns true if the input pixel is high representation saturation.
Definition: Pixel.h:236
int band() const
Returns the band coordinate of the Pixel.
Definition: Pixel.cpp:102
double DN() const
Returns the DN of the Pixel.
Definition: Pixel.cpp:108
bool IsSpecial()
Returns true if the input pixel is special.
Definition: Pixel.h:119
int line() const
Returns the line coordinate of the Pixel.
Definition: Pixel.cpp:90
double m_DN
DN of pixel.
Definition: Pixel.h:311
Store and/or manipulate pixel values.
Definition: Pixel.h:63
bool IsLow()
Returns true if the input pixel is one of the low saturation types.
Definition: Pixel.h:216
static bool IsLrs(const double d)
Returns true if the input pixel is low representation saturation.
Definition: Pixel.h:287
static short unsigned int To16UBit(const double d)
Converts double pixels to short unsigned int pixels with special pixel translations.
Definition: Pixel.cpp:210
int m_line
line coordinate of pixel
Definition: Pixel.h:302
Pixel()
Constructs an empty Pixel.
Definition: Pixel.cpp:34
bool IsLis()
Returns true if the input pixel is low instrument saturation.
Definition: Pixel.h:276
Pixel & operator=(const Pixel &other)
Copy assignment operator.
Definition: Pixel.cpp:76
int sample() const
Returns the sample coordinate of the Pixel.
Definition: Pixel.cpp:96
float ToFloat()
Converts internal pixel value to float with pixel translations and care for overflows (underflows are...
Definition: Pixel.cpp:467
std::string ToString()
Returns the name of the pixel type as a string.
Definition: Pixel.cpp:498

U.S. Department of the Interior | U.S. Geological Survey
ISIS | Privacy & Disclaimers | Astrogeology Research Program
To contact us, please post comments and questions on the ISIS Support Center
File Modified: 07/12/2023 23:25:26