9 #include <QtCore/qmath.h> 67 if (storedMatrixData.
name() !=
"CorrelationMatrixData") {
68 QString msg =
"This Pvl Object does not have the correct correlation information. The Object " 69 "you are looking for is called CorrelationMatrixData.";
78 QString msg =
"Could not find the Covariance Matrix .dat file name.";
83 QString corrFileName = storedMatrixData.
findKeyword(
"CorrelationMatrixFileName")[0];
84 if (corrFileName ==
"NULL") {
92 QString msg =
"Could not find the Correlation Matrix .dat file name.";
98 imgsIt = storedMatrixData.
findGroup(
"ImagesAndParameters").begin();
99 while ( imgsIt != storedMatrixData.
findGroup(
"ImagesAndParameters").end() ) {
106 QString msg =
"Could not get Images and Parameters from ImagesAndParameters group.";
157 if (&other !=
this) {
198 QString msg =
"Cannot compute correlation matrix without a specified file name. Use " 199 "setCorrelationFileName(FileName) before calling computeCorrelationMatrix().";
211 matrixInput.open(QIODevice::ReadOnly);
212 matrixOutput.open(QIODevice::WriteOnly);
215 QDataStream inStream(&matrixInput);
216 QDataStream outStream(&matrixOutput);
218 double firstParam1 = 0,
224 while ( !inStream.atEnd() ) {
228 int numOfBlocks = sbcm.size();
229 int lastBlock = numOfBlocks - 1;
230 int numDiagonals = sbcm[lastBlock]->size1();
233 for (
int i = 0; i < numDiagonals; i++) {
234 double val = ( *(sbcm[lastBlock]) )(i, i);
239 QMapIterator<int, LinearAlgebra::Matrix *> block(sbcm);
241 while ( block.hasNext() ) {
243 for (
int row = 0; row < (int)block.value()->size1(); row++) {
244 for (
int column = 0; column < (int)block.value()->size2(); column++) {
246 ( *block.value() )(row, column) = ( *block.value() )(row, column) /
252 param2 = firstParam2;
254 firstParam1 += block.value()->size1();
255 param1 = firstParam1;
258 param1 = firstParam1;
259 firstParam2 += block.value()->size2();
260 param2 = firstParam2;
268 matrixOutput.close();
361 QString(
"correlation") );
469 PvlObject corrMatInfo(
"CorrelationMatrixData");
474 PvlGroup imgsAndParams(
"ImagesAndParameters");
476 while ( imgParamIt.hasNext() ) {
478 imgsAndParams +=
PvlKeyword( imgParamIt.key(), imgParamIt.value().join(
",") );
480 corrMatInfo += imgsAndParams;
QMap< QString, QStringList > * m_imagesAndParameters
This map holds the images used to create this matrix and their associated parameters.
QList< SparseBlockColumnMatrix > * m_visibleBlocks
This will be the three blocks (or whole matrix depending on size) that apply to the given area...
void retrieveVisibleElements(int x, int y)
Extract requested area from correlation matrix This method will open the correlation matrix file and ...
void retrieveWholeMatrix()
This method will read the matrix in from the file and hold on to the whole thing. ...
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
This is a container for the correlation matrix that comes from a bundle adjust.
FileName covarianceFileName()
Public access for the covariance matrix file name.
File name manipulation and expansion.
CorrelationMatrix()
Default Constructor.
void setCorrelationFileName(FileName correlationFileName)
Set the qmap of images and parameters.
FileName correlationFileName()
Public access for the correlation matrix file name.
void computeCorrelationMatrix()
Read covariance matrix and compute correlation values This method reads the covariance matrix in from...
void setImagesAndParameters(QMap< QString, QStringList > imagesAndParameters)
Set the qmap of images and parameters.
QString name() const
Returns the name of the file excluding the path and the attributes in the file name.
~CorrelationMatrix()
Destructor.
This error is for when a programmer made an API call that was illegal.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
QString name() const
Returns the container name.
PvlObject pvlObject()
This method creates a Pvl group with the information necessary to recreate this correlation matrix...
PvlKeyword & findKeyword(const QString &kname, FindOptions opts)
Finds a keyword in the current PvlObject, or deeper inside other PvlObjects and Pvlgroups within this...
Contains multiple PvlContainers.
#define _FILEINFO_
Macro for the filename and line number.
void retrieveThreeVisibleBlocks()
Display only part of a matrix This method will be used when the matrix is too big to display the whol...
QList< double > * m_diagonals
List of the parameter values.
A type of error that could only have occurred due to a mistake on the user's part (e...
A single keyword-value pair.
QString expanded() const
Returns a QString of the full file name including the file path, excluding the attributes.
bool hasCovMat()
Check if the correlation matrix has a covariance matrix This is used to make sure the covariance matr...
void setCovarianceFileName(FileName covarianceFileName)
Set the qmap of images and parameters.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
FileName * m_correlationFileName
FileName of the correlation matrix.
FileName * m_covarianceFileName
FileName of the covariance matrix calculated when the bundle was run.
bool isValid()
This is the public accessor for the list of elements that should be displayed in the current view...
Namespace for ISIS/Bullet specific routines.
QList< SparseBlockColumnMatrix > * visibleBlocks()
Get the visible part of the matrix.
CorrelationMatrix & operator=(const CorrelationMatrix &other)
Equal Operator.
Contains Pvl Groups and Pvl Objects.
QMap< QString, QStringList > * imagesAndParameters()
Public access for the qmap of images and parameters.
QList< PvlKeyword >::iterator PvlKeywordIterator
The keyword iterator.