Isis 3 Programmer Reference
Isis::Chip Class Reference

A small chip of data used for pattern matching. More...

#include <Chip.h>

Collaboration diagram for Isis::Chip:
Collaboration graph

Public Member Functions

 Chip ()
 Constructs a Chip.
 
 Chip (const Chip &other)
 Constructs a copy of the passed in chip.
 
 Chip (const int samples, const int lines)
 Construct a Chip with specified dimensions.
 
virtual ~Chip ()
 Destroys the Chip object.
 
void SetSize (const int samples, const int lines)
 Change the size of the Chip.
 
bool IsInsideChip (double sample, double line)
 
int Samples () const
 
int Lines () const
 
QString FileName () const
 
void SetAllValues (const double &d)
 Single value assignment operator.
 
void SetValue (int sample, int line, const double &value)
 Sets a value in the chip.
 
double GetValue (int sample, int line)
 Loads a Chip with a value.
 
double GetValue (int sample, int line) const
 Get a value from a Chip.
 
void TackCube (const double cubeSample, const double cubeLine)
 This sets which cube position will be located at the chip tack position.
 
int TackSample () const
 This method returns a chip's fixed tack sample; the middle of the chip.
 
int TackLine () const
 This method returns a chip's fixed tack line; the middle of the chip.
 
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 Load (Cube &cube, Chip &match, Cube &matchChipCube, const double scale=1.0, const int band=1)
 Loads cube data into the Chip.
 
void Load (Cube &cube, const Affine &affine, const bool &keepPoly=true, const int band=1)
 Load a chip using an Affine transform as provided by caller.
 
void SetChipPosition (const double sample, const double line)
 Compute the position of the cube given a chip coordinate.
 
double CubeSample () const
 
double CubeLine () const
 
void SetCubePosition (const double sample, const double line)
 Compute the position of the chip given a cube coordinate.
 
double ChipSample () const
 
double ChipLine () const
 
void SetValidRange (const double minimum=Isis::ValidMinimum, const double maximum=Isis::ValidMaximum)
 Set the valid range of data in the chip.
 
bool IsValid (int sample, int line)
 
bool IsValid (double percentage)
 Return if total number of valid pixels in chip meets a specified percentage of the entire chip.
 
Chip Extract (int samples, int lines, int samp, int line)
 Extract a sub-chip from a chip.
 
void Extract (int samp, int line, Chip &output)
 Extract a subchip centered at the designated coordinate.
 
Isis::StatisticsStatistics ()
 Returns a statistics object of the current data in the chip.
 
void Extract (Chip &output, Affine &affine)
 Extract a subchip of this chip using an Affine transform.
 
void Write (const QString &filename)
 Writes the contents of the Chip to a cube.
 
void SetClipPolygon (const geos::geom::MultiPolygon &clipPolygon)
 Sets the clipping polygon for this chip.
 
Chipoperator= (const Chip &other)
 Copy assignment operator.
 
const AffineGetTransform () const
 Returns the Affine transformation of chip-to-cube indices.
 
void SetTransform (const Affine &affine, const bool &keepPoly=true)
 Sets the internal Affine transform to new translation.
 
Interpolator::interpType GetReadInterpolator ()
 Access method that returns the Interpolator Type used for loading a chip.
 
void SetReadInterpolator (const Interpolator::interpType type)
 Sets Interpolator Type for loading a chip.
 

Private Member Functions

void Init (const int samples, const int lines)
 Common initialization used by constructors.
 
void Read (Cube &cube, const int band)
 This method reads data from a cube and puts it into the chip.
 
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.
 
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.
 

Private Attributes

int m_chipSamples
 Number of samples in the chip.
 
int m_chipLines
 Number of lines in the chip.
 
std::vector< std::vector< double > > m_buf
 Chip buffer.
 
int m_tackSample
 Middle sample of the chip.
 
int m_tackLine
 Middle line of the chip.
 
double m_cubeTackSample
 cube sample at the chip tack
 
double m_cubeTackLine
 cube line at the chip tack
 
double m_validMinimum
 valid minimum chip pixel value
 
double m_validMaximum
 valid maximum chip pixel value
 
double m_chipSample
 chip sample set by SetChip/CubePosition
 
double m_chipLine
 chip line set by SetChip/CubePosition
 
double m_cubeSample
 cube sample set by SetCubePosition
 
double m_cubeLine
 cube line set by SetCubePosition
 
geos::geom::MultiPolygon * m_clipPolygon
 clipping polygon set by SetClipPolygon
 
Affine m_affine
 Transform set by SetTransform.
 
Interpolator::interpType m_readInterpolator
 Interpolator type set by.
 
QString m_filename
 FileName of loaded cube.
 

Detailed Description

A small chip of data used for pattern matching.

