tomwer 1.3.7__py3-none-any.whl → 1.3.9__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.
- tomwer/core/process/reconstruction/nabu/nabuslices.py +0 -48
- tomwer/core/process/reconstruction/nabu/utils.py +2 -0
- tomwer/gui/control/datawatcher/datawatcher.py +1 -24
- tomwer/version.py +1 -1
- {tomwer-1.3.7.dist-info → tomwer-1.3.9.dist-info}/METADATA +1 -1
- {tomwer-1.3.7.dist-info → tomwer-1.3.9.dist-info}/RECORD +12 -109
- orangecontrib/tomwer/test/TestAcquisition.py +0 -246
- orangecontrib/tomwer/widgets/cluster/test/test_future_supervisorow.py +0 -87
- orangecontrib/tomwer/widgets/cluster/test/test_slurm_clusterow.py +0 -67
- orangecontrib/tomwer/widgets/control/test/test_advancement.py +0 -51
- orangecontrib/tomwer/widgets/control/test/test_data_validator.py +0 -55
- orangecontrib/tomwer/widgets/control/test/test_datadiscovery.py +0 -131
- orangecontrib/tomwer/widgets/control/test/test_datalist.py +0 -70
- orangecontrib/tomwer/widgets/control/test/test_datalistener.py +0 -137
- orangecontrib/tomwer/widgets/control/test/test_dataselector.py +0 -95
- orangecontrib/tomwer/widgets/control/test/test_datawatcher.py +0 -436
- orangecontrib/tomwer/widgets/control/test/test_emailow.py +0 -29
- orangecontrib/tomwer/widgets/control/test/test_notifier.py +0 -51
- orangecontrib/tomwer/widgets/control/test/test_nxtomo_concatenate_ow.py +0 -64
- orangecontrib/tomwer/widgets/control/test/test_nxtomomill.py +0 -160
- orangecontrib/tomwer/widgets/control/test/test_reduce_dark_flat_selector.py +0 -40
- orangecontrib/tomwer/widgets/control/test/test_singletomoobj.py +0 -40
- orangecontrib/tomwer/widgets/control/test/test_timerow.py +0 -51
- orangecontrib/tomwer/widgets/control/test/test_tomoobj_serie.py +0 -96
- orangecontrib/tomwer/widgets/control/test/test_volume_selector.py +0 -69
- orangecontrib/tomwer/widgets/control/test/test_volumesymlink.py +0 -51
- orangecontrib/tomwer/widgets/debugtools/test/test_dataset_generator.py +0 -57
- orangecontrib/tomwer/widgets/debugtools/test/test_object_inspector.py +0 -62
- orangecontrib/tomwer/widgets/other/test/test_pythonscript.py +0 -31
- orangecontrib/tomwer/widgets/reconstruction/test/test_axis.py +0 -224
- orangecontrib/tomwer/widgets/reconstruction/test/test_cast_volumeow.py +0 -85
- orangecontrib/tomwer/widgets/reconstruction/test/test_dark_refs_widget.py +0 -136
- orangecontrib/tomwer/widgets/reconstruction/test/test_delta_beta_selector.py +0 -15
- orangecontrib/tomwer/widgets/reconstruction/test/test_i_norm.py +0 -226
- orangecontrib/tomwer/widgets/reconstruction/test/test_nabu_helical_prepare_weights_double.py +0 -20
- orangecontrib/tomwer/widgets/reconstruction/test/test_nabu_volume.py +0 -100
- orangecontrib/tomwer/widgets/reconstruction/test/test_nabu_widget.py +0 -107
- orangecontrib/tomwer/widgets/reconstruction/test/test_sa_delta_beta.py +0 -194
- orangecontrib/tomwer/widgets/reconstruction/test/test_saaxis.py +0 -220
- orangecontrib/tomwer/widgets/stitching/test/test_zstitching.py +0 -308
- orangecontrib/tomwer/widgets/test/test_conditions.py +0 -111
- orangecontrib/tomwer/widgets/test/test_darkref.py +0 -251
- orangecontrib/tomwer/widgets/test/test_foldertransfert.py +0 -131
- orangecontrib/tomwer/widgets/visualization/test/test_dataviewerow.py +0 -83
- orangecontrib/tomwer/widgets/visualization/test/test_diffviewerow.py +0 -65
- orangecontrib/tomwer/widgets/visualization/test/test_live_sliceow.py +0 -63
- orangecontrib/tomwer/widgets/visualization/test/test_nxtomo_metadata_viewer.py +0 -29
- orangecontrib/tomwer/widgets/visualization/test/test_radio_stackow.py +0 -56
- orangecontrib/tomwer/widgets/visualization/test/test_sample_movedow.py +0 -72
- orangecontrib/tomwer/widgets/visualization/test/test_sinogram_viewerow.py +0 -56
- orangecontrib/tomwer/widgets/visualization/test/test_slice_stackow.py +0 -57
- orangecontrib/tomwer/widgets/visualization/test/test_volume_viewerow.py +0 -57
- tomwer/core/log/test/test_processlog.py +0 -41
- tomwer/core/process/edit/test/test_darkflatpatch.py +0 -269
- tomwer/core/process/edit/test/test_imagekey_editor.py +0 -125
- tomwer/core/process/icat/test/test_create_screenshots.py +0 -98
- tomwer/core/process/icat/test/test_gallery.py +0 -170
- tomwer/core/process/reconstruction/nabu/test/test_castvolume.py +0 -143
- tomwer/core/process/reconstruction/nabu/test/test_nabu_utils.py +0 -203
- tomwer/core/process/reconstruction/nabu/test/test_nabunormalization.py +0 -222
- tomwer/core/process/script/test/test_script.py +0 -68
- tomwer/core/process/stitching/test/test_metadataholder.py +0 -17
- tomwer/core/process/visualization/test/test_data_viewer.py +0 -39
- tomwer/core/process/visualization/test/test_diff_viewer.py +0 -39
- tomwer/core/process/visualization/test/test_image_stack_viewer.py +0 -41
- tomwer/core/process/visualization/test/test_radio_stack.py +0 -39
- tomwer/core/process/visualization/test/test_sample_moved.py +0 -41
- tomwer/core/process/visualization/test/test_sinogram_viewer.py +0 -39
- tomwer/core/process/visualization/test/test_slice_stack.py +0 -39
- tomwer/core/process/visualization/test/test_volume_viewer.py +0 -39
- tomwer/core/utils/test/test_image.py +0 -30
- tomwer/core/utils/test/test_nxtomo.py +0 -66
- tomwer/core/utils/test/test_scan_utils.py +0 -46
- tomwer/core/utils/test/test_time.py +0 -6
- tomwer/core/volume/test/test_volumes.py +0 -21
- tomwer/gui/control/serie/test/test_creator.py +0 -451
- tomwer/gui/control/serie/test/test_nxtomo_concatenate.py +0 -21
- tomwer/gui/icat/test/test_create_screenshots_gui.py +0 -23
- tomwer/gui/icat/test/test_gallery_gui.py +0 -37
- tomwer/gui/reconstruction/nabu/test/test_check.py +0 -92
- tomwer/gui/reconstruction/nabu/test/test_ctf.py +0 -46
- tomwer/gui/reconstruction/nabu/test/test_helical.py +0 -21
- tomwer/gui/reconstruction/nabu/test/test_nabu_preprocessing.py +0 -81
- tomwer/gui/reconstruction/normalization/test/test_intensity.py +0 -119
- tomwer/gui/stitching/config/tests/test_axisparams.py +0 -25
- tomwer/gui/stitching/tests/test_axis_ordered_list.py +0 -21
- tomwer/gui/stitching/tests/test_normalization.py +0 -27
- tomwer/gui/stitching/tests/test_preview.py +0 -85
- tomwer/gui/stitching/tests/test_stitching_raw.py +0 -110
- tomwer/gui/stitching/tests/test_z_stitching.py +0 -67
- tomwer/gui/stitching/tests/utils.py +0 -79
- tomwer/gui/stitching/z_stitching/tests/test_fine_estimation.py +0 -35
- tomwer/gui/stitching/z_stitching/tests/test_raw_estimation.py +0 -215
- tomwer/gui/stitching/z_stitching/tests/test_stitching_window.py +0 -51
- tomwer/gui/utils/test/test_completer.py +0 -67
- tomwer/gui/utils/test/test_line_selector.py +0 -21
- tomwer/gui/utils/test/test_splashscreen.py +0 -8
- tomwer/gui/utils/test/test_vignettes.py +0 -68
- tomwer/io/utils/test/test_raw_and_processed_data.py +0 -10
- tomwer/io/utils/test/test_utils.py +0 -92
- tomwer/tests/test_ewoks/test_conversion.py +0 -104
- tomwer/tests/test_ewoks/test_single_node_execution.py +0 -112
- tomwer/tests/test_ewoks/test_workflows.py +0 -160
- /tomwer-1.3.7-py3.11-nspkg.pth → /tomwer-1.3.9-py3.11-nspkg.pth +0 -0
- {tomwer-1.3.7.dist-info → tomwer-1.3.9.dist-info}/LICENSE +0 -0
- {tomwer-1.3.7.dist-info → tomwer-1.3.9.dist-info}/WHEEL +0 -0
- {tomwer-1.3.7.dist-info → tomwer-1.3.9.dist-info}/entry_points.txt +0 -0
- {tomwer-1.3.7.dist-info → tomwer-1.3.9.dist-info}/namespace_packages.txt +0 -0
- {tomwer-1.3.7.dist-info → tomwer-1.3.9.dist-info}/top_level.txt +0 -0
@@ -1,67 +0,0 @@
|
|
1
|
-
import os
|
2
|
-
import tempfile
|
3
|
-
|
4
|
-
from silx.gui import qt
|
5
|
-
from silx.gui.utils.testutils import TestCaseQt
|
6
|
-
from tomoscan.serie import Serie
|
7
|
-
|
8
|
-
from tomwer.gui.stitching.stitching import ZStitchingWindow
|
9
|
-
from tomwer.gui.stitching.tests.utils import create_scans_z_serie
|
10
|
-
|
11
|
-
|
12
|
-
class TestAxis_N_Params(TestCaseQt):
|
13
|
-
"""
|
14
|
-
Test definition of an axis shift research parameters
|
15
|
-
"""
|
16
|
-
|
17
|
-
def setUp(self):
|
18
|
-
super().setUp()
|
19
|
-
self._window = ZStitchingWindow()
|
20
|
-
|
21
|
-
self._tmp_path = tempfile.mkdtemp()
|
22
|
-
self.axis_0_positions = (90, 0.0, -90.0)
|
23
|
-
self.axis_2_positions = (0.0, 0.0, 0.0)
|
24
|
-
pixel_size = 1.0
|
25
|
-
|
26
|
-
self.output_file_path = os.path.join(self._tmp_path, "output", "stitched.nx")
|
27
|
-
self._input_dir = os.path.join(self._tmp_path, "input")
|
28
|
-
|
29
|
-
self._scans = create_scans_z_serie(
|
30
|
-
output_dir=self._input_dir,
|
31
|
-
z_positions_m=self.axis_0_positions,
|
32
|
-
x_positions_m=self.axis_2_positions,
|
33
|
-
shifts=((0.0, 0.0), (-90.0, 0.0), (-180.0, 0.0)),
|
34
|
-
pixel_size=pixel_size,
|
35
|
-
raw_frame_width=280,
|
36
|
-
final_frame_width=100,
|
37
|
-
)
|
38
|
-
self._serie = Serie("z-serie", self._scans)
|
39
|
-
|
40
|
-
def tearDown(self):
|
41
|
-
self._window.setAttribute(qt.Qt.WA_DeleteOnClose)
|
42
|
-
self._window.close()
|
43
|
-
self._window = None
|
44
|
-
while self.qapp.hasPendingEvents():
|
45
|
-
self.qapp.processEvents()
|
46
|
-
|
47
|
-
def test(self):
|
48
|
-
self._window.show()
|
49
|
-
for scan in self._scans:
|
50
|
-
self._window.addTomoObj(scan)
|
51
|
-
self._window.clean()
|
52
|
-
self._window.setSerie(self._serie)
|
53
|
-
|
54
|
-
# test dumping and loading configuration to a file
|
55
|
-
with tempfile.TemporaryDirectory() as dump_dir:
|
56
|
-
config_file = os.path.join(dump_dir, "configuration.cfg")
|
57
|
-
self._window._saveSettings(file_path=config_file)
|
58
|
-
assert os.path.exists(config_file)
|
59
|
-
self._window._loadSettings(config_file)
|
60
|
-
# remove configuration
|
61
|
-
self._window.clean()
|
62
|
-
assert len(self._window._widget._mainWidget.getTomoObjs()) == 0
|
63
|
-
# reload it
|
64
|
-
self._window._loadSettings(file_path=config_file)
|
65
|
-
assert len(self._window._widget._mainWidget.getTomoObjs()) == len(
|
66
|
-
self._serie
|
67
|
-
)
|
@@ -1,79 +0,0 @@
|
|
1
|
-
import os
|
2
|
-
|
3
|
-
import numpy
|
4
|
-
from nxtomo.application.nxtomo import NXtomo
|
5
|
-
from scipy.ndimage import shift as shift_scipy
|
6
|
-
from silx.image.phantomgenerator import PhantomGenerator
|
7
|
-
from nxtomo.nxobject.nxdetector import ImageKey
|
8
|
-
|
9
|
-
from tomwer.core.scan.nxtomoscan import NXtomoScan
|
10
|
-
|
11
|
-
|
12
|
-
def create_scans_z_serie(
|
13
|
-
output_dir,
|
14
|
-
z_positions_m,
|
15
|
-
x_positions_m=None,
|
16
|
-
pixel_size=10e-6,
|
17
|
-
n_proj=20,
|
18
|
-
raw_frame_width=100,
|
19
|
-
final_frame_width=100,
|
20
|
-
shifts=None,
|
21
|
-
z_rois=None,
|
22
|
-
):
|
23
|
-
"""
|
24
|
-
:param Optioanl tuple: shift to be applied on the 2D frame
|
25
|
-
"""
|
26
|
-
if not os.path.exists(output_dir):
|
27
|
-
os.makedirs(output_dir)
|
28
|
-
frame = (
|
29
|
-
PhantomGenerator.get2DPhantomSheppLogan(n=raw_frame_width).astype(numpy.float32)
|
30
|
-
* 256.0
|
31
|
-
)
|
32
|
-
if x_positions_m is None:
|
33
|
-
x_positions_m = [None] * len(z_positions_m)
|
34
|
-
if shifts is None:
|
35
|
-
shifts = [None] * len(z_positions_m)
|
36
|
-
if z_rois is None:
|
37
|
-
z_rois = [None] * len(z_positions_m)
|
38
|
-
scans = []
|
39
|
-
for i_frame, (z_pos, x_pos, z_roi, shift) in enumerate(
|
40
|
-
zip(z_positions_m, x_positions_m, z_rois, shifts)
|
41
|
-
):
|
42
|
-
nx_tomo = NXtomo()
|
43
|
-
if z_pos is not None:
|
44
|
-
nx_tomo.sample.z_translation = [z_pos] * n_proj
|
45
|
-
if x_pos is not None:
|
46
|
-
nx_tomo.sample.x_translation = [x_pos] * n_proj
|
47
|
-
nx_tomo.sample.rotation_angle = numpy.linspace(
|
48
|
-
0, 180, num=n_proj, endpoint=False
|
49
|
-
)
|
50
|
-
nx_tomo.instrument.detector.image_key_control = [ImageKey.PROJECTION] * n_proj
|
51
|
-
if pixel_size is not None:
|
52
|
-
if isinstance(pixel_size, (tuple, list)):
|
53
|
-
y_pix_size, x_pix_size = pixel_size
|
54
|
-
else:
|
55
|
-
y_pix_size, x_pix_size = pixel_size, pixel_size
|
56
|
-
nx_tomo.instrument.detector.x_pixel_size = x_pix_size
|
57
|
-
nx_tomo.instrument.detector.y_pixel_size = y_pix_size
|
58
|
-
nx_tomo.instrument.detector.distance = 2.3
|
59
|
-
nx_tomo.energy = 19.2
|
60
|
-
|
61
|
-
if shift is not None:
|
62
|
-
sub_frame = shift_scipy(
|
63
|
-
input=frame.copy(), shift=shift, order=1, mode="constant"
|
64
|
-
)[:final_frame_width]
|
65
|
-
else:
|
66
|
-
sub_frame = frame
|
67
|
-
if z_roi is not None:
|
68
|
-
roi_start, roi_end = z_roi
|
69
|
-
sub_frame = sub_frame[roi_start:roi_end]
|
70
|
-
else:
|
71
|
-
sub_frame = sub_frame
|
72
|
-
nx_tomo.instrument.detector.data = numpy.asarray([sub_frame] * n_proj)
|
73
|
-
|
74
|
-
file_path = os.path.join(output_dir, f"nxtomo_{i_frame}.nx")
|
75
|
-
entry = f"entry000{i_frame}"
|
76
|
-
nx_tomo.save(file_path=file_path, data_path=entry)
|
77
|
-
scans.append(NXtomoScan(scan=file_path, entry=entry))
|
78
|
-
|
79
|
-
return scans
|
@@ -1,35 +0,0 @@
|
|
1
|
-
from nabu.stitching.utils import ShiftAlgorithm as _NabuShiftAlgorithm
|
2
|
-
from silx.gui import qt
|
3
|
-
from silx.gui.utils.testutils import TestCaseQt
|
4
|
-
|
5
|
-
from tomwer.gui.stitching.z_stitching.fineestimation import Axis_N_Params
|
6
|
-
|
7
|
-
|
8
|
-
class TestAxis_N_Params(TestCaseQt):
|
9
|
-
"""
|
10
|
-
Test definition of an axis shift research parameters
|
11
|
-
"""
|
12
|
-
|
13
|
-
def setUp(self):
|
14
|
-
super().setUp()
|
15
|
-
self._widget = Axis_N_Params("axis n", None)
|
16
|
-
|
17
|
-
def tearDown(self):
|
18
|
-
self._widget.setAttribute(qt.Qt.WA_DeleteOnClose)
|
19
|
-
self._widget.close()
|
20
|
-
self._widget = None
|
21
|
-
while self.qapp.hasPendingEvents():
|
22
|
-
self.qapp.processEvents()
|
23
|
-
|
24
|
-
def test(self):
|
25
|
-
self._widget.show()
|
26
|
-
assert self._widget.getCurrentMethod() == _NabuShiftAlgorithm.NONE
|
27
|
-
opts1 = self._widget.getOptsLine()
|
28
|
-
assert opts1 == "img_reg_method=None"
|
29
|
-
self._widget.setCurrentMethod(_NabuShiftAlgorithm.NABU_FFT)
|
30
|
-
opts2 = self._widget.getOptsLine()
|
31
|
-
assert opts2 == "img_reg_method=nabu-fft"
|
32
|
-
self._widget.setOptsLine(opts1)
|
33
|
-
assert self._widget.getOptsLine() == opts1
|
34
|
-
self._widget.setOptsLine(opts2)
|
35
|
-
assert self._widget.getOptsLine() == opts2
|
@@ -1,215 +0,0 @@
|
|
1
|
-
import os
|
2
|
-
import shutil
|
3
|
-
import tempfile
|
4
|
-
|
5
|
-
from silx.gui import qt
|
6
|
-
from silx.gui.utils.testutils import TestCaseQt
|
7
|
-
|
8
|
-
from tomwer.core.process.stitching.metadataholder import StitchingMetadata
|
9
|
-
from tomwer.gui.stitching.metadataholder import QStitchingMetadata
|
10
|
-
from tomwer.gui.stitching.tests.utils import create_scans_z_serie
|
11
|
-
from tomwer.gui.stitching.config.tomoobjdetails import TomoObjectPositionInfos
|
12
|
-
from tomwer.gui.stitching.axisorderedlist import AxisOrderedTomoObjsModel
|
13
|
-
|
14
|
-
|
15
|
-
class TestTomoObjectPositionInfos(TestCaseQt):
|
16
|
-
"""
|
17
|
-
Test edition of the tomo object position information
|
18
|
-
"""
|
19
|
-
|
20
|
-
def setUp(self):
|
21
|
-
super().setUp()
|
22
|
-
self._tmp_path = tempfile.mkdtemp()
|
23
|
-
self._y_pixel_size = 0.002
|
24
|
-
self._x_pixel_size = 0.001
|
25
|
-
self.scans = create_scans_z_serie(
|
26
|
-
self._tmp_path,
|
27
|
-
z_positions_m=(0.200, 0.205, 0.210),
|
28
|
-
x_positions_m=(0.0, 0.0, None),
|
29
|
-
pixel_size=(self._y_pixel_size, self._x_pixel_size),
|
30
|
-
raw_frame_width=100,
|
31
|
-
)
|
32
|
-
self.scan_0_metadata = QStitchingMetadata(tomo_obj=self.scans[0])
|
33
|
-
assert self.scan_0_metadata.get_raw_position_m(axis=0) == 0.20
|
34
|
-
assert self.scan_0_metadata.get_raw_position_m(axis=2) == 0.0
|
35
|
-
self.scan_2_metadata = QStitchingMetadata(tomo_obj=self.scans[2])
|
36
|
-
assert self.scan_2_metadata.get_raw_position_m(axis=0) == 0.21
|
37
|
-
self._widget = TomoObjectPositionInfos()
|
38
|
-
|
39
|
-
def tearDown(self):
|
40
|
-
self._widget.setAttribute(qt.Qt.WA_DeleteOnClose)
|
41
|
-
self._widget.close()
|
42
|
-
self._widget = None
|
43
|
-
while self.qapp.hasPendingEvents():
|
44
|
-
self.qapp.processEvents()
|
45
|
-
shutil.rmtree(self._tmp_path)
|
46
|
-
|
47
|
-
def testEdition(self):
|
48
|
-
# test QStitchingMetadata are correctly read
|
49
|
-
self._widget.show()
|
50
|
-
self._widget.setStitchingMetadata(self.scan_0_metadata)
|
51
|
-
self.qapp.processEvents()
|
52
|
-
assert self._widget._axis_0_pos.get_final_px_position() == int(0.20 / 0.002)
|
53
|
-
assert self._widget._axis_2_pos.get_final_px_position() == 0
|
54
|
-
self._widget.setStitchingMetadata(self.scan_2_metadata)
|
55
|
-
while self.qapp.hasPendingEvents():
|
56
|
-
self.qapp.processEvents()
|
57
|
-
assert self._widget._axis_0_pos.get_final_px_position() == int(0.21 / 0.002)
|
58
|
-
assert self._widget._axis_2_pos.get_final_px_position() is None
|
59
|
-
# test editing some parameters from the GUI. Make sure GUI is updated as the underlying metadata object
|
60
|
-
self._widget._axis_0_pos._overrideMetricPositionCB.setChecked(True)
|
61
|
-
self._widget._axis_0_pos.setRawMetricPosition(
|
62
|
-
position_m=0.4, displayed_unit="nm"
|
63
|
-
)
|
64
|
-
while self.qapp.hasPendingEvents():
|
65
|
-
self.qapp.processEvents()
|
66
|
-
assert self._widget._axis_0_pos.get_final_px_position() == int(
|
67
|
-
0.4 * 10e-6 / 0.002
|
68
|
-
)
|
69
|
-
self._widget._axis_0_pos._overridePixelPositionCB.setChecked(True)
|
70
|
-
self._widget._axis_0_pos.setOverrridePxPosition(position_px=120)
|
71
|
-
while self.qapp.hasPendingEvents():
|
72
|
-
self.qapp.processEvents()
|
73
|
-
assert self._widget._axis_0_pos.get_final_px_position() == int(120)
|
74
|
-
assert self.scan_2_metadata.get_abs_position_px(axis=0) == int(120)
|
75
|
-
|
76
|
-
|
77
|
-
class TestAxisOrderedTomoObjsModel(TestCaseQt):
|
78
|
-
"""
|
79
|
-
test the behavior of the z ordered model used for stitching
|
80
|
-
"""
|
81
|
-
|
82
|
-
def setUp(self):
|
83
|
-
super().setUp()
|
84
|
-
self._tmp_path = tempfile.mkdtemp()
|
85
|
-
self.scans_with_pos_and_pixel_size = create_scans_z_serie(
|
86
|
-
os.path.join(self._tmp_path, "case1"),
|
87
|
-
z_positions_m=(0.200, 0.205, 0.210),
|
88
|
-
pixel_size=0.001,
|
89
|
-
raw_frame_width=100,
|
90
|
-
)
|
91
|
-
self.scans_with_pixel_size = create_scans_z_serie(
|
92
|
-
os.path.join(self._tmp_path, "case2"),
|
93
|
-
z_positions_m=(None, None, None),
|
94
|
-
pixel_size=0.001,
|
95
|
-
raw_frame_width=100,
|
96
|
-
)
|
97
|
-
self.scans_without_metadata = create_scans_z_serie(
|
98
|
-
os.path.join(self._tmp_path, "case3"),
|
99
|
-
z_positions_m=(None, None, None),
|
100
|
-
pixel_size=None,
|
101
|
-
raw_frame_width=100,
|
102
|
-
)
|
103
|
-
self._widget = qt.QTableView()
|
104
|
-
self._widget.setModel(AxisOrderedTomoObjsModel(parent=self._widget, axis=0))
|
105
|
-
|
106
|
-
def tearDown(self):
|
107
|
-
self._widget.setAttribute(qt.Qt.WA_DeleteOnClose)
|
108
|
-
self._widget.close()
|
109
|
-
self._widget = None
|
110
|
-
while self.qapp.hasPendingEvents():
|
111
|
-
self.qapp.processEvents()
|
112
|
-
shutil.rmtree(self._tmp_path)
|
113
|
-
|
114
|
-
def testWithMetadata(self):
|
115
|
-
"""
|
116
|
-
make sure z ordering works in the best case scenario
|
117
|
-
"""
|
118
|
-
first_expected_scan = (
|
119
|
-
self.scans_with_pos_and_pixel_size[2].get_identifier().short_description()
|
120
|
-
)
|
121
|
-
# try giving it ordered
|
122
|
-
for scan in self.scans_with_pos_and_pixel_size[::-1]:
|
123
|
-
self._widget.model().addTomoObj(scan)
|
124
|
-
assert (
|
125
|
-
self._widget.model().data(
|
126
|
-
self._widget.model().index(0, 1), qt.Qt.DisplayRole
|
127
|
-
)
|
128
|
-
== first_expected_scan
|
129
|
-
)
|
130
|
-
self._widget.model().clearTomoObjs()
|
131
|
-
# try giving it ordered (but inverted)
|
132
|
-
for scan in self.scans_with_pos_and_pixel_size:
|
133
|
-
self._widget.model().addTomoObj(scan)
|
134
|
-
assert (
|
135
|
-
self._widget.model().data(
|
136
|
-
self._widget.model().index(0, 1), qt.Qt.DisplayRole
|
137
|
-
)
|
138
|
-
== first_expected_scan
|
139
|
-
)
|
140
|
-
|
141
|
-
def testWithPixelSizeOnly(self):
|
142
|
-
"""
|
143
|
-
make sure z ordering works when we are only aware about pixel size
|
144
|
-
"""
|
145
|
-
for scan in self.scans_with_pixel_size[::-1]:
|
146
|
-
self._widget.model().addTomoObj(scan)
|
147
|
-
|
148
|
-
# try adding some metadata to object
|
149
|
-
scans = self._widget.model()._objs
|
150
|
-
scans = self._widget.model()._objs
|
151
|
-
scans[0].stitching_metadata = StitchingMetadata(tomo_obj=scans[0])
|
152
|
-
scans[1].stitching_metadata = QStitchingMetadata(tomo_obj=scans[1])
|
153
|
-
|
154
|
-
scans[0].stitching_metadata._pos_as_m = (0.1, 1, 2)
|
155
|
-
scans[1].stitching_metadata._pos_as_m = (-0.03, 1, 2)
|
156
|
-
scans[2].stitching_metadata._pos_as_m = (0.23, 1, 2)
|
157
|
-
|
158
|
-
self._widget.model().reorder_objs()
|
159
|
-
self._widget.model().layoutChanged.emit()
|
160
|
-
|
161
|
-
assert (
|
162
|
-
self._widget.model().data(
|
163
|
-
self._widget.model().index(0, 1), qt.Qt.DisplayRole
|
164
|
-
)
|
165
|
-
== scans[2].get_identifier().short_description()
|
166
|
-
)
|
167
|
-
assert (
|
168
|
-
self._widget.model().data(
|
169
|
-
self._widget.model().index(1, 1), qt.Qt.DisplayRole
|
170
|
-
)
|
171
|
-
== scans[0].get_identifier().short_description()
|
172
|
-
)
|
173
|
-
assert (
|
174
|
-
self._widget.model().data(
|
175
|
-
self._widget.model().index(2, 1), qt.Qt.DisplayRole
|
176
|
-
)
|
177
|
-
== scans[1].get_identifier().short_description()
|
178
|
-
)
|
179
|
-
|
180
|
-
def testWithoutMetadata(self):
|
181
|
-
"""
|
182
|
-
make sure tomo obj are still displayed even if there is no metadata at all
|
183
|
-
"""
|
184
|
-
for scan in self.scans_without_metadata[::-1]:
|
185
|
-
self._widget.model().addTomoObj(scan)
|
186
|
-
# try adding some metadata to object
|
187
|
-
scans = self._widget.model()._objs
|
188
|
-
scans[0].stitching_metadata = StitchingMetadata(tomo_obj=scans[0])
|
189
|
-
scans[1].stitching_metadata = QStitchingMetadata(tomo_obj=scans[1])
|
190
|
-
|
191
|
-
scans[0].stitching_metadata._pos_as_px = (12, None, 2)
|
192
|
-
scans[1].stitching_metadata._pos_as_px = (-12, None, None)
|
193
|
-
scans[2].stitching_metadata._pos_as_px = (9999, None, None)
|
194
|
-
|
195
|
-
self._widget.model().reorder_objs()
|
196
|
-
self._widget.model().layoutChanged.emit()
|
197
|
-
|
198
|
-
assert (
|
199
|
-
self._widget.model().data(
|
200
|
-
self._widget.model().index(0, 1), qt.Qt.DisplayRole
|
201
|
-
)
|
202
|
-
== scans[2].get_identifier().short_description()
|
203
|
-
)
|
204
|
-
assert (
|
205
|
-
self._widget.model().data(
|
206
|
-
self._widget.model().index(1, 1), qt.Qt.DisplayRole
|
207
|
-
)
|
208
|
-
== scans[0].get_identifier().short_description()
|
209
|
-
)
|
210
|
-
assert (
|
211
|
-
self._widget.model().data(
|
212
|
-
self._widget.model().index(2, 1), qt.Qt.DisplayRole
|
213
|
-
)
|
214
|
-
== scans[1].get_identifier().short_description()
|
215
|
-
)
|
@@ -1,51 +0,0 @@
|
|
1
|
-
import os
|
2
|
-
import shutil
|
3
|
-
import tempfile
|
4
|
-
|
5
|
-
from silx.gui import qt
|
6
|
-
from silx.gui.utils.testutils import TestCaseQt
|
7
|
-
|
8
|
-
from tomwer.gui.stitching.tests.utils import create_scans_z_serie
|
9
|
-
from tomwer.gui.stitching.stitching import ZStitchingWindow
|
10
|
-
|
11
|
-
|
12
|
-
class TestZStichingWindow(TestCaseQt):
|
13
|
-
"""
|
14
|
-
Test high level z stitching definition
|
15
|
-
"""
|
16
|
-
|
17
|
-
def setUp(self):
|
18
|
-
super().setUp()
|
19
|
-
self._tmp_path = tempfile.mkdtemp()
|
20
|
-
self.scans = create_scans_z_serie(
|
21
|
-
os.path.join(self._tmp_path, "case1"),
|
22
|
-
z_positions_m=(0.200, 0.205, 0.210),
|
23
|
-
pixel_size=0.001,
|
24
|
-
raw_frame_width=100,
|
25
|
-
)
|
26
|
-
|
27
|
-
self._widget = ZStitchingWindow()
|
28
|
-
|
29
|
-
def tearDown(self):
|
30
|
-
self._widget.setAttribute(qt.Qt.WA_DeleteOnClose)
|
31
|
-
self._widget.close()
|
32
|
-
self._widget = None
|
33
|
-
while self.qapp.hasPendingEvents():
|
34
|
-
self.qapp.processEvents()
|
35
|
-
shutil.rmtree(self._tmp_path)
|
36
|
-
|
37
|
-
@staticmethod
|
38
|
-
def checkNbReceivers(scan, nb_receivers):
|
39
|
-
return (
|
40
|
-
scan.stitching_metadata.receivers(scan.stitching_metadata.sigChanged)
|
41
|
-
== nb_receivers
|
42
|
-
)
|
43
|
-
|
44
|
-
def test(self):
|
45
|
-
self._widget.show()
|
46
|
-
# fill the widget with scans
|
47
|
-
|
48
|
-
scan_0, scan_1, scan_2 = self.scans
|
49
|
-
for scan in self.scans:
|
50
|
-
self._widget.addTomoObj(scan)
|
51
|
-
# note: add the sigChanged to the z oredred list 'update z' slot
|
@@ -1,67 +0,0 @@
|
|
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
|
-
"""module defining dedicated completer"""
|
27
|
-
|
28
|
-
|
29
|
-
__authors__ = ["H. Payno"]
|
30
|
-
__license__ = "MIT"
|
31
|
-
__date__ = "23/03/2022"
|
32
|
-
|
33
|
-
|
34
|
-
import pytest
|
35
|
-
from silx.gui import qt
|
36
|
-
from silx.gui.utils.testutils import TestCaseQt
|
37
|
-
|
38
|
-
from tomwer.gui.utils.completer import UrlCompleterDialog
|
39
|
-
from tomwer.tests.utils import skip_gui_test
|
40
|
-
|
41
|
-
|
42
|
-
@pytest.mark.skipif(skip_gui_test(), reason="skip gui test")
|
43
|
-
class TestUrlCompleterDialog(TestCaseQt):
|
44
|
-
def setUp(self):
|
45
|
-
super().setUp()
|
46
|
-
self._urls = (
|
47
|
-
"test",
|
48
|
-
"test1",
|
49
|
-
"test2",
|
50
|
-
)
|
51
|
-
self._dialog = UrlCompleterDialog(
|
52
|
-
urls=self._urls,
|
53
|
-
current_url="test",
|
54
|
-
)
|
55
|
-
|
56
|
-
def tearDown(self):
|
57
|
-
self._dialog.setAttribute(qt.Qt.WA_DeleteOnClose)
|
58
|
-
self._dialog.close()
|
59
|
-
self._dialog = None
|
60
|
-
super().tearDown()
|
61
|
-
|
62
|
-
def test(self):
|
63
|
-
"""simple test on the dialog behavior"""
|
64
|
-
assert self._dialog._buttons.button(qt.QDialogButtonBox.Ok).isEnabled()
|
65
|
-
self._dialog._completerWidget.setText("toto")
|
66
|
-
self.qapp.processEvents()
|
67
|
-
assert not self._dialog._buttons.button(qt.QDialogButtonBox.Ok).isEnabled()
|
@@ -1,21 +0,0 @@
|
|
1
|
-
import numpy
|
2
|
-
|
3
|
-
from tomwer.gui.utils.lineselector.lineselector import QSliceSelectorDialog
|
4
|
-
from tomwer.tests.conftest import qtapp # noqa F401
|
5
|
-
|
6
|
-
|
7
|
-
def test_line_selector(
|
8
|
-
qtapp, # noqa F811
|
9
|
-
):
|
10
|
-
dialog = QSliceSelectorDialog(parent=None)
|
11
|
-
dialog.setData(
|
12
|
-
numpy.ones((100, 100)),
|
13
|
-
)
|
14
|
-
dialog.mainWidget.addSlice(2)
|
15
|
-
dialog.mainWidget.addSlice(12)
|
16
|
-
assert dialog.getSelection() == (2, 12)
|
17
|
-
dialog.mainWidget.removeSlice(12)
|
18
|
-
assert dialog.getSelection() == (2,)
|
19
|
-
dialog.setSelection((12, 23))
|
20
|
-
assert dialog.getSelection() == (12, 23)
|
21
|
-
assert dialog.mainWidget.nSelected() == 2
|
@@ -1,68 +0,0 @@
|
|
1
|
-
"""
|
2
|
-
test vignettes
|
3
|
-
"""
|
4
|
-
|
5
|
-
import time
|
6
|
-
import numpy
|
7
|
-
import pytest
|
8
|
-
from silx.gui import qt
|
9
|
-
from silx.gui.utils.testutils import TestCaseQt
|
10
|
-
|
11
|
-
from tomwer.core.process.reconstruction.scores.scores import ComputedScore, ScoreMethod
|
12
|
-
from tomwer.gui.utils.vignettes import VignettesQDialog
|
13
|
-
from tomwer.tests.utils import skip_gui_test
|
14
|
-
|
15
|
-
|
16
|
-
@pytest.mark.skipif(skip_gui_test(), reason="skip gui test")
|
17
|
-
class TestVignettes(TestCaseQt):
|
18
|
-
def setUp(self):
|
19
|
-
super().setUp()
|
20
|
-
self._window = VignettesQDialog(
|
21
|
-
value_name="cor",
|
22
|
-
score_name="score",
|
23
|
-
)
|
24
|
-
|
25
|
-
def tearDown(self):
|
26
|
-
self._window.setAttribute(qt.Qt.WA_DeleteOnClose)
|
27
|
-
self._window.close()
|
28
|
-
self._window = None
|
29
|
-
super().tearDown()
|
30
|
-
|
31
|
-
def test(self):
|
32
|
-
self._window.setScores(
|
33
|
-
scores={
|
34
|
-
"3": (numpy.ones((100, 100)), ComputedScore(tv=2.0, std=3.2)),
|
35
|
-
"7": (numpy.zeros((100, 100)), ComputedScore(tv=25, std=0.6)),
|
36
|
-
},
|
37
|
-
score_method="standard deviation",
|
38
|
-
)
|
39
|
-
self._window.show()
|
40
|
-
self.qWaitForWindowExposed(self._window)
|
41
|
-
|
42
|
-
def assert_scores_are_equal(scores_1, scores_2):
|
43
|
-
assert scores_1.keys() == scores_2.keys()
|
44
|
-
for key, (data_1, computed_score_1) in scores_1.items():
|
45
|
-
data_2, computed_score_2 = scores_2[key]
|
46
|
-
numpy.testing.assert_array_almost_equal(data_1, data_2)
|
47
|
-
assert computed_score_1 == computed_score_2
|
48
|
-
|
49
|
-
scores, score_method = self._window._vignettesWidget.getScores()
|
50
|
-
assert_scores_are_equal(
|
51
|
-
scores_1=scores,
|
52
|
-
scores_2={
|
53
|
-
"3": (numpy.ones((100, 100)), ComputedScore(std=3.2, tv=None)),
|
54
|
-
"7": (numpy.zeros((100, 100)), ComputedScore(std=0.6, tv=None)),
|
55
|
-
},
|
56
|
-
)
|
57
|
-
assert score_method is ScoreMethod.STD
|
58
|
-
|
59
|
-
self._window.setNbColumn(4)
|
60
|
-
self._window.setNbColumn(2)
|
61
|
-
with pytest.raises(ValueError):
|
62
|
-
self._window.setNbColumn(20)
|
63
|
-
self._window.setNbColumn("auto")
|
64
|
-
|
65
|
-
self._window.resize(qt.QSize(400, 400))
|
66
|
-
self.qapp.processEvents()
|
67
|
-
time.sleep(VignettesQDialog.RESIZE_MAX_TIME * 2 / 1000)
|
68
|
-
self.qapp.processEvents()
|
@@ -1,10 +0,0 @@
|
|
1
|
-
from tomwer.io.utils.raw_and_processed_data import file_is_on_processed_data
|
2
|
-
|
3
|
-
|
4
|
-
def test_file_is_on_processed_data():
|
5
|
-
"""test file_is_on_processed_data function"""
|
6
|
-
assert file_is_on_processed_data("/path/to/file") == False
|
7
|
-
assert file_is_on_processed_data("/path/to/PROCESSED_DATA/file") == True
|
8
|
-
assert file_is_on_processed_data("/path/to/RAW_DATA/file") == False
|
9
|
-
assert file_is_on_processed_data("/path/to/RAW_DATA/PROCESSED_DATA/file") == True
|
10
|
-
assert file_is_on_processed_data("/path/to/PROCESSED_DATA/RAW_DATA/file") == False
|