35 #include <geos/geom/MultiPolygon.h>
105 Chip(
const int samples,
const int lines);
108 void SetSize(
const int samples,
const int lines);
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);
251 Chip Extract(
int samples,
int lines,
int samp,
int line);
255 void Write(
const QString &filename);
319 if (type == Interpolator::NearestNeighborType ||
320 type == Interpolator::BiLinearType ||
321 type == Interpolator::CubicConvolutionType) {
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);
337 double x1,
double y1,
338 double x2,
double y2,
343 std::vector< std::vector<double> >
m_buf;
void SetChipPosition(const double sample, const double line)
Compute the position of the cube given a chip coordinate.
void SetValidRange(const double minimum=Isis::ValidMinimum, const double maximum=Isis::ValidMaximum)
Set the valid range of data in the chip.
void SetCubePosition(const double sample, const double line)
Compute the position of the chip given a cube coordinate.
bool IsValid(double percentage)
Return if the pixel is valid at a particular position.
virtual ~Chip()
Destroys the Chip object.
const Affine & GetTransform() const
Returns the Affine transformation of chip-to-cube indices.
interpType
The interpolator type, including: None, Nearest Neighbor, BiLinear or Cubic Convultion.
double m_validMaximum
valid maximum chip pixel value
const double ValidMinimum
The minimum valid double value for Isis pixels.
double m_cubeLine
cube line set by SetCubePosition
A small chip of data used for pattern matching.
double GetValue(int sample, int line) const
Get a value from a Chip.
double m_cubeSample
cube sample set by SetCubePosition
Interpolator::interpType m_readInterpolator
Interpolator type set by.
int m_tackSample
Middle sample of the chip.
bool IsInsideChip(double sample, double line)
double ChipLine() const
Returns chip line after invoking SetCubePosition.
void TackCube(const double cubeSample, const double cubeLine)
This sets which cube position will be located at the chip tack position.
double m_chipSample
chip sample set by SetChip/CubePosition
void SetTransform(const Affine &affine, const bool &keepPoly=true)
Sets the internal Affine transform to new translation.
void SetReadInterpolator(const Interpolator::interpType type)
Sets Interpolator Type for loading a chip.
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
This error is for when a programmer made an API call that was illegal.
Chip Extract(int samples, int lines, int samp, int line)
Extract a sub-chip from a chip.
int Samples() const
Return the number of samples in the chip.
double m_cubeTackLine
cube line at the chip tack
This class is used to accumulate statistics on double arrays.
bool PointsColinear(double x0, double y0, double x1, double y1, double x2, double y2, double tol)
This method is called by Load() to determine whether the given 3 points are nearly colinear...
Isis::Statistics * Statistics()
Returns a statistics object of the current data in the chip.
double m_validMinimum
valid minimum chip pixel value
bool IsValid(int sample, int line)
Returns whether the value at the given sample, line position is within the valid range.
std::vector< int > MovePoints(int startSamp, int startLine, int endSamp, int endLine)
This method is called by Load() to move a control point across the chip.
void Write(const QString &filename)
Writes the contents of the Chip to a cube.
#define _FILEINFO_
Macro for the filename and line number.
Interpolator::interpType GetReadInterpolator()
Access method that returns the Interpolator Type used for loading a chip.
double m_cubeTackSample
cube sample at the chip tack
int m_chipLines
Number of lines in the chip.
void SetAllValues(const double &d)
Single value assignment operator.
int TackSample() const
Return the fixed tack sample of the chip.
void SetSize(const int samples, const int lines)
Change the size of the Chip.
double CubeLine() const
Returns cube line after invoking SetChipPosition.
void Load(Cube &cube, const double rotation=0.0, const double scale=1.0, const int band=1)
Load cube data into the Chip.
void SetClipPolygon(const geos::geom::MultiPolygon &clipPolygon)
Sets the clipping polygon for this chip.
QString m_filename
FileName of loaded cube.
void SetValue(int sample, int line, const double &value)
Sets a value in the chip.
Affine m_affine
Transform set by SetTransform.
int m_tackLine
Middle line of the chip.
const double ValidMaximum
The maximum valid double value for Isis pixels.
geos::geom::MultiPolygon * m_clipPolygon
clipping polygon set by SetClipPolygon
int Lines() const
Return the number of lines in the chip.
int m_chipSamples
Number of samples in the chip.
void Read(Cube &cube, const int band)
This method reads data from a cube and puts it into the chip.
Chip & operator=(const Chip &other)
Copy assignment operator.
double GetValue(int sample, int line)
Loads a Chip with a value.
std::vector< std::vector< double > > m_buf
Chip buffer.
double CubeSample() const
Returns cube sample after invoking SetChipPosition.
int TackLine() const
Return the fixed tack line of the chip.
QString FileName() const
Returns the expanded filename of the cube from which this chip was chipped.
void Init(const int samples, const int lines)
Common initialization used by constructors.
double m_chipLine
chip line set by SetChip/CubePosition
double ChipSample() const
Returns chip sample after invoking SetCubePosition.
IO Handler for Isis Cubes.