Isis 3 Programmer Reference
Isis::OverlapStatistics Class Reference

Calculates statistics in the area of overlap between two projected cubes. More...

#include <OverlapStatistics.h>

Collaboration diagram for Isis::OverlapStatistics:
Collaboration graph

Public Member Functions

 OverlapStatistics (Isis::Cube &x, Isis::Cube &y, QString progressMsg="Gathering Overlap Statistics", double sampPercent=100.0)
 Constructs an OverlapStatistics object.
 
 OverlapStatistics (const PvlObject &inStats)
 Constructs an OverlapStatistics from a PvlObject.
 
bool HasOverlap (int band) const
 Checks the specified band for an overlap.
 
bool HasOverlap () const
 Checks all bands of the cubes for an overlap, and will only return false if none of the bands overlap.
 
Isis::FileName FileNameX () const
 Returns the filename of the first cube.
 
Isis::FileName FileNameY () const
 Returns the filename of the second cube.
 
Isis::MultivariateStatistics GetMStats (int band) const
 Returns the MultivariateStatistics object containing all the data from both cubes in the overlapping area.
 
int Lines () const
 Returns the number of lines in the overlapping area.
 
int Samples () const
 Returns the number of samples in the overlapping area.
 
int Bands () const
 Returns the number of bands both cubes have.
 
double SampPercent () const
 Returns the percentage of cube lines sampled.
 
int StartSampleX () const
 Returns the starting sample position of the overlap in the first cube.
 
int EndSampleX () const
 Returns the ending sample position of the overlap in the first cube.
 
int StartLineX () const
 Returns the starting line position of the overlap in the first cube.
 
int EndLineX () const
 Returns the ending line position of the overlap in the first cube.
 
int StartSampleY () const
 Returns the starting sample position of the overlap in the second cube.
 
int EndSampleY () const
 Returns the ending sample position of the overlap in the second cube.
 
int StartLineY () const
 Returns the starting line position of the overlap in the second cube.
 
int EndLineY () const
 Returns the ending line position of the overlap in the second cube.
 
void SetMincount (unsigned int mincnt)
 Sets the minimum number of valid pixels for the overlap to be considered valid for PVL output.
 
int MinCount () const
 
bool IsValid (unsigned int band) const
 Returns whether the overlap meets the minimum valid pixel requirement.
 
PvlObject toPvl (QString name="OverlapStatistics") const
 Creates a Pvl containing the following Overlap Statistics information File1 File2 Width Height Bands SamplingPercent MinCount MutlivariateStatisticsN (N = current band) Covariance Correlation SumXY ValidPixels InvalidPixels TotalPixels LinearRegression ValidOverlap XStatistics #FileX Statistics information YStatistics #FileY Statistics information File1 StartSample EndSample StartLine EndLine Average StandardDeviation Variance File2 StartSample EndSample StartLine EndLine Average StandardDeviation Variance.
 

Private Member Functions

void fromPvl (const PvlObject &inStats)
 Unserialize overlap statistics from a Pvl.
 
void init ()
 Reset member variables to default values.
 

Private Attributes

int p_bands
 Number of bands.
 
double p_sampPercent
 Percentage of lines sampled.
 
Isis::FileName p_xFile
 FileName of X cube.
 
Isis::FileName p_yFile
 FileName of Y cube.
 
int p_sampRange
 Sample range of overlap.
 
int p_lineRange
 Line range of overlap.
 
int p_minSampX
 Starting Sample of overlap in X cube.
 
int p_maxSampX
 Ending Sample of overlap in X cube.
 
int p_minSampY
 Starting Sample of overlap in Y cube.
 
int p_maxSampY
 Ending Sample of overlap in Y cube.
 
int p_minLineX
 Starting Line of overlap in X cube.
 
int p_maxLineX
 Ending Line of overlap in X cube.
 
int p_minLineY
 Starting Line of overlap in Y cube.
 
int p_maxLineY
 Ending Line of overlap in Y cube.
 
int p_mincnt
 Minimum valid pixels to be valid overlap.
 
std::vector< Isis::MultivariateStatisticsp_stats
 Multivariate Stats object for overlap data from both cubes.
 

Detailed Description

