File failed to load: https://isis.astrogeology.usgs.gov/6.0.0/Object/assets/jax/output/NativeMML/config.js
Isis Developer Reference
Chip.h
Go to the documentation of this file.
1 
6 /* SPDX-License-Identifier: CC0-1.0 */
7 
8 #ifndef Chip_h
9 #define Chip_h
10 
11 
12 #include "Affine.h"
13 #include "Interpolator.h"
14 #include "Pvl.h"
15 #include "SpecialPixel.h"
16 
17 #include <vector>
18 
19 #include <geos/geom/MultiPolygon.h>
20 
21 namespace Isis {
22  class Cube;
23  class Statistics;
24 
86  class Chip {
87  public:
88  Chip();
89  Chip(const Chip &other);
90  Chip(const int samples, const int lines);
91  virtual ~Chip();
92 
93  void SetSize(const int samples, const int lines);
94  bool IsInsideChip(double sample, double line);
95 
99  inline int Samples() const {
100  return m_chipSamples;
101  };
102 
106  inline int Lines() const {
107  return m_chipLines;
108  };
109 
113  inline QString FileName() const {
114  return m_filename;
115  };
116 
117  void SetAllValues(const double &d);
118 
126  void SetValue(int sample, int line, const double &value) {
127  m_buf[line-1][sample-1] = value;
128  }
129 
145  inline double GetValue(int sample, int line) {
146  return m_buf[line-1][sample-1];
147  }
148 
163  inline double GetValue(int sample, int line) const {
164  return m_buf[line-1][sample-1];
165  }
166 
167  void TackCube(const double cubeSample, const double cubeLine);
168 
176  inline int TackSample() const {
177  return m_tackSample;
178  };
179 
187  inline int TackLine() const {
188  return m_tackLine;
189  };
190 
191  void Load(Cube &cube, const double rotation = 0.0, const double scale = 1.0,
192  const int band = 1);
193  void Load(Cube &cube, Chip &match, Cube &matchChipCube,
194  const double scale = 1.0, const int band = 1);
195  void Load(Cube &cube, const Affine &affine, const bool &keepPoly = true,
196  const int band = 1);
197 
198  void SetChipPosition(const double sample, const double line);
199 
203  inline double CubeSample() const {
204  return m_cubeSample;
205  };
206 
210  inline double CubeLine() const {
211  return m_cubeLine;
212  };
213 
214  void SetCubePosition(const double sample, const double line);
215 
219  double ChipSample() const {
220  return m_chipSample;
221  };
222 
226  double ChipLine() const {
227  return m_chipLine;
228  };
229 
230  void SetValidRange(const double minimum = Isis::ValidMinimum,
231  const double maximum = Isis::ValidMaximum);
232 
240  inline bool IsValid(int sample, int line) {
241  double value = GetValue(sample, line);
242  if (value < m_validMinimum) return false;
243  if (value > m_validMaximum) return false;
244  return true;
245  }
246 
255  bool IsValid(double percentage);
256  Chip Extract(int samples, int lines, int samp, int line);
257  void Extract(int samp, int line, Chip &output);
259  void Extract(Chip &output, Affine &affine);
260  void Write(const QString &filename);
261 
262  void SetClipPolygon(const geos::geom::MultiPolygon &clipPolygon);
263 
264  Chip &operator=(const Chip &other);
265 
275  const Affine &GetTransform() const {
276  return (m_affine);
277  }
278 
290  void SetTransform(const Affine &affine, const bool &keepPoly = true) {
291  m_affine = affine;
292  if (!keepPoly) {
293  delete m_clipPolygon;
294  m_clipPolygon = 0;
295  }
296  return;
297  }
298 
310  return m_readInterpolator;
311  }
312 
324  if (type == Interpolator::NearestNeighborType ||
325  type == Interpolator::BiLinearType ||
327  m_readInterpolator = type;
328  return;
329  }
330  // Interpolator::None is not valid type
331  QString msg = "Invalid Interpolator type. Cannot use [";
332  msg += toString(type) + "] to read cube into chip.";
334  }
335 
336  private:
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,
344  double tol);
345 
346  int m_chipSamples;
347  int m_chipLines;
348  std::vector< std::vector<double> > m_buf;
349  int m_tackSample;
350  int m_tackLine;
351 
352  double m_cubeTackSample;
353  double m_cubeTackLine;
354 
355  double m_validMinimum;
356  double m_validMaximum;
357 
358  double m_chipSample;
359  double m_chipLine;
360  double m_cubeSample;
361  double m_cubeLine;
362 
363  geos::geom::MultiPolygon *m_clipPolygon;
364  // (line,samp)
365 
366  Affine m_affine;
367  // Used to load cubes into chip
368 
369  Interpolator::interpType m_readInterpolator;
370  // SetReadInterpolator. Used to read
371  // cubes into chip.
372 
373  QString m_filename;
374  };
375 };
376 
377 #endif
Isis::ValidMaximum
const double ValidMaximum
The maximum valid double value for Isis pixels.
Definition: SpecialPixel.h:122
Isis::Chip::operator=
Chip & operator=(const Chip &other)
Copy assignment operator.
Definition: Chip.cpp:1021
Isis::Chip::IsInsideChip
bool IsInsideChip(double sample, double line)
Definition: Chip.cpp:162
Isis::Affine::Compute
void Compute(double x, double y)
Compute (xp,yp) given (x,y).
Definition: Affine.cpp:191
Isis::Chip::SetValidRange
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
Portal.h
Isis::Interpolator::BiLinearType
@ BiLinearType
Definition: Interpolator.h:43
Isis::Statistics
This class is used to accumulate statistics on double arrays.
Definition: Statistics.h:94
Isis::Cube::fileName
virtual QString fileName() const
Returns the opened cube's filename.
Definition: Cube.cpp:1563
Cube.h
Isis::Statistics::AddData
void AddData(const double *data, const unsigned int count)
Add an array of doubles to the accumulators and counters.
Definition: Statistics.cpp:141
Isis::LineManager
Buffer manager, for moving through a cube in lines.
Definition: LineManager.h:39
Isis::PI
const double PI
The mathematical constant PI.
Definition: Constants.h:40
Isis::Portal
Buffer for containing a two dimensional section of an image.
Definition: Portal.h:36
Isis::Interpolator::CubicConvolutionType
@ CubicConvolutionType
Definition: Interpolator.h:44
Isis::TProjection::UniversalLatitude
virtual double UniversalLatitude()
This returns a universal latitude (planetocentric).
Definition: TProjection.cpp:908
Isis::Sensor::HasSurfaceIntersection
bool HasSurfaceIntersection() const
Returns if the last call to either SetLookDirection or SetUniversalGround had a valid intersection wi...
Definition: Sensor.cpp:186
Isis::Camera::SetImage
virtual bool SetImage(const double sample, const double line)
Sets the sample/line values of the image to get the lat/lon values.
Definition: Camera.cpp:154
Isis::Chip::SetSize
void SetSize(const int samples, const int lines)
Change the size of the Chip.
Definition: Chip.cpp:134
Isis::Cube::read
void read(Blob &blob, const std::vector< PvlKeyword > keywords=std::vector< PvlKeyword >()) const
This method will read data from the specified Blob object.
Definition: Cube.cpp:807
SpecialPixel.h
Isis::Camera::Sample
virtual double Sample() const
Returns the current sample number.
Definition: Camera.cpp:2690
Isis::Chip::TackCube
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
Isis::Buffer::DoubleBuffer
double * DoubleBuffer() const
Returns the value of the shape buffer.
Definition: Buffer.h:138
Isis::Chip::GetValue
double GetValue(int sample, int line)
Loads a Chip with a value.
Definition: Chip.h:145
LineManager.h
Isis::Chip::SetReadInterpolator
void SetReadInterpolator(const Interpolator::interpType type)
Sets Interpolator Type for loading a chip.
Definition: Chip.h:323
Isis::Cube::close
void close(bool remove=false)
Closes the cube and updates the labels.
Definition: Cube.cpp:260
Isis::Chip::ChipSample
double ChipSample() const
Definition: Chip.h:219
Isis::Chip::SetCubePosition
void SetCubePosition(const double sample, const double line)
Compute the position of the chip given a cube coordinate.
Definition: Chip.cpp:660
Isis::Interpolator::Lines
int Lines()
Returns the number of lines needed by the interpolator.
Definition: Interpolator.cpp:236
Isis::globalFactory
static geos::geom::GeometryFactory::Ptr globalFactory
Definition: PolygonTools.h:51
Isis::Projection::SetUniversalGround
virtual bool SetUniversalGround(const double coord1, const double coord2)
This method is used to set the lat/lon or radius/azimuth (i.e.
Definition: Projection.cpp:417
Isis::Chip::CubeSample
double CubeSample() const
Definition: Chip.h:203
Isis::Camera
Definition: Camera.h:236
Isis::Chip::Extract
Chip Extract(int samples, int lines, int samp, int line)
Extract a sub-chip from a chip.
Definition: Chip.cpp:727
Isis::Chip::SetValue
void SetValue(int sample, int line, const double &value)
Sets a value in the chip.
Definition: Chip.h:126
Isis::toString
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Definition: IString.cpp:211
Isis::Statistics::SetValidRange
void SetValidRange(const double minimum=Isis::ValidMinimum, const double maximum=Isis::ValidMaximum)
Definition: Statistics.cpp:255
IString.h
Isis::Interpolator::HotSample
double HotSample()
Returns the sample coordinate of the center pixel in the buffer for the interpolator.
Definition: Interpolator.cpp:265
Isis::Chip::Load
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
Isis::Chip::SetTransform
void SetTransform(const Affine &affine, const bool &keepPoly=true)
Sets the internal Affine transform to new translation.
Definition: Chip.h:290
Isis::IException::append
void append(const IException &exceptionSource)
Appends the given exception (and its list of previous exceptions) to this exception's causational exc...
Definition: IException.cpp:409
Isis::Chip::TackSample
int TackSample() const
This method returns a chip's fixed tack sample; the middle of the chip.
Definition: Chip.h:176
Isis::Chip::CubeLine
double CubeLine() const
Definition: Chip.h:210
Isis::Chip::Lines
int Lines() const
Definition: Chip.h:106
Isis::Projection::WorldY
virtual double WorldY() const
This returns the world Y coordinate provided SetGround, SetCoordinate, SetUniversalGround,...
Definition: Projection.cpp:544
Isis::Projection::IsGood
bool IsGood() const
This indicates if the last invocation of SetGround, SetCoordinate, SetUniversalGround,...
Definition: Projection.cpp:374
Isis::Chip::SetAllValues
void SetAllValues(const double &d)
Single value assignment operator.
Definition: Chip.cpp:100
Isis::Chip::Chip
Chip()
Constructs a Chip.
Definition: Chip.cpp:35
Isis::Double
@ Double
Definition: PixelType.h:36
Isis::Sensor::UniversalLongitude
virtual double UniversalLongitude() const
Returns the positive east, 0-360 domain longitude, in degrees, at the surface intersection point in t...
Definition: Sensor.cpp:233
Pvl.h
Isis::Cube::lineCount
int lineCount() const
Definition: Cube.cpp:1734
_FILEINFO_
#define _FILEINFO_
Macro for the filename and line number.
Definition: IException.h:24
Isis::Chip::TackLine
int TackLine() const
This method returns a chip's fixed tack line; the middle of the chip.
Definition: Chip.h:187
Isis::Affine::Forward
AMatrix Forward() const
Returns the forward Affine matrix.
Definition: Affine.h:127
Isis::Cube::setDimensions
void setDimensions(int ns, int nl, int nb)
Used prior to the Create method to specify the size of the cube.
Definition: Cube.cpp:1217
Isis::Cube::create
void create(const QString &cfile)
This method will create an isis cube for writing.
Definition: Cube.cpp:414
Isis::Interpolator::interpType
interpType
The interpolator type, including: None, Nearest Neighbor, BiLinear or Cubic Convultion.
Definition: Interpolator.h:40
Isis::Chip::Write
void Write(const QString &filename)
Writes the contents of the Chip to a cube.
Definition: Chip.cpp:985
Isis::Chip::ChipLine
double ChipLine() const
Definition: Chip.h:226
Isis::TProjection
Base class for Map TProjections.
Definition: TProjection.h:166
Isis::Camera::SetUniversalGround
virtual bool SetUniversalGround(const double latitude, const double longitude)
Sets the lat/lon values to get the sample/line values.
Definition: Camera.cpp:380
Isis::NULL8
const double NULL8
Definition: SpecialPixel.h:94
Isis::Cube::sampleCount
int sampleCount() const
Definition: Cube.cpp:1807
Isis::Projection::WorldX
virtual double WorldX() const
This returns the world X coordinate provided SetGround, SetCoordinate, SetUniversalGround,...
Definition: Projection.cpp:524
Isis::Cube
IO Handler for Isis Cubes.
Definition: Cube.h:167
Isis::Interpolator
Pixel interpolator.
Definition: Interpolator.h:34
Isis::IException
Isis exception class.
Definition: IException.h:91
Isis::Projection::SetWorld
virtual bool SetWorld(const double x, const double y)
This method is used to set a world coordinate.
Definition: Projection.cpp:497
TProjection.h
Camera.h
Isis::Chip::GetTransform
const Affine & GetTransform() const
Returns the Affine transformation of chip-to-cube indices.
Definition: Chip.h:275
Isis::Null
const double Null
Value for an Isis Null pixel.
Definition: SpecialPixel.h:95
Affine.h
Isis::Cube::camera
Camera * camera()
Return a camera associated with the cube.
Definition: Cube.cpp:1451
Isis::Chip::~Chip
virtual ~Chip()
Destroys the Chip object.
Definition: Chip.cpp:88
Statistics.h
Isis::LineManager::SetLine
bool SetLine(const int line, const int band=1)
Positions the buffer at the requested line and returns a status indicator if the set was succesful or...
Definition: LineManager.cpp:44
IException.h
Isis::ValidMinimum
const double ValidMinimum
The minimum valid double value for Isis pixels.
Definition: SpecialPixel.h:87
Isis::IException::Programmer
@ Programmer
This error is for when a programmer made an API call that was illegal.
Definition: IException.h:146
Isis::Chip::IsValid
bool IsValid(int sample, int line)
Definition: Chip.h:240
std
Namespace for the standard library.
Isis::Cube::pixelType
PixelType pixelType() const
Definition: Cube.cpp:1758
Isis::Interpolator::Interpolate
double Interpolate(const double isamp, const double iline, const double buf[])
Performs an interpolation on the data according to the parameters set in the constructor.
Definition: Interpolator.cpp:56
Isis::Affine::xp
double xp() const
Returns the computed x'.
Definition: Affine.h:86
Isis::Chip::GetValue
double GetValue(int sample, int line) const
Get a value from a Chip.
Definition: Chip.h:163
Isis::Cube::write
void write(Blob &blob, bool overwrite=true)
This method will write a blob of data (e.g.
Definition: Cube.cpp:971
Isis::TProjection::UniversalLongitude
virtual double UniversalLongitude()
This returns a universal longitude (positive east in 0 to 360 domain).
Definition: TProjection.cpp:922
Isis::Chip
A small chip of data used for pattern matching.
Definition: Chip.h:86
Isis::Chip::Samples
int Samples() const
Definition: Chip.h:99
Isis::Affine
Affine basis function.
Definition: Affine.h:65
Isis::Buffer::size
int size() const
Returns the total number of pixels in the shape buffer.
Definition: Buffer.h:97
Projection.h
Isis::Interpolator::Samples
int Samples()
Returns the number of samples needed by the interpolator.
Definition: Interpolator.cpp:208
Isis::Affine::yp
double yp() const
Returns the computed y'.
Definition: Affine.h:95
Isis::Chip::Statistics
Isis::Statistics * Statistics()
Returns a statistics object of the current data in the chip.
Definition: Chip.cpp:909
Isis::Chip::FileName
QString FileName() const
Definition: Chip.h:113
Isis::Camera::Line
virtual double Line() const
Returns the current line number.
Definition: Camera.cpp:2710
PolygonTools.h
Isis::Chip::GetReadInterpolator
Interpolator::interpType GetReadInterpolator()
Access method that returns the Interpolator Type used for loading a chip.
Definition: Chip.h:309
Isis::Chip::SetChipPosition
void SetChipPosition(const double sample, const double line)
Compute the position of the cube given a chip coordinate.
Definition: Chip.cpp:643
Isis::Buffer::Sample
int Sample(const int index=0) const
Returns the sample position associated with a shape buffer index.
Definition: Buffer.cpp:127
Isis::Projection
Base class for Map Projections.
Definition: Projection.h:155
Isis::Interpolator::HotLine
double HotLine()
Returns the line coordinate of the center pixel in the buffer for the interpolator.
Definition: Interpolator.cpp:297
Interpolator.h
Isis::Chip::SetClipPolygon
void SetClipPolygon(const geos::geom::MultiPolygon &clipPolygon)
Sets the clipping polygon for this chip.
Definition: Chip.cpp:1008
Isis::Portal::SetPosition
void SetPosition(const double sample, const double line, const int band)
Sets the line and sample position of the buffer.
Definition: Portal.h:93
Isis::Interpolator::NearestNeighborType
@ NearestNeighborType
Definition: Interpolator.h:42
Isis::Cube::projection
Projection * projection()
Definition: Cube.cpp:1794
Isis::Buffer::Line
int Line(const int index=0) const
Returns the line position associated with a shape buffer index.
Definition: Buffer.cpp:145
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16
Chip.h
Isis::Sensor::UniversalLatitude
virtual double UniversalLatitude() const
Returns the planetocentric latitude, in degrees, at the surface intersection point in the body fixed ...
Definition: Sensor.cpp:210

U.S. Department of the Interior | U.S. Geological Survey
ISIS | Privacy & Disclaimers | Astrogeology Research Program
To contact us, please post comments and questions on the USGS Astrogeology Discussion Board
To report a bug, or suggest a feature go to: ISIS Github
File Modified: 07/13/2023 15:10:43