tomwer 1.0.3__py3-none-any.whl → 1.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (269) hide show
  1. orangecontrib/tomwer/tutorials/EBS_tomo_listener.ows +39 -0
  2. orangecontrib/tomwer/tutorials/cast_volume.ows +34 -0
  3. orangecontrib/tomwer/tutorials/simple_slice_reconstruction.ows +39 -0
  4. orangecontrib/tomwer/tutorials/simple_volume_local_reconstruction.ows +49 -0
  5. orangecontrib/tomwer/tutorials/simple_volume_to_slurm_reconstruction.ows +59 -0
  6. orangecontrib/tomwer/tutorials/using_saaxis_to_find_cor.ows +44 -0
  7. orangecontrib/tomwer/widgets/cluster/FutureSupervisorOW.py +1 -1
  8. orangecontrib/tomwer/widgets/cluster/SlurmClusterOW.py +14 -4
  9. orangecontrib/tomwer/widgets/cluster/__init__.py +1 -1
  10. orangecontrib/tomwer/widgets/control/DataListOW.py +12 -5
  11. orangecontrib/tomwer/widgets/control/DataListenerOW.py +18 -9
  12. orangecontrib/tomwer/widgets/control/DataSelectorOW.py +13 -6
  13. orangecontrib/tomwer/widgets/control/DataTransfertOW.py +3 -5
  14. orangecontrib/tomwer/widgets/control/DataValidatorOW.py +8 -4
  15. orangecontrib/tomwer/widgets/control/DataWatcherOW.py +4 -6
  16. orangecontrib/tomwer/widgets/control/EDF2NXTomomillOW.py +49 -62
  17. orangecontrib/tomwer/widgets/control/FilterOW.py +2 -4
  18. orangecontrib/tomwer/widgets/control/NXTomomillMixIn.py +93 -0
  19. orangecontrib/tomwer/widgets/control/NXTomomillOW.py +135 -129
  20. orangecontrib/tomwer/widgets/control/NotifierOW.py +34 -9
  21. orangecontrib/tomwer/widgets/control/SingleTomoObjOW.py +3 -5
  22. orangecontrib/tomwer/widgets/control/TomoObjSerieOW.py +19 -13
  23. orangecontrib/tomwer/widgets/control/VolumeSelector.py +12 -4
  24. orangecontrib/tomwer/widgets/control/VolumeSymLinkOW.py +11 -7
  25. orangecontrib/tomwer/widgets/control/icons/notification.svg +4 -4
  26. orangecontrib/tomwer/widgets/control/icons/nxtomomill.png +0 -0
  27. orangecontrib/tomwer/widgets/control/icons/nxtomomill.svg +8 -5
  28. orangecontrib/tomwer/widgets/control/icons/tomoobjserie.png +0 -0
  29. orangecontrib/tomwer/widgets/control/icons/tomoobjserie.svg +73 -78
  30. orangecontrib/tomwer/widgets/edit/DarkFlatPatchOW.py +16 -4
  31. orangecontrib/tomwer/widgets/edit/NXtomoEditorOW.py +100 -0
  32. orangecontrib/tomwer/widgets/edit/icons/image_key_editor.png +0 -0
  33. orangecontrib/tomwer/widgets/edit/icons/image_key_upgrader.png +0 -0
  34. orangecontrib/tomwer/widgets/edit/icons/nx_tomo_editor.png +0 -0
  35. orangecontrib/tomwer/widgets/edit/icons/nx_tomo_editor.svg +123 -0
  36. orangecontrib/tomwer/widgets/edit/test/test_dark_flat_patch.py +21 -1
  37. orangecontrib/tomwer/widgets/edit/test/test_image_key_editor.py +1 -1
  38. orangecontrib/tomwer/widgets/edit/test/test_image_key_upgrader.py +1 -1
  39. orangecontrib/tomwer/widgets/edit/test/test_nxtomo_editor.py +25 -0
  40. orangecontrib/tomwer/widgets/other/PythonScriptOW.py +19 -11
  41. orangecontrib/tomwer/widgets/reconstruction/AxisOW.py +20 -14
  42. orangecontrib/tomwer/widgets/reconstruction/CastNabuVolumeOW.py +24 -10
  43. orangecontrib/tomwer/widgets/reconstruction/DarkRefAndCopyOW.py +26 -21
  44. orangecontrib/tomwer/widgets/reconstruction/NabuOW.py +29 -12
  45. orangecontrib/tomwer/widgets/reconstruction/NabuVolumeOW.py +44 -17
  46. orangecontrib/tomwer/widgets/reconstruction/SAAxisOW.py +28 -20
  47. orangecontrib/tomwer/widgets/reconstruction/SADeltaBetaOW.py +24 -18
  48. orangecontrib/tomwer/widgets/reconstruction/SinoNormOW.py +6 -6
  49. orangecontrib/tomwer/widgets/reconstruction/TofuOW.py +4 -2
  50. orangecontrib/tomwer/widgets/reconstruction/icons/nabu_2d.png +0 -0
  51. orangecontrib/tomwer/widgets/reconstruction/icons/nabu_2d.svg +11 -8
  52. orangecontrib/tomwer/widgets/visualization/DataViewerOW.py +10 -4
  53. orangecontrib/tomwer/widgets/visualization/DiffViewerOW.py +1 -1
  54. orangecontrib/tomwer/widgets/visualization/NXtomoMetadataViewerOW.py +69 -0
  55. orangecontrib/tomwer/widgets/visualization/SampleMovedOW.py +2 -4
  56. orangecontrib/tomwer/widgets/visualization/icons/nx_tomo_metadata_viewer.png +0 -0
  57. orangecontrib/tomwer/widgets/visualization/icons/nx_tomo_metadata_viewer.svg +105 -0
  58. tomwer/__main__.py +10 -5
  59. tomwer/app/canvas_launcher/config.py +10 -10
  60. tomwer/app/canvas_launcher/mainwindow.py +68 -6
  61. tomwer/app/canvas_launcher/widgetsscheme.py +1 -3
  62. tomwer/app/darkref.py +16 -12
  63. tomwer/app/imagekeyeditor.py +2 -2
  64. tomwer/app/imagekeyupgrader.py +104 -0
  65. tomwer/app/intensitynormalization.py +0 -1
  66. tomwer/app/nxtomoeditor.py +103 -0
  67. tomwer/app/rsync.py +1 -1
  68. tomwer/core/cluster/cluster.py +1 -1
  69. tomwer/core/futureobject.py +1 -0
  70. tomwer/core/process/control/datalistener/datalistener.py +7 -1
  71. tomwer/core/process/control/datalistener/rpcserver.py +3 -4
  72. tomwer/core/process/control/datawatcher/datawatcher.py +18 -18
  73. tomwer/core/process/control/datawatcher/datawatcherobserver.py +5 -8
  74. tomwer/core/process/control/datawatcher/datawatcherprocess.py +2 -3
  75. tomwer/core/process/control/datawatcher/edfdwprocess.py +2 -2
  76. tomwer/core/process/control/nxtomomill.py +33 -58
  77. tomwer/core/process/control/scanlist.py +2 -1
  78. tomwer/core/process/control/scanselector.py +7 -0
  79. tomwer/core/process/control/scantransfer.py +2 -2
  80. tomwer/core/process/control/scanvalidator.py +6 -5
  81. tomwer/core/process/control/singletomoobj.py +2 -1
  82. tomwer/core/process/control/timer.py +2 -1
  83. tomwer/core/process/control/tomoobjserie.py +8 -2
  84. tomwer/core/process/control/volumeselector.py +2 -1
  85. tomwer/core/process/control/volumesymlink.py +2 -1
  86. tomwer/core/process/edit/darkflatpatch.py +2 -1
  87. tomwer/core/process/edit/imagekeyeditor.py +4 -3
  88. tomwer/core/process/reconstruction/axis/axis.py +29 -32
  89. tomwer/core/process/reconstruction/axis/mode.py +3 -2
  90. tomwer/core/process/reconstruction/axis/params.py +35 -16
  91. tomwer/core/process/reconstruction/darkref/darkrefs.py +90 -707
  92. tomwer/core/process/reconstruction/darkref/darkrefscopy.py +44 -16
  93. tomwer/core/process/reconstruction/darkref/params.py +62 -67
  94. tomwer/core/process/reconstruction/lamino/tofu.py +1 -2
  95. tomwer/core/process/reconstruction/nabu/castvolume.py +21 -26
  96. tomwer/core/process/reconstruction/nabu/nabucommon.py +36 -38
  97. tomwer/core/process/reconstruction/nabu/nabuscores.py +28 -13
  98. tomwer/core/process/reconstruction/nabu/nabuslices.py +41 -14
  99. tomwer/core/process/reconstruction/nabu/nabuvolume.py +21 -12
  100. tomwer/core/process/reconstruction/nabu/utils.py +32 -3
  101. tomwer/core/process/reconstruction/normalization/normalization.py +9 -8
  102. tomwer/core/process/reconstruction/saaxis/saaxis.py +46 -20
  103. tomwer/core/process/reconstruction/sadeltabeta/sadeltabeta.py +38 -12
  104. tomwer/core/process/reconstruction/test/__init__.py +0 -39
  105. tomwer/core/process/reconstruction/test/test_axis_params.py +25 -3
  106. tomwer/core/process/reconstruction/test/test_darkref_copy.py +117 -1
  107. tomwer/core/process/script/python.py +16 -12
  108. tomwer/core/process/task.py +3 -7
  109. tomwer/core/process/test/test_axis.py +1 -1
  110. tomwer/core/process/test/test_dark_and_flat.py +41 -111
  111. tomwer/core/process/test/test_data_listener.py +0 -29
  112. tomwer/core/process/test/test_data_transfer.py +10 -14
  113. tomwer/core/process/test/test_nabu.py +1 -1
  114. tomwer/core/process/test/test_normalization.py +1 -1
  115. tomwer/core/process/visualization/liveslice.py +6 -0
  116. tomwer/core/scan/blissscan.py +37 -2
  117. tomwer/core/scan/edfscan.py +19 -8
  118. tomwer/core/scan/hdf5scan.py +10 -4
  119. tomwer/core/scan/scanbase.py +35 -29
  120. tomwer/core/scan/scanfactory.py +3 -17
  121. tomwer/core/scan/test/test_h5.py +1 -1
  122. tomwer/core/scan/test/test_process_registration.py +0 -11
  123. tomwer/core/scan/test/test_scan.py +32 -30
  124. tomwer/core/settings.py +2 -2
  125. tomwer/core/test/test_utils.py +1 -1
  126. tomwer/core/tomwer_object.py +19 -0
  127. tomwer/core/utils/__init__.py +0 -45
  128. tomwer/core/utils/char.py +2 -0
  129. tomwer/core/utils/gpu.py +5 -5
  130. tomwer/core/utils/nxtomoutils.py +2 -2
  131. tomwer/core/utils/scanutils.py +50 -0
  132. tomwer/core/utils/volumeutils.py +13 -0
  133. tomwer/core/volume/edfvolume.py +4 -0
  134. tomwer/core/volume/hdf5volume.py +4 -0
  135. tomwer/core/volume/jp2kvolume.py +4 -0
  136. tomwer/core/volume/rawvolume.py +22 -5
  137. tomwer/core/volume/tiffvolume.py +4 -0
  138. tomwer/core/volume/volumebase.py +19 -12
  139. tomwer/core/volume/volumefactory.py +20 -1
  140. tomwer/gui/cluster/slurm.py +1 -1
  141. tomwer/gui/cluster/supervisor.py +0 -2
  142. tomwer/gui/cluster/test/test_cluster.py +2 -2
  143. tomwer/gui/control/datalist.py +109 -36
  144. tomwer/gui/control/datatransfert.py +1 -1
  145. tomwer/gui/control/datawatcher/configuration.py +0 -2
  146. tomwer/gui/control/datawatcher/datawatcher.py +23 -13
  147. tomwer/gui/control/datawatcher/datawatcherobserver.py +1 -1
  148. tomwer/gui/control/observations.py +0 -3
  149. tomwer/gui/control/selectorwidgetbase.py +42 -12
  150. tomwer/gui/control/serie/seriecreator.py +967 -0
  151. tomwer/{web/__init__.py → gui/control/serie/seriewaiter.py} +5 -7
  152. tomwer/gui/control/singletomoobj.py +15 -4
  153. tomwer/gui/control/test/test_datalist.py +1 -1
  154. tomwer/gui/control/test/test_datalistener.py +1 -1
  155. tomwer/gui/control/test/test_inputwidget.py +1 -1
  156. tomwer/gui/control/test/test_process_manager.py +1 -13
  157. tomwer/gui/control/test/test_scanselector.py +1 -1
  158. tomwer/gui/control/test/test_scanvalidator.py +1 -1
  159. tomwer/gui/control/test/test_single_tomo_obj.py +1 -1
  160. tomwer/gui/control/test/test_volume_dialog.py +19 -7
  161. tomwer/gui/control/test/test_volumeselector.py +4 -4
  162. tomwer/gui/debugtools/datasetgenerator.py +1 -9
  163. tomwer/gui/edit/dkrfpatch.py +2 -3
  164. tomwer/gui/edit/imagekeyeditor.py +12 -11
  165. tomwer/gui/edit/nxtomoeditor.py +475 -0
  166. tomwer/gui/edit/test/test_dkrf_patch.py +2 -14
  167. tomwer/gui/edit/test/test_image_key_editor.py +2 -2
  168. tomwer/gui/edit/test/test_nx_editor.py +155 -0
  169. tomwer/gui/icons.py +0 -1
  170. tomwer/gui/qfolderdialog.py +11 -0
  171. tomwer/gui/reconstruction/axis/CompareImages.py +27 -29
  172. tomwer/gui/reconstruction/axis/axis.py +2 -0
  173. tomwer/gui/reconstruction/axis/radioaxis.py +70 -14
  174. tomwer/gui/reconstruction/darkref/darkrefcopywidget.py +7 -9
  175. tomwer/gui/reconstruction/darkref/darkrefwidget.py +22 -24
  176. tomwer/gui/reconstruction/lamino/tofu/projections.py +1 -1
  177. tomwer/gui/reconstruction/lamino/tofu/tofu.py +3 -3
  178. tomwer/gui/reconstruction/lamino/tofu/tofuexpert.py +4 -4
  179. tomwer/gui/reconstruction/lamino/tofu/tofuoutput.py +10 -5
  180. tomwer/gui/reconstruction/nabu/castvolume.py +103 -24
  181. tomwer/gui/reconstruction/nabu/check.py +1 -1
  182. tomwer/gui/reconstruction/nabu/nabuconfig/ctf.py +352 -0
  183. tomwer/gui/reconstruction/nabu/nabuconfig/nabuconfig.py +0 -9
  184. tomwer/gui/reconstruction/nabu/nabuconfig/output.py +1 -1
  185. tomwer/gui/reconstruction/nabu/nabuconfig/phase.py +18 -19
  186. tomwer/gui/reconstruction/nabu/nabuconfig/preprocessing.py +30 -7
  187. tomwer/gui/reconstruction/nabu/nabuconfig/reconstruction.py +26 -15
  188. tomwer/gui/reconstruction/nabu/slices.py +10 -4
  189. tomwer/gui/reconstruction/nabu/slurm.py +1 -1
  190. tomwer/gui/reconstruction/nabu/volume.py +13 -7
  191. tomwer/gui/reconstruction/normalization/intensity.py +1 -5
  192. tomwer/gui/reconstruction/saaxis/corrangeselector.py +10 -37
  193. tomwer/gui/reconstruction/saaxis/saaxis.py +11 -7
  194. tomwer/gui/reconstruction/saaxis/sliceselector.py +11 -26
  195. tomwer/gui/reconstruction/sadeltabeta/saadeltabeta.py +13 -8
  196. tomwer/gui/reconstruction/scores/scoreplot.py +67 -62
  197. tomwer/gui/reconstruction/test/test_axis.py +2 -2
  198. tomwer/gui/reconstruction/test/test_lamino.py +2 -2
  199. tomwer/gui/reconstruction/test/test_nabu.py +14 -1
  200. tomwer/gui/reconstruction/test/test_saaxis.py +8 -17
  201. tomwer/gui/reconstruction/test/test_sadeltabeta.py +7 -13
  202. tomwer/gui/stackplot.py +11 -28
  203. tomwer/gui/test/test_axis_gui.py +4 -4
  204. tomwer/gui/test/test_qfolder_dialog.py +12 -0
  205. tomwer/gui/utils/inputwidget.py +42 -22
  206. tomwer/gui/utils/lineselector/lineselector.py +13 -21
  207. tomwer/gui/utils/scandescription.py +2 -4
  208. tomwer/gui/utils/slider.py +1 -102
  209. tomwer/gui/utils/unitsystem.py +48 -11
  210. tomwer/gui/visualization/dataviewer.py +24 -17
  211. tomwer/gui/visualization/diffviewer/diffviewer.py +2 -11
  212. tomwer/gui/visualization/nxtomometadata.py +21 -0
  213. tomwer/gui/visualization/scanoverview.py +0 -1
  214. tomwer/gui/visualization/test/test_nx_tomo_metadata_viewer.py +72 -0
  215. tomwer/gui/visualization/test/test_stacks.py +1 -1
  216. tomwer/gui/visualization/tomoobjoverview.py +49 -0
  217. tomwer/gui/visualization/volumeoverview.py +64 -0
  218. tomwer/gui/visualization/volumeviewer.py +1 -1
  219. tomwer/io/utils/utils.py +2 -2
  220. tomwer/resources/gui/icons/multi-document-save.png +0 -0
  221. tomwer/resources/gui/icons/multi-document-save.svg +101 -0
  222. tomwer/resources/gui/illustrations/ctf_z1.png +0 -0
  223. tomwer/resources/gui/illustrations/ctf_z1.svg +471 -0
  224. tomwer/synctools/axis.py +0 -1
  225. tomwer/synctools/darkref.py +0 -1
  226. tomwer/synctools/datalistener.py +5 -1
  227. tomwer/synctools/imageloaderthread.py +2 -2
  228. tomwer/synctools/saaxis.py +0 -1
  229. tomwer/synctools/sadeltabeta.py +0 -1
  230. tomwer/synctools/stacks/edit/imagekeyeditor.py +1 -1
  231. tomwer/synctools/stacks/processingstack.py +2 -2
  232. tomwer/synctools/stacks/reconstruction/castvolume.py +1 -0
  233. tomwer/synctools/stacks/reconstruction/dkrefcopy.py +1 -1
  234. tomwer/synctools/stacks/reconstruction/lamino.py +1 -3
  235. tomwer/synctools/stacks/reconstruction/sadeltabeta.py +0 -2
  236. tomwer/synctools/test/test_darkRefs.py +32 -149
  237. tomwer/synctools/test/test_foldertransfer.py +1 -1
  238. tomwer/synctools/test/test_scanstages.py +2 -2
  239. tomwer/tests/conftest.py +51 -0
  240. tomwer/{test → tests}/test_scripts.py +1 -1
  241. tomwer/tests/test_utils.py +10 -0
  242. tomwer/{test → tests}/utils/utilstest.py +0 -11
  243. tomwer/version.py +3 -3
  244. {tomwer-1.0.3.dist-info → tomwer-1.1.0.dist-info}/METADATA +14 -16
  245. {tomwer-1.0.3.dist-info → tomwer-1.1.0.dist-info}/RECORD +255 -235
  246. {tomwer-1.0.3.dist-info → tomwer-1.1.0.dist-info}/WHEEL +1 -1
  247. {tomwer-1.0.3.dist-info → tomwer-1.1.0.dist-info}/entry_points.txt +6 -0
  248. orangecontrib/tomwer/setup.py +0 -45
  249. orangecontrib/tomwer/widgets/setup.py +0 -49
  250. tomwer/app/process.py +0 -153
  251. tomwer/core/process/reconstruction/nabu/slurm.py +0 -36
  252. tomwer/core/process/reconstruction/utils/nabu_slice_exec.py +0 -10
  253. tomwer/core/utils/laminoutils.py +0 -80
  254. tomwer/gui/utils/lineselector/lineselection.py +0 -76
  255. tomwer/setup.py +0 -52
  256. tomwer/slurm/executor.py +0 -36
  257. tomwer/slurm/job.py +0 -349
  258. tomwer/slurm/utils.py +0 -44
  259. tomwer/web/client.py +0 -43
  260. tomwer/web/config.py +0 -36
  261. tomwer/web/test/test_graylog_connection.py +0 -59
  262. {tomwer/slurm → orangecontrib/tomwer/tutorials}/__init__.py +0 -0
  263. /tomwer/{test → gui/control/serie}/__init__.py +0 -0
  264. /tomwer/{web/test → tests}/__init__.py +0 -0
  265. /tomwer/{test → tests}/utils/__init__.py +0 -0
  266. /tomwer-1.0.3-py3.8-nspkg.pth → /tomwer-1.1.0-py3.9-nspkg.pth +0 -0
  267. {tomwer-1.0.3.dist-info → tomwer-1.1.0.dist-info}/LICENSE +0 -0
  268. {tomwer-1.0.3.dist-info → tomwer-1.1.0.dist-info}/namespace_packages.txt +0 -0
  269. {tomwer-1.0.3.dist-info → tomwer-1.1.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,72 @@
1
+ import os
2
+ import pytest
3
+ import numpy
4
+ from tomoscan.esrf.scan.hdf5scan import ImageKey
5
+ from tomwer.core.scan.hdf5scan import HDF5TomoScan
6
+ from tomwer.gui.visualization.nxtomometadata import NXtomoMetadataViewer
7
+ from nxtomomill.nexus.nxtomo import NXtomo
8
+ from tomwer.tests.conftest import qtapp # noqa F401
9
+ from silx.gui import qt
10
+
11
+
12
+ def test_nx_editor(
13
+ tmp_path,
14
+ qtapp, # noqa F811
15
+ ):
16
+ # 1.0 create nx tomo with raw data
17
+ nx_tomo = NXtomo()
18
+ nx_tomo.instrument.detector.x_pixel_size = 2.6e-6
19
+ nx_tomo.instrument.detector.y_pixel_size = 2.5e-6
20
+ nx_tomo.instrument.detector.field_of_view = "Half"
21
+ nx_tomo.instrument.detector.distance = 59.0
22
+ nx_tomo.instrument.detector.x_flipped = True
23
+ nx_tomo.instrument.detector.y_flipped = False
24
+ nx_tomo.energy = 12.8
25
+ nx_tomo.sample.x_translation = numpy.arange(12)
26
+ nx_tomo.sample.z_translation = numpy.arange(2, 14)
27
+ nx_tomo.instrument.detector.image_key_control = [ImageKey.PROJECTION.value] * 12
28
+ nx_tomo.instrument.detector.data = numpy.empty(shape=(12, 10, 10))
29
+ nx_tomo.sample.rotation_angle = numpy.linspace(0, 180, num=12)
30
+
31
+ file_path = os.path.join(tmp_path, "nxtomo.nx")
32
+ entry = "entry0000"
33
+ nx_tomo.save(
34
+ file_path=file_path,
35
+ data_path=entry,
36
+ )
37
+
38
+ scan = HDF5TomoScan(file_path, entry)
39
+
40
+ # 2.0 create the widget and do the edition
41
+ widget = NXtomoMetadataViewer()
42
+ widget.setScan(scan=scan)
43
+ widget.show()
44
+
45
+ # 3.0 check data have been corrcetly loaded
46
+ def check_metric(expected_value, current_value):
47
+ if expected_value is None:
48
+ return current_value is None
49
+ return expected_value == current_value
50
+
51
+ assert check_metric(2.6e-6, widget._xPixelSizeMetricEntry.getValue())
52
+ assert widget._xPixelSizeMetricEntry._qcbUnit.currentText() == "m"
53
+ assert check_metric(2.5e-6, widget._yPixelSizeMetricEntry.getValue())
54
+ assert widget._yPixelSizeMetricEntry._qcbUnit.currentText() == "m"
55
+
56
+ assert check_metric(59, widget._distanceMetricEntry.getValue())
57
+ assert widget._distanceMetricEntry._qcbUnit.currentText() == "m"
58
+
59
+ assert "Half" == widget._fieldOfViewCB.currentText()
60
+ assert widget._xFlippedCB.isChecked()
61
+ assert not widget._yFlippedCB.isChecked()
62
+
63
+ assert "12.8" == widget._energyQLE.text()
64
+
65
+ # make sure saving raises an error (viewer inherit from the editor)
66
+ with pytest.raises(NotImplementedError):
67
+ widget.overwriteNXtomo()
68
+
69
+ # end
70
+ widget.setAttribute(qt.Qt.WA_DeleteOnClose)
71
+ widget.close()
72
+ widget = None
@@ -38,7 +38,7 @@ import logging
38
38
  import time
39
39
  import pytest
40
40
  from tomoscan.esrf.volume.edfvolume import EDFVolume
41
- from tomwer.test.utils import skip_gui_test
41
+ from tomwer.tests.utils import skip_gui_test
42
42
  import weakref
43
43
 
44
44
  logging.disable(logging.INFO)
@@ -0,0 +1,49 @@
1
+ from .volumeoverview import VolumeOverviewWidget
2
+ from .scanoverview import ScanOverviewWidget
3
+ from silx.gui import qt
4
+ from tomwer.core.tomwer_object import TomwerObject
5
+ from tomwer.core.volume.volumebase import TomwerVolumeBase
6
+ from tomwer.core.scan.scanbase import TomwerScanBase
7
+ from typing import Optional
8
+
9
+
10
+ class TomoObjOverview(qt.QWidget):
11
+ """
12
+ Dummy widget to show ScanOverviewWidget if the object is a scan or VolumeOverviewWidget if the object is a Volume
13
+ """
14
+
15
+ def __init__(self, parent=None) -> None:
16
+ super().__init__(parent)
17
+ self.setLayout(qt.QVBoxLayout())
18
+ self._scanOverview = ScanOverviewWidget(self)
19
+ self.layout().addWidget(self._scanOverview)
20
+
21
+ self._volumeOverview = VolumeOverviewWidget(self)
22
+ self.layout().addWidget(self._volumeOverview)
23
+
24
+ self._scanOverview.setVisible(False)
25
+ self._volumeOverview.setVisible(False)
26
+
27
+ def setTomoObj(self, tomo_obj: Optional[TomwerObject]):
28
+ """
29
+ update sub widgets according to the type of tomo_obj
30
+ """
31
+ if tomo_obj is not None and not isinstance(tomo_obj, TomwerObject):
32
+ raise TypeError(
33
+ f"tomo_obj is expected to be an instance of {TomwerObject} and not {type(tomo_obj)}"
34
+ )
35
+ # handle visibility
36
+ self._volumeOverview.setVisible(isinstance(tomo_obj, TomwerVolumeBase))
37
+ self._scanOverview.setVisible(isinstance(tomo_obj, TomwerScanBase))
38
+
39
+ if isinstance(tomo_obj, TomwerVolumeBase):
40
+ self._scanOverview.setScan(None)
41
+ self._volumeOverview.setVolume(tomo_obj)
42
+ elif isinstance(tomo_obj, TomwerScanBase):
43
+ self._scanOverview.setScan(tomo_obj)
44
+ self._volumeOverview.setVolume(None)
45
+ elif tomo_obj is None:
46
+ self._volumeOverview.setVolume(None)
47
+ self._scanOverview.setScan(None)
48
+ else:
49
+ raise RuntimeError(f"TomwerObject of type {type(tomo_obj)} is not handled")
@@ -0,0 +1,64 @@
1
+ from silx.gui import qt
2
+ from tomwer.core.volume.volumebase import TomwerVolumeBase
3
+ from tomoscan.identifier import VolumeIdentifier
4
+ from typing import Optional
5
+ import logging
6
+
7
+ _logger = logging.getLogger(__name__)
8
+
9
+
10
+ class VolumeOverviewWidget(qt.QWidget):
11
+ def __init__(self, parent=None):
12
+ super().__init__(parent)
13
+ self._volumeIdentifier = None
14
+ self.setLayout(qt.QVBoxLayout())
15
+ self._tree = qt.QTreeWidget(self)
16
+ self._tree.setColumnCount(2)
17
+ self._tree.setHeaderLabels(("metadata", "value"))
18
+ self.layout().addWidget(self._tree)
19
+
20
+ # 1: define translations
21
+ self._x_position = qt.QTreeWidgetItem(self._tree)
22
+ self._x_position.setText(0, "x position")
23
+ self._y_position = qt.QTreeWidgetItem(self._tree)
24
+ self._y_position.setText(0, "y position")
25
+ self._z_position = qt.QTreeWidgetItem(self._tree)
26
+ self._z_position.setText(0, "z position")
27
+
28
+ # 2. define pixel size
29
+ self._x_pixel_size = qt.QTreeWidgetItem(self._tree)
30
+ self._x_pixel_size.setText(0, "x pixel size")
31
+ self._y_pixel_size = qt.QTreeWidgetItem(self._tree)
32
+ self._y_pixel_size.setText(0, "y pixel size")
33
+
34
+ def setVolume(self, volume: Optional[TomwerVolumeBase]):
35
+ if volume is None:
36
+ self._x_position.setText(1, "")
37
+ self._y_position.setText(1, "")
38
+ self._z_position.setText(1, "")
39
+ self._x_pixel_size.setText(1, "")
40
+ self._y_pixel_size.setText(1, "")
41
+ elif not isinstance(volume, TomwerVolumeBase):
42
+ raise TypeError(
43
+ f"volume is expected to be a {TomwerVolumeBase} or a {VolumeIdentifier}. Not ({type(volume)}) "
44
+ )
45
+ else:
46
+ try:
47
+ x_pos, y_pos, z_pos = volume.position()
48
+ except Exception:
49
+ self._x_position.setText(1, "?")
50
+ self._y_position.setText(1, "?")
51
+ self._z_position.setText(1, "?")
52
+ else:
53
+ self._x_position.setText(1, x_pos)
54
+ self._y_position.setText(1, y_pos)
55
+ self._z_position.setText(1, z_pos)
56
+
57
+ try:
58
+ x_size, y_size = volume.pixel_size
59
+ except Exception:
60
+ self._x_pixel_size.setText(1, "?")
61
+ self._y_pixel_size.setText(1, "?")
62
+ else:
63
+ self._x_pixel_size.setText(1, x_size)
64
+ self._y_pixel_size.setText(1, y_size)
@@ -336,7 +336,7 @@ class VolumeViewer(qt.QMainWindow):
336
336
  pass
337
337
  else:
338
338
  raise TypeError(
339
- "Volume should be an instance of a Volume, a VolumeIdentifier or a string refering to a VolumeIdentifier"
339
+ f"Volume should be an instance of a Volume, a VolumeIdentifier or a string refering to a VolumeIdentifier. {type(volume)} provided"
340
340
  )
341
341
 
342
342
  data = self._get_data_volume(volume)
tomwer/io/utils/utils.py CHANGED
@@ -199,7 +199,7 @@ def get_linked_files_with_entry(hdf5_file: str, entry: str) -> set:
199
199
  while len(items_to_treat) > 0:
200
200
  to_treat = list(items_to_treat)
201
201
  items_to_treat.clear()
202
- for (abs_file_path, file_path, data_path) in to_treat:
202
+ for abs_file_path, file_path, data_path in to_treat:
203
203
  item = abs_file_path, data_path
204
204
  if item in treated_items:
205
205
  continue
@@ -250,7 +250,7 @@ def get_linked_files_with_vds(hdf5_file: str, dataset_path: str) -> set:
250
250
  while len(items_to_treat) > 0:
251
251
  to_treat = list(items_to_treat)
252
252
  items_to_treat.clear()
253
- for (abs_file_path, file_path, dataset_path) in to_treat:
253
+ for abs_file_path, file_path, dataset_path in to_treat:
254
254
  item = abs_file_path, dataset_path
255
255
  if item in treated_items:
256
256
  continue
@@ -0,0 +1,101 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <svg
3
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
4
+ xmlns:cc="http://creativecommons.org/ns#"
5
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
6
+ xmlns:svg="http://www.w3.org/2000/svg"
7
+ xmlns="http://www.w3.org/2000/svg"
8
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
9
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
10
+ version="1.1"
11
+ viewBox="0 0 32 32"
12
+ xml:space="preserve"
13
+ id="svg10"
14
+ sodipodi:docname="multi-document-save.svg"
15
+ inkscape:version="0.92.5 (2060ec1f9f, 2020-04-08)"
16
+ inkscape:export-filename="/media/payno/830add5c-f5d7-4db2-875e-03be4f0a67f0/dev/tomography/tomwer/tomwer/resources/gui/icons/multi-document-save.png"
17
+ inkscape:export-xdpi="134.50999"
18
+ inkscape:export-ydpi="134.50999"><metadata
19
+ id="metadata16"><rdf:RDF><cc:Work
20
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
21
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
22
+ id="defs14" /><sodipodi:namedview
23
+ pagecolor="#ffffff"
24
+ bordercolor="#666666"
25
+ borderopacity="1"
26
+ objecttolerance="10"
27
+ gridtolerance="10"
28
+ guidetolerance="10"
29
+ inkscape:pageopacity="0"
30
+ inkscape:pageshadow="2"
31
+ inkscape:window-width="1565"
32
+ inkscape:window-height="901"
33
+ id="namedview12"
34
+ showgrid="false"
35
+ inkscape:zoom="7.375"
36
+ inkscape:cx="12.75286"
37
+ inkscape:cy="22.157776"
38
+ inkscape:window-x="72"
39
+ inkscape:window-y="27"
40
+ inkscape:window-maximized="0"
41
+ inkscape:current-layer="svg10" /><g
42
+ id="g875"
43
+ transform="translate(7.7288136,-10.440678)"><path
44
+ style="stroke-width:0.73062545"
45
+ inkscape:connector-curvature="0"
46
+ id="path2"
47
+ d="m 22.169864,27.598717 c 0,0.193206 -0.170956,0.351283 -0.379902,0.351283 H 5.8219024 C 5.6129561,27.95 5.442,27.791923 5.442,27.598717 V 12.835685 c 0,-0.193206 0.1709561,-0.351283 0.3799024,-0.351283 H 18.184688 c 0.208946,0 0.498432,0.113816 0.643555,0.252924 l 3.077969,2.951482 c 0.144363,0.139108 0.263652,0.411002 0.263652,0.604207 z" /><path
48
+ style="fill:#ffffff;stroke-width:0.73062545"
49
+ inkscape:connector-curvature="0"
50
+ id="path4"
51
+ d="m 20.430671,25.582351 c 0,0.115923 -0.102574,0.21077 -0.227941,0.21077 H 7.6629097 c -0.1253678,0 -0.2279415,-0.09485 -0.2279415,-0.21077 v -4.928505 c 0,-0.115923 0.1025737,-0.21077 0.2279415,-0.21077 H 20.20273 c 0.125367,0 0.227941,0.09485 0.227941,0.21077 z" /><path
52
+ style="fill:#ffffff;stroke-width:0.73062545"
53
+ inkscape:connector-curvature="0"
54
+ id="path6"
55
+ d="m 17.206059,16.267723 c 0,0.115923 -0.102574,0.21077 -0.227941,0.21077 H 7.6629097 c -0.1253678,0 -0.2279415,-0.09485 -0.2279415,-0.21077 v -3.800885 c 0,-0.115924 0.1025737,-0.21077 0.2279415,-0.21077 h 9.3152083 c 0.125367,0 0.227941,0.09485 0.227941,0.21077 z" /><rect
56
+ style="stroke-width:0.73062545"
57
+ id="rect8"
58
+ height="3.0048773"
59
+ width="1.6229432"
60
+ y="12.484402"
61
+ x="13.024853" /></g><g
62
+ transform="translate(2.194068,-3.5606607)"
63
+ id="g875-2"><path
64
+ style="stroke-width:0.73062545"
65
+ inkscape:connector-curvature="0"
66
+ id="path2-7"
67
+ d="m 22.169864,27.598717 c 0,0.193206 -0.170956,0.351283 -0.379902,0.351283 H 5.8219024 C 5.6129561,27.95 5.442,27.791923 5.442,27.598717 V 12.835685 c 0,-0.193206 0.1709561,-0.351283 0.3799024,-0.351283 H 18.184688 c 0.208946,0 0.498432,0.113816 0.643555,0.252924 l 3.077969,2.951482 c 0.144363,0.139108 0.263652,0.411002 0.263652,0.604207 z" /><path
68
+ style="fill:#ffffff;stroke-width:0.73062545"
69
+ inkscape:connector-curvature="0"
70
+ id="path4-0"
71
+ d="m 20.430671,25.582351 c 0,0.115923 -0.102574,0.21077 -0.227941,0.21077 H 7.6629097 c -0.1253678,0 -0.2279415,-0.09485 -0.2279415,-0.21077 v -4.928505 c 0,-0.115923 0.1025737,-0.21077 0.2279415,-0.21077 H 20.20273 c 0.125367,0 0.227941,0.09485 0.227941,0.21077 z" /><path
72
+ style="fill:#ffffff;stroke-width:0.73062545"
73
+ inkscape:connector-curvature="0"
74
+ id="path6-9"
75
+ d="m 17.206059,16.267723 c 0,0.115923 -0.102574,0.21077 -0.227941,0.21077 H 7.6629097 c -0.1253678,0 -0.2279415,-0.09485 -0.2279415,-0.21077 v -3.800885 c 0,-0.115924 0.1025737,-0.21077 0.2279415,-0.21077 h 9.3152083 c 0.125367,0 0.227941,0.09485 0.227941,0.21077 z" /><rect
76
+ style="stroke-width:0.73062545"
77
+ id="rect8-3"
78
+ height="3.0048773"
79
+ width="1.6229432"
80
+ y="12.484402"
81
+ x="13.024853" /></g><g
82
+ transform="translate(-3.9076269,2.6766275)"
83
+ id="g875-6"><path
84
+ style="stroke-width:0.73062545"
85
+ inkscape:connector-curvature="0"
86
+ id="path2-0"
87
+ d="m 22.169864,27.598717 c 0,0.193206 -0.170956,0.351283 -0.379902,0.351283 H 5.8219024 C 5.6129561,27.95 5.442,27.791923 5.442,27.598717 V 12.835685 c 0,-0.193206 0.1709561,-0.351283 0.3799024,-0.351283 H 18.184688 c 0.208946,0 0.498432,0.113816 0.643555,0.252924 l 3.077969,2.951482 c 0.144363,0.139108 0.263652,0.411002 0.263652,0.604207 z" /><path
88
+ style="fill:#ffffff;stroke-width:0.73062545"
89
+ inkscape:connector-curvature="0"
90
+ id="path4-6"
91
+ d="m 20.430671,25.582351 c 0,0.115923 -0.102574,0.21077 -0.227941,0.21077 H 7.6629097 c -0.1253678,0 -0.2279415,-0.09485 -0.2279415,-0.21077 v -4.928505 c 0,-0.115923 0.1025737,-0.21077 0.2279415,-0.21077 H 20.20273 c 0.125367,0 0.227941,0.09485 0.227941,0.21077 z" /><path
92
+ style="fill:#ffffff;stroke-width:0.73062545"
93
+ inkscape:connector-curvature="0"
94
+ id="path6-2"
95
+ d="m 17.206059,16.267723 c 0,0.115923 -0.102574,0.21077 -0.227941,0.21077 H 7.6629097 c -0.1253678,0 -0.2279415,-0.09485 -0.2279415,-0.21077 v -3.800885 c 0,-0.115924 0.1025737,-0.21077 0.2279415,-0.21077 h 9.3152083 c 0.125367,0 0.227941,0.09485 0.227941,0.21077 z" /><rect
96
+ style="stroke-width:0.73062545"
97
+ id="rect8-6"
98
+ height="3.0048773"
99
+ width="1.6229432"
100
+ y="12.484402"
101
+ x="13.024853" /></g></svg>