Isis Developer Reference
Stretch.h
Go to the documentation of this file.
1#ifndef Stretch_h
2#define Stretch_h
8/* SPDX-License-Identifier: CC0-1.0 */
9#include <vector>
10#include <string>
11#include "Pvl.h"
12#include "ImageHistogram.h"
13#include "Histogram.h"
14
15namespace Isis {
58 class Stretch {
59 private:
60 std::vector<double> p_input;
61 std::vector<double> p_output;
62 int p_pairs;
63
64 double p_null;
66 double p_lis;
68 double p_lrs;
70 double p_his;
72 double p_hrs;
74 double p_minimum;
75 double p_maximum;
76
77 std::pair<double, double> NextPair(QString &pairs);
78
79 public:
80 Stretch();
81
84
85 void AddPair(const double input, const double output);
86
94 void SetNull(const double value) {
95 p_null = value;
96 }
97
105 void SetLis(const double value) {
106 p_lis = value;
107 }
108
116 void SetLrs(const double value) {
117 p_lrs = value;
118 }
119
127 void SetHis(const double value) {
128 p_his = value;
129 }
130
138 void SetHrs(const double value) {
139 p_hrs = value;
140 }
141
142 void SetMinimum(const double value) {
143 p_minimum = value;
144 }
145 void SetMaximum(const double value) {
146 p_maximum = value;
147 }
148
149 void Load(Pvl &pvl, QString &grpName);
150 void Save(Pvl &pvl, QString &grpName);
151 void Load(QString &file, QString &grpName);
152 void Save(QString &file, QString &grpName);
153
154 double Map(const double value) const;
155
156 void Parse(const QString &pairs);
157 void Parse(const QString &pairs, const Isis::Histogram *hist);
158
159 QString Text() const;
160
162 int Pairs() const {
163 return p_pairs;
164 };
165
166 double Input(const int index) const;
167 double Output(const int index) const;
168
170 void ClearPairs() {
171 p_pairs = 0;
172 p_input.clear();
173 p_output.clear();
174 };
175
176 void CopyPairs(const Stretch &other);
177 };
178};
179
180#endif
Container of a cube histogram.
Definition Histogram.h:74
Container for cube-like labels.
Definition Pvl.h:119
Pixel value mapper.
Definition Stretch.h:58
void CopyPairs(const Stretch &other)
Copies the stretch pairs from another Stretch object, but maintains special pixel values.
Definition Stretch.cpp:392
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:181
void AddPair(const double input, const double output)
Adds a stretch pair to the list of pairs.
Definition Stretch.cpp:48
void SetNull(const double value)
Sets the mapping for NULL pixels.
Definition Stretch.h:94
void SetMaximum(const double value)
Definition Stretch.h:145
void Save(Pvl &pvl, QString &grpName)
Definition Stretch.cpp:373
Stretch()
Constructs a Stretch object with default mapping of special pixel values to themselves.
Definition Stretch.cpp:25
void SetHrs(const double value)
Sets the mapping for HRS pixels.
Definition Stretch.h:138
double Output(const int index) const
Returns the value of the output side of the stretch pair at the specified index.
Definition Stretch.cpp:302
void SetMinimum(const double value)
Definition Stretch.h:142
double Input(const int index) const
Returns the value of the input side of the stretch pair at the specified index.
Definition Stretch.cpp:287
void SetHis(const double value)
Sets the mapping for HIS pixels.
Definition Stretch.h:127
void SetLis(const double value)
Sets the mapping for LIS pixels.
Definition Stretch.h:105
~Stretch()
Destroys the Stretch object.
Definition Stretch.h:83
void ClearPairs()
Clears the stretch pairs.
Definition Stretch.h:170
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:69
int Pairs() const
Returns the number of stretch pairs.
Definition Stretch.h:162
void Load(Pvl &pvl, QString &grpName)
Loads the stretch pairs from the pvl file into the Stretch object.
Definition Stretch.cpp:342
void SetLrs(const double value)
Sets the mapping for LRS pixels.
Definition Stretch.h:116
QString Text() const
Converts stretch pair to a string.
Definition Stretch.cpp:268
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16