tomwer 1.2.0a1__py3-none-any.whl → 1.2.0a3__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 (219) hide show
  1. orangecontrib/tomwer/tutorials/append_raw_darks_and_flats_frames_to_NXtomos.ows +44 -0
  2. orangecontrib/tomwer/tutorials/copy_reduced_darks_and_flats_meth1.ows +55 -0
  3. orangecontrib/tomwer/tutorials/copy_reduced_darks_and_flats_meth2.ows +48 -0
  4. orangecontrib/tomwer/tutorials/default_cor_search.ows +40 -0
  5. orangecontrib/tomwer/tutorials/hello_world_python_script.ows +50 -0
  6. orangecontrib/tomwer/tutorials/simple_slice_reconstruction_on_slurm.ows +50 -0
  7. orangecontrib/tomwer/tutorials/simple_volume_to_slurm_reconstruction.ows +8 -8
  8. orangecontrib/tomwer/widgets/__init__.py +1 -1
  9. orangecontrib/tomwer/widgets/cluster/FutureSupervisorOW.py +0 -1
  10. orangecontrib/tomwer/widgets/cluster/SlurmClusterOW.py +8 -6
  11. orangecontrib/tomwer/widgets/control/AdvancementOW.py +0 -1
  12. orangecontrib/tomwer/widgets/control/DataDiscoveryOW.py +1 -6
  13. orangecontrib/tomwer/widgets/control/DataListOW.py +0 -1
  14. orangecontrib/tomwer/widgets/control/DataListenerOW.py +4 -4
  15. orangecontrib/tomwer/widgets/control/DataSelectorOW.py +0 -1
  16. orangecontrib/tomwer/widgets/control/DataTransfertOW.py +7 -7
  17. orangecontrib/tomwer/widgets/control/DataValidatorOW.py +0 -1
  18. orangecontrib/tomwer/widgets/control/DataWatcherOW.py +0 -3
  19. orangecontrib/tomwer/widgets/control/EDF2NXTomomillOW.py +3 -2
  20. orangecontrib/tomwer/widgets/control/EmailOW.py +82 -0
  21. orangecontrib/tomwer/widgets/control/FilterOW.py +3 -3
  22. orangecontrib/tomwer/widgets/control/NXTomomillOW.py +1 -1
  23. orangecontrib/tomwer/widgets/control/NotifierOW.py +0 -1
  24. orangecontrib/tomwer/widgets/control/ReduceDarkFlatSelectorOW.py +93 -0
  25. orangecontrib/tomwer/widgets/control/SingleTomoObjOW.py +29 -5
  26. orangecontrib/tomwer/widgets/control/TimerOW.py +1 -2
  27. orangecontrib/tomwer/widgets/control/TomoObjSerieOW.py +0 -1
  28. orangecontrib/tomwer/widgets/control/VolumeSelector.py +0 -1
  29. orangecontrib/tomwer/widgets/control/VolumeSymLinkOW.py +4 -10
  30. orangecontrib/tomwer/widgets/control/icons/email.png +0 -0
  31. orangecontrib/tomwer/widgets/control/icons/email.svg +58 -0
  32. orangecontrib/tomwer/widgets/control/icons/reduced_darkflat_selector.png +0 -0
  33. orangecontrib/tomwer/widgets/control/icons/reduced_darkflat_selector.svg +199 -0
  34. orangecontrib/tomwer/widgets/debugtools/DatasetGeneratorOW.py +0 -1
  35. orangecontrib/tomwer/widgets/debugtools/ObjectInspectorOW.py +0 -1
  36. orangecontrib/tomwer/widgets/edit/DarkFlatPatchOW.py +1 -2
  37. orangecontrib/tomwer/widgets/edit/ImageKeyEditorOW.py +1 -2
  38. orangecontrib/tomwer/widgets/edit/ImageKeyUpgraderOW.py +0 -1
  39. orangecontrib/tomwer/widgets/edit/NXtomoEditorOW.py +0 -1
  40. orangecontrib/tomwer/widgets/other/PythonScriptOW.py +29 -1
  41. orangecontrib/tomwer/widgets/other/TomoObjsHub.py +28 -0
  42. orangecontrib/tomwer/widgets/other/icons/hub.png +0 -0
  43. orangecontrib/tomwer/widgets/other/icons/hub.svg +113 -0
  44. orangecontrib/tomwer/widgets/reconstruction/AxisOW.py +18 -12
  45. orangecontrib/tomwer/widgets/reconstruction/CastNabuVolumeOW.py +0 -2
  46. orangecontrib/tomwer/widgets/reconstruction/DarkRefAndCopyOW.py +21 -6
  47. orangecontrib/tomwer/widgets/reconstruction/NabuOW.py +29 -7
  48. orangecontrib/tomwer/widgets/reconstruction/NabuVolumeOW.py +18 -5
  49. orangecontrib/tomwer/widgets/reconstruction/SAAxisOW.py +40 -13
  50. orangecontrib/tomwer/widgets/reconstruction/SADeltaBetaOW.py +37 -10
  51. orangecontrib/tomwer/widgets/reconstruction/SinoNormOW.py +2 -3
  52. orangecontrib/tomwer/widgets/reconstruction/TofuOW.py +5 -4
  53. orangecontrib/tomwer/widgets/stitching/StitcherOW.py +0 -1
  54. orangecontrib/tomwer/widgets/stitching/ZStitchingConfigOW.py +0 -1
  55. orangecontrib/tomwer/widgets/visualization/DataViewerOW.py +10 -4
  56. orangecontrib/tomwer/widgets/visualization/DiffViewerOW.py +1 -1
  57. orangecontrib/tomwer/widgets/visualization/LivesliceOW.py +0 -1
  58. orangecontrib/tomwer/widgets/visualization/NXtomoMetadataViewerOW.py +0 -1
  59. orangecontrib/tomwer/widgets/visualization/RadioStackOW.py +7 -5
  60. orangecontrib/tomwer/widgets/visualization/SampleMovedOW.py +1 -1
  61. orangecontrib/tomwer/widgets/visualization/SinogramViewerOW.py +0 -3
  62. orangecontrib/tomwer/widgets/visualization/SliceStackOW.py +7 -5
  63. orangecontrib/tomwer/widgets/visualization/VolumeViewerOW.py +4 -4
  64. tomwer/__main__.py +139 -5
  65. tomwer/app/axis.py +16 -5
  66. tomwer/app/canvas_launcher/config.py +1 -1
  67. tomwer/app/canvas_launcher/mainwindow.py +164 -6
  68. tomwer/app/darkref.py +10 -181
  69. tomwer/app/darkrefpatch.py +10 -131
  70. tomwer/app/diffframe.py +11 -0
  71. tomwer/app/imagekeyeditor.py +12 -19
  72. tomwer/app/intensitynormalization.py +1 -0
  73. tomwer/app/lamino.py +7 -2
  74. tomwer/app/patchrawdarkflat.py +131 -0
  75. tomwer/app/radiostack.py +10 -0
  76. tomwer/app/reducedarkflat.py +205 -0
  77. tomwer/app/saaxis.py +27 -8
  78. tomwer/app/sadeltabeta.py +29 -8
  79. tomwer/app/samplemoved.py +11 -0
  80. tomwer/app/scanviewer.py +12 -0
  81. tomwer/app/sinogramviewer.py +11 -0
  82. tomwer/app/slicestack.py +11 -0
  83. tomwer/app/zstitching.py +12 -0
  84. tomwer/core/futureobject.py +4 -2
  85. tomwer/core/process/conditions/filters.py +26 -4
  86. tomwer/core/process/control/datadiscovery.py +4 -0
  87. tomwer/core/process/control/datawatcher/datawatcher.py +5 -1
  88. tomwer/core/process/control/email.py +148 -0
  89. tomwer/core/process/control/nxtomoconcatenate.py +9 -2
  90. tomwer/core/process/control/nxtomomill.py +58 -16
  91. tomwer/core/process/control/scanselector.py +4 -0
  92. tomwer/core/process/control/scantransfer.py +52 -23
  93. tomwer/core/process/control/test/test_concatenate_nxtomos.py +1 -0
  94. tomwer/core/process/control/test/test_email.py +52 -0
  95. tomwer/core/process/control/test/test_h52nx_process.py +106 -0
  96. tomwer/core/process/control/test/test_volume_link.py +5 -4
  97. tomwer/core/process/control/timer.py +27 -6
  98. tomwer/core/process/control/tomoobjserie.py +4 -0
  99. tomwer/core/process/control/volumeselector.py +4 -0
  100. tomwer/core/process/control/volumesymlink.py +47 -8
  101. tomwer/core/process/edit/darkflatpatch.py +49 -8
  102. tomwer/core/process/edit/imagekeyeditor.py +63 -13
  103. tomwer/core/process/reconstruction/axis/__init__.py +1 -1
  104. tomwer/core/process/reconstruction/axis/axis.py +61 -41
  105. tomwer/core/process/reconstruction/axis/params.py +4 -6
  106. tomwer/core/process/reconstruction/darkref/darkrefs.py +53 -16
  107. tomwer/core/process/reconstruction/darkref/darkrefscopy.py +12 -2
  108. tomwer/core/process/reconstruction/lamino/__init__.py +1 -1
  109. tomwer/core/process/reconstruction/lamino/tofu.py +22 -2
  110. tomwer/core/process/reconstruction/nabu/nabucommon.py +93 -14
  111. tomwer/core/process/reconstruction/nabu/nabuscores.py +70 -33
  112. tomwer/core/process/reconstruction/nabu/nabuslices.py +219 -41
  113. tomwer/core/process/reconstruction/nabu/nabuvolume.py +240 -108
  114. tomwer/core/process/reconstruction/nabu/utils.py +10 -36
  115. tomwer/core/process/reconstruction/normalization/normalization.py +10 -3
  116. tomwer/core/process/reconstruction/saaxis/__init__.py +1 -0
  117. tomwer/core/process/reconstruction/saaxis/saaxis.py +564 -376
  118. tomwer/core/process/reconstruction/sadeltabeta/__init__.py +1 -0
  119. tomwer/core/process/reconstruction/sadeltabeta/sadeltabeta.py +481 -268
  120. tomwer/core/process/reconstruction/scores/params.py +21 -8
  121. tomwer/core/process/reconstruction/test/test_darkref_copy.py +2 -0
  122. tomwer/core/process/reconstruction/test/test_saaxis.py +21 -8
  123. tomwer/core/process/reconstruction/test/test_sadeltabeta.py +8 -5
  124. tomwer/core/process/script/python.py +7 -2
  125. tomwer/core/process/stitching/nabustitcher.py +10 -3
  126. tomwer/core/process/task.py +2 -9
  127. tomwer/core/process/test/test_axis.py +25 -15
  128. tomwer/core/process/test/test_conditions.py +6 -6
  129. tomwer/core/process/test/test_dark_and_flat.py +20 -15
  130. tomwer/core/process/test/test_data_transfer.py +8 -8
  131. tomwer/core/process/test/test_data_watcher.py +1 -1
  132. tomwer/core/process/test/test_lamino.py +6 -6
  133. tomwer/core/process/test/test_nabu.py +13 -8
  134. tomwer/core/process/test/test_normalization.py +1 -0
  135. tomwer/core/process/test/test_timer.py +6 -6
  136. tomwer/core/process/visualization/dataviewer.py +4 -0
  137. tomwer/core/process/visualization/diffviewer.py +4 -0
  138. tomwer/core/process/visualization/imagestackviewer.py +4 -0
  139. tomwer/core/process/visualization/radiostack.py +4 -0
  140. tomwer/core/process/visualization/samplemoved.py +4 -0
  141. tomwer/core/process/visualization/sinogramviewer.py +4 -0
  142. tomwer/core/process/visualization/slicestack.py +4 -0
  143. tomwer/core/process/visualization/volumeviewer.py +4 -0
  144. tomwer/core/scan/hdf5scan.py +4 -4
  145. tomwer/core/scan/scanbase.py +5 -1
  146. tomwer/core/scan/test/test_process_registration.py +9 -9
  147. tomwer/core/settings.py +59 -1
  148. tomwer/core/test/test_lamino.py +2 -1
  149. tomwer/core/utils/__init__.py +16 -0
  150. tomwer/core/utils/locker.py +0 -1
  151. tomwer/core/utils/resource.py +6 -11
  152. tomwer/core/utils/scanutils.py +2 -0
  153. tomwer/gui/cluster/slurm.py +91 -7
  154. tomwer/gui/cluster/supervisor.py +16 -11
  155. tomwer/gui/cluster/test/test_cluster.py +16 -1
  156. tomwer/gui/conditions/filter.py +3 -3
  157. tomwer/gui/control/datalist.py +24 -11
  158. tomwer/gui/control/email.py +183 -0
  159. tomwer/gui/control/reducedarkflatselector.py +545 -0
  160. tomwer/gui/control/singletomoobj.py +23 -1
  161. tomwer/gui/control/test/test_email.py +35 -0
  162. tomwer/gui/control/test/test_reducedarkflat_selector.py +280 -0
  163. tomwer/gui/reconstruction/axis/CompareImages.py +1 -1
  164. tomwer/gui/reconstruction/axis/axis.py +10 -6
  165. tomwer/gui/reconstruction/axis/radioaxis.py +14 -6
  166. tomwer/gui/reconstruction/darkref/darkrefcopywidget.py +2 -0
  167. tomwer/gui/reconstruction/darkref/darkrefwidget.py +4 -4
  168. tomwer/gui/reconstruction/nabu/nabuconfig/phase.py +3 -1
  169. tomwer/gui/reconstruction/nabu/nabuconfig/preprocessing.py +34 -33
  170. tomwer/gui/reconstruction/nabu/nabuconfig/reconstruction.py +1 -1
  171. tomwer/gui/reconstruction/normalization/intensity.py +5 -5
  172. tomwer/gui/reconstruction/saaxis/corrangeselector.py +1 -0
  173. tomwer/gui/reconstruction/saaxis/saaxis.py +6 -6
  174. tomwer/gui/reconstruction/sadeltabeta/saadeltabeta.py +6 -6
  175. tomwer/gui/reconstruction/scores/scoreplot.py +6 -4
  176. tomwer/gui/samplemoved/__init__.py +2 -2
  177. tomwer/gui/stackplot.py +18 -7
  178. tomwer/gui/stacks.py +2 -2
  179. tomwer/gui/stitching/stitchandbackground.py +2 -2
  180. tomwer/gui/stitching/stitching.py +1 -1
  181. tomwer/gui/stitching/stitching_raw.py +1 -1
  182. tomwer/gui/utils/__init__.py +1 -85
  183. tomwer/gui/utils/illustrations.py +1 -1
  184. tomwer/gui/utils/inputwidget.py +41 -36
  185. tomwer/gui/utils/slider.py +2 -2
  186. tomwer/gui/utils/utils.py +93 -0
  187. tomwer/gui/visualization/dataviewer.py +8 -5
  188. tomwer/gui/visualization/diffviewer/diffviewer.py +4 -4
  189. tomwer/gui/visualization/reconstructionparameters.py +26 -6
  190. tomwer/gui/visualization/sinogramviewer.py +7 -1
  191. tomwer/gui/visualization/test/test_reconstruction_parameters.py +2 -4
  192. tomwer/gui/visualization/volumeviewer.py +2 -0
  193. tomwer/resources/__init__.py +55 -43
  194. tomwer/resources/gui/icons/compose.png +0 -0
  195. tomwer/resources/gui/icons/compose.svg +75 -0
  196. tomwer/synctools/datatransfert.py +3 -1
  197. tomwer/synctools/stacks/edit/darkflatpatch.py +39 -34
  198. tomwer/synctools/stacks/edit/imagekeyeditor.py +8 -27
  199. tomwer/synctools/stacks/processingstack.py +45 -9
  200. tomwer/synctools/stacks/reconstruction/axis.py +6 -5
  201. tomwer/synctools/stacks/reconstruction/dkrefcopy.py +1 -0
  202. tomwer/synctools/stacks/reconstruction/lamino.py +3 -3
  203. tomwer/synctools/stacks/reconstruction/nabu.py +49 -140
  204. tomwer/synctools/stacks/reconstruction/normalization.py +1 -0
  205. tomwer/synctools/stacks/reconstruction/saaxis.py +19 -33
  206. tomwer/synctools/stacks/reconstruction/sadeltabeta.py +16 -32
  207. tomwer/synctools/test/test_darkRefs.py +19 -10
  208. tomwer/synctools/test/test_foldertransfer.py +7 -7
  209. tomwer/third_party/nabu/preproc/phase.py +6 -8
  210. tomwer/third_party/nabu/utils.py +2 -3
  211. tomwer/version.py +1 -1
  212. {tomwer-1.2.0a1.dist-info → tomwer-1.2.0a3.dist-info}/METADATA +15 -54
  213. {tomwer-1.2.0a1.dist-info → tomwer-1.2.0a3.dist-info}/RECORD +219 -192
  214. {tomwer-1.2.0a1.dist-info → tomwer-1.2.0a3.dist-info}/WHEEL +1 -1
  215. {tomwer-1.2.0a1.dist-info → tomwer-1.2.0a3.dist-info}/entry_points.txt +3 -3
  216. /tomwer-1.2.0a1-py3.9-nspkg.pth → /tomwer-1.2.0a3-py3.11-nspkg.pth +0 -0
  217. {tomwer-1.2.0a1.dist-info → tomwer-1.2.0a3.dist-info}/LICENSE +0 -0
  218. {tomwer-1.2.0a1.dist-info → tomwer-1.2.0a3.dist-info}/namespace_packages.txt +0 -0
  219. {tomwer-1.2.0a1.dist-info → tomwer-1.2.0a3.dist-info}/top_level.txt +0 -0
