Isis 3 Developer Reference
Stretch.h
Go to the documentation of this file.
1 #ifndef Stretch_h
2 #define Stretch_h
3 
25 #include <vector>
26 #include <string>
27 #include "Pvl.h"
28 #include "Histogram.h"
29 
30 namespace Isis {
72  class Stretch {
73  private:
74  std::vector<double> p_input;
75  std::vector<double> p_output;
76  int p_pairs;
77 
78  double p_null;
80  double p_lis;
82  double p_lrs;
84  double p_his;
86  double p_hrs;
88  double p_minimum;
89  double p_maximum;
90 
91  std::pair<double, double> NextPair(QString &pairs);
92 
93  public:
94  Stretch();
95 
97  ~Stretch() {};
98 
99  void AddPair(const double input, const double output);
100 
108  void SetNull(const double value) {
109  p_null = value;
110  }
111 
119  void SetLis(const double value) {
120  p_lis = value;
121  }
122 
130  void SetLrs(const double value) {
131  p_lrs = value;
132  }
133 
141  void SetHis(const double value) {
142  p_his = value;
143  }
144 
152  void SetHrs(const double value) {
153  p_hrs = value;
154  }
155 
156  void SetMinimum(const double value) {
157  p_minimum = value;
158  }
159  void SetMaximum(const double value) {
160  p_maximum = value;
161  }
162 
163  void Load(Pvl &pvl, QString &grpName);
164  void Save(Pvl &pvl, QString &grpName);
165  void Load(QString &file, QString &grpName);
166  void Save(QString &file, QString &grpName);
167 
168  double Map(const double value) const;
169 
170  void Parse(const QString &pairs);
171  void Parse(const QString &pairs, const Isis::Histogram *hist);
172 
173  QString Text() const;
174 
176  int Pairs() const {
177  return p_pairs;
178  };
179 
180  double Input(const int index) const;
181  double Output(const int index) const;
182 
184  void ClearPairs() {
185  p_pairs = 0;
186  p_input.clear();
187  p_output.clear();
188  };
189 
190  void CopyPairs(const Stretch &other);
191  };
192 };
193 
194 #endif
195 
double Input(const int index) const
Returns the value of the input side of the stretch pair at the specified index.
Definition: Stretch.cpp:302
double Map(const double value) const
Maps an input value to an output value based on the stretch pairs and/or special pixel mappings...
Definition: Stretch.cpp:84
void SetLis(const double value)
Sets the mapping for LIS pixels.
Definition: Stretch.h:119
void SetMaximum(const double value)
Definition: Stretch.h:159
int Pairs() const
Returns the number of stretch pairs.
Definition: Stretch.h:176
void AddPair(const double input, const double output)
Adds a stretch pair to the list of pairs.
Definition: Stretch.cpp:63
void SetHrs(const double value)
Sets the mapping for HRS pixels.
Definition: Stretch.h:152
void CopyPairs(const Stretch &other)
Copies the stretch pairs from another Stretch object, but maintains special pixel values...
Definition: Stretch.cpp:407
Container of a cube histogram.
Definition: Histogram.h:86
Pixel value mapper.
Definition: Stretch.h:72
void SetLrs(const double value)
Sets the mapping for LRS pixels.
Definition: Stretch.h:130
double Output(const int index) const
Returns the value of the output side of the stretch pair at the specified index.
Definition: Stretch.cpp:317
void SetHis(const double value)
Sets the mapping for HIS pixels.
Definition: Stretch.h:141
QString Text() const
Converts stretch pair to a string.
Definition: Stretch.cpp:283
Container for cube-like labels.
Definition: Pvl.h:135
void Save(Pvl &pvl, QString &grpName)
Definition: Stretch.cpp:388
Stretch()
Constructs a Stretch object with default mapping of special pixel values to themselves.
Definition: Stretch.cpp:41
void Parse(const QString &pairs)
Parses a string of the form "i1:o1 i2:o2...iN:oN" where each i:o represents an input:output pair...
Definition: Stretch.cpp:196
void ClearPairs()
Clears the stretch pairs.
Definition: Stretch.h:184
~Stretch()
Destroys the Stretch object.
Definition: Stretch.h:97
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
void Load(Pvl &pvl, QString &grpName)
Loads the stretch pairs from the pvl file into the Stretch object.
Definition: Stretch.cpp:357
void SetNull(const double value)
Sets the mapping for NULL pixels.
Definition: Stretch.h:108
void SetMinimum(const double value)
Definition: Stretch.h:156