tomwer 1.4.0rc0__py3-none-any.whl → 1.4.0rc1__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.
Files changed (51) hide show
  1. orangecontrib/tomwer/tutorials/test_cor.ows +3 -3
  2. orangecontrib/tomwer/widgets/reconstruction/AxisOW.py +6 -14
  3. orangecontrib/tomwer/widgets/reconstruction/NabuVolumeOW.py +4 -2
  4. tomwer/app/axis.py +0 -3
  5. tomwer/app/multipag.py +11 -3
  6. tomwer/core/process/reconstruction/axis/axis.py +27 -736
  7. tomwer/core/process/reconstruction/axis/mode.py +86 -24
  8. tomwer/core/process/reconstruction/axis/params.py +127 -138
  9. tomwer/core/process/reconstruction/axis/side.py +8 -0
  10. tomwer/core/process/reconstruction/nabu/nabuscores.py +17 -20
  11. tomwer/core/process/reconstruction/nabu/nabuslices.py +5 -1
  12. tomwer/core/process/reconstruction/saaxis/saaxis.py +4 -4
  13. tomwer/core/process/reconstruction/sadeltabeta/sadeltabeta.py +4 -4
  14. tomwer/core/process/reconstruction/tests/test_axis.py +1 -1
  15. tomwer/core/process/reconstruction/tests/test_utils.py +4 -4
  16. tomwer/core/process/reconstruction/utils/cor.py +8 -4
  17. tomwer/core/process/tests/test_nabu.py +1 -3
  18. tomwer/core/scan/scanbase.py +4 -4
  19. tomwer/core/scan/tests/test_process_registration.py +0 -18
  20. tomwer/gui/fonts.py +5 -0
  21. tomwer/gui/reconstruction/axis/AxisMainWindow.py +20 -9
  22. tomwer/gui/reconstruction/axis/AxisOptionsWidget.py +239 -79
  23. tomwer/gui/reconstruction/axis/AxisSettingsWidget.py +38 -17
  24. tomwer/gui/reconstruction/axis/AxisWidget.py +16 -8
  25. tomwer/gui/reconstruction/axis/CalculationWidget.py +40 -200
  26. tomwer/gui/reconstruction/axis/ControlWidget.py +10 -2
  27. tomwer/gui/reconstruction/axis/EstimatedCORWidget.py +383 -0
  28. tomwer/gui/reconstruction/axis/EstimatedCorComboBox.py +118 -0
  29. tomwer/gui/reconstruction/axis/InputWidget.py +11 -155
  30. tomwer/gui/reconstruction/saaxis/corrangeselector.py +19 -10
  31. tomwer/gui/reconstruction/scores/scoreplot.py +5 -2
  32. tomwer/gui/reconstruction/tests/test_nabu.py +8 -0
  33. tomwer/gui/stitching/z_stitching/fineestimation.py +1 -1
  34. tomwer/gui/tests/test_axis_gui.py +31 -15
  35. tomwer/synctools/stacks/reconstruction/axis.py +5 -23
  36. tomwer/synctools/stacks/reconstruction/dkrefcopy.py +1 -1
  37. tomwer/synctools/stacks/reconstruction/nabu.py +2 -2
  38. tomwer/synctools/stacks/reconstruction/normalization.py +1 -1
  39. tomwer/synctools/stacks/reconstruction/saaxis.py +1 -1
  40. tomwer/synctools/stacks/reconstruction/sadeltabeta.py +1 -1
  41. tomwer/tests/orangecontrib/tomwer/widgets/reconstruction/tests/test_axis.py +0 -16
  42. tomwer/tests/test_ewoks/test_single_node_execution.py +1 -1
  43. tomwer/tests/test_ewoks/test_workflows.py +1 -1
  44. tomwer/version.py +1 -1
  45. {tomwer-1.4.0rc0.dist-info → tomwer-1.4.0rc1.dist-info}/METADATA +2 -2
  46. {tomwer-1.4.0rc0.dist-info → tomwer-1.4.0rc1.dist-info}/RECORD +50 -47
  47. tomwer/core/process/tests/test_axis.py +0 -231
  48. {tomwer-1.4.0rc0.dist-info → tomwer-1.4.0rc1.dist-info}/LICENSE +0 -0
  49. {tomwer-1.4.0rc0.dist-info → tomwer-1.4.0rc1.dist-info}/WHEEL +0 -0
  50. {tomwer-1.4.0rc0.dist-info → tomwer-1.4.0rc1.dist-info}/entry_points.txt +0 -0
  51. {tomwer-1.4.0rc0.dist-info → tomwer-1.4.0rc1.dist-info}/top_level.txt +0 -0
