|
Isis 3 Programmer Reference
|
13 #include <QStringList>
15 #include "IException.h"
77 #if ISIS_LITTLE_ENDIAN
78 # define DBL_INIT(a,b) {(b), (a)}
80 # define DBL_INIT(a,b) {(a), (b)}
85 const DBL_UNION IVALID_MIN8 = { DBL_INIT(0xFFEFFFFF, 0xFFFFFFFA) };
86 const double VALID_MIN8 = IVALID_MIN8.d;
93 const DBL_UNION INULL8 = { DBL_INIT(0xFFEFFFFF, 0xFFFFFFFB) };
94 const double NULL8 = INULL8.d;
95 const double Null = INULL8.d;
97 const DBL_UNION ILOW_REPR_SAT8 = { DBL_INIT(0xFFEFFFFF, 0xFFFFFFFC) };
98 const double LOW_REPR_SAT8 = ILOW_REPR_SAT8.d;
99 const double Lrs = ILOW_REPR_SAT8.d;
103 const DBL_UNION ILOW_INSTR_SAT8 = { DBL_INIT(0xFFEFFFFF, 0xFFFFFFFD) };
104 const double LOW_INSTR_SAT8 = ILOW_INSTR_SAT8.d;
105 const double Lis = ILOW_INSTR_SAT8.d;
109 const DBL_UNION IHIGH_INSTR_SAT8 = { DBL_INIT(0xFFEFFFFF, 0xFFFFFFFE) };
110 const double HIGH_INSTR_SAT8 = IHIGH_INSTR_SAT8.d;
111 const double His = IHIGH_INSTR_SAT8.d;
115 const DBL_UNION IHIGH_REPR_SAT8 = { DBL_INIT(0xFFEFFFFF, 0xFFFFFFFF) };
116 const double HIGH_REPR_SAT8 = IHIGH_REPR_SAT8.d;
117 const double Hrs = IHIGH_REPR_SAT8.d;
121 const double VALID_MAX8 = DBL_MAX;
129 const int IVALID_MIN4 = 0xFF7FFFFA;
130 const float VALID_MIN4 = (*((
const float *) &IVALID_MIN4));
133 const int INULL4 = 0xFF7FFFFB;
134 const float NULL4 = (*((
const float *) &INULL4));
136 const int ILOW_REPR_SAT4 = 0xFF7FFFFC;
137 const float LOW_REPR_SAT4 = (*((
const float *) &ILOW_REPR_SAT4));
139 const int ILOW_INSTR_SAT4 = 0xFF7FFFFD;
140 const float LOW_INSTR_SAT4 = (*((
const float *) &ILOW_INSTR_SAT4));
142 const int IHIGH_INSTR_SAT4 = 0xFF7FFFFE;
143 const float HIGH_INSTR_SAT4 = (*((
const float *) &IHIGH_INSTR_SAT4));
145 const int IHIGH_REPR_SAT4 = 0xFF7FFFFF;
146 const float HIGH_REPR_SAT4 = (*((
const float *) &IHIGH_REPR_SAT4));
149 const float VALID_MAX4 = FLT_MAX;
150 const int IVALID_MAX4 = (*((
const int *) &VALID_MAX4));
153 const short VALID_MIN2 = ((short)(-32752));
154 const short NULL2 = ((short)(-32768));
155 const short LOW_REPR_SAT2 = ((short)(-32767));
156 const short LOW_INSTR_SAT2 = ((short)(-32766));
157 const short HIGH_INSTR_SAT2 = ((short)(-32765));
158 const short HIGH_REPR_SAT2 = ((short)(-32764));
159 const short VALID_MAX2 = ((short) 32767);
162 const unsigned short VALID_MINU2 = ((
unsigned short) 3);
163 const unsigned short NULLU2 = ((
unsigned short) 0);
164 const unsigned short LOW_REPR_SATU2 = ((
unsigned short) 1);
165 const unsigned short LOW_INSTR_SATU2 = ((
unsigned short) 2);
166 const unsigned short HIGH_INSTR_SATU2 = ((
unsigned short) 65534);
167 const unsigned short HIGH_REPR_SATU2 = ((
unsigned short) 65535);
168 const unsigned short VALID_MAXU2 = ((
unsigned short) 65522);
171 const unsigned int VALID_MINUI4 = ((
unsigned int) 3);
172 const unsigned int NULLUI4 = ((
unsigned int) 0);
173 const unsigned int LOW_REPR_SATUI4 = ((
unsigned int) 1);
174 const unsigned int LOW_INSTR_SATUI4 = ((
unsigned int) 2);
175 const unsigned int HIGH_INSTR_SATUI4 = ((
unsigned int) 4294967294);
176 const unsigned int HIGH_REPR_SATUI4 = ((
unsigned int) 4294967295);
177 const unsigned int VALID_MAXUI4 = ((
unsigned int) 4294967282);
181 const unsigned char VALID_MIN1 = ((
unsigned char) 1);
182 const unsigned char NULL1 = ((
unsigned char) 0);
183 const unsigned char LOW_REPR_SAT1 = ((
unsigned char) 0);
184 const unsigned char LOW_INSTR_SAT1 = ((
unsigned char) 0);
185 const unsigned char HIGH_INSTR_SAT1 = ((
unsigned char) 255);
186 const unsigned char HIGH_REPR_SAT1 = ((
unsigned char) 255);
187 const unsigned char VALID_MAX1 = ((
unsigned char) 254);
198 return (d < VALID_MIN8);
212 return (f < VALID_MIN4);
224 return (d >= VALID_MIN8);
248 return (d == HIGH_REPR_SAT8) || (d == HIGH_INSTR_SAT8);
260 return (d == LOW_REPR_SAT8) || (d == LOW_INSTR_SAT8);
272 return (d == HIGH_REPR_SAT8);
284 return (d == HIGH_INSTR_SAT8);
296 return (d == LOW_INSTR_SAT8);
308 return (d == LOW_REPR_SAT8);
321 if(t == NULL4)
return (NULL8);
322 if(t == LOW_REPR_SAT4)
return (LOW_REPR_SAT8);
323 if(t == LOW_INSTR_SAT4)
return (LOW_INSTR_SAT8);
324 if(t == HIGH_REPR_SAT4)
return (HIGH_REPR_SAT8);
325 if(t == HIGH_INSTR_SAT4)
return (HIGH_INSTR_SAT8);
326 return (LOW_REPR_SAT8);
328 else if(t > VALID_MAX4) {
329 return (HIGH_REPR_SAT8);
346 if(t < (
double) VALID_MIN4) {
347 if(t == NULL8)
return (NULL4);
348 if(t == LOW_REPR_SAT8)
return (LOW_REPR_SAT4);
349 if(t == LOW_INSTR_SAT8)
return (LOW_INSTR_SAT4);
350 if(t == HIGH_INSTR_SAT8)
return (HIGH_INSTR_SAT4);
351 if(t == HIGH_REPR_SAT8)
return (HIGH_REPR_SAT4);
352 return (LOW_REPR_SAT4);
354 else if(t > (
double) VALID_MAX4) {
355 return (HIGH_REPR_SAT8);
382 return result.setNum(d,
'g', 8);
396 QString s = str.toUpper();
399 legal.push_back(
"NULL");
400 legal.push_back(
"HRS");
401 legal.push_back(
"LRS");
402 legal.push_back(
"HIS");
403 legal.push_back(
"LIS");
405 for(
int i = 0; i < (int) legal.size(); i++) {
406 if(legal[i].mid(0, s.size()) == s) {
411 QString msg =
"Input [" + str +
"] is not a unique abbreviation. Use " + s +
"I or " + s +
"R.";
419 QString msg =
"Input [" + str +
"] does not appear to be a legal special pixel abbreviation or double value.";
423 if(s[0] ==
'N')
return Null;
424 if(s.mid(0, 2) ==
"HR")
return Hrs;
425 if(s.mid(0, 2) ==
"LR")
return Lrs;
426 if(s.mid(0, 2) ==
"HI")
return His;
const double ValidMaximum
The maximum valid double value for Isis pixels.
QString PixelToString(double d)
Takes a double pixel value and returns the name of the pixel type as a string.
const double His
Value for an Isis High Instrument Saturation pixel.
bool IsNullPixel(const double d)
Returns if the input pixel is null.
bool IsHrsPixel(const double d)
Returns if the input pixel is high representation saturation.
bool IsSpecial(const double d)
Returns if the input pixel is special.
const double Hrs
Value for an Isis High Representation Saturation pixel.
bool IsHighPixel(const double d)
Returns if the input pixel is one of the high saturation types.
const double Lrs
Value for an Isis Low Representation Saturation pixel.
double TestPixel(const float t)
Converts float pixels to double pixels with special pixel translations.
double StringToPixel(const QString &str)
Takes the name of the pixel type as a string and returns a double pixel value.
bool IsLisPixel(const double d)
Returns if the input pixel is low instrument saturation.
bool IsLrsPixel(const double d)
Returns if the input pixel is low representation saturation.
const double Null
Value for an Isis Null pixel.
bool IsHisPixel(const double d)
Returns if the input pixel is high instrument saturation.
const double Lis
Value for an Isis Low Instrument Saturation pixel.
double toDouble(const QString &string)
Global function to convert from a string to a double.
const double ValidMinimum
The minimum valid double value for Isis pixels.
bool IsValidPixel(const double d)
Returns if the input pixel is valid.
bool IsLowPixel(const double d)
Returns if the input pixel is one of the low saturation types.
This is free and unencumbered software released into the public domain.
@ User
A type of error that could only have occurred due to a mistake on the user's part (e....
Manipulate special pixel values.