9#include "ControlNetValidMeasure.h"
12#include "ControlMeasure.h"
13#include "CubeManager.h"
14#include "MeasureValidationResults.h"
15#include "SerialNumberList.h"
16#include "SpecialPixel.h"
17#include "UniversalGroundMap.h"
32 if(pPvl != NULL && pPvl->hasGroup(
"ValidMeasure")) {
52 if(pPvl.hasGroup(
"ValidMeasure")) {
184 Camera *measureCamera = NULL;
187 measureCamera = pCube->camera();
190 QString msg =
"Cannot Create Camera for Image:" + pCube->fileName();
196 pCube, measureCamera, pMeasureGrp);
215 if (measureCamera != NULL) {
216 bool success = measureCamera->SetImage(pSample, pLine);
224 if (pMeasure != NULL) {
225 double temp = pMeasure->GetSampleResidual();
230 temp = pMeasure->GetLineResidual();
235 temp = pMeasure->GetResidualMagnitude();
240 temp = pMeasure->GetSampleShift();
245 temp = pMeasure->GetLineShift();
250 temp = pMeasure->GetPixelShift();
258 inPortal.SetPosition(pSample, pLine, 1);
259 pCube->read(inPortal);
263 if(pMeasureGrp != NULL) {
270 *pMeasureGrp +=
Isis::PvlKeyword(
"EmissionAngle",
"Invalid Emission Angle");
271 *pMeasureGrp +=
Isis::PvlKeyword(
"IncidenceAngle",
"Invalid Incidence Angle");
286 MeasureValidationResults results;
290 results.addFailure(MeasureValidationResults::EmissionAngle,
295 results.addFailure(MeasureValidationResults::IncidenceAngle,
300 results.addFailure(MeasureValidationResults::Resolution,
307 results.addFailure(MeasureValidationResults::DNValue,
314 results.addFailure(MeasureValidationResults::PixelsFromEdge,
miPixelsFromEdge);
318 results.addFailure(MeasureValidationResults::MetersFromEdge,
323 if(pMeasure != NULL) {
346 double pSample,
double pLine,
Cube *pCube,
PvlGroup *pMeasureGrp) {
368 double dSample, dLine;
369 dSample = pMeasure->GetSample();
370 dLine = pMeasure->GetLine();
380 double dSample, dLine;
381 dSample = pMeasure->GetSample();
382 dLine = pMeasure->GetLine();
385 pCube, camera, pMeasureGrp);
446 QString msg =
"Invalid Resolution value(s), Resolution must be greater than zero";
451 QString msg =
"MinResolution must be less than MaxResolution";
484 QString msg =
"MinDN must be less than MaxDN";
501 if(mdMinEmissionAngle < 0 || mdMinEmissionAngle > 135) {
502 QString msg =
"Invalid Min Emission Angle, Valid Range is [0-135]";
511 if(mdMaxEmissionAngle < 0 || mdMaxEmissionAngle > 135) {
512 QString msg =
"Invalid Max Emission Angle, Valid Range is [0-135]";
519 QString msg =
"Min EmissionAngle must be less than Max EmissionAngle";
537 if(mdMinIncidenceAngle < 0 || mdMinIncidenceAngle > 135) {
538 QString msg =
"Invalid Min Incidence Angle, Valid Range is [0-135]";
547 if(mdMaxIncidenceAngle < 0 || mdMaxIncidenceAngle > 135) {
548 QString msg =
"Invalid Max Incidence Angle, Valid Range is [0-135]";
555 QString msg =
"Min IncidenceAngle must be less than Max IncidenceAngle";
567 bool bResMag =
false;
571 QString msg =
"Invalid Sample Residual, must be greater than zero";
581 QString msg =
"Invalid Line Residual, must be greater than zero";
591 QString msg =
"Invalid Residual Magnitude Tolerance, must be greater than zero";
598 if(bRes && bResMag) {
599 QString msg =
"Cannot have both Sample/Line Residuals and Residual Magnitude.";
600 msg +=
"\nChoose either Sample/Line Residual or Residual Magnitude";
611 bool hasSampleLineShift =
false;
615 QString msg =
"Invalid Sample Shift tolerance:"
616 " must be greater than or equal to zero";
619 hasSampleLineShift =
true;
626 QString msg =
"Invalid Line Shift tolerance:"
627 " must be greater than or equal to zero";
630 hasSampleLineShift =
true;
634 bool hasPixelShift =
false;
638 QString msg =
"Invalid Pixel Shift tolerance:"
639 " must be greater than or equal to zero";
642 hasPixelShift =
true;
646 if (hasSampleLineShift && hasPixelShift) {
647 QString msg =
"Cannot have both Sample/Line Shift and Pixel Shift";
648 msg +=
" tolerances.\n";
649 msg +=
"Choose either Sample/Line Shift or Pixel Shift to validate on";
740 double pdLineResidual,
double pdResidualMagnitude,
750 pResults.addFailure(MeasureValidationResults::LineResidual,
mdLineResTolerance,
"greater");
754 pResults.addFailure(MeasureValidationResults::ResidualMagnitude,
mdResidualTolerance,
"greater");
773 double sampleShift,
double lineShift,
double pixelShift,
780 results.addFailure(MeasureValidationResults::SampleShift,
785 results.addFailure(MeasureValidationResults::LineShift,
790 results.addFailure(MeasureValidationResults::PixelShift,
829 int iNumSamples = pCube->sampleCount();
830 int iNumLines = pCube->lineCount();
871 int iNumSamples = pCube->sampleCount();
872 int iNumLines = pCube->lineCount();
876 Camera *camera = pCube->camera();
877 double resMetersTotal = 0;
878 bool bMinDistance =
false;
881 for(
int line = piLine - 1; line > 0; line--) {
884 resMetersTotal += resolution;
895 bMinDistance =
false;
897 for(
int line = piLine + 1; line <= iNumLines; line++) {
900 resMetersTotal += resolution;
912 bMinDistance =
false;
913 for(
int sample = piSample - 1; sample > 0; sample--) {
916 resMetersTotal += resolution;
928 bMinDistance =
false;
929 for(
int sample = piSample + 1; sample <= iNumSamples; sample++) {
932 resMetersTotal += resolution;
940 QString msg =
"Cannot Create Camera for Image [" +
941 pCube->fileName() +
"]";
virtual double PixelResolution()
Returns the pixel resolution at the current position in meters/pixel.
virtual bool SetImage(const double sample, const double line)
Sets the sample/line values of the image to get the lat/lon values.
double mdMaxResolution
Standard Option MaxResolution.
double m_lineShift
Store current Measure's Line Shift.
void Parse(Pvl &pvlDef)
Parse the DefFile for Standard Options.
bool mbCameraRequired
To improve speed, flag to indicate if Camera needs to be opened.
bool ValidResidualTolerances(double pdSampleResidual, double pdLineResidual, double pdResidualMagnitude, MeasureValidationResults &pResults)
Validate whether the Residuals are within the set Tolerance.
void ValidatePvlDN(void)
Validate PVL Min & Max DN Standard Options.
double m_sampleShift
Store current Measure's Sample Shift.
double mdSampleResTolerance
Standard Option Sample Residual.
double mdMinIncidenceAngle
Standard Option MinIncidenceAngle.
bool PixelsFromEdge(int piSample, int piLine, Cube *pCube)
Test for a point to be user defined number of pixels from the edge.
double m_pixelShift
Store current Measure's Pixel Shift.
double mdMetersFromEdge
Standard Option MeteresFromEdge.
MeasureValidationResults ValidStandardOptions(const ControlMeasure *pMeasure, Cube *pCube, PvlGroup *pMeasureGrp=NULL)
Validate Standard options to pick a reference based on a particular criteria.
double m_sampleShiftTolerance
Standard Option Sample Shift.
double mdResidualMagnitude
Store current Measure's Residual Magnitude.
bool MetersFromEdge(int piSample, int piLine, Cube *pCube)
Test for a point to be user defined number of meters from the edge.
ControlNetValidMeasure(Pvl *pvl=0)
Constructor - Initializes the data members and parses the input Pvl .
bool ValidShiftTolerances(double sampleShift, double lineShift, double pixelShift, MeasureValidationResults &results)
Validate whether the Sample and Line Shifts and Pixel Shift are within the set Tolerances.
PvlGroup mStdOptionsGrp
Pvl Standard Options Group.
bool ValidResolution(double pdResolution)
Validate whether the Resolution is in the set Range.
void ValidatePvlResolution(void)
Validate PVL Min & Max Resolution Standard Options.
void ValidatePvlEmissionAngle(void)
Validate PVL Min & Max EmissionAngle Standard Options.
double mdLineResTolerance
Standard Option Line Residual.
double mdMinDN
Standard Option MinDN.
double mdSampleResidual
Store current Measure's Sample Residual.
double mdLineResidual
Store current Measure's Line Residual.
double mdMaxDN
Standard Option MaxDN.
bool ValidIncidenceAngle(double pdIncidenceAngle)
Validate whether the Incidence Angle is in the set Range.
double mdMinEmissionAngle
Standard Option MinEmissionAngle.
CubeManager mCubeMgr
CubeManager to open and read cubes.
PvlGroup mStatisticsGrp
Pvl output Statistics Group.
double mdEmissionAngle
Store current Measure's Emission Angle.
double mdDnValue
Store current Measure's DN Value.
double mdMaxIncidenceAngle
Standard Option MaxIncidenceAngle.
void ValidatePvlResidualTolerances(void)
Validate Pvl Sample, Line, Residual Magnitude Tolerances.
bool mbValidateFromEdge
Check if Pixels/Meters from edge needs to be Validated.
SerialNumberList mSerialNumbers
Serial numbers list.
double m_pixelShiftTolerance
Standard Option Pixel Shift.
void InitStdOptionsGroup(void)
Initialize the Standard Options Pvl Group with no DefFile.
bool ValidEmissionAngle(double pdEmissionAngle)
Validate whether the Emission Angle is in the set Range.
void ValidatePvlShiftTolerances()
Validate Pvl Sample, Line, Pixel (Sample and Line) Magnitude Shift Tolerances.
double mdResidualTolerance
Standard Option Residual Magnitude.
Pvl mPvlLog
Pvl Log of all the processing.
int miPixelsFromEdge
Standard Option PixelsFromEdge.
double m_lineShiftTolerance
Standard Option Line Shift.
double mdMinResolution
Standard Option MinResolution.
Progress mStatus
Monitor the status of the app.
bool mbValidateDN
Check if DN needs to be Validated.
bool ValidDnValue(double pdDnValue)
Validate whether the DN Value is in the set Range.
virtual ~ControlNetValidMeasure()
Destructor: clean up stuff relevant for this class.
double mdResolution
Store current Measure's Resolution.
PvlGroup mPvlOpGrp
Pvl Operator Group.
void InitStdOptions(void)
Initialize the Standard Options.
void ReadSerialNumbers(QString psSerialNumfile)
Read the Serial Numbers from the file and open assocaited cubes.
bool ValidLatLon(Isis::Camera *pCamera, int piSample, int piLine)
Validate the Lat/Lon.
double mdIncidenceAngle
Store current Measure's Incidence Angle.
void ValidatePvlIncidenceAngle(void)
Validate PVL Min & Max IncidenceAngle Standard Options.
void ValidatePvlFromEdge(void)
Validate and read Pixels and Meters from Edge Standard Options.
double mdMaxEmissionAngle
Standard Option MaxEmissionAngle.
IO Handler for Isis Cubes.
void SetNumOpenCubes(unsigned int numCubes)
This sets the maximum number of opened cubes for this instance of CubeManager.
void CleanCubes(const QString &cubeFileName)
This method removes a cube from memory, if it exists.
@ User
A type of error that could only have occurred due to a mistake on the user's part (e....
MeasureValidationResults class.
Buffer for containing a two dimensional section of an image.
bool hasKeyword(const QString &name) const
Check to see if a keyword exists.
Contains multiple PvlContainers.
Container for cube-like labels.
A single keyword-value pair.
@ Traverse
Search child objects.
Serial Number list generator.
This is free and unencumbered software released into the public domain.
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
const double ValidMaximum
The maximum valid double value for Isis pixels.
const double Null
Value for an Isis Null pixel.
const double ValidMinimum
The minimum valid double value for Isis pixels.
bool IsSpecial(const double d)
Returns if the input pixel is special.