Isis Developer Reference
|
A small chip of data used for pattern matching. More...
#include <Chip.h>
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::Statistics * | Statistics () |
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. | |
Chip & | operator= (const Chip &other) |
Copy assignment operator. | |
const Affine & | GetTransform () 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. | |
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.
Isis::Chip::Chip | ( | ) |
Constructs a Chip.
The default size is 3x3.
Isis::Chip::Chip | ( | const Chip & | other | ) |
Constructs a copy of the passed in chip.
other | the chip to be copied |
References Isis::PolygonTools::MakeMultiPolygon().
Isis::Chip::Chip | ( | const int | samples, |
const int | lines ) |
Construct a Chip with specified dimensions.
samples | number of samples in the chip |
lines | number of lines in the chip |
|
virtual |
Destroys the Chip object.
|
inline |
Referenced by Isis::ChipViewport::cubeToViewport().
|
inline |
Referenced by Isis::ChipViewport::cubeToViewport().
|
inline |
Referenced by Isis::InterestOperator::InterestByMeasure(), Isis::ChipViewport::keyPressEvent(), Isis::ChipViewport::mousePressEvent(), Isis::InterestOperator::Operate(), Isis::ChipViewport::panDown(), Isis::ChipViewport::panLeft(), Isis::ChipViewport::panRight(), Isis::ChipViewport::panUp(), and Isis::ChipViewport::tackLine().
|
inline |
Referenced by Isis::InterestOperator::InterestByMeasure(), Isis::ChipViewport::keyPressEvent(), Isis::ChipViewport::mousePressEvent(), Isis::InterestOperator::Operate(), Isis::ChipViewport::panDown(), Isis::ChipViewport::panLeft(), Isis::ChipViewport::panRight(), Isis::ChipViewport::panUp(), and Isis::ChipViewport::tackSample().
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.
chipped | Input/output chip containing the transformed subchip |
affine | Affine transform to apply to extract subchip |
References Isis::Interpolator::BiLinearType, Isis::Double, Isis::Affine::Forward(), GetValue(), Lines(), Isis::Null, Samples(), TackLine(), and TackSample().
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.
samp | Center (tack) sample chip coordinate to extract subchip |
line | Center (tack) line chip coordinate to extract subchip |
chipped | Chip to load the subchip in and return to caller |
References GetValue(), Lines(), Isis::Null, Samples(), TackLine(), and TackSample().
Chip Isis::Chip::Extract | ( | int | samples, |
int | lines, | ||
int | samp, | ||
int | line ) |
Extract a sub-chip from a chip.
samples | Number of samples in the extracted chip (must be less than or equal to "this" chip) |
lines | Number of lines in the extracted chip (must be less than or equal to "this" chip) |
samp | Input chip sample to be placed at output chip tack |
line | Input chip line to be placed at output chip tack |
Isis::IException::Programmer | - Chip extraction invalid |
References _FILEINFO_, GetValue(), Lines(), Isis::Null, Isis::IException::Programmer, Samples(), TackLine(), TackSample(), and Isis::toString().
Referenced by Isis::InterestOperator::InterestByMeasure(), and Isis::InterestOperator::Operate().
|
inline |
|
inline |
Access method that returns the Interpolator Type used for loading a chip.
|
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.
|
inline |
Loads a Chip with a value.
For example,
sample | Sample position to load (1-based) |
line | Line position to load (1-based) |
Referenced by Extract(), Extract(), Extract(), Isis::ForstnerOperator::Interest(), Isis::GradientOperator::Interest(), Isis::MoravecOperator::Interest(), Isis::StandardDeviationOperator::Interest(), IsValid(), Isis::AutoReg::Reduce(), Isis::CentroidApolloPan::selectAdaptive(), and Write().
|
inline |
bool Isis::Chip::IsInsideChip | ( | double | sample, |
double | line ) |
sample | |
line |
Referenced by Isis::ChipViewport::cubeToViewport().
bool Isis::Chip::IsValid | ( | double | percentage | ) |
Return if total number of valid pixels in chip meets a specified percentage of the entire chip.
percentage | The percentage that the valid pixels percentage must exceed |
|
inline |
sample | Sample position |
line | Line position |
References GetValue().
Referenced by IsValid().
|
inline |
Referenced by Isis::ChipViewport::chipLines(), Isis::Selection::ellipseInChip(), Extract(), Extract(), Extract(), Isis::ForstnerOperator::Interest(), Isis::GradientOperator::Interest(), Isis::MoravecOperator::Interest(), Isis::StandardDeviationOperator::Interest(), IsValid(), Load(), Isis::AutoReg::Reduce(), Isis::AutoReg::Register(), Isis::CentroidApolloPan::selectAdaptive(), Isis::ChipViewport::setChip(), Isis::Threshold::Threshold(), and Write().
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.
cube | The cube used to put data into the chip |
match | Match the geometry of this chip |
matchChipCube | The cube used to put data into the match chip |
scale | scale factor (default of 1) |
band | Band number to use when loading (default of 1) |
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. |
References _FILEINFO_, Isis::Cube::camera(), Isis::Affine::Compute(), Isis::Cube::fileName(), Lines(), Isis::Cube::projection(), Samples(), Isis::Affine::Scale(), Isis::Affine::Solve(), TackLine(), TackSample(), Isis::Affine::Translate(), Isis::IException::User, Isis::Affine::xp(), and Isis::Affine::yp().
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.
cube | Cube to load the data from |
affine | Affine transform to set for chip load/operations |
keepPoly | Indicates whether clipping polygon should be kept or removed (default of true) |
band | Band number to read data from (default of 1) |
References Isis::Cube::fileName(), SetChipPosition(), SetTransform(), TackLine(), and TackSample().
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.
cube | The cube used to put data into the chip |
rotation | rotation in degrees of data about the cube tack point (default of 0) |
scale | scale factor (default of 1) |
band | Band number to use when loading (default of 1) |
References Isis::Cube::fileName(), Isis::Affine::Identity(), 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::ChipViewport::rotateChip(), Isis::ControlMeasureEditWidget::setLeftMeasure(), Isis::ControlPointEdit::setLeftMeasure(), Isis::ChipViewportsWidget::setPoint(), Isis::ControlMeasureEditWidget::setRightMeasure(), and Isis::ControlPointEdit::setRightMeasure().
Copy assignment operator.
other | chip to be copied to this |
References Isis::PolygonTools::MakeMultiPolygon().
|
inline |
Referenced by Isis::ChipViewport::chipSamples(), Isis::Selection::ellipseInChip(), Extract(), Extract(), Extract(), Isis::ForstnerOperator::Interest(), Isis::GradientOperator::Interest(), Isis::MoravecOperator::Interest(), Isis::StandardDeviationOperator::Interest(), IsValid(), Load(), Isis::AutoReg::Reduce(), Isis::AutoReg::Register(), Isis::CentroidApolloPan::selectAdaptive(), Isis::ChipViewport::setChip(), Isis::Threshold::Threshold(), and Write().
void Isis::Chip::SetAllValues | ( | const double & | d | ) |
Single value assignment operator.
Sets the entire chip to a constant
d | Value to set the chip to |
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
sample | chip sample coordinate |
line | chip line coordinate |
References Isis::Affine::Compute(), TackLine(), TackSample(), Isis::Affine::xp(), and Isis::Affine::yp().
Referenced by 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(), Isis::AutoReg::Register(), Isis::ChipViewport::tackLine(), and Isis::ChipViewport::tackSample().
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.
clipPolygon | The polygons used to clip the chip |
References Isis::PolygonTools::CopyMultiPolygon().
Referenced by Isis::InterestOperator::InterestByMeasure(), and Isis::InterestOperator::Operate().
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.
sample | chip sample coordinate |
line | chip line coordinate |
References Isis::Affine::ComputeInverse(), TackLine(), TackSample(), Isis::Affine::x(), and Isis::Affine::y().
Referenced by Isis::ChipViewport::cubeToViewport().
|
inline |
Sets Interpolator Type for loading a chip.
This type is used in the Read() method.
type | Interpolator type to be used. |
IException::Programmer | - Invalid Interpolator Type |
References _FILEINFO_, Isis::Interpolator::BiLinearType, Isis::Interpolator::CubicConvolutionType, Isis::Interpolator::NearestNeighborType, Isis::IException::Programmer, and Isis::toString().
Referenced by Isis::AutoReg::SetChipInterpolator().
void Isis::Chip::SetSize | ( | const int | samples, |
const int | lines ) |
Change the size of the Chip.
samples | number of samples in the chip |
lines | number of lines in the chip |
Isis::iException::User | - Samples and lines must be greater than zero. |
References _FILEINFO_, Isis::Affine::Identity(), Isis::toString(), and Isis::IException::User.
Referenced by Isis::AutoReg::AutoReg(), Isis::AutoReg::Parse(), and Isis::AutoReg::Register().
|
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.
affine | New affine tranform to set for this chip |
keepPoly | Indicates whether an existing polygon clipper should be kept (default of true) |
Referenced by Load().
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).
minimum | minimum valid pixel value (default of Isis::ValidMinimum) |
maximum | maximum valid pixel value (default of Isis::ValidMaximum) |
Isis::iException::Programmer | - First parameter must be smaller than the second. |
References _FILEINFO_, Isis::IException::Programmer, and Isis::toString().
Referenced by Isis::AutoReg::Parse().
|
inline |
Sets a value in the chip.
sample | Sample position to load (1-based) |
line | Line position to load (1-based) |
value | Value to set |
Referenced by Isis::AutoReg::Reduce(), and Isis::AutoReg::Register().
Isis::Statistics * Isis::Chip::Statistics | ( | ) |
Returns a statistics object of the current data in the chip.
The caller takes ownership of the returned instance.
void Isis::Chip::TackCube | ( | const double | cubeSample, |
const double | cubeLine ) |
This sets which cube position will be located at the chip tack position.
cubeSample | the cube sample value to tack |
cubeLine | the cube line value to tack |
References Isis::Affine::Identity(), and Isis::Affine::Translate().
Referenced by Isis::InterestOperator::InterestByMeasure(), Isis::InterestOperator::Operate(), Isis::ControlMeasureEditWidget::setLeftMeasure(), Isis::ControlPointEdit::setLeftMeasure(), Isis::ControlMeasureEditWidget::setLeftPosition(), Isis::ChipViewportsWidget::setPoint(), Isis::ControlMeasureEditWidget::setRightMeasure(), Isis::ControlPointEdit::setRightMeasure(), and Isis::ControlMeasureEditWidget::setRightPosition().
|
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.
Referenced by Extract(), Extract(), Extract(), 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().
|
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.
Referenced by Extract(), Extract(), Extract(), 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().
void Isis::Chip::Write | ( | const QString & | filename | ) |
Writes the contents of the Chip to a cube.
filename | Name of the cube to create |
References GetValue(), Lines(), Samples(), Isis::Cube::setDimensions(), and Isis::LineManager::SetLine().
Referenced by Isis::ControlMeasureEditWidget::saveChips(), and Isis::ControlPointEdit::saveChips().