A chip is a small rectangular area that can be used for pattern matching. Data can be loaded into the chip manually or by reading directly from a cube.

Author
2005-05-05 Jeff Anderson
See also
AutoReg
AutoRegFactory
History

2006-07-11 Tracie Sucharski - Added reLoad method to use m_cube instead of cube passed in.

2006-08-03 Tracie Sucharski - Added Load and ReLoad method to apply scale factor to chip.

2006-08-04 Stuart Sides - Added SetClipPolygon method. If the clip polygon is set all pixel values outside the polygon will be set to NULL.

2007-10-01 Steven Koechle - Fixed inc in LoadChip to fix an infinite loop problem when x.size() never grew to be more than 3.

2009-01-19 Steven Koechle - Fixed memory leak

2009-06-02 Stacy Alley - Added a check in the SetSize() method to make sure the given samples and lines are not equal to or less than zero.

2009-08-19 Kris Becker - Added new Extract method that applies an Affine transform to the extract a portion of the chip; added an assigment operator that sets the entire chip to a single value for convenience. Added a getter that returns a const reference to the internal Affine transform of this chip.

2009-08-20 Steven Lambright - Removed local cube pointer and parenthesis operator

2009-08-20 Travis Addair - Added Statistics method

2009-08-28 Kris Becker - Added new Affine setter method to establish a new Affine transform to the chip; added another Load method that uses a new Affine transform to load a chip from a cube.

2009-09-01 Travis Addair - Added valid Min/Max pixel value functionality for Statistics method

2010-01-28 Tracie Sucharski - In the Load method (with match chip) when calculating control points away from the corners, added a linc to move into the center of the chip in a non-linear fashion to prevent control points that fall in a line and cause the matrix inversion to fail.

2010-05-24 Jeannie Walldren - Fixed bug in the Load() method (with match chip). Modified to look for control points from each corner, rather than looping around. Added a method, PointsColinear() to check whether the points added are almost along the same line. Moved the code from Load() that chose new points to a new method, MovePoints().

2010-06-10 Jeannie Walldren - Modified PointsColinear() method to take in user defined tolerance as parameter to allow registration of more narrow search chip areas. Updated documentation, error messages, unitTest.

2010-06-15 Jeannie Walldren - Added set and accessor methods for Read() method's Interpolator::interpType. Updated documentation and unitTest.

2010-09-16 Jeannie Walldren - Updated unitTest, truth file and test cube to run properly with ShapeModel changes to Sensor class.

2011-03-29 Jai Rideout - Added copy constructor and equals operator.

2011-10-02 Kris Becker - Corrected a bug in the Extract(Chip, Affine) method when computing output pixels coordinates.

2015-07-06 David Miller - Modified code to better reflect current Coding Standards. Updated truth data. Fixes #2273

2017-08-30 Summer Stapleton - Updated documentation. References #4807.

Definition at line 86 of file Chip.h.

Constructor & Destructor Documentation

◆ Chip() [1/3]

Isis::Chip::Chip ( )

Constructs a Chip.

The default size is 3x3.

Definition at line 35 of file Chip.cpp.

References Init().

◆ Chip() [2/3]

Isis::Chip::Chip ( const Chip & other)

◆ Chip() [3/3]

Isis::Chip::Chip ( const int samples,
const int lines )

Construct a Chip with specified dimensions.

Parameters
samplesnumber of samples in the chip
linesnumber of lines in the chip

Definition at line 82 of file Chip.cpp.

References Init().

◆ ~Chip()

Isis::Chip::~Chip ( )
virtual

Destroys the Chip object.

Definition at line 88 of file Chip.cpp.

References m_clipPolygon.

Member Function Documentation

◆ ChipLine()

double Isis::Chip::ChipLine ( ) const
inline
Returns
The chip line after invoking SetCubePosition

Definition at line 226 of file Chip.h.

References m_chipLine.

Referenced by Isis::ChipViewport::cubeToViewport(), and Isis::Gruen::getChipUpdate().

◆ ChipSample()

double Isis::Chip::ChipSample ( ) const
inline
Returns
The chip sample after invoking SetCubePosition

Definition at line 219 of file Chip.h.

References m_chipSample.

Referenced by Isis::ChipViewport::cubeToViewport(), and Isis::Gruen::getChipUpdate().

◆ CubeLine()

◆ CubeSample()

◆ Extract() [1/3]

void Isis::Chip::Extract ( Chip & chipped,
Affine & affine )

Extract a subchip of this chip using an Affine transform.

This method will translate the data in this chip using an Affine transform to the output chip as provided. Note that the Affine transformation is only applied within the confines of this chip. No file I/O is performed.

