7#include "OverlapStatistics.h" 
   15#include "IException.h" 
   16#include "MultivariateStatistics.h" 
   18#include "Projection.h" 
   19#include "ProjectionFactory.h" 
   21#include "PvlKeyword.h" 
   52                                       QString progressMsg, 
double sampPercent) {
 
   57    if (sampPercent <= 0.0 || sampPercent > 100.0) {
 
   58      string msg = 
"The sampling percent must be a decimal (0.0, 100.0]";
 
   70      QString msg = 
"Number of bands do not match between cubes [" +
 
   82    if (*projX != *projY) {
 
   83      QString msg = 
"Mapping groups do not match between cubes [" +
 
   89    double Xmin1 = projX->ToProjectionX(0.5);
 
   90    double Ymax1 = projX->ToProjectionY(0.5);
 
   91    double Xmax1 = projX->ToProjectionX(x.
sampleCount() + 0.5);
 
   92    double Ymin1 = projX->ToProjectionY(x.
lineCount() + 0.5);
 
   94    double Xmin2 = projY->ToProjectionX(0.5);
 
   95    double Ymax2 = projY->ToProjectionY(0.5);
 
   96    double Xmax2 = projY->ToProjectionX(y.
sampleCount() + 0.5);
 
   97    double Ymin2 = projY->ToProjectionY(y.
lineCount() + 0.5);
 
  100    if ((Xmin1 < Xmax2) && (Xmax1 > Xmin2) && (Ymin1 < Ymax2) && (Ymax1 > Ymin2)) {
 
  101      double minX = Xmin1 > Xmin2 ? Xmin1 : Xmin2;
 
  102      double minY = Ymin1 > Ymin2 ? Ymin1 : Ymin2;
 
  103      double maxX = Xmax1 < Xmax2 ? Xmax1 : Xmax2;
 
  104      double maxY = Ymax1 < Ymax2 ? Ymax1 : Ymax2;
 
  107      p_minSampX = (int)(projX->ToWorldX(minX) + 0.5);
 
  108      p_maxSampX = (int)(projX->ToWorldX(maxX) + 0.5);
 
  109      p_minSampY = (int)(projY->ToWorldX(minX) + 0.5);
 
  110      p_maxSampY = (int)(projY->ToWorldX(maxX) + 0.5);
 
  117      p_minLineX = (int)(projX->ToWorldY(maxY) + 0.5);
 
  118      p_maxLineX = (int)(projX->ToWorldY(minY) + 0.5);
 
  119      p_minLineY = (int)(projY->ToWorldY(maxY) + 0.5);
 
  120      p_maxLineY = (int)(projY->ToWorldY(minY) + 0.5);
 
  127      int linc = (int)(100.0 / sampPercent + 0.5); 
 
  142      for (
int band = 1; band <= 
p_bands; band++) {
 
 
  176    for (
int b = 0; b < 
p_bands; b++) {
 
  177      if (
p_stats[b].ValidPixels() > 0) 
return true;
 
 
  195      if (name.isEmpty()) {
 
  196        name = 
"OverlapStatistics";
 
  218      for (
int band = 1; band <= 
Bands(); band++) {
 
  242      for (
int band = 1; band <= 
Bands(); band++) {
 
  260      bool isValid = 
false;
 
  262      for (
int band = 1; band <= 
Bands(); band++) {
 
  263        PvlKeyword validBand(
"ValidOverlap", 
"false");
 
  267            validBand.setValue(
"true");
 
  272        QString mStatsName = 
"MultivariateStatistics" + 
toString(band);
 
  277      PvlKeyword valid(
"Valid", (isValid) ? 
"true" : 
"false");
 
  283      QString msg = 
"Trivial overlap between [" + 
FileNameX().
name();
 
 
  298    const PvlGroup &fileX = inStats.findGroup(
"File1");
 
  299    const PvlGroup &fileY = inStats.findGroup(
"File2");
 
  320    for (
int band = 1; band <= 
Bands(); band++) {
 
  321      QString name = 
"MultivariateStatistics" + 
toString(band);
 
 
Functor for reduce using average functionality.
 
Buffer for containing a three dimensional section of an image.
 
IO Handler for Isis Cubes.
 
PixelType pixelType() const
 
void read(Blob &blob, const std::vector< PvlKeyword > keywords=std::vector< PvlKeyword >()) const
This method will read data from the specified Blob object.
 
virtual QString fileName() const
Returns the opened cube's filename.
 
Projection * projection()
 
virtual int bandCount() const
Returns the number of virtual bands for the cube.
 
QString name() const
Returns the name of the file excluding the path and the attributes in the file name.
 
@ User
A type of error that could only have occurred due to a mistake on the user's part (e....
 
@ Programmer
This error is for when a programmer made an API call that was illegal.
 
Container of multivariate statistics.
 
Calculates statistics in the area of overlap between two projected cubes.
 
int p_minLineX
Starting Line of overlap in X cube.
 
Isis::FileName FileNameY() const
Returns the filename of the second cube.
 
double SampPercent() const
Returns the percentage of cube lines sampled.
 
int p_minSampY
Starting Sample of overlap in Y cube.
 
int EndSampleX() const
Returns the ending sample position of the overlap in the first cube.
 
int Bands() const
Returns the number of bands both cubes have.
 
int StartSampleY() const
Returns the starting sample position of the overlap in the second cube.
 
bool HasOverlap() const
Checks all bands of the cubes for an overlap, and will only return false if none of the bands overlap...
 
void fromPvl(const PvlObject &inStats)
Unserialize overlap statistics from a Pvl.
 
int StartLineX() const
Returns the starting line position of the overlap in the first cube.
 
std::vector< Isis::MultivariateStatistics > p_stats
Multivariate Stats object for overlap data from both cubes.
 
int p_minSampX
Starting Sample of overlap in X cube.
 
Isis::MultivariateStatistics GetMStats(int band) const
Returns the MultivariateStatistics object containing all the data from both cubes in the overlapping ...
 
double p_sampPercent
Percentage of lines sampled.
 
int EndLineX() const
Returns the ending line position of the overlap in the first cube.
 
int p_sampRange
Sample range of overlap.
 
int p_mincnt
Minimum valid pixels to be valid overlap.
 
Isis::FileName FileNameX() const
Returns the filename of the first cube.
 
int p_maxSampY
Ending Sample of overlap in Y cube.
 
int p_maxLineX
Ending Line of overlap in X cube.
 
int Lines() const
Returns the number of lines in the overlapping area.
 
int StartLineY() const
Returns the starting line position of the overlap in the second cube.
 
void init()
Reset member variables to default values.
 
OverlapStatistics(Isis::Cube &x, Isis::Cube &y, QString progressMsg="Gathering Overlap Statistics", double sampPercent=100.0)
Constructs an OverlapStatistics object.
 
int p_maxSampX
Ending Sample of overlap in X cube.
 
int EndLineY() const
Returns the ending line position of the overlap in the second cube.
 
int p_lineRange
Line range of overlap.
 
int p_bands
Number of bands.
 
bool IsValid(unsigned int band) const
Returns whether the overlap meets the minimum valid pixel requirement.
 
Isis::FileName p_yFile
FileName of Y cube.
 
int Samples() const
Returns the number of samples in the overlapping area.
 
Isis::FileName p_xFile
FileName of X cube.
 
int EndSampleY() const
Returns the ending sample position of the overlap in the second cube.
 
PvlObject toPvl(QString name="OverlapStatistics") const
Creates a Pvl containing the following Overlap Statistics information File1 File2 Width Height Bands ...
 
int StartSampleX() const
Returns the starting sample position of the overlap in the first cube.
 
int p_minLineY
Starting Line of overlap in Y cube.
 
int p_maxLineY
Ending Line of overlap in Y cube.
 
Program progress reporter.
 
void AddSteps(const int steps)
If the initial step size was a guess, it can be modified using this method.
 
void SetMaximumSteps(const int steps)
This sets the maximum number of steps in the process.
 
void SetText(const QString &text)
Changes the value of the text string reported just before 0% processed.
 
void CheckStatus()
Checks and updates the status.
 
Base class for Map Projections.
 
Contains multiple PvlContainers.
 
A single keyword-value pair.
 
Contains Pvl Groups and Pvl Objects.
 
PvlObjectIterator findObject(const QString &name, PvlObjectIterator beg, PvlObjectIterator end)
Find the index of object with a specified name, between two indexes.
 
This is free and unencumbered software released into the public domain.
 
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
 
QDebug operator<<(QDebug debug, const Hillshade &hillshade)
Print this class out to a QDebug object.
 
Namespace for the standard library.