@@ -1,6 +1,7 @@
1
1
  import logging
2
2
 
3
3
  from silx.utils.enum import Enum as _Enum
4
+ from tomwer.core.process.reconstruction.axis.side import Side
4
5
 
5
6
  _logger = logging.getLogger(__name__)
6
7
 
@@ -11,6 +12,14 @@ class AxisModeMetadata:
11
12
 
12
13
  Ease processing and display
13
14
  Maybe this function should be part of nabu ?
15
+
16
+ :param lockable: True if this value can be lock and process automatically when a new scan is received
17
+ :param tooltip: short description of the mode (to be used by the GUI)
18
+ :param computing_constrains: some constrain like need to have a 0-360 acquisition (so no Half acquisition)
19
+ :param allows_padding: does the algorithm applies padding (and so can the user provide some mode)
20
+ :param valid_inputs: compatible input type (pair of radios or sinogram...)
21
+ :param valid_sides: can a side be provided
22
+ :param allows_estimated_cor_as_numerical_value: can a numerical value (first guess) be provided to the algorithm
14
23
  """
15
24
 
16
25
  def __init__(
@@ -21,6 +30,7 @@ class AxisModeMetadata:
21
30
  allows_padding=False,
22
31
  valid_inputs=(),
23
32
  valid_sides=(),
33
+ allows_estimated_cor_as_numerical_value: bool = True,
24
34
  ) -> None:
25
35
  self._lockable = lockable
26
36
  self._tooltip = tooltip
@@ -28,6 +38,9 @@ class AxisModeMetadata:
28
38
  self._allows_padding = allows_padding
29
39
  self._valid_inputs = valid_inputs
30
40
  self._valid_sides = valid_sides
41
+ self._allows_estimated_cor_as_numerical_value = (
42
+ allows_estimated_cor_as_numerical_value
43
+ )
31
44
 
32
45
  @property
33
46
  def is_lockable(self) -> bool:
@@ -53,6 +66,10 @@ class AxisModeMetadata:
53
66
  def valid_sides(self) -> tuple:
54
67
  return self._valid_sides
55
68
 
69
+ @property
70
+ def allows_estimated_cor_as_numerical_value(self) -> bool:
71
+ return self._allows_estimated_cor_as_numerical_value
72
+
56
73
 
57
74
  class _InputType(_Enum):
58
75
  SINOGRAM = "sinogram"
@@ -69,35 +86,57 @@ class AxisMode(_Enum):
69
86
  global_ = "global"
70
87
  manual = "manual"
71
88
  growing_window_sinogram = "sino-growing-window"
72
- growing_window_radios = "radios-growing-window"
89
+ growing_window_radios = "growing-window"
73
90
  sliding_window_sinogram = "sino-sliding-window"
74
- sliding_window_radios = "radios-sliding-window"
91
+ sliding_window_radios = "sliding-window"
75
92
  sino_coarse_to_fine = "sino-coarse-to-fine"
76
93
  composite_coarse_to_fine = "composite-coarse-to-fine"
77
- sino_fourier_angles = "sino-fourier-angles"
78
- octave_accurate_radios = "radios-octave-accurate"
79
- read = "read from estimated cor"
94
+ fourier_angles = "fourier-angles"
95
+ octave_accurate_radios = "octave-accurate"
96
+ read = "read 'x_rotation_axis_pixel_position'"
80
97
  # alias to composite_coarse_to_fine with near mode
81
98
  near = "near"
82
99
 
83
100
  @classmethod
84
101
  def from_value(cls, value):
85
- # ensure backward compatiblity with workflow defined before COR method on sinograms
86
- if value == "growing-window":
102
+ # ensure backward compatibility with workflow defined before COR method on sinograms
103
+ if value in ("global_", "global"):
104
+ value = AxisMode.global_
105
+ if value == "radio-growing-window":
87
106
  _logger.warning(
88
- "Axis mode requested is 'growing-window'. To insure backward compatibility replace it by 'growing-window-radios'"
107
+ f"Axis mode requested is '{value}'. To insure backward compatibility replace it by '{AxisMode.growing_window_radios.value}'"
89
108
  )
90
109
  value = AxisMode.growing_window_radios
91
- elif value == "sliding-window":
110
+ elif value == "radio-sliding-window":
92
111
  _logger.warning(
93
- "Axis mode requested is 'sliding-window'. To insure backward compatibility replace it by 'sliding-window-radios'"
112
+ f"Axis mode requested is '{value}'. To insure backward compatibility replace it by '{AxisMode.sliding_window_radios.value}'"
94
113
  )
95
114
  value = AxisMode.sliding_window_radios
96
- elif value == "read":
115
+ elif value in ("radios-octave-accurate", "accurate"):
116
+ _logger.warning(
117
+ f"Axis mode requested is '{value}'. To insure backward compatibility replace it by '{AxisMode.octave_accurate_radios.value}'"
118
+ )
119
+ value = AxisMode.octave_accurate_radios
120
+ elif value in ("read", "read from estimated cor"):
97
121
  value = AxisMode.read
98
122
 
99
123
  return super().from_value(value=value)
100
124
 
125
+ def requires_radio_indices(self) -> bool:
126
+ return self in (
127
+ AxisMode.growing_window_radios,
128
+ AxisMode.sliding_window_radios,
129
+ AxisMode.octave_accurate_radios,
130
+ )
131
+
132
+ def requires_sinogram_index(self) -> bool:
133
+ return self in (
134
+ AxisMode.growing_window_sinogram,
135
+ AxisMode.sliding_window_sinogram,
136
+ AxisMode.fourier_angles,
137
+ AxisMode.sino_coarse_to_fine,
138
+ )
139
+
101
140
 
102
141
  AXIS_MODE_METADATAS = {
103
142
  # manual
@@ -107,6 +146,7 @@ AXIS_MODE_METADATAS = {
107
146
  computing_constrains=(),
108
147
  allows_padding=False,
109
148
  valid_inputs=(_InputType.RADIOS_X2,),
149
+ allows_estimated_cor_as_numerical_value=False,
110
150
  ),
111
151
  # read
112
152
  AxisMode.read: AxisModeMetadata(
@@ -115,6 +155,7 @@ AXIS_MODE_METADATAS = {
115
155
  computing_constrains=(),
116
156
  allows_padding=False,
117
157
  valid_inputs=None,
158
+ allows_estimated_cor_as_numerical_value=False,
118
159
  ),
119
160
  # radio algorithm
120
161
  AxisMode.centered: AxisModeMetadata(
@@ -123,6 +164,7 @@ AXIS_MODE_METADATAS = {
123
164
  computing_constrains=(),
124
165
  allows_padding=True,
125
166
  valid_inputs=(_InputType.RADIOS_X2,),
167
+ valid_sides=(Side.CENTER,),
126
168
  ),
127
169
  AxisMode.global_: AxisModeMetadata(
128
170
  lockable=True,
@@ -130,6 +172,7 @@ AXIS_MODE_METADATAS = {
130
172
  computing_constrains=(),
131
173
  allows_padding=True,
132
174
  valid_inputs=(_InputType.RADIOS_X2,),
175
+ allows_estimated_cor_as_numerical_value=False,
133
176
  ),
134
177
  AxisMode.growing_window_radios: AxisModeMetadata(
135
178
  lockable=True,
@@ -137,7 +180,8 @@ AXIS_MODE_METADATAS = {
137
180
  computing_constrains=(),
138
181
  allows_padding=True,
139
182
  valid_inputs=(_InputType.RADIOS_X2,),
140
- valid_sides=("left", "right", "center", "all"),
183
+ valid_sides=(Side.RIGHT, Side.LEFT, Side.CENTER, Side.ALL),
184
+ allows_estimated_cor_as_numerical_value=False,
141
185
  ),
142
186
  AxisMode.sliding_window_radios: AxisModeMetadata(
143
187
  lockable=True,
@@ -145,15 +189,16 @@ AXIS_MODE_METADATAS = {
145
189
  computing_constrains=(),
146
190
  allows_padding=True,
147
191
  valid_inputs=(_InputType.RADIOS_X2,),
148
- valid_sides=("left", "right", "center", "near"),
192
+ valid_sides=(Side.RIGHT, Side.LEFT, Side.CENTER),
149
193
  ),
150
194
  AxisMode.octave_accurate_radios: AxisModeMetadata(
151
195
  lockable=True,
152
196
  tooltip="Same method as the 'accurate' octave code",
153
- computing_constrains=(),
197
+ computing_constrains=(_Constrain.FULL_TURN,),
154
198
  allows_padding=True,
155
199
  valid_inputs=(_InputType.RADIOS_X2,),
156
- valid_sides=("center",),
200
+ valid_sides=(Side.CENTER,),
201
+ allows_estimated_cor_as_numerical_value=False,
157
202
  ),
158
203
  # sinogram algorithm
159
204
  AxisMode.growing_window_sinogram: AxisModeMetadata(
@@ -162,7 +207,8 @@ AXIS_MODE_METADATAS = {
162
207
  computing_constrains=(),
163
208
  allows_padding=True,
164
209
  valid_inputs=(_InputType.SINOGRAM,),
165
- valid_sides=("left", "right", "center", "all"),
210
+ valid_sides=(Side.RIGHT, Side.LEFT, Side.CENTER, Side.ALL),
211
+ allows_estimated_cor_as_numerical_value=False,
166
212
  ),
167
213
  AxisMode.sliding_window_sinogram: AxisModeMetadata(
168
214
  lockable=True,
@@ -170,7 +216,11 @@ AXIS_MODE_METADATAS = {
170
216
  computing_constrains=(),
171
217
  allows_padding=True,
172
218
  valid_inputs=(_InputType.SINOGRAM,),
173
- valid_sides=("left", "right", "center", "near"),
219
+ valid_sides=(
220
+ Side.RIGHT,
221
+ Side.LEFT,
222
+ Side.CENTER,
223
+ ),
174
224
  ),
175
225
  AxisMode.sino_coarse_to_fine: AxisModeMetadata(
176
226
  lockable=True,
@@ -178,18 +228,22 @@ AXIS_MODE_METADATAS = {
178
228
  computing_constrains=(_Constrain.FULL_TURN,),
179
229
  allows_padding=True,
180
230
  valid_inputs=(_InputType.SINOGRAM,),
231
+ valid_sides=(
232
+ Side.RIGHT,
233
+ Side.LEFT,
234
+ ),
235
+ allows_estimated_cor_as_numerical_value=False,
181
236
  ),
182
- AxisMode.sino_fourier_angles: AxisModeMetadata(
237
+ AxisMode.fourier_angles: AxisModeMetadata(
183
238
  lockable=True,
184
239
  tooltip="",
185
240
  computing_constrains=(_Constrain.FULL_TURN,),
186
241
  allows_padding=True,
187
242
  valid_inputs=(_InputType.SINOGRAM,),
188
243
  valid_sides=(
189
- "left",
190
- "right",
191
- "center",
192
- "near",
244
+ Side.RIGHT,
245
+ Side.LEFT,
246
+ Side.CENTER,
193
247
  ),
194
248
  ),
195
249
  # coarse-to-fine algorithm
@@ -199,7 +253,11 @@ AXIS_MODE_METADATAS = {
199
253
  computing_constrains=(_Constrain.FULL_TURN,),
200
254
  allows_padding=True,
201
255
  valid_inputs=(_InputType.COMPOSITE,),
202
- valid_sides=("left", "right", "center", "near"),
256
+ valid_sides=(
257
+ Side.RIGHT,
258
+ Side.LEFT,
259
+ Side.CENTER,
260
+ ),
203
261
  ),
204
262
  AxisMode.near: AxisModeMetadata(
205
263
  lockable=True,
@@ -207,6 +265,10 @@ AXIS_MODE_METADATAS = {
207
265
  computing_constrains=(_Constrain.FULL_TURN,),
208
266
  allows_padding=True,
209
267
  valid_inputs=(_InputType.COMPOSITE,),
210
- valid_sides=("left", "right", "center", "near"),
268
+ valid_sides=(
269
+ Side.RIGHT,
270
+ Side.LEFT,
271
+ Side.CENTER,
272
+ ),
211
273
  ),
212
274
  }