A proper Affine transform should not deviate too much from the identity as the mapping operation may result in a NULL filled chip. The operation of this affine is added to the existing affine so proper relationship to the input cube (and any affine operations applied at load time) is preserved. This implies that the resulting affine should yield nearly identical results when read directly from the cube.

Bilinear interpolation is applied to surrounding transformed pixels to provide each new output pixel.

The chipped parameter will be updated to fully reflect the state of this original chip. The state of the chipped parameter dictates the size and the tack sample and line coordinates. Upon return, the corresponding cube sample and line coordinate is updated to the tack sample and line chip coordinate.

As such, note that an identity affine transform will yield identical results to the Chip::Extract method specifying the tack sample and line as the location to extract.

The following example demonstrates how to linearly shift a chip one pixel right and one down.

Chip mychip(35,35);
Cube cube("mycube.cub");
mychip.TackCube(200.0,200.0);
mychip.Load(cube);
Affine shift;
shift.Translate(-1.0,-1.0);
Chip ochip(15,15);
mychip.Extract(ochip, shift);
Affine basis function.
Definition Affine.h:65
void Translate(double tx, double ty)
Apply a translation to the current affine transform.
Definition Affine.cpp:134
A small chip of data used for pattern matching.
Definition Chip.h:86
IO Handler for Isis Cubes.
Definition Cube.h:168
Parameters
chippedInput/output chip containing the transformed subchip
affineAffine transform to apply to extract subchip

Definition at line 846 of file Chip.cpp.

References Isis::Affine::Forward(), GetValue(), Lines(), m_affine, m_cubeTackLine, m_cubeTackSample, m_filename, m_validMaximum, m_validMinimum, Isis::Null, Samples(), TackLine(), and TackSample().

◆ Extract() [2/3]

void Isis::Chip::Extract ( int samp,
int line,
Chip & chipped )

Extract a subchip centered at the designated coordinate.

This method extracts a subchip that is centered at the given sample and line coordinate. All appropriate variables in the given chipped parameter are set appropriately prior to return.

Parameters
sampCenter (tack) sample chip coordinate to extract subchip
lineCenter (tack) line chip coordinate to extract subchip
chippedChip to load the subchip in and return to caller

Definition at line 772 of file Chip.cpp.

References GetValue(), Lines(), m_affine, m_validMaximum, m_validMinimum, Isis::Null, Samples(), TackLine(), and TackSample().

◆ Extract() [3/3]

Chip Isis::Chip::Extract ( int samples,
int lines,
int samp,
int line )

Extract a sub-chip from a chip.

Parameters
samplesNumber of samples in the extracted chip (must be less than or equal to "this" chip)
linesNumber of lines in the extracted chip (must be less than or equal to "this" chip)
sampInput chip sample to be placed at output chip tack
lineInput chip line to be placed at output chip tack
Returns
Chip Sub-chip extracted from the chip
Exceptions
Isis::IException::Programmer- Chip extraction invalid
History
2010-06-10 Jeannie Walldren - Modified error message

Definition at line 727 of file Chip.cpp.

References GetValue(), Lines(), m_affine, m_validMaximum, m_validMinimum, Isis::Null, Isis::IException::Programmer, Samples(), TackLine(), TackSample(), and Isis::toString().

Referenced by Isis::AutoReg::ApplyGradientFilter(), Isis::InterestOperator::InterestByMeasure(), and Isis::InterestOperator::Operate().

◆ FileName()

QString Isis::Chip::FileName ( ) const
inline
Returns
The expanded filename of the cube from which this chip was chipped.

Definition at line 113 of file Chip.h.

References m_filename.

◆ GetReadInterpolator()

Interpolator::interpType Isis::Chip::GetReadInterpolator ( )
inline

Access method that returns the Interpolator Type used for loading a chip.

Returns
const Interpolator::interpType Interpolator used to read data from cube and put it into a chip.
See also
Read()
SetReadInterpolator()
Author
Jeannie Walldren
History
2010-06-05 Jeannie Walldren - Original version

Definition at line 309 of file Chip.h.

References m_readInterpolator.

◆ GetTransform()

const Affine & Isis::Chip::GetTransform ( ) const
inline

Returns the Affine transformation of chip-to-cube indices.

This method returns the affine transform used to load a chip from the same area as a match cube. It also is used to track the tack point line and sample translations from the chip indices to the absolute cube coordiates.

Returns
const Affine& Transform map from chip coordinates to cube coordinates

Definition at line 275 of file Chip.h.

References m_affine.

◆ GetValue() [1/2]

double Isis::Chip::GetValue ( int sample,
int line )
inline

Loads a Chip with a value.

For example,

Chip c(10,5);
c(1,1) = 1.1;
c(10,5) = 1.2;
Parameters
sampleSample position to load (1-based)
lineLine position to load (1-based)
Returns
(double) The value of the chip at the specified line/sample