@@ -32,6 +32,7 @@ from typing import Optional, Union
32
32
 
33
33
  from tomwer.core.cluster.cluster import SlurmClusterConfiguration
34
34
  from tomwer.core.process.reconstruction.scores.scores import ScoreMethod
35
+ from tomwer.core.utils.deprecation import deprecated
35
36
 
36
37
 
37
38
  class SABaseParams:
@@ -42,7 +43,7 @@ class SABaseParams:
42
43
  def __init__(self):
43
44
  self._n_reconstruction = 20
44
45
  self._slice_indexes = "middle"
45
- self._nabu_params = {}
46
+ self._nabu_recons_params = {}
46
47
  self._dry_run = False
47
48
  self._output_dir = None
48
49
  self._score_method = ScoreMethod.TV
@@ -85,14 +86,24 @@ class SABaseParams:
85
86
  self._slice_indexes = indexes
86
87
 
87
88
  @property
89
+ def nabu_recons_params(self) -> dict:
90
+ return self._nabu_recons_params
91
+
92
+ @nabu_recons_params.setter
93
+ def nabu_recons_params(self, params: dict):
94
+ if not isinstance(params, dict):
95
+ raise TypeError(f"params should be a dictionary and not {type(params)}")
96
+ self._nabu_recons_params = params
97
+
98
+ @property
99
+ @deprecated(replacement="nabu_recons_params", since_version="1.2")
88
100
  def nabu_params(self) -> dict:
89
- return self._nabu_params
101
+ return self.nabu_recons_params
90
102
 
91
103
  @nabu_params.setter
104
+ @deprecated(replacement="nabu_recons_params", since_version="1.2")
92
105
  def nabu_params(self, params: dict):
93
- if not isinstance(params, dict):
94
- raise TypeError(f"params should be a dictionary and not {type(params)}")
95
- self._nabu_params = params
106
+ self.nabu_recons_params = params
96
107
 
97
108
  @property
98
109
  def dry_run(self) -> bool:
@@ -161,7 +172,7 @@ class SABaseParams:
161
172
  def to_dict(self) -> dict:
162
173
  return {
163
174
  "slice_index": self.slice_indexes or "",
164
- "nabu_params": self.nabu_params,
175
+ "nabu_params": self.nabu_recons_params,
165
176
  "dry_run": self.dry_run,
166
177
  "output_dir": self.output_dir or "",
167
178
  "score_method": self.score_method.value,
@@ -177,7 +188,7 @@ class SABaseParams:
177
188
  slice_index = None
178
189
  self.slice_indexes = slice_index
179
190
  if "nabu_params" in dict_:
180
- self.nabu_params = dict_["nabu_params"]
191
+ self.nabu_recons_params = dict_["nabu_params"]
181
192
  if "dry_run" in dict_:
182
193
  self.dry_run = bool(dict_["dry_run"])
183
194
  if "output_dir" in dict_:
@@ -195,4 +206,6 @@ class SABaseParams:
195
206
 
196
207
  @staticmethod
197
208
  def from_dict(dict_):
198
- raise ValueError("Base class")
209
+ res = SABaseParams()
210
+ res.load_from_dict(dict_=dict_)
211
+ return res
@@ -58,6 +58,7 @@ def test_register_and_copy_darks_and_flats(
58
58
  "save_dir": save_dir,
59
59
  "process_only_copy": process_only_copy_scan_with_raw,
60
60
  "process_only_dkrf": process_only_dkrf_scan_with_raw,
61
+ "serialize_output_data": False,
61
62
  }
62
63
  )