Calculates statistics in the area of overlap between two projected cubes.

This class finds the overlap between two cubes. It allows the user to check whether or not two cubes overlap, and also creates a MultivariateStatistics object containing the data from each cube in the overlapping area. The cubes entered into the constructor for this class must both be projections, and must have the same projection parameters.

If you would like to see OverlapStatistics being used in implementation, see equalizer.cpp

Author
2005-07-18 Elizabeth Ribelin
History

2005-11-18 Elizabeth Miller - added 1e-9 to the min and max values when computing the ranges to fix rounding issue

2006-01-12 Elizabeth Miller - removed unwanted print statements

2006-03-31 Elizabeth Miller - added unitTest

2006-04-03 Elizabeth Miller - added .001 to the min and max values when computing the ranges to re-fix rounding issue

2007-08-27 Steven Koechle - removed space from standard deviation keyword

2008-06-18 Steven Koechle - fixed Documentation Errors

2009-03-12 Travis Addair - added tracking for percent processed

2009-06-24 Travis Addair - optimized statistic gathering, changed PVL print-out for readability, and added functionality to allow the user to specify a "sampling percent" when gathering statistics to save processing time

2012-04-16 Jeannie Backer - Added forward declaration for PvlObject and ordered #includes in the implementation file. Added documentation.

2016-07-15 Ian Humphrey - Modified toPvl() method to get the internal multivariate statistics. Added init() method to initialize primitive members during construction. Added new constructor that creates an OverlapStatistics object from a PvlObject. Added private fromPvl() method to implement these details. Updated unitTest to test these changes. References #2282.

Definition at line 61 of file OverlapStatistics.h.

Constructor & Destructor Documentation

◆ OverlapStatistics() [1/2]

Isis::OverlapStatistics::OverlapStatistics ( Isis::Cube & x,
Isis::Cube & y,
QString progressMsg = "Gathering Overlap Statistics",
double sampPercent = 100.0 )

Constructs an OverlapStatistics object.

Compares the two input cubes and finds where they overlap.

Parameters
xThe first input cube
yThe second input cube
progressMsg(Default value of "Gathering Overlap Statistics") Text for indicating progress during statistic gathering
sampPercent(Default value of 100.0) Sampling percent, or the percentage of lines to consider during the statistic gathering procedure
Exceptions
Isis::IException::User- All images must have the same number of bands

Definition at line 51 of file OverlapStatistics.cpp.

References Isis::Progress::AddSteps(), Isis::Cube::bandCount(), Isis::Progress::CheckStatus(), Isis::Cube::fileName(), init(), Isis::Cube::lineCount(), Isis::FileName::name(), p_bands, p_lineRange, p_maxLineX, p_maxLineY, p_maxSampX, p_maxSampY, p_minLineX, p_minLineY, p_minSampX, p_minSampY, p_sampPercent, p_sampRange, p_stats, p_xFile, p_yFile, Isis::Cube::pixelType(), Isis::IException::Programmer, Isis::Cube::projection(), Isis::Cube::read(), Isis::Cube::sampleCount(), Isis::Progress::SetMaximumSteps(), Isis::Progress::SetText(), and Isis::IException::User.

◆ OverlapStatistics() [2/2]

Isis::OverlapStatistics::OverlapStatistics ( const PvlObject & inStats)

Constructs an OverlapStatistics from a PvlObject.

Parameters
inStatsThe serialized OverlapStatistics PvlObject

Definition at line 32 of file OverlapStatistics.cpp.

References fromPvl(), and init().

Member Function Documentation

◆ Bands()

int Isis::OverlapStatistics::Bands ( ) const
inline

Returns the number of bands both cubes have.

Returns
int The number of bands both cubes have

Definition at line 138 of file OverlapStatistics.h.

References p_bands.

Referenced by fromPvl(), and toPvl().

◆ EndLineX()

int Isis::OverlapStatistics::EndLineX ( ) const
inline

Returns the ending line position of the overlap in the first cube.

Returns
int The ending line of the overlap in the first cube

Definition at line 183 of file OverlapStatistics.h.

References p_maxLineX.

Referenced by toPvl().

◆ EndLineY()

int Isis::OverlapStatistics::EndLineY ( ) const
inline

