Debian Codegraph @

planetary_system_stacker/display_quickstart.py

raw symbols SCIP
1 # -*- coding: utf-8; -*-
2 """
3 Copyright (c) 2021 Rolf Hempel, [email protected]
4
5 This file is part of the PlanetarySystemStacker tool (PSS).
6 https://github.com/Rolf-Hempel/PlanetarySystemStacker
7
8 PSS is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with PSS. If not, see <http://www.gnu.org/licenses/>.
20
21 """
22
23 from sys import argv
24
25 from PyQt5 import QtWidgets
26 from PyQt5.QtCore import Qt
27
28 from configuration import Configuration
29 from quickstart_gui import Ui_Form
30
31
32 class DisplayQuickstart(QtWidgets.QWidget, Ui_Form):
33 def __init__(self, parent_gui, configuration):
34 """
35 Initialization of the widget. The quickstart guide is displayed in the viewer window.
36 """
37
38 super(DisplayQuickstart, self).__init__()
39 self.setupUi(self)
40
41 self.parent_gui = parent_gui
42 self.configuration = configuration
43
44 # Get the quickstart guide text from a markdown document. The original text is in file
45 # "quickstart.md".
46 self.label.setTextFormat(Qt.MarkdownText)
47 markdown_text = """
48 ### Quickstart Guide
49
50 #### Configuration
51 Select 'Edit / Edit configuration' to check if the configuration parameters are set properly.
52 The dialog starts with the 'Frame-related Parameters' where the most important choice is the
53 stabilization mode:
54 * Surface (for extended objects which do not fit into the FoV)
55 * Planet (if there is space around the object on all sides)
56
57 If the view is very unsteady (e.g. caused by wind), increase the 'Stabilization search width'.
58 For noisier planetary images, try 'Noise levels' up to the maximum. Check the box
59 'Dialog to exclude frames from stacking' if some frames may be corrupted by artifacts.
60 Have a look at the other parameter sections as well. For example, for strongly oversampled
61 planetary images consider increasing the 'Max alignment search width' (Section 'Multipoint Alignment
62 Parameters').
63
64 #### Select jobs
65 Next, press 'File / Open' to specify the jobs for this session. Video files / image folders are
66 stacked, single images are postprocessed. Either use the PSS file chooser, or cancel the chooser and
67 'drag and drop' objects from a file explorer.
68
69 #### Job execution (interactive / batch)
70 Start the processing with 'Start / Cont.'. Jobs are executed in consecutive order, either
71 interactively (default, with GUI), or automatically (batch). If jobs are similar, use interactive
72 mode for the first job to make processing choices. Then check the box 'Automatic' to have PSS
73 process all the other jobs automatically with the same parameters. You can change back to
74 interactive mode at any time by unchecking the 'Automatic' box.
75
76 The most important dialog is the one where the alignment points are set. It is critical
77 to experiment with different 'Alignment box widths' (upper right slider). Start with a high
78 value (e.g. 100), and reduce it until the final image quality does not improve any further.
79 Too low values may result in stacking artifacts. As an alternative to the automatic AP
80 grid generation, you can set APs manually by left-clicking into the preview image.
81
82 Another important paramter which needs to be adapted to the individual case is the number /
83 percentage of frames used for stacking. Try different values to find the optimal choice.
84
85 #### Postprocessing
86 Postprocessing can follow stacking immediately (if the workflow parameter 'Stacking plus
87 postprocessing' is checked), or be executed separately (if the job input is a single image file).
88 To process several images with the same parameters, adjust the parameters for the first image in
89 interactive mode, and then check 'Automatic' to repeat the same for all other images in batch mode.
90 """
91
92 self.label.setText(markdown_text)
93
94 self.dont_show_checkBox.setChecked(not self.configuration.global_parameters_display_quickstart)
95 self.dont_show_checkBox.stateChanged.connect(self.checkbox_changed)
96
97 def checkbox_changed(self):
98 """
99 This method is connected with the checkbox in the quickstart guide and with the menu
100 entry where the quickstart guide can be re-activated.
101
102 :return: -
103 """
104 self.configuration.global_parameters_display_quickstart = \
105 not self.configuration.global_parameters_display_quickstart
106 if self.parent_gui is not None:
107 self.parent_gui.ui.actionShow_Quickstart.setChecked(
108 self.configuration.global_parameters_display_quickstart)
109
110
111 if __name__ == '__main__':
112 # Get configuration parameters.
113 configuration = Configuration()
114 configuration.initialize_configuration()
115
116 app = QtWidgets.QApplication(argv)
117 window = DisplayQuickstart(None, configuration)
118 window.show()
119 app.exec_()