63
64
  # test processing with flat and dark materials
@@ -76,6 +77,7 @@ def test_register_and_copy_darks_and_flats(
76
77
  "save_dir": save_dir,
77
78
  "process_only_copy": process_only_copy_scan_without_raw,
78
79
  "process_only_dkrf": process_only_dkrf_scan_without_raw,
80
+ "serialize_output_data": False,
79
81
  }
80
82
  )
81
83
 
@@ -36,7 +36,7 @@ import unittest
36
36
  import numpy
37
37
 
38
38
  from tomwer.core.process.reconstruction.saaxis.params import SAAxisParams
39
- from tomwer.core.process.reconstruction.saaxis.saaxis import SAAxisProcess
39
+ from tomwer.core.process.reconstruction.saaxis.saaxis import SAAxisTask
40
40
  from tomwer.core.process.reconstruction.scores.scores import (
41
41
  _METHOD_TO_FCT,
42
42
  compute_score_contrast_std,
@@ -89,17 +89,30 @@ class TestSAAxisProcess(unittest.TestCase):
89
89
  shutil.rmtree(self.tempdir)
90
90
 
91
91
  def test(self):
92
- process = SAAxisProcess(inputs={"data": self.scan})
93
- with self.assertRaises(Exception):
94
- process.run()
95
- process.set_configuration(self._default_saaxis_params)
92
+ process = SAAxisTask(
93
+ inputs={
94
+ "data": self.scan,
95
+ "sa_axis_params": self._default_saaxis_params.to_dict(),
96
+ "serialize_output_data": False,
97
+ }
98
+ )
96
99
  with self.assertRaises(ValueError):
97
100
  process.run()
98
101
  self._default_saaxis_params.estimated_cor = 11
99
102
  self._default_saaxis_params.research_width = 2
100
- process.set_configuration(self._default_saaxis_params)
103
+ process = SAAxisTask(
104
+ inputs={
105
+ "data": self.scan,
106
+ "sa_axis_params": self._default_saaxis_params.to_dict(),
107
+ "serialize_output_data": False,
108
+ },
109
+ )
101
110
  process.run()
102
- process = SAAxisProcess(
103
- inputs={"data": self.scan, "sa_axis_params": self._default_saaxis_params}
111
+ process = SAAxisTask(
112
+ inputs={
113
+ "data": self.scan,
114
+ "sa_axis_params": self._default_saaxis_params.to_dict(),
115
+ "serialize_output_data": False,
116
+ },
104
117
  )
105
118
  process.run()
@@ -35,7 +35,7 @@ import unittest
35
35
 
36
36
  from tomwer.core.process.reconstruction.sadeltabeta.sadeltabeta import (
37
37
  SADeltaBetaParams,
38
- SADeltaBetaProcess,
38
+ SADeltaBetaTask,
39
39
  )
40
40
  from tomwer.core.utils.scanutils import MockHDF5
41
41
 
@@ -57,7 +57,13 @@ class TestSADeltaBetaProcess(unittest.TestCase):
57
57
  super().tearDown()
58
58
 
59
59
  def test(self):
60
- process = SADeltaBetaProcess(inputs={"data": self.scan})
60
+ process = SADeltaBetaTask(
61
+ inputs={
62
+ "data": self.scan,
63
+ "sa_delta_beta_params": SADeltaBetaParams().to_dict(),
64
+ "serialize_output_data": False,
65
+ }
66
+ )
61
67
 
62
68
  default_sadelta_beta_params = SADeltaBetaParams()
63
69
  default_sadelta_beta_params.output_dir = os.path.join(
@@ -65,7 +71,4 @@ class TestSADeltaBetaProcess(unittest.TestCase):
65
71
  )
66
72
  default_sadelta_beta_params.dry_run = True
67
73
 
68
- with self.assertRaises(Exception):
69
- process.run()
70
- process.set_configuration(default_sadelta_beta_params)
71
74
  process.run()
@@ -43,7 +43,9 @@ _logger = logging.getLogger(__name__)
43
43
 
44
44
 
45
45
  class PythonScript(
46
- Task, optional_input_names=("data", "volume"), output_names=("data", "volume")
46
+ Task,
47
+ optional_input_names=("data", "volume", "serialize_output_data"),
48
+ output_names=("data", "volume"),
47
49
  ):
48
50
  def run(self):
49
51
  # load data
@@ -82,7 +84,10 @@ class PythonScript(
82
84
  except Exception as e:
83
85
  _logger.error("Fail to register process. Error is " + str(e))
84
86
 
85
- self.outputs.data = out_data
87
+ if out_data is not None and self.get_input_value("serialize_output_data", True):
88
+ self.outputs.data = out_data.to_dict()
89
+ else:
90
+ self.outputs.data = out_data
86
91
  self.outputs.volume = out_volume
87
92
 
88
93
  @staticmethod
@@ -34,7 +34,11 @@ class StitcherTask(
34
34
  Task,
35
35
  SuperviseProcess,
36
36
  input_names=("stitching_config",),
37
- optional_input_names=("cluster_config", "progress"),
37
+ optional_input_names=(
38
+ "cluster_config",
39
+ "progress",
40
+ "serialize_output_data",
41
+ ),
38
42
  output_names=(
39
43
  "data",
40
44
  "future_tomo_obj",
@@ -65,7 +69,10 @@ class StitcherTask(
65
69
  nx_tomo = ScanFactory.create_tomo_object_from_identifier(
66
70
  stitched_identifier.to_str()
67
71
  )
68
- self.outputs.data = nx_tomo
72
+ if self.get_input_value("serialize_output_data", True):
73
+ self.outputs.data = nx_tomo.to_dict()
74
+ else:
75
+ self.outputs.data = nx_tomo
69
76
  self.outputs.volume = None
70
77
  self.outputs.future_tomo_obj = None
71
78
  elif config.stitching_type is StitchingType.Z_POSTPROC:
@@ -96,7 +103,7 @@ class StitcherTask(
96
103
  # handle post processing
97
104
  data_aggregation = StitchingPostProcAggregation(
98
105
  futures=futures,
99
- stitching_config=stitching_config,
106
+ stitching_config=config,
100
107
  )
101
108
  for future in futures.values():
102
109
  # TODO: do we ned to make sure the processing is not finished yet ?
@@ -72,11 +72,12 @@ class BaseProcessInfo:
72
72
  self._scheme_title = (
73
73
  "scheme_title" # TODO: have a look, this must be get somewhere and reused ?
74
74
  )
75
- self._return_dict = inputs.get("return_dict", False)
76
75
 
77
76
  """should the return type of the handler should be TomoBase instance
78
77
  objects or dict"""
79
78
  self._settings = {}
79
+ self._cancelled = False
80
+ # a useful variable that can be set to True if the task has been cancelled
80
81
 
81
82
  @staticmethod
82
83
  def properties_help():
@@ -401,14 +402,6 @@ class BaseProcessInfo:
401
402
  )
402
403
  return processes
403
404
 
404
- def _set_return_dict(self, return_dict):
405
- """
406
-
407
- :param bool return_dict: if True, force the process to return a dict
408
- instead of a `.TomoBase` object
409
- """
410
- self._return_dict = return_dict
411
-
412
405
 
413
406
  class TaskWithProgress(_EwoksTaskWithProgress, BaseProcessInfo):
414
407
  """Class from which all tomwer process should inherit
@@ -45,7 +45,7 @@ from tomwer.core.scan.scanbase import TomwerScanBase
45
45
  from tomwer.core.utils.scanutils import MockEDF, MockHDF5
46
46
  from tomwer.tests.utils import UtilsTest
47
47
 
48
- from ..reconstruction.axis.axis import AxisProcess
48
+ from ..reconstruction.axis.axis import AxisTask
49
49
 
50
50
 
51
51
  class TestAxisIO(unittest.TestCase):
@@ -76,19 +76,19 @@ class TestAxisIO(unittest.TestCase):
76
76
  def testInputOutput(self):
77
77
  """Test that io using TomoBase instance work"""
78
78
  for input_type in (dict, TomwerScanBase):
79
- for return_dict in (True, False):
79
+ for serialize_output_data in (True, False):
80
80
  with self.subTest(
81
- return_dict=return_dict,
81
+ serialize_output_data=serialize_output_data,
82
82
  input_type=input_type,
83
83
  ):
84
84
  input_obj = self.scan
85
85
  if input_obj is dict:
86
86
  input_obj = input_obj.to_dict()
87
- axis_process = AxisProcess(
87
+ axis_process = AxisTask(
88
88
  inputs={
89
89
  "axis_params": self.recons_params,
90
90
  "data": input_obj,
91
- "return_dict": return_dict,
91
+ "serialize_output_data": serialize_output_data,
92
92
  }
93
93
  )
94
94
 
@@ -99,7 +99,7 @@ class TestAxisIO(unittest.TestCase):
99
99
 
100
100
  axis_process.run()
101
101
  out = axis_process.outputs.data
102
- if return_dict:
102
+ if serialize_output_data:
103
103
  self.assertTrue(isinstance(out, dict))
104
104
  else:
105
105
  self.assertTrue(isinstance(out, TomwerScanBase))
@@ -120,10 +120,11 @@ class TestAxis(unittest.TestCase):
120
120
  mock = MockEDF(scan_path=self.tempdir, n_radio=10, n_ini_radio=10)
121
121
  scan = EDFTomoScan(mock.scan_path)
122
122
  self.recons_params.mode = "centered"
123
- axis_process = AxisProcess(
123
+ axis_process = AxisTask(
124
124
  inputs={
125
125
  "data": scan,
126
126
  "axis_params": self.recons_params,
127
+ "serialize_output_data": False,
127
128
  }
128
129
  )
129
130
 
@@ -141,7 +142,7 @@ class TestAxis(unittest.TestCase):
141
142
  axis_value = h5py_read_dataset(group_axis["results"]["center_of_rotation"])
142
143
 
143
144
  processes = Task.get_processes_frm_type(
144
- process_file=scan.process_file, process_type=AxisProcess, entry="entry"
145
+ process_file=scan.process_file, process_type=AxisTask, entry="entry"
145
146
  )
146
147
  self.assertEqual(len(processes), 1)
147
148
  self.assertEqual(processes[0].results["center_of_rotation"], axis_value)
@@ -171,10 +172,11 @@ class TestAxis(unittest.TestCase):
171
172
  self.recons_params.mode = "centered"
172
173
 
173
174
  # check data url take
174
- axis_process = AxisProcess(
175
+ axis_process = AxisTask(
175
176
  inputs={
176
177
  "data": scan,
177
178
  "axis_params": self.recons_params,
179
+ "serialize_output_data": False,
178
180
  }
179
181
  )
180
182
  axis_process.run()
@@ -192,7 +194,7 @@ class TestAxis(unittest.TestCase):
192
194
  axis_value = h5py_read_dataset(group_axis["results"]["center_of_rotation"])
193
195
  self.assertTrue(-dim / 2 <= axis_value <= dim / 2)
194
196
  processes = Task.get_processes_frm_type(
195
- process_file=scan.process_file, process_type=AxisProcess
197
+ process_file=scan.process_file, process_type=AxisTask
196
198
  )
197
199
  self.assertEqual(len(processes), 1)
198
200
  self.assertEqual(processes[0].results["center_of_rotation"], axis_value)
@@ -268,7 +270,7 @@ class TestSinogramAlgorithm(unittest.TestCase):
268
270
 
269
271
  def test_growing_window_sinogram(self):
270
272
  recons_params = AxisRP()
271
- axis_process = AxisProcess(
273
+ axis_process = AxisTask(
272
274
  inputs={"axis_params": recons_params, "data": self.scan}
273
275
  )
274
276
  recons_params.mode = AxisMode.growing_window_sinogram
@@ -278,8 +280,12 @@ class TestSinogramAlgorithm(unittest.TestCase):
278
280
 
279
281
  def test_sliding_window(self):
280
282
  recons_params = AxisRP()
281
- axis_process = AxisProcess(
282
- inputs={"axis_params": recons_params, "data": self.scan}
283
+ axis_process = AxisTask(
284
+ inputs={
285
+ "axis_params": recons_params,
286
+ "data": self.scan,
287
+ "serialize_output_data": False,
288
+ }
283
289
  )
284
290
  recons_params.mode = AxisMode.sliding_window_sinogram
285
291
  recons_params.side = "left"
@@ -289,8 +295,12 @@ class TestSinogramAlgorithm(unittest.TestCase):
289
295
 
290
296
  def test_sino_coarse_to_fine(self):
291
297
  recons_params = AxisRP()
292
- axis_process = AxisProcess(
293
- inputs={"axis_params": recons_params, "data": self.scan}
298
+ axis_process = AxisTask(
299
+ inputs={
300
+ "axis_params": recons_params,
301
+ "data": self.scan,
302
+ "serialize_output_data": False,
303
+ }
294
304
  )
295
305
  recons_params.mode = AxisMode.sino_coarse_to_fine
296
306
  recons_params.sinogram_subsampling = 1
@@ -33,7 +33,7 @@ import tempfile
33
33
  import unittest
34
34
 
35
35
  from tomwer.core.process.conditions.filters import (
36
- FileNameFilter,
36
+ FileNameFilterTask,
37
37
  RegularExpressionFilter,
38
38
  )
39
39
  from tomwer.core.scan.scanbase import TomwerScanBase
@@ -69,24 +69,24 @@ class TestConditionIO(unittest.TestCase):
69
69
 
70
70
  def testInputOutput(self):
71
71
  for input_type in (dict, TomwerScanBase):
72
- for return_dict in (True, False):
72
+ for serialize_output_data in (True, False):
73
73
  with self.subTest(
74
- return_dict=return_dict,
74
+ return_dict=serialize_output_data,
75
75
  input_type=input_type,
76
76
  ):
77
77
  input_obj = self.scan
78
78
  if input_type is dict:
79
79
  input_obj = self.scan.to_dict()
80
- filter_process = FileNameFilter(
80
+ filter_process = FileNameFilterTask(
81
81
  inputs={
82
82
  "pattern": "*",
83
- "return_dict": return_dict,
83
+ "serialize_output_data": serialize_output_data,
84
84
  "data": input_obj,
85
85
  }
86
86
  )
87
87
  filter_process.run()
88
88
  out = filter_process.outputs.data
89
- if return_dict:
89
+ if serialize_output_data:
90
90
  self.assertTrue(isinstance(out, dict))
91
91
  else:
92
92
  self.assertTrue(isinstance(out, TomwerScanBase))
@@ -43,7 +43,7 @@ from tomwer.core.scan.scanbase import TomwerScanBase
43
43
  from tomwer.core.utils.scanutils import MockEDF, MockHDF5
44
44
  from tomwer.tests.utils import UtilsTest
45
45
 
46
- from ..reconstruction.darkref.darkrefs import DarkRefs
46
+ from ..reconstruction.darkref.darkrefs import DarkRefsTask
47
47
  from ..reconstruction.darkref.darkrefscopy import DarkRefsCopy
48
48
 
49
49
 
@@ -69,25 +69,25 @@ class TestDarkRefIO(unittest.TestCase):
69
69
  (self.scan_edf, self.scan_hdf5), ("edf scan", "hdf5 scan")
70
70
  ):
71
71
  for input_type in (dict, TomwerScanBase):
72
- for return_dict in (True, False):
72
+ for serialize_output_data in (True, False):
73
73
  with self.subTest(
74
- return_dict=return_dict,
74
+ return_dict=serialize_output_data,
75
75
  input_type=input_type,
76
76
  scan_type=scan_type,
77
77
  ):
78
78
  input_obj = scan
79
79
  if input_obj is dict:
80
80
  input_obj = input_obj.to_dict()
81
- process = DarkRefs(
81
+ process = DarkRefsTask(
82
82
  inputs={
83
83
  "dark_ref_params": self.recons_params,
84
84
  "data": input_obj,
85
- "return_dict": return_dict,
85
+ "serialize_output_data": serialize_output_data,
86
86
  }
87
87
  )
88
88
  process.run()
89
89
  out = process.outputs.data
90
- if return_dict:
90
+ if serialize_output_data:
91
91
  self.assertTrue(isinstance(out, dict))
92
92
  else:
93
93
  self.assertTrue(isinstance(out, TomwerScanBase))
@@ -116,9 +116,9 @@ class TestDarkRefCopyIO(unittest.TestCase):
116
116
  (self.scan_edf, self.scan_hdf5), ("edf scan", "hdf5 scan")
117
117
  ):
118
118
  for input_type in (dict, TomwerScanBase):
119
- for return_dict in (True, False):
119
+ for serialize_output_data in (True, False):
120
120
  with self.subTest(
121
- return_dict=return_dict,
121
+ return_dict=serialize_output_data,
122
122
  input_type=input_type,
123
123
  scan_type=scan_type,
124
124
  ):
@@ -129,13 +129,13 @@ class TestDarkRefCopyIO(unittest.TestCase):
129
129
  inputs={
130
130
  "dark_ref_params": self.recons_params,
131
131
  "data": input_obj,
132
- "return_dict": return_dict,
132
+ "serialize_output_data": serialize_output_data,
133
133
  "save_dir": self._save_dir,
134
134
  }
135
135
  )
136
136
  dkrf_process.run()
137
137
  out = dkrf_process.outputs.data
138
- if return_dict:
138
+ if serialize_output_data:
139
139
  self.assertTrue(isinstance(out, dict))
140
140
  else:
141
141
  self.assertTrue(isinstance(out, TomwerScanBase))
@@ -195,10 +195,11 @@ class TestDarkRefEdf(unittest.TestCase):
195
195
  with self.subTest(method=method):
196
196
  if os.path.exists(self.scan.process_file):
197
197
  os.remove(self.scan.process_file)
198
- process = DarkRefs(
198
+ process = DarkRefsTask(
199
199
  inputs={
200
200
  "dark_ref_params": self.recons_params,
201
201
  "data": self.scan,
202
+ "serialize_output_data": False,
202
203
  }
203
204
  )
204
205
 
@@ -231,10 +232,11 @@ class TestDarkRefEdf(unittest.TestCase):
231
232
  os.remove(self.scan.process_file)
232
233
  self.recons_params.dark_calc_method = cMethod.NONE
233
234
  self.recons_params.flat_calc_method = method
234
- process = DarkRefs(
235
+ process = DarkRefsTask(
235
236
  inputs={
236
237
  "dark_ref_params": self.recons_params,
237
238
  "data": self.scan,
239
+ "serialize_output_data": False,
238
240
  }
239
241
  )
240
242
  process.run()
@@ -278,10 +280,11 @@ class TestDarkRefNx(unittest.TestCase):
278
280
  with self.subTest(method=method):
279
281
  self.recons_params.dark_calc_method = method
280
282
  self.recons_params.flat_calc_method = cMethod.NONE
281
- process = DarkRefs(
283
+ process = DarkRefsTask(
282
284
  inputs={
283
285
  "dark_ref_params": self.recons_params,
284
286
  "data": self.scan,
287
+ "serialize_output_data": False,
285
288
  }
286
289
  )
287
290
  process.run()
@@ -326,10 +329,11 @@ class TestDarkRefNx(unittest.TestCase):
326
329
 
327
330
  self.recons_params.dark_calc_method = cMethod.NONE
328
331
  self.recons_params.flat_calc_method = method
329
- process = DarkRefs(
332
+ process = DarkRefsTask(
330
333
  inputs={
331
334
  "dark_ref_params": self.recons_params,
332
335
  "data": self.scan,
336
+ "serialize_output_data": False,
333
337
  }
334
338
  )
335
339
  process.run()
@@ -364,10 +368,11 @@ class TestDarkRefNx(unittest.TestCase):
364
368
 
365
369
  expected_flats_s1 = numpy.median(data_flat_serie_1, axis=0)
366
370
  expected_flats_s2 = numpy.median(data_flat_serie_2, axis=0)
367
- process = DarkRefs(
371
+ process = DarkRefsTask(
368
372
  inputs={
369
373
  "dark_ref_params": self.recons_params,
370
374
  "data": self.scan,
375
+ "serialize_output_data": False,
371
376
  }
372
377
  )
373
378
  process.run()
@@ -45,7 +45,7 @@ from tomoscan.io import HDF5File
45
45
  from tomoscan.validator import is_valid_for_reconstruction
46
46
 
47
47
  from tomwer.core.process.control.datalistener import DataListener
48
- from tomwer.core.process.control.scantransfer import ScanTransfer
48
+ from tomwer.core.process.control.scantransfer import ScanTransferTask
49
49
  from tomwer.core.scan.hdf5scan import HDF5TomoScan
50
50
  from tomwer.core.scan.scanbase import TomwerScanBase
51
51
  from tomwer.core.utils.scanutils import MockEDF
@@ -70,9 +70,9 @@ class TestDataTransferIO(unittest.TestCase):
70
70
  def testInputOutput(self):
71
71
  """Test that io using TomoBase instance work"""
72
72
  for input_type in (dict, TomwerScanBase):
73
- for return_dict in (True, False):
73
+ for serialize_output_data in (True, False):
74
74
  with self.subTest(
75
- return_dict=return_dict,
75
+ return_dict=serialize_output_data,
76
76
  input_type=input_type,
77
77
  ):
78
78
  output_folder = tempfile.mkdtemp()
@@ -91,11 +91,11 @@ class TestDataTransferIO(unittest.TestCase):
91
91
  dim=10,
92
92
  )
93
93
 
94
- transfert_process = ScanTransfer(
94
+ transfert_process = ScanTransferTask(
95
95
  inputs={
96
96
  "data": scan,
97
97
  "dest_dir": output_folder,
98
- "return_dict": return_dict,
98
+ "serialize_output_data": serialize_output_data,
99
99
  }
100
100
  )
101
101
 
@@ -105,7 +105,7 @@ class TestDataTransferIO(unittest.TestCase):
105
105
  input_obj = input_obj.to_dict()
106
106
  transfert_process.run()
107
107
  out = transfert_process.outputs.data
108
- if return_dict:
108
+ if serialize_output_data:
109
109
  self.assertTrue(isinstance(out, dict))
110
110
  else:
111
111
  self.assertTrue(isinstance(out, TomwerScanBase))
@@ -175,7 +175,7 @@ class TestBlissDataTransfer(unittest.TestCase):
175
175
  for scan_path in out_not_included_scans:
176
176
  self.assertFalse(os.path.exists(scan_path))
177
177
 
178
- process = ScanTransfer(
178
+ process = ScanTransferTask(
179
179
  inputs={
180
180
  "data": self.scan,
181
181
  "block": True,
@@ -321,7 +321,7 @@ class NXTomoDataTransferBase(unittest.TestCase):
321
321
  def _test(self):
322
322
  src_scan = HDF5TomoScan(self.nexus_file_path, entry="entry0000")
323
323
  assert is_valid_for_reconstruction(src_scan)
324
- process = ScanTransfer(
324
+ process = ScanTransferTask(
325
325
  inputs={
326
326
  "data": src_scan,
327
327
  "turn_off_print": True,
@@ -53,7 +53,7 @@ def test_data_watcher_io(tmp_path, det_method):
53
53
  )
54
54
  data_watcher_process.setFolderObserved(str(tmp_path / "folder"))
55
55
  data_watcher_process.clear_output_values()
56
- data_watcher_process._set_return_dict(True)
56
+ data_watcher_process.set_serialize_output_data(True)
57
57
  LoopThread.quitEvent.clear()
58
58
  data_watcher_process.start()
59
59
 
@@ -35,7 +35,7 @@ import unittest
35
35
  from tomwer.core.scan.scanbase import TomwerScanBase
36
36
  from tomwer.core.utils.scanutils import MockEDF
37
37
 
38
- from ..reconstruction.lamino import LaminoReconstruction
38
+ from ..reconstruction.lamino import LaminoReconstructionTask
39
39
 
40
40
 
41
41
  class TestLaminoIO(unittest.TestCase):
@@ -53,24 +53,24 @@ class TestLaminoIO(unittest.TestCase):
53
53
 
54
54
  def testInputOutput(self):
55
55
  for input_type in (dict, TomwerScanBase):
56
- for return_dict in (True, False):
56
+ for serialize_output_data in (True, False):
57
57
  with self.subTest(
58
- return_dict=return_dict,
58
+ serialize_output_data=serialize_output_data,
59
59
  input_type=input_type,
60
60
  ):
61
61
  input_obj = self.scan
62
62
  if input_obj is dict:
63
63
  input_obj = input_obj.to_dict()
64
- lamino_process = LaminoReconstruction(
64
+ lamino_process = LaminoReconstructionTask(
65
65
  inputs={
66
66
  "dry_run": True,
67
- "return_dict": return_dict,
68
67
  "data": input_obj,
68
+ "serialize_output_data": serialize_output_data,
69
69
  }
70
70
  )
71
71
  lamino_process.run()
72
72
  out = lamino_process.outputs.data
73
- if return_dict:
73
+ if serialize_output_data:
74
74
  self.assertTrue(isinstance(out, dict))
75
75
  else:
76
76
  self.assertTrue(isinstance(out, TomwerScanBase))