35 #include <geos/geom/MultiPolygon.h>
105 Chip(
const int samples,
const int lines);
108 void SetSize(
const int samples,
const int lines);
115 return m_chipSamples;
141 void SetValue(
int sample,
int line,
const double &value) {
142 m_buf[line-1][sample-1] = value;
159 return m_buf[line-1][sample-1];
174 inline double GetValue(
int sample,
int line)
const {
175 return m_buf[line-1][sample-1];
178 void TackCube(
const double cubeSample,
const double cubeLine);
202 void Load(
Cube &cube,
const double rotation = 0.0,
const double scale = 1.0,
205 const double scale = 1.0,
const int band = 1);
206 void Load(
Cube &cube,
const Affine &affine,
const bool &keepPoly =
true,
235 bool IsValid(
double percentage);
245 double value =
GetValue(sample, line);
246 if (value < m_validMinimum)
return false;
247 if (value > m_validMaximum)
return false;
251 Chip Extract(
int samples,
int lines,
int samp,
int line);
255 void Write(
const QString &filename);
288 delete m_clipPolygon;
305 return m_readInterpolator;
322 m_readInterpolator = type;
326 QString msg =
"Invalid Interpolator type. Cannot use [";
327 msg +=
toString(type) +
"] to read cube into chip.";
332 void Init(
const int samples,
const int lines);
333 void Read(
Cube &cube,
const int band);
334 std::vector<int> MovePoints(
int startSamp,
int startLine,
335 int endSamp,
int endLine);
336 bool PointsColinear(
double x0,
double y0,
337 double x1,
double y1,
338 double x2,
double y2,
343 std::vector< std::vector<double> > m_buf;
347 double m_cubeTackSample;
348 double m_cubeTackLine;
350 double m_validMinimum;
351 double m_validMaximum;
358 geos::geom::MultiPolygon *m_clipPolygon;
void SetChipPosition(const double sample, const double line)
Compute the position of the cube given a chip coordinate.
Definition: Chip.cpp:665
void SetValidRange(const double minimum=Isis::ValidMinimum, const double maximum=Isis::ValidMaximum)
Set the valid range of data in the chip.
Definition: Chip.cpp:703
void SetCubePosition(const double sample, const double line)
Compute the position of the chip given a cube coordinate.
Definition: Chip.cpp:682
bool IsValid(double percentage)
Return if the pixel is valid at a particular position.
Definition: Chip.cpp:739
virtual ~Chip()
Destroys the Chip object.
Definition: Chip.cpp:110
const Affine & GetTransform() const
Returns the Affine transformation of chip-to-cube indices.
Definition: Chip.h:270
interpType
The interpolator type, including: None, Nearest Neighbor, BiLinear or Cubic Convultion.
Definition: Interpolator.h:57
const double ValidMinimum
The minimum valid double value for Isis pixels.
Definition: SpecialPixel.h:101
A small chip of data used for pattern matching.
Definition: Chip.h:101
double GetValue(int sample, int line) const
Get a value from a Chip.
Definition: Chip.h:174
Definition: Interpolator.h:59
bool IsInsideChip(double sample, double line)
Definition: Chip.cpp:184
double ChipLine() const
Returns chip line after invoking SetCubePosition.
Definition: Chip.h:229
void TackCube(const double cubeSample, const double cubeLine)
This sets which cube position will be located at the chip tack position.
Definition: Chip.cpp:204
void SetTransform(const Affine &affine, const bool &keepPoly=true)
Sets the internal Affine transform to new translation.
Definition: Chip.h:285
void SetReadInterpolator(const Interpolator::interpType type)
Sets Interpolator Type for loading a chip.
Definition: Chip.h:318
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Definition: IString.cpp:226
This error is for when a programmer made an API call that was illegal.
Definition: IException.h:154
Chip Extract(int samples, int lines, int samp, int line)
Extract a sub-chip from a chip.
Definition: Chip.cpp:765
int Samples() const
Return the number of samples in the chip.
Definition: Chip.h:114
This class is used to accumulate statistics on double arrays.
Definition: Statistics.h:109
Isis::Statistics * Statistics()
Returns a statistics object of the current data in the chip.
Definition: Chip.cpp:947
Affine basis function.
Definition: Affine.h:79
bool IsValid(int sample, int line)
Returns whether the value at the given sample, line position is within the valid range.
Definition: Chip.h:244
void Write(const QString &filename)
Writes the contents of the Chip to a cube.
Definition: Chip.cpp:1023
#define _FILEINFO_
Macro for the filename and line number.
Definition: IException.h:38
Interpolator::interpType GetReadInterpolator()
Access method that returns the Interpolator Type used for loading a chip.
Definition: Chip.h:304
void SetAllValues(const double &d)
Single value assignment operator.
Definition: Chip.cpp:122
int TackSample() const
Return the fixed tack sample of the chip.
Definition: Chip.h:187
void SetSize(const int samples, const int lines)
Change the size of the Chip.
Definition: Chip.cpp:156
double CubeLine() const
Returns cube line after invoking SetChipPosition.
Definition: Chip.h:217
void Load(Cube &cube, const double rotation=0.0, const double scale=1.0, const int band=1)
Load cube data into the Chip.
Definition: Chip.cpp:225
Chip()
Constructs a Chip.
Definition: Chip.cpp:57
void SetClipPolygon(const geos::geom::MultiPolygon &clipPolygon)
Sets the clipping polygon for this chip.
Definition: Chip.cpp:1046
void SetValue(int sample, int line, const double &value)
Sets a value in the chip.
Definition: Chip.h:141
const double ValidMaximum
The maximum valid double value for Isis pixels.
Definition: SpecialPixel.h:136
Definition: Interpolator.h:60
int Lines() const
Return the number of lines in the chip.
Definition: Chip.h:121
Isis exception class.
Definition: IException.h:99
Definition: Interpolator.h:61
Chip & operator=(const Chip &other)
Copy assignment operator.
Definition: Chip.cpp:1057
double GetValue(int sample, int line)
Loads a Chip with a value.
Definition: Chip.h:158
double CubeSample() const
Returns cube sample after invoking SetChipPosition.
Definition: Chip.h:212
int TackLine() const
Return the fixed tack line of the chip.
Definition: Chip.h:198
QString FileName() const
Returns the expanded filename of the cube from which this chip was chipped.
Definition: Chip.h:128
double ChipSample() const
Returns chip sample after invoking SetCubePosition.
Definition: Chip.h:224
IO Handler for Isis Cubes.
Definition: Cube.h:158