19#include <geos/geom/MultiPolygon.h>
90 Chip(
const int samples,
const int lines);
93 void SetSize(
const int samples,
const int lines);
100 return m_chipSamples;
126 void SetValue(
int sample,
int line,
const double &value) {
127 m_buf[line-1][sample-1] = value;
146 return m_buf[line-1][sample-1];
163 inline double GetValue(
int sample,
int line)
const {
164 return m_buf[line-1][sample-1];
167 void TackCube(
const double cubeSample,
const double cubeLine);
191 void Load(
Cube &cube,
const double rotation = 0.0,
const double scale = 1.0,
194 const double scale = 1.0,
const int band = 1);
195 void Load(
Cube &cube,
const Affine &affine,
const bool &keepPoly =
true,
241 double value =
GetValue(sample, line);
242 if (value < m_validMinimum)
return false;
243 if (value > m_validMaximum)
return false;
255 bool IsValid(
double percentage);
256 Chip Extract(
int samples,
int lines,
int samp,
int line);
260 void Write(
const QString &filename);
293 delete m_clipPolygon;
310 return m_readInterpolator;
327 m_readInterpolator = type;
331 QString msg =
"Invalid Interpolator type. Cannot use [";
332 msg +=
toString(type) +
"] to read cube into chip.";
337 void Init(
const int samples,
const int lines);
338 void Read(
Cube &cube,
const int band);
339 std::vector<int> MovePoints(
int startSamp,
int startLine,
340 int endSamp,
int endLine);
341 bool PointsColinear(
double x0,
double y0,
342 double x1,
double y1,
343 double x2,
double y2,
348 std::vector< std::vector<double> > m_buf;
352 double m_cubeTackSample;
353 double m_cubeTackLine;
355 double m_validMinimum;
356 double m_validMaximum;
363 geos::geom::MultiPolygon *m_clipPolygon;
#define _FILEINFO_
Macro for the filename and line number.
Definition IException.h:24
Affine basis function.
Definition Affine.h:65
A small chip of data used for pattern matching.
Definition Chip.h:86
double CubeLine() const
Definition Chip.h:210
void SetReadInterpolator(const Interpolator::interpType type)
Sets Interpolator Type for loading a chip.
Definition Chip.h:323
void SetSize(const int samples, const int lines)
Change the size of the Chip.
Definition Chip.cpp:134
void Write(const QString &filename)
Writes the contents of the Chip to a cube.
Definition Chip.cpp:985
double GetValue(int sample, int line)
Loads a Chip with a value.
Definition Chip.h:145
void SetTransform(const Affine &affine, const bool &keepPoly=true)
Sets the internal Affine transform to new translation.
Definition Chip.h:290
Interpolator::interpType GetReadInterpolator()
Access method that returns the Interpolator Type used for loading a chip.
Definition Chip.h:309
int Samples() const
Definition Chip.h:99
void SetValidRange(const double minimum=Isis::ValidMinimum, const double maximum=Isis::ValidMaximum)
Set the valid range of data in the chip.
Definition Chip.cpp:681
int TackSample() const
This method returns a chip's fixed tack sample; the middle of the chip.
Definition Chip.h:176
bool IsInsideChip(double sample, double line)
Definition Chip.cpp:162
int Lines() const
Definition Chip.h:106
void SetAllValues(const double &d)
Single value assignment operator.
Definition Chip.cpp:100
void SetChipPosition(const double sample, const double line)
Compute the position of the cube given a chip coordinate.
Definition Chip.cpp:643
double ChipSample() const
Definition Chip.h:219
double ChipLine() const
Definition Chip.h:226
Isis::Statistics * Statistics()
Returns a statistics object of the current data in the chip.
Definition Chip.cpp:909
void SetClipPolygon(const geos::geom::MultiPolygon &clipPolygon)
Sets the clipping polygon for this chip.
Definition Chip.cpp:1008
const Affine & GetTransform() const
Returns the Affine transformation of chip-to-cube indices.
Definition Chip.h:275
void TackCube(const double cubeSample, const double cubeLine)
This sets which cube position will be located at the chip tack position.
Definition Chip.cpp:182
double CubeSample() const
Definition Chip.h:203
bool IsValid(int sample, int line)
Definition Chip.h:240
virtual ~Chip()
Destroys the Chip object.
Definition Chip.cpp:88
Chip Extract(int samples, int lines, int samp, int line)
Extract a sub-chip from a chip.
Definition Chip.cpp:727
double GetValue(int sample, int line) const
Get a value from a Chip.
Definition Chip.h:163
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:203
int TackLine() const
This method returns a chip's fixed tack line; the middle of the chip.
Definition Chip.h:187
Chip & operator=(const Chip &other)
Copy assignment operator.
Definition Chip.cpp:1021
Chip()
Constructs a Chip.
Definition Chip.cpp:35
void SetCubePosition(const double sample, const double line)
Compute the position of the chip given a cube coordinate.
Definition Chip.cpp:660
void SetValue(int sample, int line, const double &value)
Sets a value in the chip.
Definition Chip.h:126
QString FileName() const
Definition Chip.h:113
IO Handler for Isis Cubes.
Definition Cube.h:168
Isis exception class.
Definition IException.h:91
@ Programmer
This error is for when a programmer made an API call that was illegal.
Definition IException.h:146
interpType
The interpolator type, including: None, Nearest Neighbor, BiLinear or Cubic Convultion.
Definition Interpolator.h:40
@ BiLinearType
Definition Interpolator.h:43
@ CubicConvolutionType
Definition Interpolator.h:44
@ NearestNeighborType
Definition Interpolator.h:42
This class is used to accumulate statistics on double arrays.
Definition Statistics.h:94
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Definition IString.cpp:211
const double ValidMaximum
The maximum valid double value for Isis pixels.
Definition SpecialPixel.h:122
const double ValidMinimum
The minimum valid double value for Isis pixels.
Definition SpecialPixel.h:87