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.
- orangecontrib/tomwer/tutorials/append_raw_darks_and_flats_frames_to_NXtomos.ows +44 -0
- orangecontrib/tomwer/tutorials/copy_reduced_darks_and_flats_meth1.ows +55 -0
- orangecontrib/tomwer/tutorials/copy_reduced_darks_and_flats_meth2.ows +48 -0
- orangecontrib/tomwer/tutorials/default_cor_search.ows +40 -0
- orangecontrib/tomwer/tutorials/hello_world_python_script.ows +50 -0
- orangecontrib/tomwer/tutorials/simple_slice_reconstruction_on_slurm.ows +50 -0
- orangecontrib/tomwer/tutorials/simple_volume_to_slurm_reconstruction.ows +8 -8
- orangecontrib/tomwer/widgets/__init__.py +1 -1
- orangecontrib/tomwer/widgets/cluster/FutureSupervisorOW.py +0 -1
- orangecontrib/tomwer/widgets/cluster/SlurmClusterOW.py +8 -6
- orangecontrib/tomwer/widgets/control/AdvancementOW.py +0 -1
- orangecontrib/tomwer/widgets/control/DataDiscoveryOW.py +1 -6
- orangecontrib/tomwer/widgets/control/DataListOW.py +0 -1
- orangecontrib/tomwer/widgets/control/DataListenerOW.py +4 -4
- orangecontrib/tomwer/widgets/control/DataSelectorOW.py +0 -1
- orangecontrib/tomwer/widgets/control/DataTransfertOW.py +7 -7
- orangecontrib/tomwer/widgets/control/DataValidatorOW.py +0 -1
- orangecontrib/tomwer/widgets/control/DataWatcherOW.py +0 -3
- orangecontrib/tomwer/widgets/control/EDF2NXTomomillOW.py +3 -2
- orangecontrib/tomwer/widgets/control/EmailOW.py +82 -0
- orangecontrib/tomwer/widgets/control/FilterOW.py +3 -3
- orangecontrib/tomwer/widgets/control/NXTomomillOW.py +1 -1
- orangecontrib/tomwer/widgets/control/NotifierOW.py +0 -1
- orangecontrib/tomwer/widgets/control/ReduceDarkFlatSelectorOW.py +93 -0
- orangecontrib/tomwer/widgets/control/SingleTomoObjOW.py +29 -5
- orangecontrib/tomwer/widgets/control/TimerOW.py +1 -2
- orangecontrib/tomwer/widgets/control/TomoObjSerieOW.py +0 -1
- orangecontrib/tomwer/widgets/control/VolumeSelector.py +0 -1
- orangecontrib/tomwer/widgets/control/VolumeSymLinkOW.py +4 -10
- orangecontrib/tomwer/widgets/control/icons/email.png +0 -0
- orangecontrib/tomwer/widgets/control/icons/email.svg +58 -0
- orangecontrib/tomwer/widgets/control/icons/reduced_darkflat_selector.png +0 -0
- orangecontrib/tomwer/widgets/control/icons/reduced_darkflat_selector.svg +199 -0
- orangecontrib/tomwer/widgets/debugtools/DatasetGeneratorOW.py +0 -1
- orangecontrib/tomwer/widgets/debugtools/ObjectInspectorOW.py +0 -1
- orangecontrib/tomwer/widgets/edit/DarkFlatPatchOW.py +1 -2
- orangecontrib/tomwer/widgets/edit/ImageKeyEditorOW.py +1 -2
- orangecontrib/tomwer/widgets/edit/ImageKeyUpgraderOW.py +0 -1
- orangecontrib/tomwer/widgets/edit/NXtomoEditorOW.py +0 -1
- orangecontrib/tomwer/widgets/other/PythonScriptOW.py +29 -1
- orangecontrib/tomwer/widgets/other/TomoObjsHub.py +28 -0
- orangecontrib/tomwer/widgets/other/icons/hub.png +0 -0
- orangecontrib/tomwer/widgets/other/icons/hub.svg +113 -0
- orangecontrib/tomwer/widgets/reconstruction/AxisOW.py +18 -12
- orangecontrib/tomwer/widgets/reconstruction/CastNabuVolumeOW.py +0 -2
- orangecontrib/tomwer/widgets/reconstruction/DarkRefAndCopyOW.py +21 -6
- orangecontrib/tomwer/widgets/reconstruction/NabuOW.py +29 -7
- orangecontrib/tomwer/widgets/reconstruction/NabuVolumeOW.py +18 -5
- orangecontrib/tomwer/widgets/reconstruction/SAAxisOW.py +40 -13
- orangecontrib/tomwer/widgets/reconstruction/SADeltaBetaOW.py +37 -10
- orangecontrib/tomwer/widgets/reconstruction/SinoNormOW.py +2 -3
- orangecontrib/tomwer/widgets/reconstruction/TofuOW.py +5 -4
- orangecontrib/tomwer/widgets/stitching/StitcherOW.py +0 -1
- orangecontrib/tomwer/widgets/stitching/ZStitchingConfigOW.py +0 -1
- orangecontrib/tomwer/widgets/visualization/DataViewerOW.py +10 -4
- orangecontrib/tomwer/widgets/visualization/DiffViewerOW.py +1 -1
- orangecontrib/tomwer/widgets/visualization/LivesliceOW.py +0 -1
- orangecontrib/tomwer/widgets/visualization/NXtomoMetadataViewerOW.py +0 -1
- orangecontrib/tomwer/widgets/visualization/RadioStackOW.py +7 -5
- orangecontrib/tomwer/widgets/visualization/SampleMovedOW.py +1 -1
- orangecontrib/tomwer/widgets/visualization/SinogramViewerOW.py +0 -3
- orangecontrib/tomwer/widgets/visualization/SliceStackOW.py +7 -5
- orangecontrib/tomwer/widgets/visualization/VolumeViewerOW.py +4 -4
- tomwer/__main__.py +139 -5
- tomwer/app/axis.py +16 -5
- tomwer/app/canvas_launcher/config.py +1 -1
- tomwer/app/canvas_launcher/mainwindow.py +164 -6
- tomwer/app/darkref.py +10 -181
- tomwer/app/darkrefpatch.py +10 -131
- tomwer/app/diffframe.py +11 -0
- tomwer/app/imagekeyeditor.py +12 -19
- tomwer/app/intensitynormalization.py +1 -0
- tomwer/app/lamino.py +7 -2
- tomwer/app/patchrawdarkflat.py +131 -0
- tomwer/app/radiostack.py +10 -0
- tomwer/app/reducedarkflat.py +205 -0
- tomwer/app/saaxis.py +27 -8
- tomwer/app/sadeltabeta.py +29 -8
- tomwer/app/samplemoved.py +11 -0
- tomwer/app/scanviewer.py +12 -0
- tomwer/app/sinogramviewer.py +11 -0
- tomwer/app/slicestack.py +11 -0
- tomwer/app/zstitching.py +12 -0
- tomwer/core/futureobject.py +4 -2
- tomwer/core/process/conditions/filters.py +26 -4
- tomwer/core/process/control/datadiscovery.py +4 -0
- tomwer/core/process/control/datawatcher/datawatcher.py +5 -1
- tomwer/core/process/control/email.py +148 -0
- tomwer/core/process/control/nxtomoconcatenate.py +9 -2
- tomwer/core/process/control/nxtomomill.py +58 -16
- tomwer/core/process/control/scanselector.py +4 -0
- tomwer/core/process/control/scantransfer.py +52 -23
- tomwer/core/process/control/test/test_concatenate_nxtomos.py +1 -0
- tomwer/core/process/control/test/test_email.py +52 -0
- tomwer/core/process/control/test/test_h52nx_process.py +106 -0
- tomwer/core/process/control/test/test_volume_link.py +5 -4
- tomwer/core/process/control/timer.py +27 -6
- tomwer/core/process/control/tomoobjserie.py +4 -0
- tomwer/core/process/control/volumeselector.py +4 -0
- tomwer/core/process/control/volumesymlink.py +47 -8
- tomwer/core/process/edit/darkflatpatch.py +49 -8
- tomwer/core/process/edit/imagekeyeditor.py +63 -13
- tomwer/core/process/reconstruction/axis/__init__.py +1 -1
- tomwer/core/process/reconstruction/axis/axis.py +61 -41
- tomwer/core/process/reconstruction/axis/params.py +4 -6
- tomwer/core/process/reconstruction/darkref/darkrefs.py +53 -16
- tomwer/core/process/reconstruction/darkref/darkrefscopy.py +12 -2
- tomwer/core/process/reconstruction/lamino/__init__.py +1 -1
- tomwer/core/process/reconstruction/lamino/tofu.py +22 -2
- tomwer/core/process/reconstruction/nabu/nabucommon.py +93 -14
- tomwer/core/process/reconstruction/nabu/nabuscores.py +70 -33
- tomwer/core/process/reconstruction/nabu/nabuslices.py +219 -41
- tomwer/core/process/reconstruction/nabu/nabuvolume.py +240 -108
- tomwer/core/process/reconstruction/nabu/utils.py +10 -36
- tomwer/core/process/reconstruction/normalization/normalization.py +10 -3
- tomwer/core/process/reconstruction/saaxis/__init__.py +1 -0
- tomwer/core/process/reconstruction/saaxis/saaxis.py +564 -376
- tomwer/core/process/reconstruction/sadeltabeta/__init__.py +1 -0
- tomwer/core/process/reconstruction/sadeltabeta/sadeltabeta.py +481 -268
- tomwer/core/process/reconstruction/scores/params.py +21 -8
- tomwer/core/process/reconstruction/test/test_darkref_copy.py +2 -0
- tomwer/core/process/reconstruction/test/test_saaxis.py +21 -8
- tomwer/core/process/reconstruction/test/test_sadeltabeta.py +8 -5
- tomwer/core/process/script/python.py +7 -2
- tomwer/core/process/stitching/nabustitcher.py +10 -3
- tomwer/core/process/task.py +2 -9
- tomwer/core/process/test/test_axis.py +25 -15
- tomwer/core/process/test/test_conditions.py +6 -6
- tomwer/core/process/test/test_dark_and_flat.py +20 -15
- tomwer/core/process/test/test_data_transfer.py +8 -8
- tomwer/core/process/test/test_data_watcher.py +1 -1
- tomwer/core/process/test/test_lamino.py +6 -6
- tomwer/core/process/test/test_nabu.py +13 -8
- tomwer/core/process/test/test_normalization.py +1 -0
- tomwer/core/process/test/test_timer.py +6 -6
- tomwer/core/process/visualization/dataviewer.py +4 -0
- tomwer/core/process/visualization/diffviewer.py +4 -0
- tomwer/core/process/visualization/imagestackviewer.py +4 -0
- tomwer/core/process/visualization/radiostack.py +4 -0
- tomwer/core/process/visualization/samplemoved.py +4 -0
- tomwer/core/process/visualization/sinogramviewer.py +4 -0
- tomwer/core/process/visualization/slicestack.py +4 -0
- tomwer/core/process/visualization/volumeviewer.py +4 -0
- tomwer/core/scan/hdf5scan.py +4 -4
- tomwer/core/scan/scanbase.py +5 -1
- tomwer/core/scan/test/test_process_registration.py +9 -9
- tomwer/core/settings.py +59 -1
- tomwer/core/test/test_lamino.py +2 -1
- tomwer/core/utils/__init__.py +16 -0
- tomwer/core/utils/locker.py +0 -1
- tomwer/core/utils/resource.py +6 -11
- tomwer/core/utils/scanutils.py +2 -0
- tomwer/gui/cluster/slurm.py +91 -7
- tomwer/gui/cluster/supervisor.py +16 -11
- tomwer/gui/cluster/test/test_cluster.py +16 -1
- tomwer/gui/conditions/filter.py +3 -3
- tomwer/gui/control/datalist.py +24 -11
- tomwer/gui/control/email.py +183 -0
- tomwer/gui/control/reducedarkflatselector.py +545 -0
- tomwer/gui/control/singletomoobj.py +23 -1
- tomwer/gui/control/test/test_email.py +35 -0
- tomwer/gui/control/test/test_reducedarkflat_selector.py +280 -0
- tomwer/gui/reconstruction/axis/CompareImages.py +1 -1
- tomwer/gui/reconstruction/axis/axis.py +10 -6
- tomwer/gui/reconstruction/axis/radioaxis.py +14 -6
- tomwer/gui/reconstruction/darkref/darkrefcopywidget.py +2 -0
- tomwer/gui/reconstruction/darkref/darkrefwidget.py +4 -4
- tomwer/gui/reconstruction/nabu/nabuconfig/phase.py +3 -1
- tomwer/gui/reconstruction/nabu/nabuconfig/preprocessing.py +34 -33
- tomwer/gui/reconstruction/nabu/nabuconfig/reconstruction.py +1 -1
- tomwer/gui/reconstruction/normalization/intensity.py +5 -5
- tomwer/gui/reconstruction/saaxis/corrangeselector.py +1 -0
- tomwer/gui/reconstruction/saaxis/saaxis.py +6 -6
- tomwer/gui/reconstruction/sadeltabeta/saadeltabeta.py +6 -6
- tomwer/gui/reconstruction/scores/scoreplot.py +6 -4
- tomwer/gui/samplemoved/__init__.py +2 -2
- tomwer/gui/stackplot.py +18 -7
- tomwer/gui/stacks.py +2 -2
- tomwer/gui/stitching/stitchandbackground.py +2 -2
- tomwer/gui/stitching/stitching.py +1 -1
- tomwer/gui/stitching/stitching_raw.py +1 -1
- tomwer/gui/utils/__init__.py +1 -85
- tomwer/gui/utils/illustrations.py +1 -1
- tomwer/gui/utils/inputwidget.py +41 -36
- tomwer/gui/utils/slider.py +2 -2
- tomwer/gui/utils/utils.py +93 -0
- tomwer/gui/visualization/dataviewer.py +8 -5
- tomwer/gui/visualization/diffviewer/diffviewer.py +4 -4
- tomwer/gui/visualization/reconstructionparameters.py +26 -6
- tomwer/gui/visualization/sinogramviewer.py +7 -1
- tomwer/gui/visualization/test/test_reconstruction_parameters.py +2 -4
- tomwer/gui/visualization/volumeviewer.py +2 -0
- tomwer/resources/__init__.py +55 -43
- tomwer/resources/gui/icons/compose.png +0 -0
- tomwer/resources/gui/icons/compose.svg +75 -0
- tomwer/synctools/datatransfert.py +3 -1
- tomwer/synctools/stacks/edit/darkflatpatch.py +39 -34
- tomwer/synctools/stacks/edit/imagekeyeditor.py +8 -27
- tomwer/synctools/stacks/processingstack.py +45 -9
- tomwer/synctools/stacks/reconstruction/axis.py +6 -5
- tomwer/synctools/stacks/reconstruction/dkrefcopy.py +1 -0
- tomwer/synctools/stacks/reconstruction/lamino.py +3 -3
- tomwer/synctools/stacks/reconstruction/nabu.py +49 -140
- tomwer/synctools/stacks/reconstruction/normalization.py +1 -0
- tomwer/synctools/stacks/reconstruction/saaxis.py +19 -33
- tomwer/synctools/stacks/reconstruction/sadeltabeta.py +16 -32
- tomwer/synctools/test/test_darkRefs.py +19 -10
- tomwer/synctools/test/test_foldertransfer.py +7 -7
- tomwer/third_party/nabu/preproc/phase.py +6 -8
- tomwer/third_party/nabu/utils.py +2 -3
- tomwer/version.py +1 -1
- {tomwer-1.2.0a1.dist-info → tomwer-1.2.0a3.dist-info}/METADATA +15 -54
- {tomwer-1.2.0a1.dist-info → tomwer-1.2.0a3.dist-info}/RECORD +219 -192
- {tomwer-1.2.0a1.dist-info → tomwer-1.2.0a3.dist-info}/WHEEL +1 -1
- {tomwer-1.2.0a1.dist-info → tomwer-1.2.0a3.dist-info}/entry_points.txt +3 -3
- /tomwer-1.2.0a1-py3.9-nspkg.pth → /tomwer-1.2.0a3-py3.11-nspkg.pth +0 -0
- {tomwer-1.2.0a1.dist-info → tomwer-1.2.0a3.dist-info}/LICENSE +0 -0
- {tomwer-1.2.0a1.dist-info → tomwer-1.2.0a3.dist-info}/namespace_packages.txt +0 -0
- {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.
|
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.
|
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
|
-
|
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.
|
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.
|
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
|
-
|
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
|
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 =
|
93
|
-
|
94
|
-
|
95
|
-
|
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
|
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 =
|
103
|
-
inputs={
|
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
|
-
|
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 =
|
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,
|
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.
|
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=(
|
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.
|
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=
|
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 ?
|
tomwer/core/process/task.py
CHANGED
@@ -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
|
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
|
79
|
+
for serialize_output_data in (True, False):
|
80
80
|
with self.subTest(
|
81
|
-
|
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 =
|
87
|
+
axis_process = AxisTask(
|
88
88
|
inputs={
|
89
89
|
"axis_params": self.recons_params,
|
90
90
|
"data": input_obj,
|
91
|
-
"
|
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
|
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 =
|
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=
|
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 =
|
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=
|
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 =
|
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 =
|
282
|
-
inputs={
|
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 =
|
293
|
-
inputs={
|
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
|
-
|
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
|
72
|
+
for serialize_output_data in (True, False):
|
73
73
|
with self.subTest(
|
74
|
-
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 =
|
80
|
+
filter_process = FileNameFilterTask(
|
81
81
|
inputs={
|
82
82
|
"pattern": "*",
|
83
|
-
"
|
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
|
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
|
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
|
72
|
+
for serialize_output_data in (True, False):
|
73
73
|
with self.subTest(
|
74
|
-
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 =
|
81
|
+
process = DarkRefsTask(
|
82
82
|
inputs={
|
83
83
|
"dark_ref_params": self.recons_params,
|
84
84
|
"data": input_obj,
|
85
|
-
"
|
85
|
+
"serialize_output_data": serialize_output_data,
|
86
86
|
}
|
87
87
|
)
|
88
88
|
process.run()
|
89
89
|
out = process.outputs.data
|
90
|
-
if
|
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
|
119
|
+
for serialize_output_data in (True, False):
|
120
120
|
with self.subTest(
|
121
|
-
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
|
-
"
|
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
|
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 =
|
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 =
|
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 =
|
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 =
|
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 =
|
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
|
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
|
73
|
+
for serialize_output_data in (True, False):
|
74
74
|
with self.subTest(
|
75
|
-
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 =
|
94
|
+
transfert_process = ScanTransferTask(
|
95
95
|
inputs={
|
96
96
|
"data": scan,
|
97
97
|
"dest_dir": output_folder,
|
98
|
-
"
|
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
|
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 =
|
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 =
|
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.
|
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
|
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
|
56
|
+
for serialize_output_data in (True, False):
|
57
57
|
with self.subTest(
|
58
|
-
|
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 =
|
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
|
73
|
+
if serialize_output_data:
|
74
74
|
self.assertTrue(isinstance(out, dict))
|
75
75
|
else:
|
76
76
|
self.assertTrue(isinstance(out, TomwerScanBase))
|