1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213
|
/* MainWindow for StellarSolver Tester Application, developed by Robert Lancaster, 2020
This application is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
*/
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
//Qt Includes
#include <QMainWindow>
#include <QObject>
#include <QWidget>
#include <QDir>
#include <QFileDialog>
#include <QMessageBox>
#include <QTextStream>
#include <QProcess>
#include <QPointer>
#include <QScrollBar>
#include <QThread>
#include <QLineEdit>
#include <QElapsedTimer>
#include <QTimer>
#include <QTableWidget>
//Project Includes
#include "structuredefinitions.h"
#include "stellarsolver.h"
#include "ssolverutils/fileio.h"
//System includes
#include "math.h"
#ifndef _MSC_VER
#include <sys/mman.h>
#endif
//Astrometry.net includes
extern "C"{
#include "ioutils.h"
#include "bl.h"
#include "an-bool.h"
#include "solver.h"
#include "astrometry/blind.h"
#include "log.h"
#include "engine.h"
#include "anqfits.h"
#include "ioutils.h"
#include "fitstable.h"
}
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow();
~MainWindow();
void setStarList(QList<FITSImage::Star> starList){stars = starList;};
private:
Ui::MainWindow *ui;
StellarSolver stellarSolver;
QString fileToProcess;
QList<FITSImage::Star> stars;
int selectedStar;
QList<SSolver::Parameters> optionsList;
bool optionsAreSaved = true;
//Options for StellarSolver Tester
QString dirPath = QDir::homePath();
bool hasHFRData = false;
bool hasWCSData = false;
bool showFluxInfo = false;
bool showStarShapeInfo = false;
bool showExtractorParams = false;
bool showAstrometryParams = false;
bool showSolutionDetails = true;
bool settingSubframe = false;
bool useSubframe = false;
QRect subframe;
SSolver::ProcessType processType;
SSolver::ExtractorType m_ExtractorType;
SSolver::SolverType solverType;
int profileSelection;
//This allows for averaging over multiple trials
int currentTrial = 0;
int numberOfTrials = 0;
double totalTime = 0;
//Data about the image
bool imageLoaded = false;
FITSImage::Statistic stats;
QList<fileio::Record> m_HeaderRecords;
QImage rawImage;
QImage scaledImage;
int currentWidth;
int currentHeight;
double currentZoom;
int sampling = 2;
/// Generic data image buffer
uint8_t *m_ImageBuffer { nullptr };
/// Above buffer size in bytes
uint32_t m_ImageBufferSize { 0 };
QElapsedTimer processTimer;
QTimer timerMonitor;
double elapsed;
void setupResultsTable();
void clearAstrometrySettings();
void addExtractionToTable();
FITSImage::Solution lastSolution;
QStringList indexFileList;
QString lastIndexNumber = "4";
QString lastHealpix = "";
QDialog *convInspector = nullptr;
QTableWidget *convTable = nullptr;
public slots:
bool prepareForProcesses();
void logOutput(QString text);
void toggleLogDisplay();
void toggleFullScreen();
void helpPopup();
void startProcessMonitor();
void stopProcessMonitor();
void clearStars();
void clearResults();
void loadOptionsProfile();
void settingJustChanged();
void loadIndexFilesListInFolder();
void loadIndexFilesToUse();
void setSubframe();
//These are the functions that run when the bottom buttons are clicked
void extractButtonClicked();
void solveButtonClicked();
void extractImage();
void solveImage();
void abort();
//These functions are for loading and displaying the image
bool imageLoad();
bool imageSave();
void clearImageBuffers();
void zoomIn();
void zoomOut();
void panLeft();
void panRight();
void panUp();
void panDown();
void autoScale();
void updateImage();
//These functions handle the star table
void displayTable();
void sortStars();
void starClickedInTable();
void updateStarTableFromList();
void updateHiddenStarTableColumns();
void saveStarTable();
void mouseMovedOverImage(QPoint location);
QString getValue(int x, int y, int channel);
void mouseClickedInImage(QPoint location);
void mousePressedInImage(QPoint location);
QRect getStarSizeInImage(FITSImage::Star star, bool &accurate);
void reloadConvTable();
//These functions handle the settings for the Star Extractors and Solvers
SSolver::Parameters getSettingsFromUI();
void sendSettingsToUI(SSolver::Parameters a);
void setupExternalExtractorSolverIfNeeded();
void setupStellarSolverParameters();
//These functions get called when the star extractor or solver finishes
bool extractorComplete();
bool solverComplete();
//These functions handle the solution table
void addSolutionToTable(FITSImage::Solution solution);
void updateHiddenResultsTableColumns();
void saveResultsTable();
//These functions save and load the settings of the program.
void saveOptionsProfiles();
void loadOptionsProfiles();
void closeEvent(QCloseEvent *event);
signals:
void readyForStarTable();
};
#endif // MAINWINDOW_H
|