Returns the ending line position of the overlap in the second cube.

Returns
int The ending line of the overlap in the second cube

Definition at line 219 of file OverlapStatistics.h.

References p_maxLineY.

Referenced by toPvl().

◆ EndSampleX()

int Isis::OverlapStatistics::EndSampleX ( ) const
inline

Returns the ending sample position of the overlap in the first cube.

Returns
int The ending sample of the overlap in the first cube

Definition at line 165 of file OverlapStatistics.h.

References p_maxSampX.

Referenced by toPvl().

◆ EndSampleY()

int Isis::OverlapStatistics::EndSampleY ( ) const
inline

Returns the ending sample position of the overlap in the second cube.

Returns
int The ending sample of the overlap in the second cube

Definition at line 201 of file OverlapStatistics.h.

References p_maxSampY.

Referenced by toPvl().

◆ FileNameX()

Isis::FileName Isis::OverlapStatistics::FileNameX ( ) const
inline

Returns the filename of the first cube.

Returns
QString The name of the first cube

Definition at line 87 of file OverlapStatistics.h.

References p_xFile.

Referenced by toPvl().

◆ FileNameY()

Isis::FileName Isis::OverlapStatistics::FileNameY ( ) const
inline

Returns the filename of the second cube.

Returns
QString The name of the second cube

Definition at line 96 of file OverlapStatistics.h.

References p_yFile.

Referenced by toPvl().

◆ fromPvl()

void Isis::OverlapStatistics::fromPvl ( const PvlObject & inStats)
private

Unserialize overlap statistics from a Pvl.

Parameters
constPvlObject & - The pvl object to initialize the overlap statistics with

Definition at line 295 of file OverlapStatistics.cpp.

References Bands(), Isis::PvlObject::findObject(), init(), p_bands, p_lineRange, p_maxLineX, p_maxLineY, p_maxSampX, p_maxSampY, p_mincnt, p_minLineX, p_minLineY, p_minSampX, p_minSampY, p_sampPercent, p_sampRange, p_stats, p_xFile, p_yFile, and Isis::toString().

Referenced by OverlapStatistics().

◆ GetMStats()

Isis::MultivariateStatistics Isis::OverlapStatistics::GetMStats ( int band) const
inline

Returns the MultivariateStatistics object containing all the data from both cubes in the overlapping area.

Parameters
bandThe band number the MultivariateStatistics object needs to contain data from
Returns
MultivariateStatistics The MultivariateStatistics object containing all data from both cubes in the overlapping area from the specified band

Definition at line 111 of file OverlapStatistics.h.

References p_stats.

Referenced by IsValid(), and toPvl().

◆ HasOverlap() [1/2]

bool Isis::OverlapStatistics::HasOverlap ( ) const

Checks all bands of the cubes for an overlap, and will only return false if none of the bands overlap.

Returns
bool Returns true if any of the bands overlap, and false if none of the bands overlap

Definition at line 175 of file OverlapStatistics.cpp.

References p_bands, and p_stats.

Referenced by toPvl().

◆ HasOverlap() [2/2]

bool Isis::OverlapStatistics::HasOverlap ( int band) const
inline

Checks the specified band for an overlap.

Parameters
bandThe band number of the cubes to be checked for an overlap
Returns
bool Returns true if the cubes overlap in the specified band, and false if they do not overlap

Definition at line 76 of file OverlapStatistics.h.

References p_stats.

◆ init()

void Isis::OverlapStatistics::init ( )
private

Reset member variables to default values.

Definition at line 332 of file OverlapStatistics.cpp.

References p_bands, p_lineRange, p_maxLineX, p_maxLineY, p_maxSampX, p_maxSampY, p_mincnt, p_minLineX, p_minLineY, p_minSampX, p_minSampY, p_sampPercent, and p_sampRange.

Referenced by fromPvl(), OverlapStatistics(), and OverlapStatistics().

◆ IsValid()

bool Isis::OverlapStatistics::IsValid ( unsigned int band) const
inline

Returns whether the overlap meets the minimum valid pixel requirement.

Parameters
bandThe band to check
Returns
bool Is minimum requirement met

Definition at line 244 of file OverlapStatistics.h.