Definition at line 145 of file Chip.h.

References m_buf.

Referenced by Isis::AutoReg::ComputeChipZScore(), Isis::ChipViewport::computeStretch(), Extract(), Extract(), Extract(), Isis::ForstnerOperator::Interest(), Isis::GradientOperator::Interest(), Isis::MoravecOperator::Interest(), Isis::StandardDeviationOperator::Interest(), IsValid(), Isis::ChipViewport::paintImage(), Isis::AutoReg::Reduce(), Isis::CentroidApolloPan::selectAdaptive(), and Write().

◆ GetValue() [2/2]

double Isis::Chip::GetValue ( int sample,
int line ) const
inline

Get a value from a Chip.

For example,

Chip c(10,5);
cout << c[3,3] << endl;
Parameters
sampleSample position to get (1-based)
lineLine position to get (1-based)
Returns
(double) The value of the chip at the specified line/sample

Definition at line 163 of file Chip.h.

References m_buf.

◆ Init()

void Isis::Chip::Init ( const int samples,
const int lines )
private

Common initialization used by constructors.

Parameters
samplesnumber of samples in the chip
linesnumber of lines in the chip
History
2010-06-15 Jeannie Walldren - Added call to set Read() method's interpolator default to Cubic Convolution type

Definition at line 116 of file Chip.cpp.

References m_clipPolygon, SetReadInterpolator(), SetSize(), and SetValidRange().

Referenced by Chip(), and Chip().

◆ IsInsideChip()

bool Isis::Chip::IsInsideChip ( double sample,
double line )
Parameters
sample
line
Returns
bool True if the given sample, line is inside the chip

Definition at line 162 of file Chip.cpp.

References m_chipLines, m_chipSamples, m_cubeTackLine, and m_cubeTackSample.

Referenced by Isis::ChipViewport::cubeToViewport().

◆ IsValid() [1/2]

bool Isis::Chip::IsValid ( double percentage)

Return if total number of valid pixels in chip meets a specified percentage of the entire chip.

Parameters
percentageThe percentage that the valid pixels percentage must exceed
Returns
bool Returns true if the percentage of valid pixels is greater than the specified percentage, and false if it is not

Definition at line 701 of file Chip.cpp.

References IsValid(), Lines(), and Samples().

◆ IsValid() [2/2]

bool Isis::Chip::IsValid ( int sample,
int line )
inline
Parameters
sampleSample position
lineLine position
Returns
(bool) Whether the value at the given sample, line position is within the valid range

Definition at line 240 of file Chip.h.

References GetValue(), m_validMaximum, and m_validMinimum.

Referenced by IsValid().

◆ Lines()

◆ Load() [1/3]

void Isis::Chip::Load ( Cube & cube,
Chip & match,
Cube & matchChipCube,
const double scale = 1.0,
const int band = 1 )

Loads cube data into the Chip.

The data will be loaded such that the position set using TackCube method will be put at the center of the chip. The data will be loaded to sub-pixel accuracy using the interpolator indicated using SetReadInterpolator() method. Additionally, the data will be loaded such that it matches the camera and/or projective geometry of a given Chip.

Parameters
cubeThe cube used to put data into the chip
matchMatch the geometry of this chip
matchChipCubeThe cube used to put data into the match chip
scalescale factor (default of 1)
bandBand number to use when loading (default of 1)
Exceptions
Isis::iException::Programmer- Chip cube is not a camera or map projection
Isis::iException::Programmer- Match chip cube is not a camera or map projection
Isis::iException::Programmer- Cannot find enough points to perform Affine transformation.
See also
Read()
SetReadInterpolator()
GetReadInterpolator()
History

2010-01-28 Tracie Sucharski - When calculating control points away from corners, added a linc to move into the center of the chip in a non-linear fashion to prevent control points that fall in a line and cause the matrix inversion to fail.

2010-05-24 Jeannie Walldren - Modified code when looking for control points for affine to start at each corner and move inward rather than looping around the corners. This lessens the likelyhood that the points will be too linear for the transform to work properly. A check was also added to ensure that we do not choose colinear points.

2010-06-10 Jeannie Walldren - Modified error message and added tolerance to linearity check. Fixed error messages.

Definition at line 300 of file Chip.cpp.

References Isis::Cube::camera(), Isis::Affine::Compute(), Isis::Cube::fileName(), Lines(), m_affine, m_cubeTackLine, m_cubeTackSample, m_filename, MovePoints(), PointsColinear(), Isis::Cube::projection(), Read(), Samples(), Isis::Affine::Scale(), Isis::Affine::Solve(), TackLine(), TackSample(), Isis::Affine::Translate(), Isis::IException::User, Isis::Affine::xp(), and Isis::Affine::yp().

