Kstars

fitsdebayer.cpp
1 /*
2  SPDX-FileCopyrightText: 2015 Jasem Mutlaq <[email protected]>
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 
15 debayerUI::debayerUI(QDialog *parent) : QDialog(parent)
16 {
17  setupUi(parent);
18  setModal(false);
19 }
20 
21 FITSDebayer::FITSDebayer(FITSViewer *parent) : QDialog(parent)
22 {
23  ui = new debayerUI(this);
24 
25  viewer = parent;
26 
27  connect(ui->buttonBox->button(QDialogButtonBox::Apply), &QPushButton::clicked,
28  this, &FITSDebayer::applyDebayer);
29 }
30 
31 void 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 
67 void 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 }
void clicked(bool checked)
QString i18n(const char *text, const TYPE &arg...)
Primary window to view monochrome and color FITS images. The FITSviewer can open multiple images each...
Definition: fitsviewer.h:48
QFuture< void > filter(Sequence &sequence, KeepFunctor filterFunction)
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Mon Aug 8 2022 04:13:20 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.