References GetMStats(), p_mincnt, and Isis::MultivariateStatistics::ValidPixels().

Referenced by toPvl().

◆ Lines()

int Isis::OverlapStatistics::Lines ( ) const
inline

Returns the number of lines in the overlapping area.

Returns
int The number of lines in the overlapping area

Definition at line 120 of file OverlapStatistics.h.

References p_lineRange.

Referenced by toPvl().

◆ MinCount()

int Isis::OverlapStatistics::MinCount ( ) const
inline

Definition at line 233 of file OverlapStatistics.h.

◆ Samples()

int Isis::OverlapStatistics::Samples ( ) const
inline

Returns the number of samples in the overlapping area.

Returns
int The number of samples in the overlapping area

Definition at line 129 of file OverlapStatistics.h.

References p_sampRange.

Referenced by toPvl().

◆ SampPercent()

double Isis::OverlapStatistics::SampPercent ( ) const
inline

Returns the percentage of cube lines sampled.

Returns
int The percentage of lines sampled

Definition at line 147 of file OverlapStatistics.h.

References p_sampPercent.

Referenced by toPvl().

◆ SetMincount()

void Isis::OverlapStatistics::SetMincount ( unsigned int mincnt)
inline

Sets the minimum number of valid pixels for the overlap to be considered valid for PVL output.

Parameters
mincntThe minimum valid pixel value to set

Definition at line 229 of file OverlapStatistics.h.

References p_mincnt.

◆ StartLineX()

int Isis::OverlapStatistics::StartLineX ( ) const
inline

Returns the starting line position of the overlap in the first cube.

Returns
int The starting line of the overlap in the first cube

Definition at line 174 of file OverlapStatistics.h.

References p_minLineX.

Referenced by toPvl().

◆ StartLineY()

int Isis::OverlapStatistics::StartLineY ( ) const
inline

Returns the starting line position of the overlap in the second cube.

Returns
int The starting line of the overlap in the second cube

Definition at line 210 of file OverlapStatistics.h.

References p_minLineY.

Referenced by toPvl().

◆ StartSampleX()

int Isis::OverlapStatistics::StartSampleX ( ) const
inline

Returns the starting sample position of the overlap in the first cube.

Returns
int The starting sample of the overlap in the first cube

Definition at line 156 of file OverlapStatistics.h.

References p_minSampX.

Referenced by toPvl().

◆ StartSampleY()

int Isis::OverlapStatistics::StartSampleY ( ) const
inline

Returns the starting sample position of the overlap in the second cube.

Returns
int The starting sample of the overlap in the second cube

Definition at line 192 of file OverlapStatistics.h.

References p_minSampY.

Referenced by toPvl().

◆ toPvl()

PvlObject Isis::OverlapStatistics::toPvl ( QString name = "OverlapStatistics") const

Creates a Pvl containing the following Overlap Statistics information File1 File2 Width Height Bands SamplingPercent MinCount MutlivariateStatisticsN (N = current band) Covariance Correlation SumXY ValidPixels InvalidPixels TotalPixels LinearRegression ValidOverlap XStatistics #FileX Statistics information YStatistics #FileY Statistics information File1 StartSample EndSample StartLine EndLine Average StandardDeviation Variance File2 StartSample EndSample StartLine EndLine Average StandardDeviation Variance.

Serialize overlap statistics as a PvlObject.

Returns
PvlObject PvlObject containing the information for the Overlap Statistics.
Parameters
QStringname (Default value of "OverlapStatistics") Name of the PvlObject created
Returns
PvlObject A pvl object representing the OverlapStatistics and its data
Exceptions
Isis::IException::User- Trivial overlap between [File1] and [File2]

Definition at line 192 of file OverlapStatistics.cpp.

References Bands(), EndLineX(), EndLineY(), EndSampleX(), EndSampleY(), FileNameX(), FileNameY(), GetMStats(), HasOverlap(), IsValid(), Lines(), Isis::FileName::name(), Samples(), SampPercent(), StartLineX(), StartLineY(), StartSampleX(), StartSampleY(), toPvl(), Isis::toString(), and Isis::IException::User.

Referenced by toPvl().

Member Data Documentation

◆ p_bands

int Isis::OverlapStatistics::p_bands
private