◆ Load() [2/3]

void Isis::Chip::Load ( Cube & cube,
const Affine & affine,
const bool & keepPoly = true,
const int band = 1 )

Load a chip using an Affine transform as provided by caller.

This method will load data from a cube using an established Affine transform as provided by the caller. It is up to the caller to set up the affine appropriately.

For example, the first thing this method will do is set the chip tack point to the transformed cube location by replacing the existing affine transform with the one passed in and then calling SetChipPosition providing the chip tack point as the argument. This establishes which cube pixel is located at the chip tack point.

The data will be loaded to sub-pixel accuracy using the interpolator indicated using SetReadInterpolator() method.

Parameters
cubeCube to load the data from
affineAffine transform to set for chip load/operations
keepPolyIndicates whether clipping polygon should be kept or removed (default of true)
bandBand number to read data from (default of 1)
See also
Read()
SetReadInterpolator()
GetReadInterpolator()

Definition at line 244 of file Chip.cpp.

References Isis::Cube::fileName(), m_clipPolygon, m_filename, Read(), SetChipPosition(), SetTransform(), TackLine(), and TackSample().

◆ Load() [3/3]

void Isis::Chip::Load ( Cube & cube,
const double rotation = 0.0,
const double scale = 1.0,
const int band = 1 )

Load cube data into the Chip.

The data will be loaded such that the position set using TackCube method will be put at the center of the chip. The data will be loaded to sub-pixel accuracy using the interpolator indicated using SetReadInterpolator() method.

Parameters
cubeThe cube used to put data into the chip
rotationrotation in degrees of data about the cube tack point (default of 0)
scalescale factor (default of 1)
bandBand number to use when loading (default of 1)
See also
Read()
SetReadInterpolator()
GetReadInterpolator()

Definition at line 203 of file Chip.cpp.

References Isis::Cube::fileName(), Isis::Affine::Identity(), m_affine, m_cubeTackLine, m_cubeTackSample, m_filename, Read(), Isis::Affine::Rotate(), Isis::Affine::Scale(), and Isis::Affine::Translate().

Referenced by Isis::ChipViewport::geomChip(), Isis::InterestOperator::InterestByMeasure(), Isis::ChipViewport::nogeomChip(), Isis::InterestOperator::Operate(), Isis::ControlMeasureEditWidget::registerPoint(), Isis::ControlPointEdit::registerPoint(), Isis::ChipViewport::reloadChip(), Isis::ChipViewport::rotateChip(), Isis::ControlMeasureEditWidget::setLeftMeasure(), Isis::ControlPointEdit::setLeftMeasure(), Isis::ControlMeasureEditWidget::setRightMeasure(), and Isis::ControlPointEdit::setRightMeasure().

◆ MovePoints()

vector< int > Isis::Chip::MovePoints ( int startSamp,
int startLine,
int endSamp,
int endLine )
private

This method is called by Load() to move a control point across the chip.

Parameters
*startSampSample value to be increased, or moved right.
*startLineLine value to be increased, or moved downward.
*endSampSample value to be decreased, or moved left.
*endLineLine value to be decreased, or moved upward.
Returns
vector < int > Vector containing the new sample and line values in the same order as the parameters passed into the method.
Author
Tracie Sucharski
History
2010-05-24 Jeannie Walldren - Moved from Load() method to its own method since this code needed to be repeated several times.

Definition at line 615 of file Chip.cpp.

Referenced by Load().

◆ operator=()

Chip & Isis::Chip::operator= ( const Chip & other)

Copy assignment operator.

Parameters
otherchip to be copied to this
Returns
The chip that was copied from the other

Definition at line 1021 of file Chip.cpp.

References m_affine, m_buf, m_chipLine, m_chipLines, m_chipSample, m_chipSamples, m_clipPolygon, m_cubeLine, m_cubeSample, m_cubeTackLine, m_cubeTackSample, m_filename, m_readInterpolator, m_tackLine, m_tackSample, m_validMaximum, m_validMinimum, and Isis::PolygonTools::MakeMultiPolygon().

◆ PointsColinear()

bool Isis::Chip::PointsColinear ( double x0,
double y0,
double x1,
double y1,
double x2,
double y2,
double tol )
private

This method is called by Load() to determine whether the given 3 points are nearly colinear.

This is done by considering the triangle composed of these points. The method returns true if all angles of the triangle are greater than the tolerance angle and less than 180 degrees, minus the tolerance angle.

Parameters
x0The x-value of the first point
y0The y-value of the first point
x1The x-value of the second point
y1The y-value of the second point
x2The x-value of the third point
y2The y-value of the third point
tolMinimum tolerance angle in degrees
Returns
bool True if 3 given points are nearly colinear
Author
Jeannie Walldren
History

