16#include "LeastSquares.h"
17#include "OverlapNormalization.h"
23 class OverlapStatistics;
127 void addHolds(QString holdListName);
138 void write(QString outstatsFileName);
140 double evaluate(
double dn,
int imageIndex,
int bandIndex)
const;
155 void addGain(
double gain) {
156 gains.push_back(gain);
159 void addOffset(
double offset) {
160 offsets.push_back(offset);
163 void addAverage(
double average) {
164 avgs.push_back(average);
167 double getGain(
int index)
const {
171 double getOffset(
int index)
const {
172 return offsets[index];
175 double getAverage(
int index)
const {
179 double evaluate(
double dn,
int index)
const {
180 double result =
Null;
182 double gain = gains[index];
184 double offset = offsets[index];
185 double avg = avgs[index];
186 result = (dn - avg) * gain + offset + avg;
196 vector<double> gains;
197 vector<double> offsets;
221 m_linc = (int) (100.0 / percent + 0.5);
226 void operator()(
Buffer &in)
const;
229 virtual void addStats(
Buffer &in)
const;
258 void setInput(
int index, QString value);
266 virtual void fillOutList(
FileList &outList, QString toListName);
267 virtual void errorCheck(QString fromListName);
310 vector<ImageAdjustment *> m_adjustments;
Buffer for reading and writing cube data.
This class is used as a functor to apply adjustments (equalize) to an image.
const ImageAdjustment * m_adjustment
ImageAdjustment to equalize image.
This class is used as a functor calculate image statistics.
Statistics * m_stats
Calculated statistics.
int m_linc
Line increment value when calculating statistics.
CalculateFunctor(Statistics *stats, double percent)
Constructs a CalculateFunctor.
This class can be used to calculate, read in, and/or apply equalization statistics for a list of file...
void calculateBandStatistics()
Calculates the image statistics on a band-by-band basis.
void importStatistics(QString instatsFileName)
Imports statistics for applying correction.
void generateOutputs(FileList &outList)
Generates the names of the equalized cubes if no output list is provided.
void clearAdjustments()
Frees image adjustments.
void loadOutputs(FileList &outList, QString toListName)
Checks that the output image list is correct.
bool m_wtopt
Whether or not overlaps should be weighted.
virtual void errorCheck(QString fromListName)
Checks that the input images have the same mapping groups and same number of bands.
vector< OverlapNormalization * > m_overlapNorms
Normalization data for input images.
void calculateStatistics(double samplingPercent, int mincnt, bool wtopt, LeastSquares::SolveMethod methodType)
Calculates the image and overlap statistics, and then determines corrective factors if possible.
LeastSquares::SolveMethod m_lsqMethod
Least squares method for solving normalization correcitve factors.
PvlGroup getResults()
Returns general information about the equalization.
void addAdjustment(ImageAdjustment *adjustment)
Adds an image adjustment.
void fromPvl(const PvlObject &inStats)
Loads a previous Equalization state from an input pvl object.
void applyCorrection(QString toListName)
Equalizes the input images.
void setSolved(bool solved)
Sets solved state indicating if OverlapNormalizations (corrective factors) were solved.
void clearNormalizations()
Frees overlap normalizations.
int m_maxBand
Number of bands in each input image.
bool m_normsSolved
Indicates if corrective factors were solved.
void clearOverlapStatistics()
Frees overlap statistics.
void recalculateStatistics(QString inStatsFileName)
Recalculates statistics for any new input images.
vector< int > m_holdIndices
Indices of images being held.
void addInvalid(int count)
Increments the number of invalid overlaps by a given amount.
OverlapNormalization::SolutionType m_sType
The normalization solution type for solving normalizations (offsets, gains, or both)
void init()
Initializes member variables to default values.
int m_mincnt
Minimum number of pixels for an overlap to be considered valid.
int m_invalidCnt
Number of invalid overlaps.
bool m_recalculating
Indicates if recalculating with loaded statistics.
void write(QString outstatsFileName)
Write the equalization information (results) to a file.
void addHolds(QString holdListName)
Adds a list of images to be held in the equalization.
void loadInputs(QString fromListName)
Loads in the input images.
double m_samplingPercent
Percentage of the lines to consider when gathering cube and overlap statistics (process-by-line)
Equalization()
Default constructor.
void addValid(int count)
Increments the number of valid overlaps by a given amount.
Pvl * m_results
Calculation results and normalization corrective factors (if solved)
vector< bool > m_doesOverlapList
Which images have a valid overlap.
bool isSolved() const
Indicates if the corrective factors were solved.
int m_maxCube
Number of input images.
void calculateOverlapStatistics()
Calculates the overlap statistics for each pair of input images.
vector< OverlapStatistics * > m_overlapStats
Calculated overlap statistics.
QStringList m_badFiles
List of image names that don't overlap.
void setResults()
Creates the results pvl containing statistics and corrective factors.
vector< bool > m_alreadyCalculated
Which images that have statistics already calculated.
virtual ~Equalization()
Destructor.
QVector< int > validateInputStatistics(QString instatsFileName)
Validates the input statistics pvl file.
int m_validCnt
Number of valid overlaps.
Internalizes a list of files.
Calculate the bases and multipliers for normalizing overlapping "data sets" (e.g.,...
SolutionType
Enumeration for whether user/programmer wants to calculate new gains, offsets, or both when solving.
@ GainsWithoutNormalization
The equation being solved for Gains, Offsets, and Both is output = (input - average) * gain + offset ...
Contains multiple PvlContainers.
Container for cube-like labels.
Contains Pvl Groups and Pvl Objects.
This class is used to accumulate statistics on double arrays.
This is free and unencumbered software released into the public domain.
const double Null
Value for an Isis Null pixel.
Namespace for the standard library.