tomwer 1.3.5__py3-none-any.whl → 1.3.7__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/test/TestAcquisition.py +246 -0
- orangecontrib/tomwer/widgets/cluster/test/test_future_supervisorow.py +87 -0
- orangecontrib/tomwer/widgets/cluster/test/test_slurm_clusterow.py +67 -0
- orangecontrib/tomwer/widgets/control/test/test_advancement.py +51 -0
- orangecontrib/tomwer/widgets/control/test/test_data_validator.py +55 -0
- orangecontrib/tomwer/widgets/control/test/test_datadiscovery.py +131 -0
- orangecontrib/tomwer/widgets/control/test/test_datalist.py +70 -0
- orangecontrib/tomwer/widgets/control/test/test_datalistener.py +137 -0
- orangecontrib/tomwer/widgets/control/test/test_dataselector.py +95 -0
- orangecontrib/tomwer/widgets/control/test/test_datawatcher.py +436 -0
- orangecontrib/tomwer/widgets/control/test/test_emailow.py +29 -0
- orangecontrib/tomwer/widgets/control/test/test_notifier.py +51 -0
- orangecontrib/tomwer/widgets/control/test/test_nxtomo_concatenate_ow.py +64 -0
- orangecontrib/tomwer/widgets/control/test/test_nxtomomill.py +160 -0
- orangecontrib/tomwer/widgets/control/test/test_reduce_dark_flat_selector.py +40 -0
- orangecontrib/tomwer/widgets/control/test/test_singletomoobj.py +40 -0
- orangecontrib/tomwer/widgets/control/test/test_timerow.py +51 -0
- orangecontrib/tomwer/widgets/control/test/test_tomoobj_serie.py +96 -0
- orangecontrib/tomwer/widgets/control/test/test_volume_selector.py +69 -0
- orangecontrib/tomwer/widgets/control/test/test_volumesymlink.py +51 -0
- orangecontrib/tomwer/widgets/debugtools/test/test_dataset_generator.py +57 -0
- orangecontrib/tomwer/widgets/debugtools/test/test_object_inspector.py +62 -0
- orangecontrib/tomwer/widgets/other/test/test_pythonscript.py +31 -0
- orangecontrib/tomwer/widgets/reconstruction/test/test_axis.py +224 -0
- orangecontrib/tomwer/widgets/reconstruction/test/test_cast_volumeow.py +85 -0
- orangecontrib/tomwer/widgets/reconstruction/test/test_dark_refs_widget.py +136 -0
- orangecontrib/tomwer/widgets/reconstruction/test/test_delta_beta_selector.py +15 -0
- orangecontrib/tomwer/widgets/reconstruction/test/test_i_norm.py +226 -0
- orangecontrib/tomwer/widgets/reconstruction/test/test_nabu_helical_prepare_weights_double.py +20 -0
- orangecontrib/tomwer/widgets/reconstruction/test/test_nabu_volume.py +100 -0
- orangecontrib/tomwer/widgets/reconstruction/test/test_nabu_widget.py +107 -0
- orangecontrib/tomwer/widgets/reconstruction/test/test_sa_delta_beta.py +194 -0
- orangecontrib/tomwer/widgets/reconstruction/test/test_saaxis.py +220 -0
- orangecontrib/tomwer/widgets/stitching/test/test_zstitching.py +308 -0
- orangecontrib/tomwer/widgets/test/test_conditions.py +111 -0
- orangecontrib/tomwer/widgets/test/test_darkref.py +251 -0
- orangecontrib/tomwer/widgets/test/test_foldertransfert.py +131 -0
- orangecontrib/tomwer/widgets/visualization/test/test_dataviewerow.py +83 -0
- orangecontrib/tomwer/widgets/visualization/test/test_diffviewerow.py +65 -0
- orangecontrib/tomwer/widgets/visualization/test/test_live_sliceow.py +63 -0
- orangecontrib/tomwer/widgets/visualization/test/test_nxtomo_metadata_viewer.py +29 -0
- orangecontrib/tomwer/widgets/visualization/test/test_radio_stackow.py +56 -0
- orangecontrib/tomwer/widgets/visualization/test/test_sample_movedow.py +72 -0
- orangecontrib/tomwer/widgets/visualization/test/test_sinogram_viewerow.py +56 -0
- orangecontrib/tomwer/widgets/visualization/test/test_slice_stackow.py +57 -0
- orangecontrib/tomwer/widgets/visualization/test/test_volume_viewerow.py +57 -0
- tomwer/core/log/test/test_processlog.py +41 -0
- tomwer/core/process/control/datalistener/datalistener.py +11 -11
- tomwer/core/process/edit/test/test_darkflatpatch.py +269 -0
- tomwer/core/process/edit/test/test_imagekey_editor.py +125 -0
- tomwer/core/process/icat/test/test_create_screenshots.py +98 -0
- tomwer/core/process/icat/test/test_gallery.py +170 -0
- tomwer/core/process/reconstruction/axis/axis.py +3 -3
- tomwer/core/process/reconstruction/darkref/darkrefscopy.py +3 -2
- tomwer/core/process/reconstruction/nabu/nabucommon.py +3 -4
- tomwer/core/process/reconstruction/nabu/nabuslices.py +4 -4
- tomwer/core/process/reconstruction/nabu/nabuvolume.py +2 -5
- tomwer/core/process/reconstruction/nabu/test/test_castvolume.py +143 -0
- tomwer/core/process/reconstruction/nabu/test/test_nabu_utils.py +203 -0
- tomwer/core/process/reconstruction/nabu/test/test_nabunormalization.py +222 -0
- tomwer/core/process/script/test/test_script.py +68 -0
- tomwer/core/process/stitching/test/test_metadataholder.py +17 -0
- tomwer/core/process/task.py +3 -2
- tomwer/core/process/test/test_data_transfer.py +4 -3
- tomwer/core/process/visualization/test/test_data_viewer.py +39 -0
- tomwer/core/process/visualization/test/test_diff_viewer.py +39 -0
- tomwer/core/process/visualization/test/test_image_stack_viewer.py +41 -0
- tomwer/core/process/visualization/test/test_radio_stack.py +39 -0
- tomwer/core/process/visualization/test/test_sample_moved.py +41 -0
- tomwer/core/process/visualization/test/test_sinogram_viewer.py +39 -0
- tomwer/core/process/visualization/test/test_slice_stack.py +39 -0
- tomwer/core/process/visualization/test/test_volume_viewer.py +39 -0
- tomwer/core/scan/blissscan.py +3 -3
- tomwer/core/scan/nxtomoscan.py +2 -2
- tomwer/core/scan/scanbase.py +5 -6
- tomwer/core/utils/test/test_image.py +30 -0
- tomwer/core/utils/test/test_nxtomo.py +66 -0
- tomwer/core/utils/test/test_scan_utils.py +46 -0
- tomwer/core/utils/test/test_time.py +6 -0
- tomwer/core/volume/test/test_volumes.py +21 -0
- tomwer/gui/control/reducedarkflatselector.py +2 -2
- tomwer/gui/control/serie/test/test_creator.py +451 -0
- tomwer/gui/control/serie/test/test_nxtomo_concatenate.py +21 -0
- tomwer/gui/edit/dkrfpatch.py +4 -4
- tomwer/gui/edit/nxtomowarmer.py +3 -2
- tomwer/gui/icat/test/test_create_screenshots_gui.py +23 -0
- tomwer/gui/icat/test/test_gallery_gui.py +37 -0
- tomwer/gui/imagefromfile.py +2 -2
- tomwer/gui/reconstruction/nabu/test/test_check.py +92 -0
- tomwer/gui/reconstruction/nabu/test/test_ctf.py +46 -0
- tomwer/gui/reconstruction/nabu/test/test_helical.py +21 -0
- tomwer/gui/reconstruction/nabu/test/test_nabu_preprocessing.py +81 -0
- tomwer/gui/reconstruction/normalization/test/test_intensity.py +119 -0
- tomwer/gui/stitching/config/tests/test_axisparams.py +25 -0
- tomwer/gui/stitching/tests/test_axis_ordered_list.py +21 -0
- tomwer/gui/stitching/tests/test_normalization.py +27 -0
- tomwer/gui/stitching/tests/test_preview.py +85 -0
- tomwer/gui/stitching/tests/test_stitching_raw.py +110 -0
- tomwer/gui/stitching/tests/test_z_stitching.py +67 -0
- tomwer/gui/stitching/tests/utils.py +79 -0
- tomwer/gui/stitching/z_stitching/tests/test_fine_estimation.py +35 -0
- tomwer/gui/stitching/z_stitching/tests/test_raw_estimation.py +215 -0
- tomwer/gui/stitching/z_stitching/tests/test_stitching_window.py +51 -0
- tomwer/gui/utils/test/test_completer.py +67 -0
- tomwer/gui/utils/test/test_line_selector.py +21 -0
- tomwer/gui/utils/test/test_splashscreen.py +8 -0
- tomwer/gui/utils/test/test_vignettes.py +68 -0
- tomwer/io/utils/h5pyutils.py +3 -7
- tomwer/io/utils/test/test_raw_and_processed_data.py +10 -0
- tomwer/io/utils/test/test_utils.py +92 -0
- tomwer/io/utils/utils.py +3 -3
- tomwer/synctools/stacks/reconstruction/castvolume.py +20 -5
- tomwer/tests/test_ewoks/test_conversion.py +104 -0
- tomwer/tests/test_ewoks/test_single_node_execution.py +112 -0
- tomwer/tests/test_ewoks/test_workflows.py +160 -0
- tomwer/version.py +1 -1
- {tomwer-1.3.5.dist-info → tomwer-1.3.7.dist-info}/METADATA +1 -1
- {tomwer-1.3.5.dist-info → tomwer-1.3.7.dist-info}/RECORD +124 -27
- /tomwer-1.3.5-py3.11-nspkg.pth → /tomwer-1.3.7-py3.11-nspkg.pth +0 -0
- {tomwer-1.3.5.dist-info → tomwer-1.3.7.dist-info}/LICENSE +0 -0
- {tomwer-1.3.5.dist-info → tomwer-1.3.7.dist-info}/WHEEL +0 -0
- {tomwer-1.3.5.dist-info → tomwer-1.3.7.dist-info}/entry_points.txt +0 -0
- {tomwer-1.3.5.dist-info → tomwer-1.3.7.dist-info}/namespace_packages.txt +0 -0
- {tomwer-1.3.5.dist-info → tomwer-1.3.7.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,222 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
# /*##########################################################################
|
3
|
+
#
|
4
|
+
# Copyright (c) 2016-2017 European Synchrotron Radiation Facility
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
# of this software and associated documentation files (the "Software"), to deal
|
8
|
+
# in the Software without restriction, including without limitation the rights
|
9
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
# copies of the Software, and to permit persons to whom the Software is
|
11
|
+
# furnished to do so, subject to the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be included in
|
14
|
+
# all copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
|
+
# THE SOFTWARE.
|
23
|
+
#
|
24
|
+
# ###########################################################################*/
|
25
|
+
|
26
|
+
__authors__ = ["H. Payno"]
|
27
|
+
__license__ = "MIT"
|
28
|
+
__date__ = "29/03/2022"
|
29
|
+
|
30
|
+
|
31
|
+
import configparser
|
32
|
+
from collections import namedtuple
|
33
|
+
|
34
|
+
import numpy
|
35
|
+
import pytest
|
36
|
+
from silx.io.url import DataUrl
|
37
|
+
from tomoscan.io import HDF5File
|
38
|
+
from nabu.pipeline.config import get_default_nabu_config
|
39
|
+
from nabu.pipeline.fullfield.nabu_config import (
|
40
|
+
nabu_config as nabu_fullfield_default_config,
|
41
|
+
)
|
42
|
+
from tomwer.core.process.reconstruction.nabu import settings as nabu_settings
|
43
|
+
from tomwer.core.process.reconstruction.nabu.nabuslices import NabuSlicesTask
|
44
|
+
from tomwer.core.process.reconstruction.normalization.normalization import (
|
45
|
+
SinoNormalizationTask,
|
46
|
+
)
|
47
|
+
from tomwer.core.process.reconstruction.normalization.params import (
|
48
|
+
SinoNormalizationParams,
|
49
|
+
)
|
50
|
+
from tomwer.core.utils.scanutils import MockNXtomo
|
51
|
+
from tomwer.core.process.reconstruction.output import PROCESS_FOLDER_NAME
|
52
|
+
|
53
|
+
try:
|
54
|
+
import nabu
|
55
|
+
except ImportError:
|
56
|
+
has_nabu = False
|
57
|
+
else:
|
58
|
+
has_nabu = True
|
59
|
+
import os
|
60
|
+
|
61
|
+
_norm_setting = namedtuple("_norm_setting", ["method", "source", "extra_infos"])
|
62
|
+
|
63
|
+
_nabu_norm_field = namedtuple(
|
64
|
+
"_nabu_norm_field",
|
65
|
+
["sino_normalization", "has_sino_normalization_file"],
|
66
|
+
)
|
67
|
+
|
68
|
+
|
69
|
+
normalization_config_test = (
|
70
|
+
# no normalization
|
71
|
+
(
|
72
|
+
_norm_setting(method="none", source=None, extra_infos=None),
|
73
|
+
_nabu_norm_field(
|
74
|
+
sino_normalization="",
|
75
|
+
has_sino_normalization_file=False,
|
76
|
+
),
|
77
|
+
),
|
78
|
+
# chebyshev normalization
|
79
|
+
(
|
80
|
+
_norm_setting(method="chebyshev", source=None, extra_infos=None),
|
81
|
+
_nabu_norm_field(
|
82
|
+
sino_normalization="chebyshev",
|
83
|
+
has_sino_normalization_file=False,
|
84
|
+
),
|
85
|
+
),
|
86
|
+
# divide by a scalar
|
87
|
+
(
|
88
|
+
_norm_setting(method="division", source="scalar", extra_infos={"value": 12.0}),
|
89
|
+
_nabu_norm_field(
|
90
|
+
sino_normalization="division",
|
91
|
+
has_sino_normalization_file=True,
|
92
|
+
),
|
93
|
+
),
|
94
|
+
# substract a roi
|
95
|
+
(
|
96
|
+
_norm_setting(
|
97
|
+
method="subtraction",
|
98
|
+
source="manual ROI",
|
99
|
+
extra_infos={
|
100
|
+
"start_x": 0.0,
|
101
|
+
"end_x": 1.0,
|
102
|
+
"start_y": 0.0,
|
103
|
+
"end_y": 1.0,
|
104
|
+
"calc_fct": "mean",
|
105
|
+
"calc_area": "volume",
|
106
|
+
"calc_method": "scalar",
|
107
|
+
},
|
108
|
+
),
|
109
|
+
_nabu_norm_field(
|
110
|
+
sino_normalization="subtraction",
|
111
|
+
has_sino_normalization_file=True,
|
112
|
+
),
|
113
|
+
),
|
114
|
+
# substract from a dataset
|
115
|
+
(
|
116
|
+
_norm_setting(
|
117
|
+
method="subtraction",
|
118
|
+
source="from dataset",
|
119
|
+
extra_infos={
|
120
|
+
"dataset_url": DataUrl(
|
121
|
+
file_path="random_dataset.hdf5",
|
122
|
+
data_path="data",
|
123
|
+
scheme="silx",
|
124
|
+
),
|
125
|
+
"calc_fct": "median",
|
126
|
+
"calc_area": "volume",
|
127
|
+
"calc_method": "scalar",
|
128
|
+
},
|
129
|
+
),
|
130
|
+
_nabu_norm_field(
|
131
|
+
sino_normalization="subtraction",
|
132
|
+
has_sino_normalization_file=True,
|
133
|
+
),
|
134
|
+
),
|
135
|
+
)
|
136
|
+
|
137
|
+
|
138
|
+
@pytest.mark.skipif(
|
139
|
+
(not has_nabu or nabu.version < "2022.2"),
|
140
|
+
reason="nabu not available or the current version doesn't handle sino normlaization yet",
|
141
|
+
)
|
142
|
+
@pytest.mark.parametrize(
|
143
|
+
"norm_setting, expected_nabu_conf", [item for item in normalization_config_test]
|
144
|
+
)
|
145
|
+
def test_normalization(norm_setting, expected_nabu_conf, tmp_path):
|
146
|
+
"""
|
147
|
+
Insure normalization is correctly provided to nabu configuration file
|
148
|
+
For this run a normalization process followed by a nabu process.
|
149
|
+
"""
|
150
|
+
scan_dir = tmp_path / "scan"
|
151
|
+
scan_dir.mkdir()
|
152
|
+
|
153
|
+
nabu_cfg_folders = os.path.join(scan_dir, nabu_settings.NABU_CFG_FILE_FOLDER)
|
154
|
+
os.makedirs(nabu_cfg_folders, exist_ok=True)
|
155
|
+
|
156
|
+
random_dataset_file = os.path.join(nabu_cfg_folders, "random_dataset.hdf5")
|
157
|
+
|
158
|
+
# create a random dataset if necessary
|
159
|
+
with HDF5File(random_dataset_file, mode="w") as h5f:
|
160
|
+
h5f["data"] = numpy.ones((20, 20))
|
161
|
+
|
162
|
+
mock = MockNXtomo(
|
163
|
+
scan_path=scan_dir,
|
164
|
+
n_proj=10,
|
165
|
+
n_ini_proj=10,
|
166
|
+
scan_range=180,
|
167
|
+
dim=20,
|
168
|
+
)
|
169
|
+
scan = mock.scan
|
170
|
+
|
171
|
+
cfg_folder = os.path.join(str(scan_dir), PROCESS_FOLDER_NAME, "nabu_cfg_files")
|
172
|
+
cfg_file = os.path.join(cfg_folder, "entry_scan.cfg")
|
173
|
+
assert not os.path.exists(cfg_file)
|
174
|
+
norm_params = SinoNormalizationParams(
|
175
|
+
method=norm_setting.method,
|
176
|
+
source=norm_setting.source,
|
177
|
+
extra_infos=norm_setting.extra_infos,
|
178
|
+
)
|
179
|
+
|
180
|
+
normalization = SinoNormalizationTask(
|
181
|
+
inputs={
|
182
|
+
"data": scan,
|
183
|
+
"configuration": norm_params.to_dict(),
|
184
|
+
"serialize_output_data": False,
|
185
|
+
},
|
186
|
+
varinfo=None,
|
187
|
+
)
|
188
|
+
normalization.run()
|
189
|
+
|
190
|
+
# insure the method is style valid
|
191
|
+
assert scan.intensity_normalization.method.value == norm_setting.method
|
192
|
+
assert (
|
193
|
+
"tomwer_processing_res_code" in scan.intensity_normalization.get_extra_infos()
|
194
|
+
)
|
195
|
+
|
196
|
+
process = NabuSlicesTask(
|
197
|
+
inputs={
|
198
|
+
"data": scan,
|
199
|
+
"dry_run": True,
|
200
|
+
"nabu_params": get_default_nabu_config(nabu_fullfield_default_config),
|
201
|
+
"serialize_output_data": False,
|
202
|
+
},
|
203
|
+
varinfo=None,
|
204
|
+
)
|
205
|
+
process.run()
|
206
|
+
assert os.path.exists(cfg_file)
|
207
|
+
|
208
|
+
configuration = configparser.ConfigParser(allow_no_value=True)
|
209
|
+
configuration.read(cfg_file)
|
210
|
+
|
211
|
+
preproc_section = configuration["preproc"]
|
212
|
+
sino_normalization = preproc_section.get("sino_normalization", "")
|
213
|
+
sino_normalization_file = preproc_section.get("sino_normalization_file", "")
|
214
|
+
assert sino_normalization == expected_nabu_conf.sino_normalization
|
215
|
+
if expected_nabu_conf.has_sino_normalization_file:
|
216
|
+
url = DataUrl(path=sino_normalization_file)
|
217
|
+
assert url.is_valid()
|
218
|
+
else:
|
219
|
+
assert sino_normalization_file == ""
|
220
|
+
assert (
|
221
|
+
"tomwer_processing_res_code" in scan.intensity_normalization.get_extra_infos()
|
222
|
+
)
|
@@ -0,0 +1,68 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
# /*##########################################################################
|
3
|
+
#
|
4
|
+
# Copyright (c) 2017-2021 European Synchrotron Radiation Facility
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
# of this software and associated documentation files (the "Software"), to deal
|
8
|
+
# in the Software without restriction, including without limitation the rights
|
9
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
# copies of the Software, and to permit persons to whom the Software is
|
11
|
+
# furnished to do so, subject to the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be included in
|
14
|
+
# all copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
|
+
# THE SOFTWARE.
|
23
|
+
#
|
24
|
+
# ###########################################################################*/
|
25
|
+
|
26
|
+
__authors__ = ["H. Payno"]
|
27
|
+
__license__ = "MIT"
|
28
|
+
__date__ = "18/06/2021"
|
29
|
+
|
30
|
+
|
31
|
+
import os
|
32
|
+
import shutil
|
33
|
+
import tempfile
|
34
|
+
import unittest
|
35
|
+
|
36
|
+
from tomwer.core.process.script.python import PythonScript
|
37
|
+
from tomwer.core.utils.scanutils import MockNXtomo
|
38
|
+
|
39
|
+
|
40
|
+
class TestPythonScript(unittest.TestCase):
|
41
|
+
def setUp(self):
|
42
|
+
self.tempdir = tempfile.mkdtemp()
|
43
|
+
dim = 10
|
44
|
+
mock = MockNXtomo(
|
45
|
+
scan_path=os.path.join(self.tempdir, "scan1"),
|
46
|
+
n_proj=10,
|
47
|
+
n_ini_proj=10,
|
48
|
+
scan_range=180,
|
49
|
+
dim=dim,
|
50
|
+
)
|
51
|
+
self.scan = mock.scan
|
52
|
+
|
53
|
+
def tearDown(self):
|
54
|
+
shutil.rmtree(self.tempdir)
|
55
|
+
|
56
|
+
def test(self):
|
57
|
+
process = PythonScript(inputs={"data": self.scan})
|
58
|
+
process.definition()
|
59
|
+
process.program_version()
|
60
|
+
process.program_name()
|
61
|
+
# TODO: configuration should be passed in inputs during construction
|
62
|
+
process.set_configuration(
|
63
|
+
{
|
64
|
+
"scriptText": "print('toto')",
|
65
|
+
}
|
66
|
+
)
|
67
|
+
|
68
|
+
process.run()
|
@@ -0,0 +1,17 @@
|
|
1
|
+
from tomwer.core.process.stitching.metadataholder import StitchingMetadata
|
2
|
+
|
3
|
+
|
4
|
+
def test_to_dict_from_dict():
|
5
|
+
"""Test conversion of StitchingMetadata from dict and to dict"""
|
6
|
+
metadata = StitchingMetadata(tomo_obj=None)
|
7
|
+
metadata._pixel_or_voxel_size = [12.3, 2.5, None]
|
8
|
+
metadata._pos_as_m = [None, 3.6, None]
|
9
|
+
metadata._pos_as_px = [5, 9, 8]
|
10
|
+
|
11
|
+
ddict = metadata.to_dict()
|
12
|
+
assert isinstance(ddict, dict)
|
13
|
+
|
14
|
+
loaded_metadata = StitchingMetadata.from_dict(ddict, tomo_obj=None)
|
15
|
+
assert loaded_metadata == metadata
|
16
|
+
assert loaded_metadata.to_dict() == ddict
|
17
|
+
assert isinstance(str(loaded_metadata), str)
|
tomwer/core/process/task.py
CHANGED
@@ -46,7 +46,8 @@ from ewokscore.task import Task as _EwoksTask
|
|
46
46
|
from ewokscore.taskwithprogress import TaskWithProgress as _EwoksTaskWithProgress
|
47
47
|
from silx.io.dictdump import dicttoh5, h5todict
|
48
48
|
from silx.io.utils import h5py_read_dataset
|
49
|
-
from
|
49
|
+
from silx.io.utils import open as open_hdf5
|
50
|
+
from tomoscan.io import HDF5File
|
50
51
|
from tomwer.core.utils.locker import FileLockerManager
|
51
52
|
|
52
53
|
|
@@ -376,7 +377,7 @@ class BaseProcessInfo:
|
|
376
377
|
:rtype: list
|
377
378
|
"""
|
378
379
|
# retrieve process to load
|
379
|
-
with
|
380
|
+
with open_hdf5(process_file) as h5f:
|
380
381
|
if entry is None:
|
381
382
|
if len(h5f.keys()) > 0:
|
382
383
|
root = h5f[list(h5f.keys())[0]]
|
@@ -42,7 +42,8 @@ from nxtomomill.converter import from_h5_to_nx
|
|
42
42
|
from nxtomomill.io.config.hdf5config import TomoHDF5Config
|
43
43
|
from nxtomo.nxobject.nxdetector import ImageKey
|
44
44
|
|
45
|
-
from
|
45
|
+
from silx.io.utils import open as open_hdf5
|
46
|
+
from tomoscan.io import HDF5File
|
46
47
|
from tomoscan.validator import is_valid_for_reconstruction
|
47
48
|
|
48
49
|
from tomwer.core.process.control.datalistener import DataListener
|
@@ -335,9 +336,9 @@ class NXTomoDataTransferBase(unittest.TestCase):
|
|
335
336
|
dst_scan = process.outputs.data
|
336
337
|
assert dst_scan.master_file != self.nexus_file_path
|
337
338
|
assert is_valid_for_reconstruction(dst_scan, check_values=True)
|
338
|
-
with
|
339
|
+
with open_hdf5(src_scan.master_file) as h5s_src:
|
339
340
|
src_dataset = h5s_src["entry0000/detector/data"][...]
|
340
|
-
with
|
341
|
+
with open_hdf5(dst_scan.master_file) as h5s_dst:
|
341
342
|
dst_dataset = h5s_dst["entry0000/detector/data"][...]
|
342
343
|
assert numpy.array_equal(src_dataset, dst_dataset)
|
343
344
|
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
# /*##########################################################################
|
3
|
+
#
|
4
|
+
# Copyright (c) 2017-2019 European Synchrotron Radiation Facility
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
# of this software and associated documentation files (the "Software"), to deal
|
8
|
+
# in the Software without restriction, including without limitation the rights
|
9
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
# copies of the Software, and to permit persons to whom the Software is
|
11
|
+
# furnished to do so, subject to the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be included in
|
14
|
+
# all copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
|
+
# THE SOFTWARE.
|
23
|
+
#
|
24
|
+
# ###########################################################################*/
|
25
|
+
__authors__ = ["H. Payno"]
|
26
|
+
__license__ = "MIT"
|
27
|
+
__date__ = "10/12/2021"
|
28
|
+
|
29
|
+
|
30
|
+
from tomwer.core.process.visualization.dataviewer import _DataViewerPlaceHolder
|
31
|
+
|
32
|
+
|
33
|
+
def test_data_viewer():
|
34
|
+
process = _DataViewerPlaceHolder(
|
35
|
+
inputs={
|
36
|
+
"data": None,
|
37
|
+
}
|
38
|
+
)
|
39
|
+
process.run()
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
# /*##########################################################################
|
3
|
+
#
|
4
|
+
# Copyright (c) 2017-2019 European Synchrotron Radiation Facility
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
# of this software and associated documentation files (the "Software"), to deal
|
8
|
+
# in the Software without restriction, including without limitation the rights
|
9
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
# copies of the Software, and to permit persons to whom the Software is
|
11
|
+
# furnished to do so, subject to the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be included in
|
14
|
+
# all copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
|
+
# THE SOFTWARE.
|
23
|
+
#
|
24
|
+
# ###########################################################################*/
|
25
|
+
__authors__ = ["H. Payno"]
|
26
|
+
__license__ = "MIT"
|
27
|
+
__date__ = "10/12/2021"
|
28
|
+
|
29
|
+
|
30
|
+
from tomwer.core.process.visualization.diffviewer import _DiffViewerPlaceHolder
|
31
|
+
|
32
|
+
|
33
|
+
def test_diff_viewer():
|
34
|
+
process = _DiffViewerPlaceHolder(
|
35
|
+
inputs={
|
36
|
+
"data": None,
|
37
|
+
}
|
38
|
+
)
|
39
|
+
process.run()
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
# /*##########################################################################
|
3
|
+
#
|
4
|
+
# Copyright (c) 2017-2019 European Synchrotron Radiation Facility
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
# of this software and associated documentation files (the "Software"), to deal
|
8
|
+
# in the Software without restriction, including without limitation the rights
|
9
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
# copies of the Software, and to permit persons to whom the Software is
|
11
|
+
# furnished to do so, subject to the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be included in
|
14
|
+
# all copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
|
+
# THE SOFTWARE.
|
23
|
+
#
|
24
|
+
# ###########################################################################*/
|
25
|
+
__authors__ = ["H. Payno"]
|
26
|
+
__license__ = "MIT"
|
27
|
+
__date__ = "10/12/2021"
|
28
|
+
|
29
|
+
|
30
|
+
from tomwer.core.process.visualization.imagestackviewer import (
|
31
|
+
_ImageStackViewerPlaceHolder,
|
32
|
+
)
|
33
|
+
|
34
|
+
|
35
|
+
def test_image_stack_viewer():
|
36
|
+
process = _ImageStackViewerPlaceHolder(
|
37
|
+
inputs={
|
38
|
+
"data": None,
|
39
|
+
}
|
40
|
+
)
|
41
|
+
process.run()
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
# /*##########################################################################
|
3
|
+
#
|
4
|
+
# Copyright (c) 2017-2019 European Synchrotron Radiation Facility
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
# of this software and associated documentation files (the "Software"), to deal
|
8
|
+
# in the Software without restriction, including without limitation the rights
|
9
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
# copies of the Software, and to permit persons to whom the Software is
|
11
|
+
# furnished to do so, subject to the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be included in
|
14
|
+
# all copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
|
+
# THE SOFTWARE.
|
23
|
+
#
|
24
|
+
# ###########################################################################*/
|
25
|
+
__authors__ = ["H. Payno"]
|
26
|
+
__license__ = "MIT"
|
27
|
+
__date__ = "10/12/2021"
|
28
|
+
|
29
|
+
|
30
|
+
from tomwer.core.process.visualization.radiostack import _RadioStackPlaceHolder
|
31
|
+
|
32
|
+
|
33
|
+
def test_radio_stack():
|
34
|
+
process = _RadioStackPlaceHolder(
|
35
|
+
inputs={
|
36
|
+
"data": None,
|
37
|
+
}
|
38
|
+
)
|
39
|
+
process.run()
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
# /*##########################################################################
|
3
|
+
#
|
4
|
+
# Copyright (c) 2017-2019 European Synchrotron Radiation Facility
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
# of this software and associated documentation files (the "Software"), to deal
|
8
|
+
# in the Software without restriction, including without limitation the rights
|
9
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
# copies of the Software, and to permit persons to whom the Software is
|
11
|
+
# furnished to do so, subject to the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be included in
|
14
|
+
# all copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
|
+
# THE SOFTWARE.
|
23
|
+
#
|
24
|
+
# ###########################################################################*/
|
25
|
+
__authors__ = ["H. Payno"]
|
26
|
+
__license__ = "MIT"
|
27
|
+
__date__ = "10/12/2021"
|
28
|
+
|
29
|
+
|
30
|
+
from tomwer.core.process.visualization.imagestackviewer import (
|
31
|
+
_ImageStackViewerPlaceHolder,
|
32
|
+
)
|
33
|
+
|
34
|
+
|
35
|
+
def test_sample_moved():
|
36
|
+
process = _ImageStackViewerPlaceHolder(
|
37
|
+
inputs={
|
38
|
+
"data": None,
|
39
|
+
}
|
40
|
+
)
|
41
|
+
process.run()
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
# /*##########################################################################
|
3
|
+
#
|
4
|
+
# Copyright (c) 2017-2019 European Synchrotron Radiation Facility
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
# of this software and associated documentation files (the "Software"), to deal
|
8
|
+
# in the Software without restriction, including without limitation the rights
|
9
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
# copies of the Software, and to permit persons to whom the Software is
|
11
|
+
# furnished to do so, subject to the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be included in
|
14
|
+
# all copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
|
+
# THE SOFTWARE.
|
23
|
+
#
|
24
|
+
# ###########################################################################*/
|
25
|
+
__authors__ = ["H. Payno"]
|
26
|
+
__license__ = "MIT"
|
27
|
+
__date__ = "10/12/2021"
|
28
|
+
|
29
|
+
|
30
|
+
from tomwer.core.process.visualization.sinogramviewer import _SinogramViewerPlaceHolder
|
31
|
+
|
32
|
+
|
33
|
+
def test_sinogram_viewer():
|
34
|
+
process = _SinogramViewerPlaceHolder(
|
35
|
+
inputs={
|
36
|
+
"data": None,
|
37
|
+
}
|
38
|
+
)
|
39
|
+
process.run()
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
# /*##########################################################################
|
3
|
+
#
|
4
|
+
# Copyright (c) 2017-2019 European Synchrotron Radiation Facility
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
# of this software and associated documentation files (the "Software"), to deal
|
8
|
+
# in the Software without restriction, including without limitation the rights
|
9
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
# copies of the Software, and to permit persons to whom the Software is
|
11
|
+
# furnished to do so, subject to the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be included in
|
14
|
+
# all copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
|
+
# THE SOFTWARE.
|
23
|
+
#
|
24
|
+
# ###########################################################################*/
|
25
|
+
__authors__ = ["H. Payno"]
|
26
|
+
__license__ = "MIT"
|
27
|
+
__date__ = "10/12/2021"
|
28
|
+
|
29
|
+
|
30
|
+
from tomwer.core.process.visualization.slicestack import _SliceStackPlaceHolder
|
31
|
+
|
32
|
+
|
33
|
+
def test_slice_stack():
|
34
|
+
process = _SliceStackPlaceHolder(
|
35
|
+
inputs={
|
36
|
+
"data": None,
|
37
|
+
}
|
38
|
+
)
|
39
|
+
process.run()
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
# /*##########################################################################
|
3
|
+
#
|
4
|
+
# Copyright (c) 2017-2019 European Synchrotron Radiation Facility
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
# of this software and associated documentation files (the "Software"), to deal
|
8
|
+
# in the Software without restriction, including without limitation the rights
|
9
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
# copies of the Software, and to permit persons to whom the Software is
|
11
|
+
# furnished to do so, subject to the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be included in
|
14
|
+
# all copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
|
+
# THE SOFTWARE.
|
23
|
+
#
|
24
|
+
# ###########################################################################*/
|
25
|
+
__authors__ = ["H. Payno"]
|
26
|
+
__license__ = "MIT"
|
27
|
+
__date__ = "10/12/2021"
|
28
|
+
|
29
|
+
|
30
|
+
from tomwer.core.process.visualization.volumeviewer import _VolumeViewerPlaceHolder
|
31
|
+
|
32
|
+
|
33
|
+
def test_volume_viewer():
|
34
|
+
process = _VolumeViewerPlaceHolder(
|
35
|
+
inputs={
|
36
|
+
"data": None,
|
37
|
+
}
|
38
|
+
)
|
39
|
+
process.run()
|