2010-05-24 Jeannie Walldren - Original version.

2010-06-10 Jeannie Walldren - Modified to take in user defined tolerance as parameter to allow registration of narrow search chip areas

Definition at line 546 of file Chip.cpp.

References Isis::PI.

Referenced by Load().

◆ Read()

void Isis::Chip::Read ( Cube & cube,
const int band )
private

This method reads data from a cube and puts it into the chip.

The affine transform is used in the SetChipPosition routine, so the geom of the chip is automatic. This method uses a default interpolator type of Cubic Convolution. This can be changed using SetReadInterpolator().

Parameters
cubeCube to read data from
bandBand number to read data from
See also
SetReadInterpolator
Todo
We could modify the affine class to return the coefficients and then compute the derivative of the change in cube sample and line with respect to chip sample or line. The change might make the geom run a bit faster.
See also
SetReadInterpolator()
GetReadInterpolator()
History
2010-06-15 Jeannie Walldren - Modified to allow any interpolator type except "None"

Definition at line 939 of file Chip.cpp.

References CubeLine(), CubeSample(), Isis::Cube::lineCount(), Lines(), m_buf, m_clipPolygon, m_readInterpolator, Isis::Cube::pixelType(), Isis::Cube::read(), Isis::Cube::sampleCount(), Samples(), and SetChipPosition().

Referenced by Load(), Load(), and Load().

◆ Samples()

◆ SetAllValues()

void Isis::Chip::SetAllValues ( const double & d)

Single value assignment operator.

Sets the entire chip to a constant

Parameters
dValue to set the chip to

Definition at line 100 of file Chip.cpp.

References m_buf.

◆ SetChipPosition()

void Isis::Chip::SetChipPosition ( const double sample,
const double line )

Compute the position of the cube given a chip coordinate.

Any rotation or geometric matching done during the Load process will be taken into account. Use CubeSample and CubeLine methods to obtain results. Note the results could be outside of the cube

Parameters
samplechip sample coordinate
linechip line coordinate

Definition at line 643 of file Chip.cpp.

References Isis::Affine::Compute(), m_affine, m_chipLine, m_chipSample, m_cubeLine, m_cubeSample, TackLine(), TackSample(), Isis::Affine::xp(), and Isis::Affine::yp().

Referenced by Isis::Gruen::getChipUpdate(), Isis::InterestOperator::InterestByMeasure(), Isis::ChipViewport::keyPressEvent(), Load(), Isis::ChipViewport::mousePressEvent(), Isis::InterestOperator::Operate(), Isis::ChipViewport::panDown(), Isis::ChipViewport::panLeft(), Isis::ChipViewport::panRight(), Isis::ChipViewport::panUp(), Read(), Isis::AutoReg::Register(), Isis::ChipViewport::tackLine(), and Isis::ChipViewport::tackSample().

◆ SetClipPolygon()

void Isis::Chip::SetClipPolygon ( const geos::geom::MultiPolygon & clipPolygon)

Sets the clipping polygon for this chip.

The coordinates must be in (sample,line) order. All Pixel values outside this polygon will be set to Null8. The cubic convolution interpolation is allowed to uses valid pixels outside the clipping area.

Parameters
clipPolygonThe polygons used to clip the chip

Definition at line 1008 of file Chip.cpp.

References Isis::PolygonTools::CopyMultiPolygon(), and m_clipPolygon.

Referenced by Isis::InterestOperator::InterestByMeasure(), and Isis::InterestOperator::Operate().

◆ SetCubePosition()

void Isis::Chip::SetCubePosition ( const double sample,
const double line )

Compute the position of the chip given a cube coordinate.

Any rotation or geometric matching done during the Load process will be taken into account. Use ChipSample and ChipLine methods to obtain results. Note that the results could be outside of the chip.

Parameters
samplechip sample coordinate
linechip line coordinate

Definition at line 660 of file Chip.cpp.

References Isis::Affine::ComputeInverse(), m_affine, m_chipLine, m_chipSample, m_cubeLine, m_cubeSample, TackLine(), TackSample(), Isis::Affine::x(), and Isis::Affine::y().

Referenced by Isis::ChipViewport::cubeToViewport().

◆ SetReadInterpolator()

void Isis::Chip::SetReadInterpolator ( const Interpolator::interpType type)
inline

Sets Interpolator Type for loading a chip.

This type is used in the Read() method.

Parameters
typeInterpolator type to be used.
Exceptions
IException::Programmer- Invalid Interpolator Type
See also
Read()
SetReadInterpolator()
Author
Jeannie Walldren
History
2010-06-05 Jeannie Walldren - Original version

Definition at line 323 of file Chip.h.

