tomwer 1.5.0rc0__py3-none-any.whl → 1.5.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- orangecontrib/tomwer/tutorials/id16b/ID16b_insitu.ows +1 -1
- orangecontrib/tomwer/tutorials/id16b/ID16b_normalization.ows +1 -1
- tomwer/app/axis.py +1 -1
- tomwer/core/process/control/datalistener/rpcserver.py +2 -8
- tomwer/core/process/drac/binning.py +2 -2
- tomwer/core/process/drac/output.py +1 -1
- tomwer/core/process/reconstruction/axis/mode.py +2 -2
- tomwer/core/process/reconstruction/axis/params.py +4 -4
- tomwer/core/process/reconstruction/axis/projectiontype.py +1 -1
- tomwer/core/process/reconstruction/axis/side.py +1 -1
- tomwer/core/process/reconstruction/darkref/params.py +1 -2
- tomwer/core/process/reconstruction/nabu/nabucommon.py +2 -2
- tomwer/core/process/reconstruction/nabu/nabuslices.py +18 -5
- tomwer/core/process/reconstruction/nabu/target.py +1 -1
- tomwer/core/process/reconstruction/nabu/test/test_nabu_utils.py +9 -0
- tomwer/core/process/reconstruction/nabu/utils.py +3 -0
- tomwer/core/process/reconstruction/normalization/normalization.py +1 -1
- tomwer/core/process/reconstruction/normalization/params.py +3 -3
- tomwer/core/process/reconstruction/saaxis/params.py +3 -3
- tomwer/core/process/reconstruction/saaxis/saaxis.py +5 -1
- tomwer/core/process/reconstruction/scores/params.py +2 -2
- tomwer/core/process/reconstruction/scores/scores.py +3 -3
- tomwer/core/process/reconstruction/tests/test_saaxis.py +56 -66
- tomwer/core/process/tests/test_normalization.py +2 -1
- tomwer/core/scan/scanbase.py +1 -1
- tomwer/core/scan/scantype.py +1 -1
- tomwer/core/settings.py +1 -1
- tomwer/gui/cluster/slurm.py +3 -3
- tomwer/gui/configuration/level.py +1 -1
- tomwer/gui/control/actions.py +1 -1
- tomwer/gui/control/datalist.py +1 -1
- tomwer/gui/control/series/seriescreator.py +5 -5
- tomwer/gui/control/tomoobjdisplaymode.py +1 -1
- tomwer/gui/dataportal/gallery.py +6 -6
- tomwer/gui/edit/tests/test_nx_editor.py +1 -1
- tomwer/gui/reconstruction/axis/EstimatedCorComboBox.py +2 -2
- tomwer/gui/reconstruction/axis/InputWidget.py +3 -3
- tomwer/gui/reconstruction/nabu/nabuconfig/base.py +1 -3
- tomwer/gui/reconstruction/nabu/nabuconfig/ctf.py +6 -6
- tomwer/gui/reconstruction/nabu/nabuconfig/phase.py +3 -3
- tomwer/gui/reconstruction/nabu/nabuconfig/preprocessing.py +3 -3
- tomwer/gui/reconstruction/nabu/nabuconfig/reconstruction.py +7 -3
- tomwer/gui/reconstruction/nabu/slices.py +6 -6
- tomwer/gui/reconstruction/nabu/volume.py +1 -1
- tomwer/gui/reconstruction/normalization/intensity.py +6 -10
- tomwer/gui/reconstruction/saaxis/corrangeselector.py +2 -2
- tomwer/gui/reconstruction/sacommon.py +2 -2
- tomwer/gui/reconstruction/scores/scoreplot.py +3 -3
- tomwer/gui/reconstruction/tests/test_nabu.py +2 -2
- tomwer/gui/stitching/config/positionoveraxis.py +1 -1
- tomwer/gui/utils/buttons.py +1 -1
- tomwer/gui/utils/flow.py +1 -1
- tomwer/gui/utils/loadingmode.py +1 -1
- tomwer/gui/utils/vignettes.py +1 -1
- tomwer/gui/visualization/dataviewer.py +7 -7
- tomwer/gui/visualization/reconstructionparameters.py +35 -23
- tomwer/gui/visualization/scanoverview.py +28 -11
- tomwer/gui/visualization/test/test_reconstruction_parameters.py +2 -2
- tomwer/resources/gui/icons/borders.png +0 -0
- tomwer/synctools/stacks/processingstack.py +19 -3
- tomwer/synctools/stacks/reconstruction/nabu.py +5 -0
- tomwer/synctools/utils/scanstages.py +3 -3
- tomwer/version.py +2 -2
- {tomwer-1.5.0rc0.dist-info → tomwer-1.5.1.dist-info}/METADATA +1 -1
- {tomwer-1.5.0rc0.dist-info → tomwer-1.5.1.dist-info}/RECORD +69 -68
- {tomwer-1.5.0rc0.dist-info → tomwer-1.5.1.dist-info}/WHEEL +0 -0
- {tomwer-1.5.0rc0.dist-info → tomwer-1.5.1.dist-info}/entry_points.txt +0 -0
- {tomwer-1.5.0rc0.dist-info → tomwer-1.5.1.dist-info}/licenses/LICENSE +0 -0
- {tomwer-1.5.0rc0.dist-info → tomwer-1.5.1.dist-info}/top_level.txt +0 -0
tomwer/gui/control/actions.py
CHANGED
@@ -86,7 +86,7 @@ class TomoObjDisplayModeToolButton(qt.QToolButton):
|
|
86
86
|
urlDescAction.triggered.connect(partial(self.setDisplayMode, DisplayMode.URL))
|
87
87
|
|
88
88
|
def setDisplayMode(self, mode: DisplayMode):
|
89
|
-
mode = DisplayMode
|
89
|
+
mode = DisplayMode(mode)
|
90
90
|
if mode is DisplayMode.SHORT:
|
91
91
|
self.setIcon(self._shortDescIcon)
|
92
92
|
self.setToolTip(self._SHORT_DESC_TOOLTIP)
|
tomwer/gui/control/datalist.py
CHANGED
@@ -616,7 +616,7 @@ class _TomwerObjectList(qt.QTableWidget):
|
|
616
616
|
self.setDisplayMode(DisplayMode.SHORT)
|
617
617
|
|
618
618
|
def setDisplayMode(self, mode: DisplayMode) -> None:
|
619
|
-
self._displayMode = DisplayMode
|
619
|
+
self._displayMode = DisplayMode(mode)
|
620
620
|
self._update()
|
621
621
|
|
622
622
|
def n_data(self):
|
@@ -6,7 +6,7 @@ from typing import Iterable
|
|
6
6
|
|
7
7
|
from silx.gui import qt
|
8
8
|
from silx.gui.utils import blockSignals
|
9
|
-
from
|
9
|
+
from enum import Enum as _Enum
|
10
10
|
from tomoscan.series import Series
|
11
11
|
|
12
12
|
from tomwer.core.scan.scanbase import TomwerScanBase
|
@@ -144,8 +144,8 @@ class SeriesDefinition(qt.QWidget):
|
|
144
144
|
self.layout().addWidget(self._modeLabel, 0, 0, 1, 1)
|
145
145
|
|
146
146
|
self._modeCB = qt.QComboBox(self)
|
147
|
-
for mode in _SeriesDefinitionMode
|
148
|
-
self._modeCB.addItem(mode)
|
147
|
+
for mode in _SeriesDefinitionMode:
|
148
|
+
self._modeCB.addItem(mode.value)
|
149
149
|
self.layout().addWidget(self._modeCB, 0, 1, 1, 1)
|
150
150
|
|
151
151
|
self._manualDefWidget = SeriesManualFromTomoObj(parent=self)
|
@@ -169,10 +169,10 @@ class SeriesDefinition(qt.QWidget):
|
|
169
169
|
raise ValueError(f"mode {self.getMode()} is not handled yet")
|
170
170
|
|
171
171
|
def getMode(self) -> str:
|
172
|
-
return _SeriesDefinitionMode
|
172
|
+
return _SeriesDefinitionMode(self._modeCB.currentText())
|
173
173
|
|
174
174
|
def setMode(self, mode: str):
|
175
|
-
mode = _SeriesDefinitionMode
|
175
|
+
mode = _SeriesDefinitionMode(mode)
|
176
176
|
idx = self._modeCB.findText(mode.value)
|
177
177
|
self._modeCB.setCurrentIndex(idx)
|
178
178
|
|
tomwer/gui/dataportal/gallery.py
CHANGED
@@ -29,7 +29,7 @@ class GalleryWidget(qt.QWidget):
|
|
29
29
|
self.layout().addRow("precision", self._precisionQCB)
|
30
30
|
# binning
|
31
31
|
self._binningQCB = qt.QComboBox(self)
|
32
|
-
self._binningQCB.addItems(Binning
|
32
|
+
self._binningQCB.addItems([item.value for item in Binning])
|
33
33
|
self.layout().addRow("binning", self._binningQCB)
|
34
34
|
self._binningQCB.setCurrentText(Binning.SIXTEEN_BY_SIXTEEN.value)
|
35
35
|
self._binningQCB.setToolTip(
|
@@ -37,7 +37,7 @@ class GalleryWidget(qt.QWidget):
|
|
37
37
|
) # recommended size: 5ko for the entire gallery
|
38
38
|
# output format
|
39
39
|
self._outputFormat = qt.QComboBox(self)
|
40
|
-
self._outputFormat.addItems(OutputFormat
|
40
|
+
self._outputFormat.addItems([item.value for item in OutputFormat])
|
41
41
|
self.layout().addRow("output format", self._outputFormat)
|
42
42
|
# overwrite
|
43
43
|
self._overwriteCB = qt.QCheckBox("overwrite", self)
|
@@ -49,17 +49,17 @@ class GalleryWidget(qt.QWidget):
|
|
49
49
|
self._binningQCB.currentIndexChanged.connect(self._configChanged)
|
50
50
|
|
51
51
|
def getOutputFormat(self) -> OutputFormat:
|
52
|
-
return OutputFormat
|
52
|
+
return OutputFormat(self._outputFormat.currentText())
|
53
53
|
|
54
54
|
def setOutputFormat(self, format: OutputFormat):
|
55
|
-
format = OutputFormat
|
55
|
+
format = OutputFormat(format)
|
56
56
|
self._outputFormat.setCurrentText(format.value)
|
57
57
|
|
58
58
|
def getBinning(self) -> Binning:
|
59
|
-
return Binning
|
59
|
+
return Binning(self._binningQCB.currentText())
|
60
60
|
|
61
61
|
def setBinning(self, binning: Binning):
|
62
|
-
binning = Binning
|
62
|
+
binning = Binning(binning)
|
63
63
|
self._binningQCB.setCurrentText(binning.value)
|
64
64
|
|
65
65
|
def overwrite(self) -> bool:
|
@@ -29,7 +29,7 @@ _ureg = pint.get_application_registry()
|
|
29
29
|
@pytest.mark.parametrize("detector_y_pixel_size", (None,))
|
30
30
|
@pytest.mark.parametrize("sample_x_pixel_size", (None,))
|
31
31
|
@pytest.mark.parametrize("sample_y_pixel_size", (None, 0.0066 * _ureg.meter))
|
32
|
-
@pytest.mark.parametrize("field_of_view", FOV
|
32
|
+
@pytest.mark.parametrize("field_of_view", [item.value for item in FOV])
|
33
33
|
@pytest.mark.parametrize("sample_detector_distance", (1.2 * _ureg.meter,))
|
34
34
|
@pytest.mark.parametrize("sample_source_distance", (-10.2 * _ureg.meter,))
|
35
35
|
@pytest.mark.parametrize("propagation_distance", (1.01 * _ureg.meter,))
|
@@ -13,8 +13,8 @@ class _EstimatedCorValidator(qt.QDoubleValidator):
|
|
13
13
|
|
14
14
|
def validate(self, a0: str, a1: int):
|
15
15
|
"""validate float or string that could be part of the side values..."""
|
16
|
-
for
|
17
|
-
if value.startswith(a0):
|
16
|
+
for side in Side:
|
17
|
+
if side.value.startswith(a0):
|
18
18
|
return (qt.QDoubleValidator.Acceptable, a0, a1)
|
19
19
|
return super().validate(a0, a1)
|
20
20
|
|
@@ -153,8 +153,8 @@ class InputWidget(qt.QWidget):
|
|
153
153
|
modes = set(modes)
|
154
154
|
for mode in modes:
|
155
155
|
try:
|
156
|
-
axis_mode._InputType
|
157
|
-
except
|
156
|
+
axis_mode._InputType(mode)
|
157
|
+
except ValueError:
|
158
158
|
raise ValueError(
|
159
159
|
f"mode {mode} should be an instance of {axis_mode._InputType}"
|
160
160
|
)
|
@@ -166,7 +166,7 @@ class InputWidget(qt.QWidget):
|
|
166
166
|
elif len(modes) < 0:
|
167
167
|
raise ValueError("modes is empty")
|
168
168
|
else:
|
169
|
-
mode = axis_mode._InputType
|
169
|
+
mode = axis_mode._InputType(modes.pop())
|
170
170
|
if mode is axis_mode._InputType.SINOGRAM:
|
171
171
|
self._sinogramGB.setEnabled(True)
|
172
172
|
self._radioGB.setEnabled(False)
|
@@ -49,9 +49,7 @@ class _NabuStageConfigBase:
|
|
49
49
|
:returns: _FilteringObject to use to define widget visibility
|
50
50
|
"""
|
51
51
|
filteringObj = _FilteringObject(widget=widget)
|
52
|
-
self._registeredWidgets[filteringObj] = ConfigurationLevel
|
53
|
-
config_level
|
54
|
-
)
|
52
|
+
self._registeredWidgets[filteringObj] = ConfigurationLevel(config_level)
|
55
53
|
return filteringObj
|
56
54
|
|
57
55
|
def getConfiguration(self) -> dict:
|
@@ -2,7 +2,7 @@ from __future__ import annotations
|
|
2
2
|
|
3
3
|
from silx.gui import qt
|
4
4
|
from silx.gui.utils import blockSignals
|
5
|
-
from
|
5
|
+
from enum import Enum as _Enum
|
6
6
|
|
7
7
|
from tomwer.core.process.reconstruction.nabu.utils import _NabuStages
|
8
8
|
from tomwer.gui.reconstruction.nabu.nabuconfig import base
|
@@ -159,8 +159,8 @@ class CTFGeometry(qt.QGroupBox):
|
|
159
159
|
super().__init__(parent, title=title)
|
160
160
|
self.setLayout(qt.QFormLayout())
|
161
161
|
self._beamShapeCB = QComboBoxIgnoreWheel(self)
|
162
|
-
for shape in _BeamShape
|
163
|
-
self._beamShapeCB.addItem(shape)
|
162
|
+
for shape in _BeamShape:
|
163
|
+
self._beamShapeCB.addItem(shape.value)
|
164
164
|
self.layout().addRow("shape", self._beamShapeCB)
|
165
165
|
|
166
166
|
# cone beam settings
|
@@ -188,10 +188,10 @@ class CTFGeometry(qt.QGroupBox):
|
|
188
188
|
self._beamShapeCB.currentIndexChanged.connect(self._confChanged)
|
189
189
|
|
190
190
|
def getBeamShape(self):
|
191
|
-
return _BeamShape
|
191
|
+
return _BeamShape(self._beamShapeCB.currentText())
|
192
192
|
|
193
193
|
def setBeamShape(self, shape: str | _BeamShape):
|
194
|
-
shape = _BeamShape
|
194
|
+
shape = _BeamShape(shape)
|
195
195
|
self._beamShapeCB.setCurrentText(shape.value)
|
196
196
|
|
197
197
|
def _updateView(self, *args, **kwargs):
|
@@ -228,7 +228,7 @@ class CTFGeometry(qt.QGroupBox):
|
|
228
228
|
|
229
229
|
beam_shape = ddict.get("beam_shape", None)
|
230
230
|
if beam_shape is not None:
|
231
|
-
if _BeamShape
|
231
|
+
if _BeamShape(beam_shape) is _BeamShape.CONE:
|
232
232
|
self._coneBeamSettings.setGeometry(params)
|
233
233
|
self.setBeamShape(beam_shape)
|
234
234
|
|
@@ -5,7 +5,7 @@ from __future__ import annotations
|
|
5
5
|
import logging
|
6
6
|
|
7
7
|
from silx.gui import qt
|
8
|
-
from
|
8
|
+
from enum import Enum as _Enum
|
9
9
|
|
10
10
|
from tomwer.core.process.reconstruction.nabu.utils import _NabuPhaseMethod, _NabuStages
|
11
11
|
from tomwer.core.utils.char import BETA_CHAR, DELTA_CHAR
|
@@ -212,10 +212,10 @@ class NabuPaganinConfig(qt.QWidget, base._NabuStageConfigBase):
|
|
212
212
|
|
213
213
|
def getPaddingType(self) -> PaddingMode:
|
214
214
|
current_text = self._paddingTypeCB.currentText()
|
215
|
-
return PaddingMode
|
215
|
+
return PaddingMode(current_text)
|
216
216
|
|
217
217
|
def setPaddingType(self, padding_type):
|
218
|
-
padding_type = PaddingMode
|
218
|
+
padding_type = PaddingMode(padding_type)
|
219
219
|
item_index = self._paddingTypeCB.findText(padding_type.value)
|
220
220
|
self._paddingTypeCB.setCurrentIndex(item_index)
|
221
221
|
|
@@ -221,7 +221,7 @@ class _NabuPreProcessingConfig(_NabuStageConfigBase, qt.QWidget):
|
|
221
221
|
self._signalConfChanged("flatfield")
|
222
222
|
|
223
223
|
def _dffChanged(self, *args, **kwargs):
|
224
|
-
self._signalConfChanged("
|
224
|
+
self._signalConfChanged("double_flatfield")
|
225
225
|
|
226
226
|
def _dffSigmaChanged(self, *args, **kwargs):
|
227
227
|
self._signalConfChanged("dff_sigma")
|
@@ -337,7 +337,7 @@ class _NabuPreProcessingConfig(_NabuStageConfigBase, qt.QWidget):
|
|
337
337
|
tilt_correction, autotilt_opts = self._tiltCorrection.getTiltCorrection()
|
338
338
|
return {
|
339
339
|
"flatfield": int(self.isFlatFieldActivate()),
|
340
|
-
"
|
340
|
+
"double_flatfield": int(self.isDoubleFlatFieldActivate()),
|
341
341
|
"dff_sigma": self.getDFFSigma(),
|
342
342
|
"ccd_filter_enabled": int(self.isCCDFilterActivate()),
|
343
343
|
"ccd_filter_threshold": self.getCCDThreshold(),
|
@@ -365,7 +365,7 @@ class _NabuPreProcessingConfig(_NabuStageConfigBase, qt.QWidget):
|
|
365
365
|
if ff is not None:
|
366
366
|
self._flatFieldCB.setChecked(bool(ff))
|
367
367
|
|
368
|
-
dff = conf.get("
|
368
|
+
dff = conf.get("double_flatfield", None)
|
369
369
|
if dff is not None:
|
370
370
|
self._dffCB.setChecked(bool(dff))
|
371
371
|
|
@@ -7,7 +7,7 @@ import logging
|
|
7
7
|
|
8
8
|
from silx.gui import qt
|
9
9
|
from silx.gui.dialog.DataFileDialog import DataFileDialog
|
10
|
-
from
|
10
|
+
from enum import Enum as _Enum
|
11
11
|
|
12
12
|
from nxtomomill.io.utils import convert_str_to_tuple
|
13
13
|
from tomwer.core.utils.char import DEGREE_CHAR
|
@@ -159,9 +159,13 @@ class TranslationMvtFileWidget(qt.QWidget):
|
|
159
159
|
self._grpBox.layout().setContentsMargins(0, 0, 0, 0)
|
160
160
|
self._grpBox.layout().setSpacing(0)
|
161
161
|
|
162
|
-
self._hdf5FileRB = qt.QRadioButton(
|
162
|
+
self._hdf5FileRB = qt.QRadioButton(
|
163
|
+
TranslationMvtFileWidget.Mode.HDF5.value, self
|
164
|
+
)
|
163
165
|
self._grpBox.layout().addWidget(self._hdf5FileRB)
|
164
|
-
self._textFileRB = qt.QRadioButton(
|
166
|
+
self._textFileRB = qt.QRadioButton(
|
167
|
+
TranslationMvtFileWidget.Mode.TEXT.value, self
|
168
|
+
)
|
165
169
|
self._grpBox.layout().addWidget(self._textFileRB)
|
166
170
|
self.layout().addWidget(self._grpBox)
|
167
171
|
|
@@ -10,7 +10,7 @@ from nabu.pipeline.fullfield.nabu_config import (
|
|
10
10
|
)
|
11
11
|
from silx.gui import icons as silx_icons
|
12
12
|
from silx.gui import qt
|
13
|
-
from
|
13
|
+
from enum import Enum as _Enum
|
14
14
|
from nxtomo.nxobject.nxdetector import FOV
|
15
15
|
|
16
16
|
from tomwer.core.utils.dictutils import concatenate_dict
|
@@ -113,8 +113,8 @@ class _NabuProcess(qt.QWidget):
|
|
113
113
|
qt.QWidget.__init__(self, parent=parent)
|
114
114
|
self.setLayout(qt.QGridLayout())
|
115
115
|
self._stageCB = qt.QComboBox(parent=self)
|
116
|
-
for stage in _NabuStages
|
117
|
-
self._stageCB.addItem(stage)
|
116
|
+
for stage in _NabuStages:
|
117
|
+
self._stageCB.addItem(stage.value)
|
118
118
|
|
119
119
|
self.layout().addWidget(qt.QLabel("stage:", self), 0, 0, 1, 1)
|
120
120
|
self.layout().addWidget(self._stageCB, 0, 1, 1, 1)
|
@@ -323,7 +323,7 @@ class NabuWindow(qt.QMainWindow):
|
|
323
323
|
self._mainWidget.nabuSettingsWidget._configuration._preProcessingWidget._sinoRingsOpts.resetConfiguration()
|
324
324
|
default_config["tomwer_slices"] = "middle"
|
325
325
|
default_config["preproc"]["ccd_filter_enabled"] = False
|
326
|
-
default_config["preproc"]["
|
326
|
+
default_config["preproc"]["double_flatfield"] = False
|
327
327
|
default_config["preproc"]["flatfield"] = True
|
328
328
|
default_config["preproc"]["take_logarithm"] = True
|
329
329
|
self.setConfiguration(default_config)
|
@@ -377,7 +377,7 @@ class NabuWindow(qt.QMainWindow):
|
|
377
377
|
return self._filterAction.isChecked()
|
378
378
|
|
379
379
|
def setConfigurationLevel(self, level):
|
380
|
-
level = ConfigurationLevel
|
380
|
+
level = ConfigurationLevel(level)
|
381
381
|
if level == ConfigurationLevel.REQUIRED:
|
382
382
|
self._minimalisticAction.setChecked(True)
|
383
383
|
elif level == ConfigurationLevel.ADVANCED:
|
@@ -601,7 +601,7 @@ class NabuWidget(qt.QWidget):
|
|
601
601
|
self._configurationScrollArea.updateGeometry()
|
602
602
|
|
603
603
|
def setConfigurationLevel(self, level):
|
604
|
-
level = ConfigurationLevel
|
604
|
+
level = ConfigurationLevel(level)
|
605
605
|
self._configuration_level = level
|
606
606
|
self.updateConfigurationFilter()
|
607
607
|
|
@@ -330,7 +330,7 @@ class NabuVolumeWidget(_NabuStageConfigBase, qt.QWidget):
|
|
330
330
|
self.setHistogramRequested(requested=bool(config["output_histogram"]))
|
331
331
|
|
332
332
|
def setConfigurationLevel(self, level):
|
333
|
-
level = ConfigurationLevel
|
333
|
+
level = ConfigurationLevel(level)
|
334
334
|
_NabuStageConfigBase.setConfigurationLevel(self, level)
|
335
335
|
|
336
336
|
def getConfigurationLevel(self):
|
@@ -502,12 +502,12 @@ class _NormIntensityOptions(qt.QWidget):
|
|
502
502
|
|
503
503
|
def getCurrentSource(self):
|
504
504
|
if self.getCurrentMethod() in (Method.DIVISION, Method.SUBTRACTION):
|
505
|
-
return _ValueSource
|
505
|
+
return _ValueSource(self._sourceCB.currentText())
|
506
506
|
else:
|
507
507
|
return _ValueSource.NONE
|
508
508
|
|
509
509
|
def setCurrentSource(self, source):
|
510
|
-
source = _ValueSource
|
510
|
+
source = _ValueSource(source)
|
511
511
|
idx = self._sourceCB.findText(source.value)
|
512
512
|
self._sourceCB.setCurrentIndex(idx)
|
513
513
|
|
@@ -601,8 +601,8 @@ class _NormIntensityCalcOpts(qt.QWidget):
|
|
601
601
|
self.setLayout(qt.QFormLayout())
|
602
602
|
# calculation function
|
603
603
|
self._calculationModeCB = qt.QComboBox(self)
|
604
|
-
for fct in _normParams._ValueCalculationFct
|
605
|
-
self._calculationModeCB.addItem(fct)
|
604
|
+
for fct in _normParams._ValueCalculationFct:
|
605
|
+
self._calculationModeCB.addItem(fct.value)
|
606
606
|
self._calculationModeLabel = qt.QLabel("calculation fct", self)
|
607
607
|
self.layout().addRow(self._calculationModeLabel, self._calculationModeCB)
|
608
608
|
|
@@ -616,14 +616,10 @@ class _NormIntensityCalcOpts(qt.QWidget):
|
|
616
616
|
self._calculationModeCB.setVisible(visible)
|
617
617
|
|
618
618
|
def getCalculationFct(self):
|
619
|
-
return _normParams._ValueCalculationFct.
|
620
|
-
self._calculationModeCB.currentText()
|
621
|
-
)
|
619
|
+
return _normParams._ValueCalculationFct(self._calculationModeCB.currentText())
|
622
620
|
|
623
621
|
def setCalculationFct(self, fct):
|
624
|
-
idx = self._calculationModeCB.findText(
|
625
|
-
_normParams._ValueCalculationFct.from_value(fct)
|
626
|
-
)
|
622
|
+
idx = self._calculationModeCB.findText(_normParams._ValueCalculationFct(fct))
|
627
623
|
self._calculationModeCB.setCurrentIndex(idx)
|
628
624
|
|
629
625
|
|
@@ -13,7 +13,7 @@ from silx.gui import icons as silxicons
|
|
13
13
|
from silx.gui import qt
|
14
14
|
from silx.gui.dialog.ImageFileDialog import ImageFileDialog
|
15
15
|
from silx.gui.plot import items
|
16
|
-
from
|
16
|
+
from enum import Enum as _Enum
|
17
17
|
from tomoscan.esrf.scan.utils import get_data
|
18
18
|
|
19
19
|
from tomwer.core.process.reconstruction.utils.cor import (
|
@@ -308,7 +308,7 @@ class _ReconstructionModeGB(qt.QGroupBox):
|
|
308
308
|
raise ValueError("No reconstruction mode selected")
|
309
309
|
|
310
310
|
def setReconstructionMode(self, mode: ReconstructionMode | str) -> None:
|
311
|
-
mode = ReconstructionMode
|
311
|
+
mode = ReconstructionMode(mode)
|
312
312
|
if mode is ReconstructionMode.TILT_CORRECTION:
|
313
313
|
self._tiltCorrectionRB.setChecked(True)
|
314
314
|
elif mode is ReconstructionMode.VERTICAL:
|
@@ -87,7 +87,7 @@ class NabuWidgetWithToolbar(qt.QMainWindow):
|
|
87
87
|
self._nabuSettings._configuration._preProcessingWidget._sinoRingsOpts.resetConfiguration()
|
88
88
|
default_config["tomwer_slices"] = "middle"
|
89
89
|
default_config["preproc"]["ccd_filter_enabled"] = False
|
90
|
-
default_config["preproc"]["
|
90
|
+
default_config["preproc"]["double_flatfield"] = False
|
91
91
|
default_config["preproc"]["flatfield"] = True
|
92
92
|
default_config["preproc"]["take_logarithm"] = True
|
93
93
|
self._nabuSettings.setConfiguration(default_config)
|
@@ -107,7 +107,7 @@ class NabuWidgetWithToolbar(qt.QMainWindow):
|
|
107
107
|
self._nabuSettings.setConfiguration(config)
|
108
108
|
|
109
109
|
def setConfigurationLevel(self, level):
|
110
|
-
level = ConfigurationLevel
|
110
|
+
level = ConfigurationLevel(level)
|
111
111
|
if level == ConfigurationLevel.REQUIRED:
|
112
112
|
self._minimalisticAction.setChecked(True)
|
113
113
|
elif level == ConfigurationLevel.ADVANCED:
|
@@ -248,10 +248,10 @@ class VariableSelection(qt.QWidget):
|
|
248
248
|
self._img_width = width
|
249
249
|
|
250
250
|
def getScoreMethod(self):
|
251
|
-
return ScoreMethod
|
251
|
+
return ScoreMethod(self._scoreMethodCB.currentText())
|
252
252
|
|
253
253
|
def setScoreMethod(self, method):
|
254
|
-
method_value = ScoreMethod
|
254
|
+
method_value = ScoreMethod(method).value
|
255
255
|
index = self._scoreMethodCB.findText(method_value)
|
256
256
|
self._scoreMethodCB.setCurrentIndex(index)
|
257
257
|
|
@@ -671,7 +671,7 @@ class ScorePlot(qt.QWidget):
|
|
671
671
|
:param scores: cor value (float) as key and
|
672
672
|
tuple(url: DataUrl, score: float) as value
|
673
673
|
"""
|
674
|
-
score_method = ScoreMethod
|
674
|
+
score_method = ScoreMethod(score_method)
|
675
675
|
if not update_only_scores:
|
676
676
|
self.clear()
|
677
677
|
self._scores = scores
|
@@ -90,7 +90,7 @@ class TestNabuPreProcConfig(TestCaseQt):
|
|
90
90
|
"""Test that the get configuration is working"""
|
91
91
|
ini_conf = {
|
92
92
|
"flatfield": 1,
|
93
|
-
"
|
93
|
+
"double_flatfield": 0,
|
94
94
|
"dff_sigma": 0.0,
|
95
95
|
"ccd_filter_enabled": 0,
|
96
96
|
"ccd_filter_threshold": 0.04,
|
@@ -110,7 +110,7 @@ class TestNabuPreProcConfig(TestCaseQt):
|
|
110
110
|
"""Test that the set configuration is working"""
|
111
111
|
conf = {
|
112
112
|
"flatfield": 0,
|
113
|
-
"
|
113
|
+
"double_flatfield": 1,
|
114
114
|
"dff_sigma": 2.0,
|
115
115
|
"ccd_filter_enabled": 1,
|
116
116
|
"ccd_filter_threshold": 0.98,
|
tomwer/gui/utils/buttons.py
CHANGED
@@ -111,7 +111,7 @@ class TapeMeasureToolButton(PlotToolButton):
|
|
111
111
|
self._lastRoiCreated.setVisible(self.isChecked())
|
112
112
|
if self.isChecked():
|
113
113
|
self._roiManager.start(
|
114
|
-
|
114
|
+
TapeMeasureROI,
|
115
115
|
self,
|
116
116
|
)
|
117
117
|
self.__interactiveModeStarted(self._roiManager)
|
tomwer/gui/utils/flow.py
CHANGED
tomwer/gui/utils/loadingmode.py
CHANGED
tomwer/gui/utils/vignettes.py
CHANGED
@@ -302,7 +302,7 @@ class VignettesWidget(qt.QWidget):
|
|
302
302
|
f"score is expected to be a dict with values as (v1: numpy.ndarray, v2: ComputedScore). v2 type Found: {type(score_cls)}"
|
303
303
|
)
|
304
304
|
scores_values.append(score_cls.get(score_method))
|
305
|
-
self.__score_method = ScoreMethod
|
305
|
+
self.__score_method = ScoreMethod(score_method)
|
306
306
|
highest_score_indices = numpy.nanargmax(scores_values)
|
307
307
|
self._vignettesGroup = qt.QButtonGroup(self)
|
308
308
|
self._vignettesGroup.setExclusive(True)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import weakref
|
2
2
|
|
3
3
|
from silx.gui import qt
|
4
|
-
from
|
4
|
+
from enum import Enum as _Enum
|
5
5
|
|
6
6
|
from tomwer.core.scan.scanbase import TomwerScanBase
|
7
7
|
from tomwer.core.volume.volumebase import TomwerVolumeBase
|
@@ -318,26 +318,26 @@ class DisplayControl(qt.QWidget):
|
|
318
318
|
|
319
319
|
:return: selected mode: display slices or radios
|
320
320
|
"""
|
321
|
-
return _DisplayMode
|
321
|
+
return _DisplayMode(self._displayMode.currentText())
|
322
322
|
|
323
323
|
def setDisplayMode(self, mode):
|
324
|
-
mode = _DisplayMode
|
324
|
+
mode = _DisplayMode(mode)
|
325
325
|
idx = self._displayMode.findText(mode.value)
|
326
326
|
self._displayMode.setCurrentIndex(idx)
|
327
327
|
|
328
328
|
def getRadioOption(self) -> _RadioMode:
|
329
|
-
return _RadioMode
|
329
|
+
return _RadioMode(self._radioMode.currentText())
|
330
330
|
|
331
331
|
def setRadioOption(self, opt):
|
332
|
-
opt = _RadioMode
|
332
|
+
opt = _RadioMode(opt)
|
333
333
|
idx = self._radioMode.findText(opt.value)
|
334
334
|
self._radioMode.setCurrentIndex(idx)
|
335
335
|
|
336
336
|
def getSliceOption(self) -> _SliceMode:
|
337
|
-
return _SliceMode
|
337
|
+
return _SliceMode(self._sliceMode.currentText())
|
338
338
|
|
339
339
|
def setSliceOption(self, opt):
|
340
|
-
opt = _SliceMode
|
340
|
+
opt = _SliceMode(opt)
|
341
341
|
idx = self._sliceMode.findText(opt.value)
|
342
342
|
self._sliceMode.setCurrentIndex(idx)
|
343
343
|
|
@@ -1,5 +1,6 @@
|
|
1
1
|
from __future__ import annotations
|
2
2
|
|
3
|
+
import numpy
|
3
4
|
import logging
|
4
5
|
from silx.gui import qt
|
5
6
|
from tomwer.core.utils.char import BETA_CHAR, DELTA_CHAR
|
@@ -28,14 +29,16 @@ class ReconstructionParameters(qt.QWidget):
|
|
28
29
|
self._deltaBetaQLE = qt.QLineEdit("", self)
|
29
30
|
self._deltaBetaQLE.setReadOnly(True)
|
30
31
|
self.layout().addRow(self._deltaBetaLabel, self._deltaBetaQLE)
|
31
|
-
# distance
|
32
|
-
self.
|
33
|
-
self.
|
34
|
-
self.layout().addRow(
|
32
|
+
# sample_detector distance
|
33
|
+
self._sampleDetectorDistanceQLE = qt.QLineEdit("", self)
|
34
|
+
self._sampleDetectorDistanceQLE.setReadOnly(True)
|
35
|
+
self.layout().addRow(
|
36
|
+
"sample-detector distance (cm)", self._sampleDetectorDistanceQLE
|
37
|
+
)
|
35
38
|
# pixel size
|
36
|
-
self.
|
37
|
-
self.
|
38
|
-
self.layout().addRow("
|
39
|
+
self._voxelSizeQLE = qt.QLineEdit("", self)
|
40
|
+
self._voxelSizeQLE.setReadOnly(True)
|
41
|
+
self.layout().addRow("voxel size (cm)", self._voxelSizeQLE)
|
39
42
|
# cor
|
40
43
|
self._corQLE = qt.QLineEdit("", self)
|
41
44
|
self._corQLE.setReadOnly(True)
|
@@ -89,7 +92,7 @@ class ReconstructionParameters(qt.QWidget):
|
|
89
92
|
self._setPhaseMethod,
|
90
93
|
self._setDeltaBeta,
|
91
94
|
self._setDistance,
|
92
|
-
self.
|
95
|
+
self._setVoxelSize,
|
93
96
|
self._setCor,
|
94
97
|
self._setPaddingType,
|
95
98
|
self._setHalfTomo,
|
@@ -136,29 +139,38 @@ class ReconstructionParameters(qt.QWidget):
|
|
136
139
|
distance_cm = f"{distance_cm:.2}"
|
137
140
|
else:
|
138
141
|
distance_cm = ""
|
139
|
-
self.
|
142
|
+
self._sampleDetectorDistanceQLE.setText(distance_cm)
|
140
143
|
|
141
|
-
def
|
144
|
+
def _setVoxelSize(self, metadata: dict):
|
142
145
|
# voxel size can be stored as pixel size (old version) or voxel size (new version)
|
143
146
|
recons_params = metadata.get("processing_options", {}).get("reconstruction", {})
|
144
|
-
voxel_size_cm = recons_params.get("voxel_size_cm", None)
|
147
|
+
voxel_size_cm = recons_params.get("voxel_size_cm", [None] * 3)
|
148
|
+
# back compatibility when voxel was a scalar ( ~ nabu 2023 ?)
|
149
|
+
if numpy.isscalar(voxel_size_cm):
|
150
|
+
voxel_size_cm = [voxel_size_cm] * 3
|
145
151
|
|
146
152
|
# now voxel size is expected to be a tuple of three elements
|
147
153
|
if voxel_size_cm is not None:
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
+
|
155
|
+
def clean_voxel_value(value):
|
156
|
+
if isinstance(value, str):
|
157
|
+
for char_to_ignore in (" ", "(", ")", "[", "]"):
|
158
|
+
value = value.replace(char_to_ignore, "")
|
159
|
+
return value
|
160
|
+
|
161
|
+
voxel_size_cm = [clean_voxel_value(value) for value in voxel_size_cm]
|
162
|
+
|
154
163
|
else:
|
155
164
|
# backward compatibility with old volume
|
156
|
-
voxel_size_cm = recons_params.get("pixel_size_cm", None)
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
165
|
+
voxel_size_cm = recons_params.get("pixel_size_cm", [None] * 3)
|
166
|
+
|
167
|
+
voxel_size_cm = filter(None, voxel_size_cm)
|
168
|
+
|
169
|
+
def cast_voxel_value(value: float | None):
|
170
|
+
return f"{float(value):.8}"
|
171
|
+
|
172
|
+
voxel_size_cm = [cast_voxel_value(value) for value in voxel_size_cm]
|
173
|
+
self._voxelSizeQLE.setText("x".join(voxel_size_cm))
|
162
174
|
|
163
175
|
def _setCor(self, metadata: dict):
|
164
176
|
cor = (
|