Isis 3 Programmer 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
double p_null
Mapping of input NULL values go to this value (default NULL)
Definition: Stretch.h:78
void SetLis(const double value)
Sets the mapping for LIS pixels.
Definition: Stretch.h:119
int Pairs() const
Returns the number of stretch pairs.
Definition: Stretch.h:176
std::pair< double, double > NextPair(QString &pairs)
Given a string containing stretch pairs for example "0:0 50:0 100:255 255:255" evaluate the first pai...
Definition: Stretch.cpp:160
double p_his
Mapping of input HIS values go to this value (default HIS)
Definition: Stretch.h:84
void AddPair(const double input, const double output)
Adds a stretch pair to the list of pairs.
Definition: Stretch.cpp:63
double p_hrs
Mapping of input HRS values go to this value (default HRS)
Definition: Stretch.h:86
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
int p_pairs
Number of stretch pairs.
Definition: Stretch.h:76
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
double p_lis
Mapping of input LIS values go to this value (default LIS)
Definition: Stretch.h:80
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
std::vector< double > p_input
Array for input side of stretch pairs.
Definition: Stretch.h:74
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
double p_maximum
By default this value is set to p_hrs.
Definition: Stretch.h:89
void SetNull(const double value)
Sets the mapping for NULL pixels.
Definition: Stretch.h:108
double p_lrs
Mapping of input LRS values go to this value (default LRS)
Definition: Stretch.h:82
double p_minimum
By default this value is set to p_lrs.
Definition: Stretch.h:88
std::vector< double > p_output
Array for output side of stretch pairs.
Definition: Stretch.h:75