Isis Developer Reference
Pixel.h
Go to the documentation of this file.
1 #ifndef Pixel_h
2 #define Pixel_h
3 
8 /* SPDX-License-Identifier: CC0-1.0 */
9 #include "SpecialPixel.h"
10 
11 namespace Isis {
48  class Pixel {
49  public:
50  Pixel();
51  Pixel(int sample, int line, int band, double DN);
52  Pixel(const Pixel& pixel);
53  virtual ~Pixel();
54 
55 
56  Pixel &operator=(const Pixel& other);
57 
58  int line() const;
59  int sample() const;
60  int band() const;
61  double DN() const;
62 
63  static unsigned char To8Bit(const double d);
64  unsigned char To8Bit();
65  static short int To16Bit(const double d);
66  short int To16Bit();
67  static short unsigned int To16UBit(const double d);
68  short unsigned int To16Ubit();
69  static float To32Bit(const double d);
70  float To32Bit();
71 
72  static double ToDouble(const unsigned char t);
73  static double ToDouble(const short int t);
74  static double ToDouble(const short unsigned int t);
75  static double ToDouble(const float t);
76  double ToDouble();
77 
78  static float ToFloat(const unsigned char d);
79  static float ToFloat(const short int d);
80  static float ToFloat(const short unsigned int d);
81  static float ToFloat(const double d);
82  float ToFloat();
83 
84  static std::string ToString(double d);
85  std::string ToString();
86 
95  static inline bool IsSpecial(const double d) {
96  return(d < VALID_MIN8);
97  }
98 
105  bool IsSpecial() {
106  return IsSpecial(m_DN);
107  }
108 
118  static inline bool IsSpecial(const float f) {
119  return(f < VALID_MIN4);
120  }
121 
130  static inline bool IsValid(const double d) {
131  return(d >= VALID_MIN8);
132  }
133 
140  bool IsValid() {
141  return IsValid(m_DN);
142  }
143 
151  static inline bool IsNull(const double d) {
152  return(d == NULL8);
153  }
154 
160  bool IsNull() {
161  return IsNull(m_DN);
162  }
163 
171  static inline bool IsHigh(const double d) {
172  return(d == HIGH_REPR_SAT8) || (d == HIGH_INSTR_SAT8);
173  }
174 
180  bool IsHigh() {
181  return IsHigh(m_DN);
182  }
183 
191  static inline bool IsLow(const double d) {
192  return(d == LOW_REPR_SAT8) || (d == LOW_INSTR_SAT8);
193  }
194 
200  bool IsLow() {
201  return IsLow(m_DN);
202  }
203 
211  static inline bool IsHrs(const double d) {
212  return(d == HIGH_REPR_SAT8);
213  }
214 
220  bool IsHrs() {
221  return IsHrs(m_DN);
222  }
223 
231  static inline bool IsHis(const double d) {
232  return(d == HIGH_INSTR_SAT8);
233  }
234 
240  bool IsHis() {
241  return IsHis(m_DN);
242  }
243 
251  static inline bool IsLis(const double d) {
252  return(d == LOW_INSTR_SAT8);
253  }
254 
260  bool IsLis() {
261  return IsLis(m_DN);
262  }
263 
271  static inline bool IsLrs(const double d) {
272  return(d == LOW_REPR_SAT8);
273  }
274 
280  bool IsLrs() {
281  return IsLrs(m_DN);
282  }
283 
284  private:
286  int m_line;
287 
289  int m_sample;
290 
292  int m_band;
293 
295  double m_DN;
296 
297  }; // end of pixel class
298 }
299 #endif
Isis::LOW_INSTR_SAT2
const short LOW_INSTR_SAT2
Definition: SpecialPixel.h:156
Isis::Pixel::IsLrs
bool IsLrs()
Returns true if the input pixel is low representation saturation.
Definition: Pixel.h:280
Isis::VALID_MAX4
const float VALID_MAX4
Definition: SpecialPixel.h:149
Isis::ToString
QString ToString(const T &value)
Helper function to convert values to strings.
Definition: HiCalUtil.h:246
Isis::Pixel::To16UBit
static short unsigned int To16UBit(const double d)
Converts double pixels to short unsigned int pixels with special pixel translations.
Definition: Pixel.cpp:200
Isis::VALID_MAX8
const double VALID_MAX8
Definition: SpecialPixel.h:121
Isis::Pixel::ToDouble
double ToDouble()
Converts stored pixel value to a double.
Definition: Pixel.cpp:359
Isis::Pixel::Pixel
Pixel()
Constructs an empty Pixel.
Definition: Pixel.cpp:18
Isis::LOW_INSTR_SATU2
const unsigned short LOW_INSTR_SATU2
Definition: SpecialPixel.h:165
Isis::HIGH_REPR_SATU2
const unsigned short HIGH_REPR_SATU2
Definition: SpecialPixel.h:167
Isis::LOW_REPR_SAT4
const float LOW_REPR_SAT4
Definition: SpecialPixel.h:137
SpecialPixel.h
Isis::LOW_INSTR_SAT4
const float LOW_INSTR_SAT4
Definition: SpecialPixel.h:140
Isis::Pixel::operator=
Pixel & operator=(const Pixel &other)
Copy assignment operator.
Definition: Pixel.cpp:66
Isis::VALID_MIN1
const unsigned char VALID_MIN1
Definition: SpecialPixel.h:181
Isis::Pixel::IsLis
bool IsLis()
Returns true if the input pixel is low instrument saturation.
Definition: Pixel.h:260
Isis::Pixel::IsHis
static bool IsHis(const double d)
Returns true if the input pixel is high instrument saturation.
Definition: Pixel.h:231
Isis::NULL1
const unsigned char NULL1
Definition: SpecialPixel.h:182
Isis::Pixel::~Pixel
virtual ~Pixel()
Default destructor.
Definition: Pixel.cpp:76
Isis::Pixel::IsHrs
static bool IsHrs(const double d)
Returns true if the input pixel is high representation saturation.
Definition: Pixel.h:211
Isis::LOW_INSTR_SAT1
const unsigned char LOW_INSTR_SAT1
Definition: SpecialPixel.h:184
Isis::LOW_REPR_SATU2
const unsigned short LOW_REPR_SATU2
Definition: SpecialPixel.h:164
Isis::Pixel::IsLis
static bool IsLis(const double d)
Returns true if the input pixel is low instrument saturation.
Definition: Pixel.h:251
Isis::HIGH_REPR_SAT8
const double HIGH_REPR_SAT8
Definition: SpecialPixel.h:116
Isis::Pixel::IsSpecial
static bool IsSpecial(const double d)
Returns true if the input pixel is special.
Definition: Pixel.h:95
Isis::IsSpecial
bool IsSpecial(const double d)
Returns if the input pixel is special.
Definition: SpecialPixel.h:197
Isis::Pixel::ToFloat
float ToFloat()
Converts internal pixel value to float with pixel translations and care for overflows (underflows are...
Definition: Pixel.cpp:457
Isis::Pixel::IsSpecial
static bool IsSpecial(const float f)
Returns true if the input pixel is special.
Definition: Pixel.h:118
Isis::VALID_MAX2
const short VALID_MAX2
Definition: SpecialPixel.h:159
Isis::LOW_REPR_SAT1
const unsigned char LOW_REPR_SAT1
Definition: SpecialPixel.h:183
Isis::VALID_MIN2
const short VALID_MIN2
Definition: SpecialPixel.h:153
Isis::Pixel::To16Ubit
short unsigned int To16Ubit()
Converts internal pixel value to a short int pixel with special pixel translations.
Definition: Pixel.cpp:237
Isis::Pixel::IsSpecial
bool IsSpecial()
Returns true if the input pixel is special.
Definition: Pixel.h:105
Isis::HIGH_REPR_SAT4
const float HIGH_REPR_SAT4
Definition: SpecialPixel.h:146
Isis::VALID_MIN8
const double VALID_MIN8
Definition: SpecialPixel.h:86
Isis::HIGH_INSTR_SAT1
const unsigned char HIGH_INSTR_SAT1
Definition: SpecialPixel.h:185
Isis::Pixel::band
int band() const
Definition: Pixel.cpp:92
Isis::Pixel::IsHigh
static bool IsHigh(const double d)
Returns true if the input pixel is one of the high saturation types.
Definition: Pixel.h:171
Isis::HIGH_REPR_SAT2
const short HIGH_REPR_SAT2
Definition: SpecialPixel.h:158
Isis::NULL8
const double NULL8
Definition: SpecialPixel.h:94
Isis::Pixel::IsLow
static bool IsLow(const double d)
Returns true if the input pixel is one of the low saturation types.
Definition: Pixel.h:191
Isis::HIGH_INSTR_SAT2
const short HIGH_INSTR_SAT2
Definition: SpecialPixel.h:157
Isis::Pixel::IsLow
bool IsLow()
Returns true if the input pixel is one of the low saturation types.
Definition: Pixel.h:200
Isis::Pixel::ToString
std::string ToString()
Returns the name of the pixel type as a string.
Definition: Pixel.cpp:488
Isis::HIGH_INSTR_SAT8
const double HIGH_INSTR_SAT8
Definition: SpecialPixel.h:110
Isis::Pixel::To8Bit
unsigned char To8Bit()
Converts internal pixel value to an unsigned char pixel with special pixel translations.
Definition: Pixel.cpp:140
Isis::HIGH_INSTR_SAT4
const float HIGH_INSTR_SAT4
Definition: SpecialPixel.h:143
Isis::NULL2
const short NULL2
Definition: SpecialPixel.h:154
Isis::NULLU2
const unsigned short NULLU2
Definition: SpecialPixel.h:163
Isis::Null
const double Null
Value for an Isis Null pixel.
Definition: SpecialPixel.h:95
Isis::VALID_MAXU2
const unsigned short VALID_MAXU2
Definition: SpecialPixel.h:168
Isis::Pixel::To32Bit
float To32Bit()
Converts internal pixel value to float with special pixel translations.
Definition: Pixel.cpp:267
Isis::Pixel::line
int line() const
Definition: Pixel.cpp:80
Isis::ToDouble
double ToDouble(const T &value)
Helper function to convert values to doubles.
Definition: HiCalUtil.h:234
Pixel.h
Isis::Pixel::DN
double DN() const
Definition: Pixel.cpp:98
std
Namespace for the standard library.
Isis::NULL4
const float NULL4
Definition: SpecialPixel.h:134
Isis::Pixel
Store and/or manipulate pixel values.
Definition: Pixel.h:48
Isis::Pixel::IsNull
static bool IsNull(const double d)
Returns true if the input pixel is null.
Definition: Pixel.h:151
Isis::Pixel::sample
int sample() const
Definition: Pixel.cpp:86
Isis::VALID_MIN4
const float VALID_MIN4
Definition: SpecialPixel.h:130
Isis::Pixel::IsLrs
static bool IsLrs(const double d)
Returns true if the input pixel is low representation saturation.
Definition: Pixel.h:271
Isis::HIGH_INSTR_SATU2
const unsigned short HIGH_INSTR_SATU2
Definition: SpecialPixel.h:166
Isis::VALID_MINU2
const unsigned short VALID_MINU2
Definition: SpecialPixel.h:162
Isis::VALID_MAX1
const unsigned char VALID_MAX1
Definition: SpecialPixel.h:187
Isis::Pixel::To16Bit
short int To16Bit()
Converts internal pixel value to a short int pixel with special pixel translations.
Definition: Pixel.cpp:189
Isis::LOW_REPR_SAT8
const double LOW_REPR_SAT8
Definition: SpecialPixel.h:98
Isis::HIGH_REPR_SAT1
const unsigned char HIGH_REPR_SAT1
Definition: SpecialPixel.h:186
Isis::Pixel::IsValid
bool IsValid()
Returns true if the input pixel is valid.
Definition: Pixel.h:140
Isis::Pixel::IsHis
bool IsHis()
Returns true if the input pixel is high instrument saturation.
Definition: Pixel.h:240
Isis::LOW_INSTR_SAT8
const double LOW_INSTR_SAT8
Definition: SpecialPixel.h:104
Isis::LOW_REPR_SAT2
const short LOW_REPR_SAT2
Definition: SpecialPixel.h:155
Isis::Pixel::IsNull
bool IsNull()
Returns true if the input pixel is null.
Definition: Pixel.h:160
Isis::Pixel::IsValid
static bool IsValid(const double d)
Returns true if the input pixel is valid.
Definition: Pixel.h:130
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16
Isis::Pixel::IsHigh
bool IsHigh()
Returns true if the input pixel is one of the high saturation types.
Definition: Pixel.h:180
Isis::Pixel::IsHrs
bool IsHrs()
Returns true if the input pixel is high representation saturation.
Definition: Pixel.h:220