Compare commits

...

13 Commits

Author SHA1 Message Date
nou 4afa940886 Update metainfo 2024-11-16 22:58:34 +01:00
nou d1344d2dc8 Add support for uint32 and double in boxResample 2024-11-15 23:29:22 +01:00
nou 24eea573e6 Handle all data types when converting to QImage 2024-10-29 19:43:16 +01:00
nou 8f7f527732 Add RawImage::convertToType() 2024-10-29 19:42:36 +01:00
nou 3635ac00cb Fix alpha channel in fromPlanarSSE 2024-10-29 19:39:37 +01:00
nou eba9110933 Remove dead code 2024-10-29 15:32:06 +01:00
nou 464207beb1 Apply index folder directory change immediatly 2024-10-24 20:15:06 +02:00
nou 4aeff61c44 Add TIFF as valid format for script convert 2024-10-13 19:58:13 +02:00
nou 790c836bbd MXE build 2024-10-13 19:58:12 +02:00
nou 62616898ed Forgot to add fts and fz to one place 2024-10-13 19:57:21 +02:00
nou e216af6a6d Better handling of missing and overwrite files 2024-10-13 19:57:21 +02:00
nou e0d6f417a0 fixup! Fix compiling without stellarsolver 2024-10-04 20:51:53 +02:00
nou 3c5fef988e Fix compiling without stellarsolver 2024-10-02 15:25:32 +02:00
15 changed files with 238 additions and 133 deletions
+17 -12
View File
@@ -81,6 +81,23 @@ if(COLOR_MANAGMENT)
target_compile_definitions(tenmon PRIVATE "COLOR_MANAGMENT")
endif(COLOR_MANAGMENT)
find_path(STELLARSOLVER_INCLUDE stellarsolver.h PATH_SUFFIXES libstellarsolver)
if(STELLARSOLVER_INCLUDE AND STELLARSOLVER_LIB)
target_include_directories(tenmon PRIVATE ${STELLARSOLVER_INCLUDE})
if(MXE)
target_link_libraries(tenmon PRIVATE ${STELLARSOLVER_LIB} ${GSL_LIB} ${GSLCBLAS_LIB} boost_regex-mt-x64)
else(MXE)
target_link_libraries(tenmon PRIVATE ${STELLARSOLVER_LIB})
endif(MXE)
target_compile_definitions(tenmon PRIVATE "PLATESOLVER")
target_sources(tenmon PRIVATE
solver.cpp solver.h
platesolving.cpp platesolving.h platesolving.ui
platesolvingsettings.cpp platesolvingsettings.h platesolvingsettings.ui
)
message(STATUS "Found stellarsolver ${STELLARSOLVER_INCLUDE} ${STELLARSOLVER_LIB}")
endif(STELLARSOLVER_INCLUDE AND STELLARSOLVER_LIB)
target_link_libraries(tenmon PRIVATE Qt6::Widgets Qt6::Sql Qt6::OpenGLWidgets Qt6::Qml ${GSL_LIB} ${GSLCBLAS_LIB} ${EXIF_LIB} ${FITS_LIB} ${RAW_LIB} ${WCS_LIB} ${LCMS2_LIB} XISF)
if(APPLE)
target_link_libraries(tenmon PRIVATE Qt6::DBus "-framework CoreFoundation")
@@ -93,18 +110,6 @@ if(LIBRAW_STATIC)
target_link_libraries(tenmon PRIVATE jasper)
endif()
find_path(STELLARSOLVER_INCLUDE stellarsolver.h PATH_SUFFIXES libstellarsolver)
if(STELLARSOLVER_INCLUDE AND STELLARSOLVER_LIB)
target_include_directories(tenmon PRIVATE ${STELLARSOLVER_INCLUDE})
target_link_libraries(tenmon PRIVATE ${STELLARSOLVER_LIB})
target_compile_definitions(tenmon PRIVATE "PLATESOLVER")
target_sources(tenmon PRIVATE
solver.cpp solver.h
platesolving.cpp platesolving.h platesolving.ui
platesolvingsettings.cpp platesolvingsettings.h platesolvingsettings.ui
)
endif(STELLARSOLVER_INCLUDE AND STELLARSOLVER_LIB)
option(FLATPAK "Flatpak build" OFF)
if(FLATPAK)
target_compile_definitions(tenmon PRIVATE FLATPAK)
+1 -1
View File
@@ -202,7 +202,7 @@ In <b>files</b> array there are instances of type <b>File</b> objects that have
This path can be relative or absolute. In case that <i>newpath</i> parameter is relative path then it "Output directory" from GUI windows is used as base directory. Parameter <i>newpath</i> can be absolute path.
File is then moved to this path.</li>
<li><b>convert(outpath, format, params)</b> convert image file from any format that program is able to open into FITS, XISF, JPEG, PNG, BMP.
Parameters are: <i>outputpath</i> path where converted image will be saved. It automatically replace suffix according to format. <i>format</i> one of "FITS" "XISF", "JPG", "PNG" or "BMP". <i>params</i> object with attributes "compressionType" and "compressionLevel".
Parameters are: <i>outputpath</i> path where converted image will be saved. It automatically replace suffix according to format. <i>format</i> one of "FITS" "XISF", "JPG", "PNG", "TIFF" or "BMP". <i>params</i> object with attributes "compressionType" and "compressionLevel".
Valid values for compressionType are be "gzip" or "rice" when converting to FITS. When converting to XISF compressionType can be "zlib", "lz4", "lz4hc", "zstd", "zlib+sh", "lz4+sh", "lz4hc+sh", "zstd+sh".
It is recommended to use "+sh" variants of compression.
XISF format also accept "compressionLevel" in range 0-100 where zero is fastest compression and 100 slowest. If you omit this attribute or set it to -1 then default compression level will be used.
+1 -1
View File
@@ -161,7 +161,7 @@ le fichier <i>C:/images/lights/red/M42_001.fits</i>, alors cette méthode renver
Ce chemin peut être relatif ou absolu. Dans le cas où le paramètre <i>newpath</i> est un chemin relatif, le "répertoire de sortie" des fenêtres de l'interface graphique est utilisé comme répertoire de base. Le paramètre <i>newpath</i> peut être un chemin absolu.
Le fichier est ensuite déplacé vers ce chemin.</li>
<li><b>convert(outpath, format, params)</b> Convertir un fichier image à partir de n'importe quel format que le programme peut ouvrir en FITS, XISF, JPEG, PNG, BMP.
Les paramètres sont : <i>outputpath</i> chemin où l'image convertie sera enregistrée. Il remplace automatiquement le suffixe en fonction du format. <i>format</i> l'un des éléments suivants : "FITS", "XISF", "JPG", "PNG" ou "BMP". <i>params</i> objet avec les attributs "compressionType" et "compressionLevel".
Les paramètres sont : <i>outputpath</i> chemin où l'image convertie sera enregistrée. Il remplace automatiquement le suffixe en fonction du format. <i>format</i> l'un des éléments suivants : "FITS", "XISF", "JPG", "PNG", "TIFF" ou "BMP". <i>params</i> objet avec les attributs "compressionType" et "compressionLevel".
Les valeurs valides pour compressionType sont "gzip" ou "rice" lors de la conversion en FITS. Lors de la conversion en XISF, compressionType peut être "zlib", "lz4", "lz4hc", "zstd", "zlib+sh", "lz4+sh", "lz4hc+sh", "zstd+sh".
Il est recommandé d'utiliser les variantes de compression "+sh".
Le format XISF accepte également les "compressionLevel" dans la plage 0-100, où zéro est la compression la plus rapide et 100 la plus lente. Si vous omettez cet attribut ou le définissez sur -1, le niveau de compression par défaut sera utilisé.
+1 -1
View File
@@ -151,7 +151,7 @@ V poli <b>files</b> sú inštancie objektu typu <b>File</b> ktorý ma nasledovn
This path can be relative or absolute. In case that <i>newpath</i> parameter is relative path then it "Output directory" from GUI windows is used as base directory. Parameter <i>newpath</i> can be absolute path.
File is then moved to this path.</li>
<li><b>convert(outpath, format, params)</b> convert image file from any format that program is able to open into FITS, XISF, JPEG, PNG, BMP.
Parameters are: <i>outputpath</i> path where converted image will be saved. It automatically replace suffix according to format. <i>format</i> one of "FITS" "XISF", "JPG", "PNG" or "BMP". <i>params</i> object with attributes "compressionType" and "compressionLevel".
Parameters are: <i>outputpath</i> path where converted image will be saved. It automatically replace suffix according to format. <i>format</i> one of "FITS" "XISF", "JPG", "PNG", "TIFF" or "BMP". <i>params</i> object with attributes "compressionType" and "compressionLevel".
Valid values for compressionType are be "gzip" or "rice" when converting to FITS. When converting to XISF compressionType can be "zlib", "lz4", "lz4hc", "zstd", "zlib+sh", "lz4+sh", "lz4hc+sh", "zstd+sh".
It is recommended to use "+sh" variants of compression.
XISF format also accept "compressionLevel" in range 0-100 where zero is fastest compression and 100 slowest. If you omit this attribute or set it to -1 then default compression level will be used.
+12 -2
View File
@@ -709,6 +709,7 @@ void ConvertRunable::run()
{
QImage::Format format = QImage::Format_Invalid;
int width = rawimage->widthBytes();
switch(rawimage->type())
{
case RawImage::UINT8:
@@ -722,9 +723,18 @@ void ConvertRunable::run()
else if(rawimage->channels() == 4)format = QImage::Format_RGBA64;
width *= 2;
break;
default:
return;
case RawImage::FLOAT16:
case RawImage::FLOAT32:
case RawImage::FLOAT64:
case RawImage::UINT32:
rawimage->convertToType(RawImage::UINT16);
if(rawimage->channels() == 1)format = QImage::Format_Grayscale16;
else if(rawimage->channels() == 3)format = QImage::Format_RGBX64;
else if(rawimage->channels() == 4)format = QImage::Format_RGBA64;
width *= 2;
break;
}
if(format == QImage::Format_Invalid)return;
QImage qimage(rawimage->width(), rawimage->height(), format);
+41 -2
View File
@@ -64,7 +64,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
}
_openFilter.append("*.fit *.fits *.fts *.fz *.xisf *.cr2 *.cr3 *.nef *.dng)");
_openFilter.append(tr(";;All files (*)"));
nameFilter.append({"fit", "fits", "xisf", "cr2", "cr3", "nef", "dng"});
nameFilter.append({"fit", "fits", "fts", "fz", "xisf", "cr2", "cr3", "nef", "dng"});
QImageReader::setAllocationLimit(0);
m_info = new ImageInfo(this);
@@ -407,6 +407,9 @@ void MainWindow::copyOrMove(bool copy, const QString &dest)
if(!dest.isEmpty() && dir.exists())
{
int i = 0;
int missing = 0;
bool overwriteAll = false;
bool skipAll = false;
QStringList files = m_database->getMarkedFiles();
QProgressDialog progress(copy ? tr("Copying") : tr("Moving"), tr("Cancel"), 0, files.size(), this);
progress.setWindowModality(Qt::WindowModal);
@@ -418,8 +421,42 @@ void MainWindow::copyOrMove(bool copy, const QString &dest)
QFile srcFile(file);
QFile dstFile(dir.absoluteFilePath(info.fileName()));
if(dstFile.exists())
if(!srcFile.exists())
{
missing++;
continue;
}
if(dstFile.exists())
{
if(skipAll)
{
continue;
}
else if(overwriteAll)
{
dstFile.remove();
}
else
{
QMessageBox::StandardButton button = QMessageBox::question(this, tr("Overwrite file?"), tr("Destination file %1 already exists. Overwrite?").arg(dstFile.fileName()),
QMessageBox::Yes | QMessageBox::YesToAll | QMessageBox::No | QMessageBox::NoToAll);
switch (button)
{
case QMessageBox::YesToAll:
overwriteAll = true;
case QMessageBox::Yes:
dstFile.remove();
break;
case QMessageBox::NoToAll:
skipAll = true;
case QMessageBox::No:
continue;
default:
break;
}
}
}
if(progress.wasCanceled())
return;
@@ -458,6 +495,8 @@ void MainWindow::copyOrMove(bool copy, const QString &dest)
progress.setValue(i++);
}
m_database->clearMarkedFiles();
if(missing)
QMessageBox::information(this, tr("Missing marked files"), tr("%1 marked files were missing. They were skipped.").arg(missing));
}
}
+1
View File
@@ -198,4 +198,5 @@ void PlateSolving::settings()
{
PlateSolvingSettings settings(this);
settings.exec();
_solver->setIndexFolder(settings.indexDirectory());
}
+5
View File
@@ -123,6 +123,11 @@ void PlateSolvingSettings::checkIndexFiles()
checkScale(_ui->scale19, 19);
}
QString PlateSolvingSettings::indexDirectory() const
{
return _ui->indexPaths->currentText();
}
void PlateSolvingSettings::progress(int percent, int files)
{
_ui->filesRemaining->setText(tr("%1 files").arg(files));
+1
View File
@@ -18,6 +18,7 @@ public:
explicit PlateSolvingSettings(QWidget *parent = nullptr);
~PlateSolvingSettings();
void checkIndexFiles();
QString indexDirectory() const;
protected slots:
void progress(int percent, int files);
private:
+107 -83
View File
@@ -279,46 +279,6 @@ void RawImage::calcStats()
}
}
void RawImage::rect(int &x, int &y, int w, int h, std::vector<double> &r) const
{
/*r.resize(w*h);
x -= w/2;
y -= h/2;
if(x<0)x = 0;
if(y<0)y = 0;
if(x+w >= m_img.cols)x = m_img.cols-w;
if(y+h >= m_img.rows)y = m_img.rows-h;
cv::Mat roiImg(m_img, cv::Rect(x, y, w, h));
cv::Mat doubleMat;
roiImg.convertTo(doubleMat, CV_64F);
r = std::vector<double>(doubleMat.begin<double>(), doubleMat.end<double>());*/
}
int RawImage::findPeaks(double background, double distance, std::vector<Peak> &peaks) const
{
/*std::vector<std::vector<cv::Point>> contours;
cv::Mat kernel = cv::getStructuringElement(cv::MORPH_RECT, cv::Size(distance, distance));
cv::Mat img, mask, dilate, locMax, result;
if(m_img.channels() == 1)img = m_img;
else cv::cvtColor(m_img, img, cv::COLOR_RGB2GRAY);
cv::dilate(img, dilate, kernel);
cv::compare(img, dilate, locMax, cv::CMP_GE);
cv::compare(img, cv::Scalar(background), mask, cv::CMP_GT);
cv::bitwise_and(locMax, mask, result);
cv::findContours(result, contours, cv::noArray(), cv::RETR_EXTERNAL, cv::CHAIN_APPROX_SIMPLE);
peaks.reserve(contours.size());
for(auto contour : contours)
{
peaks.push_back(Peak(1, contour[0].x, contour[0].y));
}
return peaks.size();*/
}
uint32_t RawImage::width() const
{
return m_width;
@@ -475,45 +435,106 @@ void RawImage::convertToThumbnail()
void RawImage::convertToGLFormat()
{
size_t s = size() * m_ch;
if(m_type == UINT32)
{
m_origWidth = m_width;
m_origHeight = m_height;
m_original = std::move(m_pixels);
allocate(m_width, m_height, m_channels, FLOAT32);
m_origType = UINT32;
float *dst = reinterpret_cast<float*>(m_pixels.get());
uint32_t *src = reinterpret_cast<uint32_t*>(m_original.get());
if(m_type == UINT32 || m_type == FLOAT64)
convertToType(FLOAT32);
else if(OpenGLES && m_type == UINT16)
convertToType(FLOAT16);
}
for(size_t i = 0; i < s; i++)
dst[i] = src[i] / (float)UINT32_MAX;
}
else if(m_type == FLOAT64)
template<typename T, typename U>
void convertType2(uint32_t size, const T *src, U *dst)
{
if constexpr((std::is_floating_point_v<T> || std::is_same_v<T, F16>) && (std::is_floating_point_v<U> || std::is_same_v<T, F16>))
{
m_origWidth = m_width;
m_origHeight = m_height;
m_original = std::move(m_pixels);
allocate(m_width, m_height, m_channels, FLOAT32);
m_origType = FLOAT64;
float *dst = reinterpret_cast<float*>(m_pixels.get());
double *src = reinterpret_cast<double*>(m_original.get());
for(size_t i = 0; i < s; i++)
for(uint32_t i = 0; i < size; i++)
dst[i] = src[i];
}
else if(OpenGLES && m_type == UINT16)
{
m_origWidth = m_width;
m_origHeight = m_height;
m_original = std::move(m_pixels);
allocate(m_width, m_height, m_channels, FLOAT16);
m_origType = UINT16;
F16 *dst = reinterpret_cast<F16*>(m_pixels.get());
uint16_t *src = reinterpret_cast<uint16_t*>(m_original.get());
for(size_t i = 0; i < s; i++)
dst[i] = (F16)(src[i] / (float)UINT16_MAX);
if constexpr(std::is_integral_v<T> && std::is_integral_v<U>)
{
if constexpr(sizeof(T) > sizeof(U))
for(uint32_t i = 0; i < size; i++)
dst[i] = src[i] >> ((sizeof(T) - sizeof(U)) * 8);
else
for(uint32_t i = 0; i < size; i++)
dst[i] = static_cast<U>(src[i]) << ((sizeof(U) - sizeof(T)) * 8);
}
if constexpr((std::is_floating_point_v<T> || std::is_same_v<T, F16>) && std::is_integral_v<U>)
{
U max = std::numeric_limits<U>::max();
T scale = (T)(max);
for(uint32_t i = 0; i < size; i++)
dst[i] = src[i] * scale;
}
if constexpr(std::is_integral_v<T> && (std::is_floating_point_v<U> || std::is_same_v<U, F16>))
{
U scale = (U)(1.0 / (double)std::numeric_limits<T>::max());
for(uint32_t i = 0; i < size; i++)
dst[i] = (U)src[i] * scale;
}
}
template<typename T>
void convertType(uint32_t size, RawImage::DataType dstType, const T *src, void *dst)
{
switch(dstType)
{
case RawImage::UINT8:
convertType2(size, src, static_cast<uint8_t*>(dst));
break;
case RawImage::UINT16:
convertType2(size, src, static_cast<uint16_t*>(dst));
break;
case RawImage::UINT32:
convertType2(size, src, static_cast<uint32_t*>(dst));
break;
case RawImage::FLOAT16:
convertType2(size, src, static_cast<F16*>(dst));
break;
case RawImage::FLOAT32:
convertType2(size, src, static_cast<float*>(dst));
break;
case RawImage::FLOAT64:
convertType2(size, src, static_cast<double*>(dst));
break;
}
}
void RawImage::convertToType(DataType type)
{
if(type == m_type)
return;
m_origWidth = m_width;
m_origHeight = m_height;
m_original = std::move(m_pixels);
DataType origType = m_type;
allocate(m_width, m_height, m_channels, type);
m_origType = origType;
uint32_t s = size() * m_ch;
switch(m_origType)
{
case UINT8:
convertType(s, type, reinterpret_cast<uint8_t*>(m_original.get()), m_pixels.get());
break;
case UINT16:
convertType(s, type, reinterpret_cast<uint16_t*>(m_original.get()), m_pixels.get());
break;
case UINT32:
convertType(s, type, reinterpret_cast<uint32_t*>(m_original.get()), m_pixels.get());
break;
case FLOAT16:
convertType(s, type, reinterpret_cast<F16*>(m_original.get()), m_pixels.get());
break;
case FLOAT32:
convertType(s, type, reinterpret_cast<float*>(m_original.get()), m_pixels.get());
break;
case FLOAT64:
convertType(s, type, reinterpret_cast<double*>(m_original.get()), m_pixels.get());
break;
}
}
@@ -622,16 +643,16 @@ bool RawImage::pixel(int x, int y, double &r, double &g, double &b) const
return true;
}
template<typename T>
template<typename T, typename U = float>
void boxResample(uint32_t w, uint32_t h, uint32_t ch, uint32_t oldw, uint32_t oldh, const uint8_t *in_, uint8_t *out_)
{
if(oldw == 0 || oldh == 0)return;
const T *in = reinterpret_cast<const T*>(in_);
T *out = reinterpret_cast<T*>(out_);
float max = 255.0f;
if constexpr(std::is_same_v<T, uint16_t>)
max = UINT16_MAX;
U max = 255.0f;
if constexpr(std::is_integral_v<T>)
max = (U)std::numeric_limits<T>::max();
float sx = (float)w / oldw;
float sy = (float)h / oldh;
@@ -639,7 +660,7 @@ void boxResample(uint32_t w, uint32_t h, uint32_t ch, uint32_t oldw, uint32_t ol
{
for(uint32_t x = 0; x < w; x++)//iterate over destination X
{
float p[4] = {0.0f};
U p[4] = {0.0f};
uint32_t xx = x * oldw / w;//calculate source rect
uint32_t yy = y * oldh / h;
uint32_t xe = std::min((x + 1) * oldw / w, oldw - 1);
@@ -692,14 +713,17 @@ void RawImage::resize(uint32_t w, uint32_t h)
case RawImage::UINT16:
boxResample<uint16_t>(w, h, m_ch, oldw, oldh, old_pixels.get(), m_pixels.get());
break;
case RawImage::FLOAT32:
boxResample<float>(w, h, m_ch, oldw, oldh, old_pixels.get(), m_pixels.get());
case RawImage::UINT32:
boxResample<uint32_t>(w, h, m_ch, oldw, oldh, old_pixels.get(), m_pixels.get());
break;
case RawImage::FLOAT16:
boxResample<F16>(w, h, m_ch, oldw, oldh, old_pixels.get(), m_pixels.get());
break;
default:
qWarning() << "Resizing format not supported";
case RawImage::FLOAT32:
boxResample<float>(w, h, m_ch, oldw, oldh, old_pixels.get(), m_pixels.get());
break;
case RawImage::FLOAT64:
boxResample<double, double>(w, h, m_ch, oldw, oldh, old_pixels.get(), m_pixels.get());
break;
}
}
+1 -2
View File
@@ -86,8 +86,6 @@ public:
RawImage(const QImage &img);
const RawImage::Stats& imageStats() const;
void calcStats();
void rect(int &x, int &y, int w, int h, std::vector<double> &r) const;
int findPeaks(double background, double distance, std::vector<Peak> &peaks) const;
uint32_t width() const;
uint32_t height() const;
uint32_t channels() const;
@@ -105,6 +103,7 @@ public:
void setPlanar();
void convertToThumbnail();
void convertToGLFormat();
void convertToType(RawImage::DataType type);
float thumbAspect() const;
bool pixel(int x, int y, double &r, double &g, double &b) const;
void resize(uint32_t w, uint32_t h);
+3 -3
View File
@@ -21,7 +21,7 @@ void fromPlanarSSE(const void *in, void *out, size_t count)
__m128i r = _mm_loadu_si128(_in[0] + i);
__m128i g = _mm_loadu_si128(_in[1] + i);
__m128i b = _mm_loadu_si128(_in[2] + i);
if constexpr(ch==4)a = _mm_loadu_si128(_in[3]);
if constexpr(ch==4)a = _mm_loadu_si128(_in[3] + i);
__m128i d1 = _mm_unpacklo_epi8(r, b);
__m128i d2 = _mm_unpacklo_epi8(g, a);
@@ -43,7 +43,7 @@ void fromPlanarSSE(const void *in, void *out, size_t count)
__m128i r = _mm_loadu_si128(_in[0] + i);
__m128i g = _mm_loadu_si128(_in[1] + i);
__m128i b = _mm_loadu_si128(_in[2] + i);
if constexpr(ch==4)a = _mm_loadu_si128(_in[3]);
if constexpr(ch==4)a = _mm_loadu_si128(_in[3] + i);
__m128i d1 = _mm_unpacklo_epi16(r, b);
__m128i d2 = _mm_unpacklo_epi16(g, a);
@@ -66,7 +66,7 @@ void fromPlanarSSE(const void *in, void *out, size_t count)
__m128i r = _mm_loadu_si128(_in[0] + i);
__m128i g = _mm_loadu_si128(_in[1] + i);
__m128i b = _mm_loadu_si128(_in[2] + i);
if constexpr(ch==4)a = _mm_loadu_si128(_in[3]);
if constexpr(ch==4)a = _mm_loadu_si128(_in[3] + i);
__m128i d1 = _mm_unpacklo_epi32(r, b);
__m128i d2 = _mm_unpacklo_epi32(g, a);
+32 -22
View File
@@ -9,7 +9,9 @@
#include "batchprocessing.h"
#include <fitsio2.h>
#include "libXISF/libxisf.h"
#ifdef PLATESOLVER
#include "solver.h"
#endif // PLATESOLVER
namespace Script
{
@@ -27,7 +29,9 @@ ScriptEngine::ScriptEngine(BatchProcessing *parent)
_database->init(QLatin1String("scriptengine"));
_semaphore.release(_pool->maxThreadCount());
#ifdef PLATESOLVER
_solver = new Solver(this);
#endif // PLATESOLVER
}
void ScriptEngine::setParams(const QString &scriptPath, const QList<QPair<QString, QString>> &paths, const QString &outputDir)
@@ -49,7 +53,9 @@ const QString &ScriptEngine::outputDir() const
void ScriptEngine::interrupt()
{
_solver->abort();
#ifdef PLATESOLVER
if(_solver)_solver->abort();
#endif
_jsEngine->setInterrupted(true);
}
@@ -122,25 +128,6 @@ QJSValue ScriptEngine::getItem(const QStringList &items, const QString &label, i
return ret;
}
void ScriptEngine::setStartingSolution(const QJSValue &solution)
{
if(solution.isObject())
{
if(solution.hasProperty("ra") && solution.hasProperty("dec") && solution.property("ra").isNumber() && solution.property("dec").isNumber())
_solver->setSearchPosition(solution.property("ra").toNumber(), solution.property("dec").toNumber());
if(solution.hasProperty("pixscale") && solution.property("pixscale").isNumber())
{
double scale = solution.property("pixscale").toNumber();
_solver->setSearchScale(scale * 0.8, scale * 1.2, SSolver::ScaleUnits::ARCSEC_PER_PIX);
}
}
else
{
_solver->clearStartingPositionAndScale();
}
}
bool ScriptEngine::convert(File *file, QString &outpath, const QString &format, const QVariantMap &params, bool async)
{
QString path;
@@ -153,9 +140,9 @@ bool ScriptEngine::convert(File *file, QString &outpath, const QString &format,
path = dir.absoluteFilePath(outpath);
QString f = format.toLower();
if(f != "xisf" && f != "fits" && f != "png" && f != "bmp" && f != "jpg")
if(f != "xisf" && f != "fits" && f != "png" && f != "bmp" && f != "jpg" && f != "tiff")
{
logError("Output format must be one of xisf fits jpg png bmp");
logError("Output format must be one of xisf fits jpg png bmp tiff");
return false;
}
@@ -174,6 +161,26 @@ bool ScriptEngine::convert(File *file, QString &outpath, const QString &format,
return true;
}
#ifdef PLATESOLVER
void ScriptEngine::setStartingSolution(const QJSValue &solution)
{
if(solution.isObject())
{
if(solution.hasProperty("ra") && solution.hasProperty("dec") && solution.property("ra").isNumber() && solution.property("dec").isNumber())
_solver->setSearchPosition(solution.property("ra").toNumber(), solution.property("dec").toNumber());
if(solution.hasProperty("pixscale") && solution.property("pixscale").isNumber())
{
double scale = solution.property("pixscale").toNumber();
_solver->setSearchScale(scale * 0.8, scale * 1.2, SSolver::ScaleUnits::ARCSEC_PER_PIX);
}
}
else
{
_solver->clearStartingPositionAndScale();
}
}
QJSValue ScriptEngine::solveImage(File *file, bool updateHeader)
{
QString path = file->absoluteFilePath();
@@ -253,6 +260,7 @@ QJSValue ScriptEngine::extractStars(File *file, bool hfr)
return ret;
}
#endif // PLATESOLVER
QJSValue ScriptEngine::newObject()
{
@@ -682,6 +690,7 @@ QJSValue File::stats()
return _stats;
}
#ifdef PLATESOLVER
QJSValue File::solve(bool updateHeader)
{
if(_solution.isUndefined() || updateHeader)
@@ -697,6 +706,7 @@ QJSValue File::extractStars(bool hfr)
return _stars;
}
#endif // PLATESOLVER
ScriptEngineThread::ScriptEngineThread(BatchProcessing *parent) : QObject(parent)
{
+6 -2
View File
@@ -29,7 +29,7 @@ class ScriptEngine : public QObject
QString _scriptPath;
QString _outputDir;
QList<QPair<QString, QString>> _paths;
Solver *_solver;
Solver *_solver = nullptr;
public:
explicit ScriptEngine(BatchProcessing *parent = nullptr);
void setParams(const QString &scriptPath, const QList<QPair<QString, QString>> &paths, const QString &outputDir);
@@ -47,10 +47,12 @@ public:
Q_INVOKABLE QJSValue getInt(const QString &label = QString(), int value = 0);
Q_INVOKABLE QJSValue getFloat(const QString &label = QString(), double value = 0, int decimals = 3) const;
Q_INVOKABLE QJSValue getItem(const QStringList &items, const QString &label = "", int current = 0) const;
Q_INVOKABLE void setStartingSolution(const QJSValue &solution = QJSValue());
bool convert(File *file, QString &outpath, const QString &format, const QVariantMap &params, bool async);
#ifdef PLATESOLVER
Q_INVOKABLE void setStartingSolution(const QJSValue &solution = QJSValue());
QJSValue solveImage(File *file, bool updateHeader);
QJSValue extractStars(File *file, bool hfr);
#endif // PLATESOLVER
QJSValue newObject();
QJSValue newArray(uint size);
public slots:
@@ -116,8 +118,10 @@ public:
Q_INVOKABLE File* convert(const QString &outpath, const QString &format, const QVariantMap &params = QVariantMap());
Q_INVOKABLE File* convertAsync(const QString &outpath, const QString &format, const QVariantMap &params = QVariantMap());
Q_INVOKABLE QJSValue stats();
#ifdef PLATESOLVER
Q_INVOKABLE QJSValue solve(bool updateHeader = false);
Q_INVOKABLE QJSValue extractStars(bool hfr);
#endif // PLATESOLVER
};
class FITSRecordModify : public QObject
+9 -2
View File
@@ -57,6 +57,13 @@
</screenshots>
<content_rating type="oars-1.1"/>
<releases>
<release version="20241116" date="2024-11-16">
<description>
<ul>
<li>Extending support of data formats</li>
</ul>
</description>
</release>
<release version="20241002" date="2024-10-02">
<description>
<ul>
@@ -81,7 +88,7 @@
</ul>
</description>
</release>
<release version="20240201" date="2024-02-01">
<release version="20240201" date="2024-02-01">
<description>
<ul>
<li>Smooth thumbnails</li>
@@ -89,7 +96,7 @@
<li>Bugfixes</li>
</ul>
</description>
</release>
</release>
<release version="20240108" date="2024-01-08">
<description>
<ul>