References m_readInterpolator, Isis::IException::Programmer, and Isis::toString().

Referenced by Init(), and Isis::AutoReg::SetChipInterpolator().

◆ SetSize()

void Isis::Chip::SetSize ( const int samples,
const int lines )

Change the size of the Chip.

Parameters
samplesnumber of samples in the chip
linesnumber of lines in the chip
Exceptions
Isis::iException::User- Samples and lines must be greater than zero.
History
2010-06-10 Jeannie Walldren - Modified error message

Definition at line 134 of file Chip.cpp.

References Isis::Affine::Identity(), m_affine, m_buf, m_chipLines, m_chipSamples, m_tackLine, m_tackSample, Isis::toString(), and Isis::IException::User.

Referenced by Isis::AutoReg::AutoReg(), Init(), Isis::AutoReg::Parse(), and Isis::AutoReg::Register().

◆ SetTransform()

void Isis::Chip::SetTransform ( const Affine & affine,
const bool & keepPoly = true )
inline

Sets the internal Affine transform to new translation.

Provides the ability to establish a new affine transformation without overhead of, say, loading the chip with a new translation. The caller also has the option to specify the disposition of an established polygon.

Parameters
affineNew affine tranform to set for this chip
keepPolyIndicates whether an existing polygon clipper should be kept (default of true)

Definition at line 290 of file Chip.h.

References m_affine, and m_clipPolygon.

Referenced by Load().

◆ SetValidRange()

void Isis::Chip::SetValidRange ( const double minimum = Isis::ValidMinimum,
const double maximum = Isis::ValidMaximum )

Set the valid range of data in the chip.

If never called all data in the chip is consider valid (other than special pixels).

Parameters
minimumminimum valid pixel value (default of Isis::ValidMinimum)
maximummaximum valid pixel value (default of Isis::ValidMaximum)
Exceptions
Isis::iException::Programmer- First parameter must be smaller than the second.
History
2010-06-10 Jeannie Walldren - Modified error message

Definition at line 681 of file Chip.cpp.

References m_validMaximum, m_validMinimum, Isis::IException::Programmer, and Isis::toString().

Referenced by Init(), and Isis::AutoReg::Parse().

◆ SetValue()

void Isis::Chip::SetValue ( int sample,
int line,
const double & value )
inline

Sets a value in the chip.

Parameters
sampleSample position to load (1-based)
lineLine position to load (1-based)
valueValue to set

Definition at line 126 of file Chip.h.

References m_buf.

Referenced by Isis::AutoReg::ApplyGradientFilter(), Isis::AutoReg::Init(), Isis::AutoReg::Reduce(), and Isis::AutoReg::Register().

◆ Statistics()

Isis::Statistics * Isis::Chip::Statistics ( )

Returns a statistics object of the current data in the chip.

The caller takes ownership of the returned instance.

Returns
Isis::Statistics* Statistics of the data in the chip

Definition at line 909 of file Chip.cpp.

References m_buf, m_chipLines, m_chipSamples, m_validMaximum, and m_validMinimum.

◆ TackCube()

◆ TackLine()

int Isis::Chip::TackLine ( ) const
inline

This method returns a chip's fixed tack line; the middle of the chip.

It is a chip coordinate, not a cube coordinate. For example, a chip with 5 lines will return 3, the middle pixel. A chip with 4 lines will return 2.

Returns
The fixed tack line of the chip.

Definition at line 187 of file Chip.h.

References m_tackLine.

Referenced by Extract(), Extract(), Extract(), Isis::Gruen::getChipUpdate(), Isis::ChipViewport::keyPressEvent(), Load(), Load(), Isis::ChipViewport::panDown(), Isis::ChipViewport::panLeft(), Isis::ChipViewport::panRight(), Isis::ChipViewport::panUp(), SetChipPosition(), SetCubePosition(), Isis::ChipViewport::tackLine(), and Isis::ChipViewport::tackSample().

◆ TackSample()

int Isis::Chip::TackSample ( ) const
inline

This method returns a chip's fixed tack sample; the middle of the chip.

It is a chip coordinate, not a cube coordinate. For example, a chip with 5 samples will return 3, the middle pixel. A chip with 4 samples will return 2.

Returns
The fixed tack sample of the chip.

Definition at line 176 of file Chip.h.

References m_tackSample.

Referenced by Extract(), Extract(), Extract(), Isis::Gruen::getChipUpdate(), Isis::ChipViewport::keyPressEvent(), Load(), Load(), Isis::ChipViewport::panDown(), Isis::ChipViewport::panLeft(), Isis::ChipViewport::panRight(), Isis::ChipViewport::panUp(), SetChipPosition(), SetCubePosition(), Isis::ChipViewport::tackLine(), and Isis::ChipViewport::tackSample().

