Kstars

fitsdebayer.cpp
1/*
2 SPDX-FileCopyrightText: 2015 Jasem Mutlaq <mutlaqja@ikarustech.com>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#include "fitsdebayer.h"
8
9#include "fitsdata.h"
10#include "fitsview.h"
11#include "fitsviewer.h"
12
13#include <QPushButton>
14
15debayerUI::debayerUI(QDialog *parent) : QDialog(parent)
16{
17 setupUi(parent);
18 setModal(false);
19}
20
21FITSDebayer::FITSDebayer(FITSViewer *parent) : QDialog(parent)
22{
23 ui = new debayerUI(this);
24
25 viewer = parent;
26
28 this, &FITSDebayer::applyDebayer);
29}
30
31void FITSDebayer::applyDebayer()
32{
34 if (viewer->getCurrentView(view))
35 {
36 auto image_data = view->imageData();
37
38 dc1394bayer_method_t method = static_cast<dc1394bayer_method_t>(ui->methodCombo->currentIndex());
39 dc1394color_filter_t filter = static_cast<dc1394color_filter_t>(ui->filterCombo->currentIndex() + 512);
40
41 int offsetX = ui->XOffsetSpin->value();
42 int offsetY = ui->YOffsetSpin->value();
43
44 BayerParams param;
45 param.method = method;
46 param.filter = filter;
47 param.offsetX = offsetX;
48 param.offsetY = offsetY;
49
50 image_data->setBayerParams(&param);
51
52 ui->statusEdit->setText(i18n("Processing..."));
53
54 qApp->processEvents();
55
56 if (image_data->debayer(true))
57 {
58 ui->statusEdit->setText(i18n("Complete."));
59 view->rescale(ZOOM_KEEP_LEVEL);
60 view->updateFrame();
61 }
62 else
63 ui->statusEdit->setText(i18n("Debayer failed."));
64 }
65}
66
67void FITSDebayer::setBayerParams(BayerParams *param)
68{
69 ui->methodCombo->setCurrentIndex(param->method);
70 ui->filterCombo->setCurrentIndex(param->filter - 512);
71
72 ui->XOffsetSpin->setValue(param->offsetX);
73 ui->YOffsetSpin->setValue(param->offsetY);
74}
Primary window to view monochrome and color FITS images.
Definition fitsviewer.h:54
QString i18n(const char *text, const TYPE &arg...)
void clicked(bool checked)
QFuture< void > filter(QThreadPool *pool, Sequence &sequence, KeepFunctor &&filterFunction)
QFuture< ArgsType< Signal > > connect(Sender *sender, Signal signal)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:04:46 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.