40 p_interestAmount = 0.0;
41 p_worstInterest = 0.0;
91 p_samples = op[
"Samples"];
94 p_lines = op[
"Lines"];
97 p_deltaLine = op[
"DeltaLine"];
108 QString msg =
"Improper format for InterestOperator PVL [" + pPvl.
fileName() +
"]";
156 int piSample,
int piLine) {
161 QString msg =
"Cannot run interest on images with no camera. Image " +
162 pCube.
fileName() +
" has no Camera";
167 Chip chip(2 *
p_deltaSamp + p_samples + pad, 2 * p_deltaLine + p_lines + pad);
176 double dSmallestDist = DBL_MAX;
178 int iLines = 2 * p_deltaLine + p_lines / 2 + 1;
179 int iSamples = 2 *
p_deltaSamp + p_samples / 2 + 1;
180 bool bCalculateInterest =
false;
182 for (
int lin = p_lines / 2 + 1; lin <= iLines; lin++) {
183 for (
int samp = p_samples / 2 + 1; samp <= iSamples; samp++) {
188 bCalculateInterest =
false;
191 if (results.isValid()) {
192 bCalculateInterest =
true;
195 if (bCalculateInterest) {
196 Chip subChip = chip.
Extract(p_samples + pad, p_lines + pad, samp, lin);
197 double interest =
Interest(subChip);
200 double dist = std::sqrt(std::pow(piSample - samp, 2.0) + std::pow(piLine - lin, 2.0));
201 if (interest == dBestInterest && dist > dSmallestDist) {
205 dBestInterest = interest;
208 dSmallestDist = dist;
219 if (pUnivGrndMap.
SetImage(piSample, piLine)) {
220 p_interestAmount = dBestInterest;
225 p_interestAmount = dBestInterest;
247 QString psOverlapListFile) {
252 if (psOverlapListFile !=
"") {
272 int iNumMeasures = pCPoint.GetNumMeasures();
273 bool bPntEditLock = pCPoint.IsEditLocked();
281 for (
int measure = 0; measure < iNumMeasures; measure++) {
292 PvlGroup pvlMeasureGrp(
"MeasureDetails");
297 if (bMeasureLocked) {
301 if (!newMeasure->IsIgnored()) {
306 if (!results.isValid()) {
308 pvlMeasureGrp +=
Isis::PvlKeyword(
"UnIgnored",
"Failed Validation Test but not "
309 "Ignored as Point EditLock is True");
311 else if (bMeasureLocked == measure) {
316 pvlMeasureGrp +=
Isis::PvlKeyword(
"Ignored",
"Failed Emission, Incidence, Resolution "
317 "and/or Dn Value Test");
318 newMeasure->SetIgnored(
true);
320 piMeasuresModified++;
329 pPvlObj += pvlMeasureGrp;
332 if ((iNumMeasures - iMsrIgnored) < 2) {
335 "but Point EditLock is True");
364 int iPointsModified = 0;
365 int iMeasuresModified = 0;
374 for (
int point = 0; point < pNewNet.
GetNumPoints(); ++point) {
387 int numMeasures = newPnt->GetNumMeasures();
389 bool bRefLocked =
false;
390 int iOrigRefIndex = -1;
401 (iNumMeasuresLocked == 0 || (iNumMeasuresLocked > 0 && bRefLocked))) {
405 if (newPnt->IsEditLocked() || iNumMeasuresLocked > 0) {
411 if (*newPnt != origPnt) {
420 double dReferenceLat = 0, dReferenceLon = 0;
421 if (iBestMeasureIndex >= 0) {
428 bestCamera = bestCube->
camera();
438 bestCamera->
SetImage(dBestSample, dBestLine);
449 for (
int measure = 0; measure < numMeasures; ++measure) {
456 PvlGroup pvlMeasureGrp(
"MeasureDetails");
459 newMeasure->GetLine()));
462 if (!newMeasure->IsIgnored() && iBestMeasureIndex >= 0 &&
467 newMeasure->SetIgnored(
false);
473 measureCamera = measureCube->
camera();
481 measureCamera->
InCube()) {
483 if (measure == iBestMeasureIndex) {
497 double dSample = measureCamera->
Sample();
498 double dLine = measureCamera->
Line();
500 double origSample = newMeasure->GetSample();
501 double origLine = newMeasure->GetLine();
507 if (!results.isValid()) {
509 pvlMeasureGrp +=
Isis::PvlKeyword(
"Ignored",
"Failed Validation Test-" + results.toString());
510 newMeasure->SetIgnored(
true);
521 newMeasure->SetIgnored(
true);
522 if (!measureCamera->
InCube()) {
523 pvlMeasureGrp +=
Isis::PvlKeyword(
"Comments",
"New location is not in the Image");
531 newMeasure->SetIgnored(
true);
534 if (newMeasure != origPnt[measure]) {
535 iMeasuresModified ++;
543 pvlPointObj += pvlMeasureGrp;
547 if ((numMeasures - iNumIgnore) < 2) {
554 if (*newPnt != origPnt) {
558 if (!newPnt->IsIgnored() && iBestMeasureIndex != iOrigRefIndex) {
560 PvlGroup pvlRefChangeGrp(
"ReferenceChangeDetails");
561 if (iOrigRefIndex >= 0) {
576 if (newPnt->GetAprioriSurfacePointSource() == ControlPoint::SurfacePointSource::Reference) {
577 pvlRefChangeGrp +=
Isis::PvlKeyword(
"AprioriSource",
"Reference is the source and has changed");
580 pvlPointObj += pvlRefChangeGrp;
592 if (numMeasures == 0) {
593 QString sComment =
"Comment";
598 if (newPnt->IsIgnored()) {
599 QString sComment =
"Comment";
605 QString sComment =
"Comment";
610 QString sComment =
"Comment";
615 if (iNumMeasuresLocked > 0 && !bRefLocked) {
616 pvlPointObj +=
Isis::PvlKeyword(
"Error",
"Point has a Measure with EditLock set to true "
617 "but the Reference is not Locked");
620 for (
int measure = 0; measure < newPnt->GetNumMeasures(); measure++) {
651 const geos::geom::MultiPolygon *overlapPoly = NULL;
655 if (overlapPoly == NULL) {
656 QString msg =
"Unable to find overlap polygon for point [" +
657 pCnetPoint.
GetId() +
"]";
662 std::vector <PvlGroup> pvlGrpVector;
667 int iBestMeasureIndex = -1;
670 for (
int measure = 0; measure < pCnetPoint.GetNumMeasures(); ++measure) {
676 if (!origMsr->IsIgnored()) {
696 iBestMeasureIndex = measure;
705 return iBestMeasureIndex;
724 int iOrigSample = (int)(pCnetMeasure.GetSample() + 0.5);
725 int iOrigLine = (int)(pCnetMeasure.GetLine() + 0.5);
732 Chip chip(2 *
p_deltaSamp + p_samples + pad, 2 * p_deltaLine + p_lines + pad);
733 chip.
TackCube(iOrigSample, iOrigLine);
741 double dSmallestDist = DBL_MAX;
743 int iLines = 2 * p_deltaLine + p_lines / 2 + 1;
744 int iSamples = 2 *
p_deltaSamp + p_samples / 2 + 1;
745 bool bCalculateInterest =
false;
746 for (
int lin = p_lines / 2 + 1; lin <= iLines; lin++) {
747 for (
int samp = p_samples / 2 + 1; samp <= iSamples; samp++) {
752 bCalculateInterest =
false;
756 if (results.isValid()) {
757 bCalculateInterest =
true;
760 if (bCalculateInterest) {
761 Chip subChip = chip.
Extract(p_samples + pad, p_lines + pad, samp, lin);
762 double interest =
Interest(subChip);
766 double dist = std::sqrt(std::pow(iOrigSample - samp, 2.0) +
767 std::pow(iOrigLine - lin, 2.0));
768 if (interest == dBestInterest && dist > dSmallestDist) {
772 dBestInterest = interest;
773 dSmallestDist = dist;
803 if (camera->
SetImage(iOrigSample, iOrigLine)) {
806 pCube.
read(inPortal);
839 int exactMatchIndex = -1;
841 for (
int overlapIndex = 0; ((exactMatchIndex == -1) && (overlapIndex <
mOverlaps.
Size()));
846 if (overlap->Size() != pCnetPoint.GetNumMeasures())
853 for (
int measureIndex = 0;
854 measureIndex < pCnetPoint.GetNumMeasures();
856 if (measureIndex == numMatches) {
865 if (numMatches == pCnetPoint.GetNumMeasures()) {
866 exactMatchIndex = overlapIndex;
870 if (exactMatchIndex < 0) {
874 return mOverlaps[exactMatchIndex]->Polygon();
890 geos::geom::Geometry *geomIntersect1, *geomIntersect2;
893 QString sn1 = pCnetPoint[0]->GetCubeSerialNumber();
894 Cube *inCube1 = mCubeMgr.OpenCube(mSerialNumbers.fileName(sn1));
895 inCube1->
read((
Blob &)measPolygon1);
898 QString sn2 = pCnetPoint[1]->GetCubeSerialNumber();
899 Cube *inCube2 = mCubeMgr.OpenCube(mSerialNumbers.fileName(sn2));
900 inCube2->
read((
Blob &)measPolygon2);
904 (
const geos::geom::Geometry *)measPolygon2.Polys());
906 for (
int measureIndex = 2; measureIndex < pCnetPoint.GetNumMeasures(); measureIndex ++) {
907 QString sn3 = pCnetPoint[measureIndex]->GetCubeSerialNumber();
908 Cube *inCube3 = mCubeMgr.OpenCube(mSerialNumbers.fileName(sn3));
909 inCube3->
read((
Blob &)measPolygon3);
913 (
const geos::geom::Geometry *)measPolygon3.Polys());
914 geomIntersect1 = geomIntersect2;
927 return(int1 >= int2);
Status SetType(MeasureType type)
Set how the coordinate was obtained.
InterestOperator(Pvl &pPvl)
Create InterestOperator object.
void SetChipPosition(const double sample, const double line)
Compute the position of the cube given a chip coordinate.
PointType GetType() const
const geos::geom::MultiPolygon * FindOverlapByImageFootPrint(Isis::ControlPoint &pCnetPoint)
Find imageoverlaps by finding the intersection of image footprints.
void Parse(Pvl &pPvl)
Parse the Interest specific keywords.
int p_deltaSamp
Specified in the Pvl Operator group for the box car size.
const double Null
Value for an Isis Null pixel.
void SetMaximumSteps(const int steps)
This sets the maximum number of steps in the process.
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
(e.g., autoseed, interest) AKA predicted, unmeasured, unverified
A Constrained point is a Control Point whose lat/lon/radius is somewhat established and should not be...
PixelType pixelType() const
const double ValidMinimum
The minimum valid double value for Isis pixels.
A Fixed point is a Control Point whose lat/lon is well established and should not be changed...
geos::geom::MultiPolygon * p_clipPolygon
Clipping polygon set by SetClipPolygon (line,samp)
void ReadImageOverlaps(const QString &filename)
Create polygons of overlap from the file specified.
Camera * camera()
Return a camera associated with the cube.
bool InterestByMeasure(int piMeasure, Isis::ControlMeasure &pCnetMeasure, Isis::Cube &pCube)
Calculate interest for a measure by index.
A small chip of data used for pattern matching.
Buffer for containing a two dimensional section of an image.
Status SetIgnored(bool newIgnoreStatus)
Set whether to ignore or use control point.
Structure to hold Interest Results.
void addGroup(const Isis::PvlGroup &group)
Add a group to the object.
bool InCube()
This returns true if the current Sample() or Line() value is outside of the cube (meaning the point m...
double UniversalLatitude() const
Returns the planetocentric latitude, in degrees, at the surface intersection point in the body fixed ...
bool mbOverlaps
If Overlaplist exists.
void TackCube(const double cubeSample, const double cubeLine)
This sets which cube position will be located at the chip tack position.
double mdEmissionAngle
Store current Measure's Emission Angle.
Progress mStatus
Monitor the status of the app.
int InterestByPoint(ControlPoint &pCnetPoint)
Calculate interest for a Control Point.
QString fileName() const
Returns the filename used to initialise the Pvl object.
int Size()
Returns the total number of latitude and longitude overlaps.
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
int GetNumPoints() const
Return the number of control points in the network.
Isis::PvlGroup mOperatorGrp
Operator group that created this projection.
void read(Blob &blob) const
This method will read data from the specified Blob object.
SerialNumberList mSerialNumbers
Serial numbers list.
This error is for when a programmer made an API call that was illegal.
int miDeltaSample
The number of Samples the point has been moved.
CubeManager mCubeMgr
CubeManager to open and read cubes.
const ControlMeasure * GetRefMeasure() const
Get the reference control measure.
Chip Extract(int samples, int lines, int samp, int line)
Extract a sub-chip from a chip.
Create cube polygons, read/write polygons to blobs.
void CheckStatus()
Checks and updates the status.
double WorstInterest() const
Return the Worst(least value) Interest.
A Free point is a Control Point that identifies common measurements between two or more cubes...
QString LocationString(double pdSample, double pdLine) const
API to display location in the form "Sample,Line".
PvlGroup mStatisticsGrp
Pvl output Statistics Group.
QString fileName(const QString &sn)
Return a filename given a serial number.
virtual ~InterestOperator()
Destroy InterestOperator object.
QString msSerialNum
Serial Number of the Measure.
bool SetUniversalGround(const double latitude, const double longitude)
Sets the lat/lon values to get the sample/line values.
double mdResolution
Camera resolution at most interesting sample,line.
double UniversalLongitude() const
Returns the positive east, 0-360 domain longitude, in degrees, at the surface intersection point in t...
bool mbValid
Value of the interest operator result (success)
bool SetImage(const double sample, const double line)
Sets the sample/line values of the image to get the lat/lon values.
double mdIncidence
Incidence angle at most interesting sample,line.
const geos::geom::MultiPolygon * FindOverlap(Isis::ControlPoint &pCnetPoint)
Find if a point is in the overlap.
double mdBestLine
Most interesting line.
double mdInterest
Resulting interest amt from InterestOperator.
double mdDn
Cube DN value at most interesting sample,line.
Isis::ImageOverlapSet mOverlaps
Holds the overlaps from the Overlaplist.
int miDeltaLine
The number of Lines the point has been moved.
QString GetId() const
Return the Id of the control point.
double mdIncidenceAngle
Store current Measure's Incidence Angle.
void FindCnetRef(ControlNet &pNewNet)
Find best ref for an entire control net by calculating the interest and moving point to a better inte...
void SetText(const QString &text)
Changes the value of the text string reported just before 0% processed.
double EmissionAngle() const
Returns the emission angle in degrees.
Contains multiple PvlContainers.
#define _FILEINFO_
Macro for the filename and line number.
Status SetRefMeasure(ControlMeasure *cm)
Set the point's reference measure.
Isis::PvlGroup Operator()
Return the Operator name.
double Sample()
Returns the current sample number.
A type of error that could only have occurred due to a mistake on the user's part (e...
A single keyword-value pair.
virtual int Padding()
Sets an offset to pass in larger chips if operator requires it This is used to offset the subchip siz...
InterestResults * mtInterestResults
Holds the results of an interest computation.
void InitInterestResults(int piIndex)
Init Interest Results structure.
void ReadSerialNumbers(QString psSerialNumfile)
Read the Serial Numbers from the file and open assocaited cubes.
Container for cube-like labels.
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.
bool IsEditLocked() const
Return value for p_editLock or implicit lock on reference measure.
void SetPosition(const double sample, const double line, const int band)
Sets the line and sample position of the buffer.
void SetClipPolygon(const geos::geom::MultiPolygon &clipPolygon)
Sets the clipping polygon for this chip.
void InitInterestOptions()
Initialise Interest Options to defaults.
virtual double Interest(Chip &subCube)=0
Calculate the interest.
double mdDnValue
Store current Measure's DN Value.
Pvl mPvlLog
Pvl Log of all the processing.
bool SetImage(double sample, double line)
Returns whether the sample/line postion was set successfully in the camera model or projection...
double p_cubeLine
Point in a cube from a chip perspective.
MeasureValidationResults class.
MeasureValidationResults ValidStandardOptions(const ControlMeasure *pMeasure, Cube *pCube, PvlGroup *pMeasureGrp=NULL)
Validate Standard options to pick a reference based on a particular criteria.
bool HasCamera()
Returns whether the ground map has a camera or not.
double Line()
Returns the current line number.
void SetClipPolygon(const geos::geom::MultiPolygon &clipPolygon)
Set the Clip Polygon for points to be contained in the overlaps.
double PixelResolution()
Returns the pixel resolution at the current position in meters/pixel.
Status SetChooserName()
Set chooser name to a user who last changed the coordinate.
double p_minimumInterest
Specified in the Pvl Operator group.
double mdOrigLine
Control Measure's original line.
QString GetCubeSerialNumber() const
Return the serial number of the cube containing the coordinate.
Status SetCoordinate(double sample, double line)
Set the coordinate of the measurement.
double mdEmission
Emission angle at most interesting sample,line.
QString fileName() const
Returns the opened cube's filename.
int GetNumLockedMeasures() const
Returns the number of locked control measures.
Status SetDateTime()
Date Time - Creation Time.
double CubeSample() const
Returns cube sample after invoking SetChipPosition.
double mdBestSample
Most interesting sample.
Individual overlap container.
void ProcessLocked_Point_Reference(ControlPoint &pCPoint, PvlObject &pPvlObj, int &piMeasuresModified)
Process (Validate and Log) Point with Lock or with Referemce Measure Locked.
bool Operate(Cube &pCube, UniversalGroundMap &pUnivGrndMap, int piSample, int piLine)
Operate used by the app interestcube- to calculate interest by sample,line.
double mdResolution
Store current Measure's Resolution.
double IncidenceAngle() const
Returns the incidence angle in degrees.
Contains Pvl Groups and Pvl Objects.
const ControlMeasure * GetMeasure(QString serialNumber) const
Get a control measure based on its cube's serial number.
bool HasSerialNumber(QString &sn) const
This method will return true if input serial number exists in the ImageOverlap.
int IndexOfRefMeasure() const
Cube * OpenCube(const QString &cubeFileName)
This method opens a cube.
double mdOrigSample
Control Measure's original sample.
ControlNetValidMeasure class.
virtual bool CompareInterests(double int1, double int2)
Compare for int1 greater than / equal to int2.
IO Handler for Isis Cubes.