◆ Write()

void Isis::Chip::Write ( const QString & filename)

Writes the contents of the Chip to a cube.

Parameters
filenameName of the cube to create

Definition at line 985 of file Chip.cpp.

References GetValue(), Lines(), Samples(), Isis::Cube::setDimensions(), and Isis::LineManager::SetLine().

Referenced by Isis::ControlMeasureEditWidget::saveChips(), and Isis::ControlPointEdit::saveChips().

Member Data Documentation

◆ m_affine

Affine Isis::Chip::m_affine
private

◆ m_buf

std::vector< std::vector<double> > Isis::Chip::m_buf
private

Chip buffer.

Definition at line 348 of file Chip.h.

Referenced by Chip(), GetValue(), GetValue(), operator=(), Read(), SetAllValues(), SetSize(), SetValue(), and Statistics().

◆ m_chipLine

double Isis::Chip::m_chipLine
private

chip line set by SetChip/CubePosition

Definition at line 359 of file Chip.h.

Referenced by Chip(), ChipLine(), operator=(), SetChipPosition(), and SetCubePosition().

◆ m_chipLines

int Isis::Chip::m_chipLines
private

Number of lines in the chip.

Definition at line 347 of file Chip.h.

Referenced by Chip(), IsInsideChip(), Lines(), operator=(), SetSize(), and Statistics().

◆ m_chipSample

double Isis::Chip::m_chipSample
private

chip sample set by SetChip/CubePosition

Definition at line 358 of file Chip.h.

Referenced by Chip(), ChipSample(), operator=(), SetChipPosition(), and SetCubePosition().

◆ m_chipSamples

int Isis::Chip::m_chipSamples
private

Number of samples in the chip.

Definition at line 346 of file Chip.h.

Referenced by Chip(), IsInsideChip(), operator=(), Samples(), SetSize(), and Statistics().

◆ m_clipPolygon

geos::geom::MultiPolygon* Isis::Chip::m_clipPolygon
private

clipping polygon set by SetClipPolygon

Definition at line 363 of file Chip.h.

Referenced by Chip(), Init(), Load(), operator=(), Read(), SetClipPolygon(), SetTransform(), and ~Chip().

◆ m_cubeLine

double Isis::Chip::m_cubeLine
private

cube line set by SetCubePosition

Definition at line 361 of file Chip.h.

Referenced by Chip(), CubeLine(), operator=(), SetChipPosition(), and SetCubePosition().

◆ m_cubeSample

double Isis::Chip::m_cubeSample
private

cube sample set by SetCubePosition

Definition at line 360 of file Chip.h.

Referenced by Chip(), CubeSample(), operator=(), SetChipPosition(), and SetCubePosition().

◆ m_cubeTackLine

double Isis::Chip::m_cubeTackLine
private

cube line at the chip tack

Definition at line 353 of file Chip.h.

Referenced by Chip(), Extract(), IsInsideChip(), Load(), Load(), operator=(), and TackCube().

◆ m_cubeTackSample

double Isis::Chip::m_cubeTackSample
private

cube sample at the chip tack

Definition at line 352 of file Chip.h.

Referenced by Chip(), Extract(), IsInsideChip(), Load(), Load(), operator=(), and TackCube().

◆ m_filename

QString Isis::Chip::m_filename
private

FileName of loaded cube.

Definition at line 373 of file Chip.h.

Referenced by Chip(), Extract(), FileName(), Load(), Load(), Load(), and operator=().

◆ m_readInterpolator

Interpolator::interpType Isis::Chip::m_readInterpolator
private

Interpolator type set by.

Definition at line 369 of file Chip.h.

Referenced by Chip(), GetReadInterpolator(), operator=(), Read(), and SetReadInterpolator().

◆ m_tackLine

int Isis::Chip::m_tackLine
private

Middle line of the chip.

Definition at line 350 of file Chip.h.

Referenced by Chip(), operator=(), SetSize(), and TackLine().

◆ m_tackSample

int Isis::Chip::m_tackSample
private

Middle sample of the chip.

Definition at line 349 of file Chip.h.

Referenced by Chip(), operator=(), SetSize(), and TackSample().

◆ m_validMaximum

double Isis::Chip::m_validMaximum
private

valid maximum chip pixel value

Definition at line 356 of file Chip.h.

Referenced by Chip(), Extract(), Extract(), Extract(), IsValid(), operator=(), SetValidRange(), and Statistics().

◆ m_validMinimum

double Isis::Chip::m_validMinimum
private

valid minimum chip pixel value

Definition at line 355 of file Chip.h.

Referenced by Chip(), Extract(), Extract(), Extract(), IsValid(), operator=(), SetValidRange(), and Statistics().


The documentation for this class was generated from the following files: