5 #include "CubeManager.h" 24 if(pPvl != NULL && pPvl->
hasGroup(
"ValidMeasure")) {
176 Camera *measureCamera = NULL;
179 measureCamera = pCube->
camera();
182 QString msg =
"Cannot Create Camera for Image:" + pCube->
fileName();
188 pCube, measureCamera, pMeasureGrp);
207 if (measureCamera != NULL) {
208 bool success = measureCamera->
SetImage(pSample, pLine);
216 if (pMeasure != NULL) {
217 double temp = pMeasure->GetSampleResidual();
222 temp = pMeasure->GetLineResidual();
232 temp = pMeasure->GetSampleShift();
237 temp = pMeasure->GetLineShift();
242 temp = pMeasure->GetPixelShift();
251 pCube->
read(inPortal);
255 if(pMeasureGrp != NULL) {
262 *pMeasureGrp +=
Isis::PvlKeyword(
"EmissionAngle",
"Invalid Emission Angle");
263 *pMeasureGrp +=
Isis::PvlKeyword(
"IncidenceAngle",
"Invalid Incidence Angle");
278 MeasureValidationResults results;
282 results.addFailure(MeasureValidationResults::EmissionAngle,
287 results.addFailure(MeasureValidationResults::IncidenceAngle,
292 results.addFailure(MeasureValidationResults::Resolution,
299 results.addFailure(MeasureValidationResults::DNValue,
306 results.addFailure(MeasureValidationResults::PixelsFromEdge,
miPixelsFromEdge);
310 results.addFailure(MeasureValidationResults::MetersFromEdge,
315 if(pMeasure != NULL) {
338 double pSample,
double pLine,
Cube *pCube,
PvlGroup *pMeasureGrp) {
360 double dSample, dLine;
361 dSample = pMeasure->GetSample();
362 dLine = pMeasure->GetLine();
372 double dSample, dLine;
373 dSample = pMeasure->GetSample();
374 dLine = pMeasure->GetLine();
377 pCube, camera, pMeasureGrp);
438 QString msg =
"Invalid Resolution value(s), Resolution must be greater than zero";
443 QString msg =
"MinResolution must be less than MaxResolution";
476 QString msg =
"MinDN must be less than MaxDN";
493 if(mdMinEmissionAngle < 0 || mdMinEmissionAngle > 135) {
494 QString msg =
"Invalid Min Emission Angle, Valid Range is [0-135]";
503 if(mdMaxEmissionAngle < 0 || mdMaxEmissionAngle > 135) {
504 QString msg =
"Invalid Max Emission Angle, Valid Range is [0-135]";
511 QString msg =
"Min EmissionAngle must be less than Max EmissionAngle";
529 if(mdMinIncidenceAngle < 0 || mdMinIncidenceAngle > 135) {
530 QString msg =
"Invalid Min Incidence Angle, Valid Range is [0-135]";
539 if(mdMaxIncidenceAngle < 0 || mdMaxIncidenceAngle > 135) {
540 QString msg =
"Invalid Max Incidence Angle, Valid Range is [0-135]";
547 QString msg =
"Min IncidenceAngle must be less than Max IncidenceAngle";
559 bool bResMag =
false;
563 QString msg =
"Invalid Sample Residual, must be greater than zero";
573 QString msg =
"Invalid Line Residual, must be greater than zero";
583 QString msg =
"Invalid Residual Magnitude Tolerance, must be greater than zero";
590 if(bRes && bResMag) {
591 QString msg =
"Cannot have both Sample/Line Residuals and Residual Magnitude.";
592 msg +=
"\nChoose either Sample/Line Residual or Residual Magnitude";
603 bool hasSampleLineShift =
false;
607 QString msg =
"Invalid Sample Shift tolerance:" 608 " must be greater than or equal to zero";
611 hasSampleLineShift =
true;
618 QString msg =
"Invalid Line Shift tolerance:" 619 " must be greater than or equal to zero";
622 hasSampleLineShift =
true;
626 bool hasPixelShift =
false;
630 QString msg =
"Invalid Pixel Shift tolerance:" 631 " must be greater than or equal to zero";
634 hasPixelShift =
true;
638 if (hasSampleLineShift && hasPixelShift) {
639 QString msg =
"Cannot have both Sample/Line Shift and Pixel Shift";
640 msg +=
" tolerances.\n";
641 msg +=
"Choose either Sample/Line Shift or Pixel Shift to validate on";
732 double pdLineResidual,
double pdResidualMagnitude,
742 pResults.addFailure(MeasureValidationResults::LineResidual,
mdLineResTolerance,
"greater");
746 pResults.addFailure(MeasureValidationResults::ResidualMagnitude,
mdResidualTolerance,
"greater");
765 double sampleShift,
double lineShift,
double pixelShift,
772 results.addFailure(MeasureValidationResults::SampleShift,
777 results.addFailure(MeasureValidationResults::LineShift,
782 results.addFailure(MeasureValidationResults::PixelShift,
869 double resMetersTotal = 0;
870 bool bMinDistance =
false;
873 for(
int line = piLine - 1; line > 0; line--) {
876 resMetersTotal += resolution;
887 bMinDistance =
false;
889 for(
int line = piLine + 1; line <= iNumLines; line++) {
892 resMetersTotal += resolution;
904 bMinDistance =
false;
905 for(
int sample = piSample - 1; sample > 0; sample--) {
908 resMetersTotal += resolution;
920 bMinDistance =
false;
921 for(
int sample = piSample + 1; sample <= iNumSamples; sample++) {
924 resMetersTotal += resolution;
932 QString msg =
"Cannot Create Camera for Image [" +
void ValidatePvlEmissionAngle(void)
Validate PVL Min & Max EmissionAngle Standard Options.
double m_pixelShift
Store current Measure's Pixel Shift.
bool hasKeyword(const QString &name) const
Check to see if a keyword exists.
double m_pixelShiftTolerance
Standard Option Pixel Shift.
double m_sampleShift
Store current Measure's Sample Shift.
const double Null
Value for an Isis Null pixel.
double m_sampleShiftTolerance
Standard Option Sample Shift.
bool ValidResolution(double pdResolution)
Validate whether the Resolution is in the set Range.
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
const double ValidMinimum
The minimum valid double value for Isis pixels.
bool PixelsFromEdge(int piSample, int piLine, Cube *pCube)
Test for a point to be user defined number of pixels from the edge.
void ValidatePvlFromEdge(void)
Validate and read Pixels and Meters from Edge Standard Options.
Camera * camera()
Return a camera associated with the cube.
double mdMaxDN
Standard Option MaxDN.
Buffer for containing a two dimensional section of an image.
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.
double mdLineResTolerance
Standard Option Line Residual.
void InitStdOptions(void)
Initialize the Standard Options.
bool mbValidateFromEdge
Check if Pixels/Meters from edge needs to be Validated.
double GetResidualMagnitude() const
Return Residual magnitude.
PvlGroup mStdOptionsGrp
Pvl Standard Options Group.
bool ValidDnValue(double pdDnValue)
Validate whether the DN Value is in the set Range.
double m_lineShiftTolerance
Standard Option Line Shift.
double mdEmissionAngle
Store current Measure's Emission Angle.
Progress mStatus
Monitor the status of the app.
bool hasGroup(const QString &name) const
Returns a boolean value based on whether the object has the specified group or not.
bool mbValidateDN
Check if DN needs to be Validated.
ControlNetValidMeasure(Pvl *pvl=0)
Constructor - Initializes the data members and parses the input Pvl .
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
SerialNumberList mSerialNumbers
Serial numbers list.
CubeManager mCubeMgr
CubeManager to open and read cubes.
double mdMaxEmissionAngle
Standard Option MaxEmissionAngle.
double mdSampleResTolerance
Standard Option Sample Residual.
bool ValidLatLon(Isis::Camera *pCamera, int piSample, int piLine)
Validate the Lat/Lon.
PvlGroup mStatisticsGrp
Pvl output Statistics Group.
double mdSampleResidual
Store current Measure's Sample Residual.
void SetNumOpenCubes(unsigned int numCubes)
This sets the maximum number of opened cubes for this instance of CubeManager.
void ValidatePvlDN(void)
Validate PVL Min & Max DN Standard Options.
virtual ~ControlNetValidMeasure()
Destructor: clean up stuff relevant for this class.
double EmissionAngle() const
Returns the emission angle in degrees.
bool SetImage(const double sample, const double line)
Sets the sample/line values of the image to get the lat/lon values.
double mdResidualMagnitude
Store current Measure's Residual Magnitude.
bool ValidIncidenceAngle(double pdIncidenceAngle)
Validate whether the Incidence Angle is in the set Range.
double mdMetersFromEdge
Standard Option MeteresFromEdge.
void ValidatePvlResidualTolerances(void)
Validate Pvl Sample, Line, Residual Magnitude Tolerances.
void ValidatePvlShiftTolerances()
Validate Pvl Sample, Line, Pixel (Sample and Line) Magnitude Shift Tolerances.
void InitStdOptionsGroup(void)
Initialize the Standard Options Pvl Group with no DefFile.
double mdIncidenceAngle
Store current Measure's Incidence Angle.
void ValidatePvlIncidenceAngle(void)
Validate PVL Min & Max IncidenceAngle Standard Options.
double m_lineShift
Store current Measure's Line Shift.
Contains multiple PvlContainers.
int miPixelsFromEdge
Standard Option PixelsFromEdge.
bool ValidResidualTolerances(double pdSampleResidual, double pdLineResidual, double pdResidualMagnitude, MeasureValidationResults &pResults)
Validate whether the Residuals are within the set Tolerance.
#define _FILEINFO_
Macro for the filename and line number.
PvlGroup mPvlOpGrp
Pvl Operator Group.
A type of error that could only have occurred due to a mistake on the user's part (e...
A single keyword-value pair.
double mdMaxResolution
Standard Option MaxResolution.
void read(Blob &blob) const
This method will read data from the specified Blob object.
bool IsSpecial(const double d)
Returns if the input pixel is special.
void ReadSerialNumbers(QString psSerialNumfile)
Read the Serial Numbers from the file and open assocaited cubes.
Container for cube-like labels.
double mdMinDN
Standard Option MinDN.
PixelType pixelType() const
void SetPosition(const double sample, const double line, const int band)
Sets the line and sample position of the buffer.
double mdDnValue
Store current Measure's DN Value.
double mdResidualTolerance
Standard Option Residual Magnitude.
Pvl mPvlLog
Pvl Log of all the processing.
MeasureValidationResults class.
const double ValidMaximum
The maximum valid double value for Isis pixels.
double mdMinEmissionAngle
Standard Option MinEmissionAngle.
MeasureValidationResults ValidStandardOptions(const ControlMeasure *pMeasure, Cube *pCube, PvlGroup *pMeasureGrp=NULL)
Validate Standard options to pick a reference based on a particular criteria.
virtual QString fileName() const
Returns the opened cube's filename.
void ValidatePvlResolution(void)
Validate PVL Min & Max Resolution Standard Options.
double PixelResolution()
Returns the pixel resolution at the current position in meters/pixel.
double mdMinIncidenceAngle
Standard Option MinIncidenceAngle.
bool MetersFromEdge(int piSample, int piLine, Cube *pCube)
Test for a point to be user defined number of meters from the edge.
Namespace for ISIS/Bullet specific routines.
double IncidenceAngle() const
Returns the incidence angle in degrees.
Serial Number list generator.
double mdResolution
Store current Measure's Resolution.
double mdLineResidual
Store current Measure's Line Residual.
bool ValidEmissionAngle(double pdEmissionAngle)
Validate whether the Emission Angle is in the set Range.
void Parse(Pvl &pvlDef)
Parse the DefFile for Standard Options.
double mdMaxIncidenceAngle
Standard Option MaxIncidenceAngle.
bool mbCameraRequired
To improve speed, flag to indicate if Camera needs to be opened.
void CleanCubes(const QString &cubeFileName)
This method removes a cube from memory, if it exists.
double mdMinResolution
Standard Option MinResolution.
IO Handler for Isis Cubes.