113 if(d == NULL8)
return NULL1;
114 else if(d == LOW_INSTR_SAT8)
return LOW_INSTR_SAT1;
115 else if(d == LOW_REPR_SAT8)
return LOW_REPR_SAT1;
116 else if(d == HIGH_INSTR_SAT8)
return HIGH_INSTR_SAT1;
117 else if(d == HIGH_REPR_SAT8)
return HIGH_REPR_SAT1;
118 else return LOW_REPR_SAT1;
121 if(d < VALID_MIN1 - 0.5)
return LOW_REPR_SAT1;
122 else if(d > VALID_MAX1 + 0.5)
return HIGH_REPR_SAT1;
125 int itemp = (int)(d + 0.5);
126 if(itemp < VALID_MIN1)
return LOW_REPR_SAT1;
127 else if(itemp > VALID_MAX1)
return HIGH_REPR_SAT1;
128 else return (
unsigned char)(d + 0.5);
154 if(d == NULL8)
return NULL2;
155 else if(d == LOW_INSTR_SAT8)
return LOW_INSTR_SAT2;
156 else if(d == LOW_REPR_SAT8)
return LOW_REPR_SAT2;
157 else if(d == HIGH_INSTR_SAT8)
return HIGH_INSTR_SAT2;
158 else if(d == HIGH_REPR_SAT8)
return HIGH_REPR_SAT2;
159 else return LOW_REPR_SAT2;
162 if(d < VALID_MIN2 - 0.5)
return LOW_REPR_SAT2;
163 else if(d > VALID_MAX2 + 0.5)
return HIGH_REPR_SAT2;
168 itemp = (int)(d - 0.5);
171 itemp = (int)(d + 0.5);
174 if(itemp < VALID_MIN2)
return LOW_REPR_SAT2;
175 else if(itemp > VALID_MAX2)
return HIGH_REPR_SAT2;
176 else if(d < 0.0)
return (
short)(d - 0.5);
177 else return (
short)(d + 0.5);
202 if(d == NULL8)
return NULLU2;
203 else if(d == LOW_INSTR_SAT8)
return LOW_INSTR_SATU2;
204 else if(d == LOW_REPR_SAT8)
return LOW_REPR_SATU2;
205 else if(d == HIGH_INSTR_SAT8)
return HIGH_INSTR_SATU2;
206 else if(d == HIGH_REPR_SAT8)
return HIGH_REPR_SATU2;
207 else return LOW_REPR_SATU2;
210 if(d < VALID_MIN2 - 0.5)
return LOW_REPR_SATU2;
211 else if(d > VALID_MAX2 + 0.5)
return HIGH_REPR_SATU2;
216 itemp = (int)(d - 0.5);
219 itemp = (int)(d + 0.5);
222 if(itemp < VALID_MIN2)
return LOW_REPR_SATU2;
223 else if(itemp > VALID_MAX2)
return HIGH_REPR_SATU2;
224 else if(d < 0.0)
return (
short)(d - 0.5);
225 else return (
short)(d + 0.5);
249 if(d < (
double) VALID_MIN8) {
250 if(d == NULL8)
return(NULL4);
251 else if(d == LOW_REPR_SAT8)
return(LOW_REPR_SAT4);
252 else if(d == LOW_INSTR_SAT8)
return(LOW_INSTR_SAT4);
253 else if(d == HIGH_INSTR_SAT8)
return(HIGH_INSTR_SAT4);
254 else if(d == HIGH_REPR_SAT8)
return(HIGH_REPR_SAT4);
255 else return(LOW_REPR_SAT4);
257 else if(d > (
double) VALID_MAX8)
return(HIGH_REPR_SAT8);
258 else return((
float) d);
282 if(d == NULL1)
return(NULL8);
283 else if(d == LOW_REPR_SAT1)
return(LOW_REPR_SAT8);
284 else if(d == LOW_INSTR_SAT1)
return(LOW_INSTR_SAT8);
285 else if(d == HIGH_REPR_SAT1)
return(HIGH_REPR_SAT8);
286 else if(d == HIGH_INSTR_SAT1)
return(HIGH_INSTR_SAT8);
287 else return(LOW_REPR_SAT8);
289 else if(d > VALID_MAX1)
return(HIGH_REPR_SAT8);
290 else return((
double) d);
303 if(d == NULL2)
return(NULL8);
304 else if(d == LOW_REPR_SAT2)
return(LOW_REPR_SAT8);
305 else if(d == LOW_INSTR_SAT2)
return(LOW_INSTR_SAT8);
306 else if(d == HIGH_REPR_SAT2)
return(HIGH_REPR_SAT8);
307 else if(d == HIGH_INSTR_SAT2)
return(HIGH_INSTR_SAT8);
308 else return(LOW_REPR_SAT8);
310 else return((
double) d);
321 if(d < VALID_MINU2) {
322 if(d == NULLU2)
return(NULL8);
323 else if(d == LOW_REPR_SATU2)
return(LOW_REPR_SAT8);
324 else if(d == LOW_INSTR_SATU2)
return(LOW_INSTR_SAT8);
325 else if(d == HIGH_REPR_SATU2)
return(HIGH_REPR_SAT8);
326 else if(d == HIGH_INSTR_SATU2)
return(HIGH_INSTR_SAT8);
327 else return(LOW_REPR_SAT8);
329 else return((
double) d);
342 if(d == NULL4)
return(NULL8);
343 else if(d == LOW_REPR_SAT4)
return(LOW_REPR_SAT8);
344 else if(d == LOW_INSTR_SAT4)
return(LOW_INSTR_SAT8);
345 else if(d == HIGH_REPR_SAT4)
return(HIGH_REPR_SAT8);
346 else if(d == HIGH_INSTR_SAT4)
return(HIGH_INSTR_SAT8);
347 else return(LOW_REPR_SAT8);
349 else if(d > VALID_MAX4)
return(HIGH_REPR_SAT8);
350 else return((
double) d);
375 if(t < (
double) VALID_MIN1) {
376 if(t == NULL1)
return(NULL4);
377 else if(t == LOW_REPR_SAT1)
return(LOW_REPR_SAT4);
378 else if(t == LOW_INSTR_SAT1)
return(LOW_INSTR_SAT4);
379 else if(t == HIGH_INSTR_SAT1)
return(HIGH_INSTR_SAT4);
380 else if(t == HIGH_REPR_SAT1)
return(HIGH_REPR_SAT4);
381 else return(LOW_REPR_SAT4);
383 else if(t > (
double) VALID_MAX1)
return(HIGH_REPR_SAT8);
384 else return((
float) t);
396 if(t < (
double) VALID_MIN2) {
397 if(t == NULL2)
return(NULL4);
398 else if(t == LOW_REPR_SAT2)
return(LOW_REPR_SAT4);
399 else if(t == LOW_INSTR_SAT2)
return(LOW_INSTR_SAT4);
400 else if(t == HIGH_INSTR_SAT2)
return(HIGH_INSTR_SAT4);
401 else if(t == HIGH_REPR_SAT2)
return(HIGH_REPR_SAT4);
402 else return(LOW_REPR_SAT4);
404 else if(t > (
double) VALID_MAX2)
return(HIGH_REPR_SAT8);
405 else return((
float) t);
417 if(t < (
double) VALID_MINU2) {
418 if(t == NULLU2)
return(NULL4);
419 else if(t == LOW_REPR_SATU2)
return(LOW_REPR_SAT4);
420 else if(t == LOW_INSTR_SATU2)
return(LOW_INSTR_SAT4);
421 else if(t == HIGH_INSTR_SATU2)
return(HIGH_INSTR_SAT4);
422 else if(t == HIGH_REPR_SATU2)
return(HIGH_REPR_SAT4);
423 else return(LOW_REPR_SAT4);
425 else if(t > (
double) VALID_MAXU2)
return(HIGH_REPR_SAT8);
426 else return((
float) t);
438 if(t < (
double) VALID_MIN8) {
439 if(t == NULL8)
return(NULL4);
440 else if(t == LOW_REPR_SAT8)
return(LOW_REPR_SAT4);
441 else if(t == LOW_INSTR_SAT8)
return(LOW_INSTR_SAT4);
442 else if(t == HIGH_INSTR_SAT8)
return(HIGH_INSTR_SAT4);
443 else if(t == HIGH_REPR_SAT8)
return(HIGH_REPR_SAT4);
444 else return(LOW_REPR_SAT4);
446 else if(t > (
double) VALID_MAX8)
return(HIGH_REPR_SAT8);
447 else return((
float) t);
471 if(
IsNull(d))
return string(
"Null");
472 else if(
IsLrs(d))
return string(
"Lrs");
473 else if(
IsHrs(d))
return string(
"Hrs");
474 else if(
IsHis(d))
return string(
"His");
475 else if(
IsLis(d))
return string(
"Lis");
476 else return string(
"Invalid");
480 return result.setNum(d).toStdString();
Store and/or manipulate pixel values.
virtual ~Pixel()
Default destructor.
int m_sample
sample coordinate of pixel
short unsigned int To16Ubit()
Converts internal pixel value to a short int pixel with special pixel translations.
Pixel & operator=(const Pixel &other)
Copy assignment operator.
unsigned char To8Bit()
Converts internal pixel value to an unsigned char pixel with special pixel translations.
std::string ToString()
Returns the name of the pixel type as a string.
bool IsLis()
Returns true if the input pixel is low instrument saturation.
float To32Bit()
Converts internal pixel value to float with special pixel translations.
short int To16Bit()
Converts internal pixel value to a short int pixel with special pixel translations.
bool IsHis()
Returns true if the input pixel is high instrument saturation.
bool IsSpecial()
Returns true if the input pixel is special.
int m_band
band coordinate of pixel
Pixel()
Constructs an empty Pixel.
bool IsNull()
Returns true if the input pixel is null.
bool IsLrs()
Returns true if the input pixel is low representation saturation.
int m_line
line coordinate of pixel
double ToDouble()
Converts stored pixel value to a double.
bool IsHrs()
Returns true if the input pixel is high representation saturation.
static short unsigned int To16UBit(const double d)
Converts double pixels to short unsigned int pixels with special pixel translations.
float ToFloat()
Converts internal pixel value to float with pixel translations and care for overflows (underflows are...
This is free and unencumbered software released into the public domain.
const double Null
Value for an Isis Null pixel.
Namespace for the standard library.