Refining platesolving

This commit is contained in:
2024-10-01 17:37:34 +02:00
parent da1aa4c6fc
commit 9f4c4c8bdc
6 changed files with 158 additions and 17 deletions
+22 -11
View File
@@ -3,6 +3,7 @@
#include <QJsonDocument>
#include <fitsio.h>
#include <QStandardPaths>
#include <QSettings>
#include <wcslib/wcshdr.h>
#include <wcslib/wcsutil.h>
#include "rawimage.h"
@@ -15,8 +16,11 @@ Solver::Solver(QObject *parent) : QObject(parent)
connect(_solver, &StellarSolver::logOutput, this, &Solver::logOutput);
_solver->setProperty("ProcessType", SSolver::SOLVE);
_solver->setIndexFolderPaths(QStringList(getTenmonIndexPath()));
_solver->setParameterProfile(SSolver::Parameters::ALL_STARS);
QSettings settings;
setIndexFolder(settings.value("platesolving/indexPath", Solver::getTenmonIndexPath()).toString());
int profileIdx = settings.value("platesolving/profile", 0).toInt();
auto profiles = _solver->getBuiltInProfiles();
_solver->setParameters(profiles[profileIdx]);
connect(_solver, &StellarSolver::finished, this, &Solver::finished);
}
@@ -32,12 +36,14 @@ void Solver::setIndexFolder(const QString &indexPath)
bool Solver::loadImage(const QString &path)
{
if(path == _path)return true;
_loaded = false;
std::shared_ptr<RawImage> image;
ImageInfoData info;
if(::loadImage(path, info, image, true))
{
loadImage(image, path);
return loadImage(image, path);
}
return false;
}
@@ -85,25 +91,27 @@ bool Solver::loadImage(std::shared_ptr<RawImage> &image, const QString &path)
return _loaded;
}
bool Solver::solveImage()
bool Solver::solveImage(bool sync)
{
if(_loaded && !_solver->isRunning())
{
_process = SSolver::ProcessType::SOLVE;
_solver->setProperty("ProcessType", _process);
_solver->start();
if(sync)return _solver->solve();
else _solver->start();
return true;
}
return false;
}
bool Solver::extractSources(bool hfr)
bool Solver::extractSources(bool hfr, bool sync)
{
if(_loaded && !_solver->isRunning())
{
_process = hfr ? SSolver::ProcessType::EXTRACT_WITH_HFR : SSolver::ProcessType::EXTRACT;
_solver->setProperty("ProcessType", _process);
_solver->start();
if(sync)return _solver->extract(hfr);
else _solver->start();
return true;
}
return false;
@@ -161,6 +169,7 @@ bool Solver::updateHeader(QString &error)
Script::File file(_path, nullptr);
Script::FITSRecordModify modify;
modify.removeKeyword("RADECSYS");
modify.updateKeyword("CRPIX1", _stats.width / 2.0, QByteArray("x pixel coordinate of the reference point"));
modify.updateKeyword("CRPIX2", _stats.height / 2.0, QByteArray("y pixel coordinate of the reference point"));
modify.updateKeyword("CDELT1", cdeltx, QByteArray("X pixel size (deg)"));
@@ -185,18 +194,14 @@ bool Solver::updateHeader(QString &error)
void Solver::setParameters(Parameters::ParametersProfile profile)
{
auto profileParam = _solver->getBuiltInProfiles().at(profile);
// TODO seems like any paralel is crashing with Qt6
profileParam.partition = false;
//profileParam.inParallel = false;
_solver->setParameters(profileParam);
}
void Solver::setParameters(const Parameters &parameters)
{
auto profile = parameters;
// TODO seems like any paralel is crashing with Qt6
profile.partition = false;
//profile.inParallel = false;
_solver->setParameters(profile);
}
@@ -210,6 +215,12 @@ void Solver::setSearchPosition(double ra, double dec)
_solver->setSearchPositionRaDec(ra, dec);
}
void Solver::clearStartingPositionAndScale()
{
_solver->clearSearchPosition();
_solver->clearSearchScale();
}
QStringList Solver::getIndexPaths()
{
QStringList paths = StellarSolver::getDefaultIndexFolderPaths();