Number of bands.

Definition at line 299 of file OverlapStatistics.h.

Referenced by Bands(), fromPvl(), HasOverlap(), init(), and OverlapStatistics().

◆ p_lineRange

int Isis::OverlapStatistics::p_lineRange
private

Line range of overlap.

Definition at line 304 of file OverlapStatistics.h.

Referenced by fromPvl(), init(), Lines(), and OverlapStatistics().

◆ p_maxLineX

int Isis::OverlapStatistics::p_maxLineX
private

Ending Line of overlap in X cube.

Definition at line 310 of file OverlapStatistics.h.

Referenced by EndLineX(), fromPvl(), init(), and OverlapStatistics().

◆ p_maxLineY

int Isis::OverlapStatistics::p_maxLineY
private

Ending Line of overlap in Y cube.

Definition at line 312 of file OverlapStatistics.h.

Referenced by EndLineY(), fromPvl(), init(), and OverlapStatistics().

◆ p_maxSampX

int Isis::OverlapStatistics::p_maxSampX
private

Ending Sample of overlap in X cube.

Definition at line 306 of file OverlapStatistics.h.

Referenced by EndSampleX(), fromPvl(), init(), and OverlapStatistics().

◆ p_maxSampY

int Isis::OverlapStatistics::p_maxSampY
private

Ending Sample of overlap in Y cube.

Definition at line 308 of file OverlapStatistics.h.

Referenced by EndSampleY(), fromPvl(), init(), and OverlapStatistics().

◆ p_mincnt

int Isis::OverlapStatistics::p_mincnt
private

Minimum valid pixels to be valid overlap.

Definition at line 313 of file OverlapStatistics.h.

Referenced by fromPvl(), init(), IsValid(), and SetMincount().

◆ p_minLineX

int Isis::OverlapStatistics::p_minLineX
private

Starting Line of overlap in X cube.

Definition at line 309 of file OverlapStatistics.h.

Referenced by fromPvl(), init(), OverlapStatistics(), and StartLineX().

◆ p_minLineY

int Isis::OverlapStatistics::p_minLineY
private

Starting Line of overlap in Y cube.

Definition at line 311 of file OverlapStatistics.h.

Referenced by fromPvl(), init(), OverlapStatistics(), and StartLineY().

◆ p_minSampX

int Isis::OverlapStatistics::p_minSampX
private

Starting Sample of overlap in X cube.

Definition at line 305 of file OverlapStatistics.h.

Referenced by fromPvl(), init(), OverlapStatistics(), and StartSampleX().

◆ p_minSampY

int Isis::OverlapStatistics::p_minSampY
private

Starting Sample of overlap in Y cube.

Definition at line 307 of file OverlapStatistics.h.

Referenced by fromPvl(), init(), OverlapStatistics(), and StartSampleY().

◆ p_sampPercent

double Isis::OverlapStatistics::p_sampPercent
private

Percentage of lines sampled.

Definition at line 300 of file OverlapStatistics.h.

Referenced by fromPvl(), init(), OverlapStatistics(), and SampPercent().

◆ p_sampRange

int Isis::OverlapStatistics::p_sampRange
private

Sample range of overlap.

Definition at line 303 of file OverlapStatistics.h.

Referenced by fromPvl(), init(), OverlapStatistics(), and Samples().

◆ p_stats

std::vector<Isis::MultivariateStatistics> Isis::OverlapStatistics::p_stats
private

Multivariate Stats object for overlap data from both cubes.

Definition at line 316 of file OverlapStatistics.h.

Referenced by fromPvl(), GetMStats(), HasOverlap(), HasOverlap(), and OverlapStatistics().

◆ p_xFile

Isis::FileName Isis::OverlapStatistics::p_xFile
private

FileName of X cube.

Definition at line 301 of file OverlapStatistics.h.

Referenced by FileNameX(), fromPvl(), and OverlapStatistics().

◆ p_yFile

Isis::FileName Isis::OverlapStatistics::p_yFile
private

FileName of Y cube.

Definition at line 302 of file OverlapStatistics.h.

Referenced by FileNameY(), fromPvl(), and OverlapStatistics().


The documentation for this class was generated from the following files: