tomwer 1.0.4__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 (256) 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 +4 -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 -128
  20. orangecontrib/tomwer/widgets/control/NotifierOW.py +31 -7
  21. orangecontrib/tomwer/widgets/control/SingleTomoObjOW.py +3 -5
  22. orangecontrib/tomwer/widgets/control/TomoObjSerieOW.py +85 -0
  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 +138 -0
  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 -10
  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 -18
  47. orangecontrib/tomwer/widgets/reconstruction/SADeltaBetaOW.py +24 -17
  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/nxtomoeditor.py +103 -0
  66. tomwer/app/rsync.py +1 -1
  67. tomwer/core/cluster/cluster.py +1 -1
  68. tomwer/core/futureobject.py +1 -0
  69. tomwer/core/process/control/datalistener/datalistener.py +7 -1
  70. tomwer/core/process/control/datalistener/rpcserver.py +3 -3
  71. tomwer/core/process/control/datawatcher/datawatcher.py +18 -18
  72. tomwer/core/process/control/datawatcher/datawatcherobserver.py +5 -8
  73. tomwer/core/process/control/datawatcher/datawatcherprocess.py +2 -3
  74. tomwer/core/process/control/datawatcher/edfdwprocess.py +2 -2
  75. tomwer/core/process/control/nxtomomill.py +33 -58
  76. tomwer/core/process/control/scanlist.py +2 -1
  77. tomwer/core/process/control/scanselector.py +7 -0
  78. tomwer/core/process/control/scantransfer.py +9 -18
  79. tomwer/core/process/control/scanvalidator.py +6 -5
  80. tomwer/core/process/control/singletomoobj.py +2 -1
  81. tomwer/core/process/control/timer.py +2 -1
  82. tomwer/core/process/control/tomoobjserie.py +8 -0
  83. tomwer/core/process/control/volumeselector.py +2 -1
  84. tomwer/core/process/control/volumesymlink.py +2 -1
  85. tomwer/core/process/edit/darkflatpatch.py +2 -1
  86. tomwer/core/process/edit/imagekeyeditor.py +4 -3
  87. tomwer/core/process/reconstruction/axis/axis.py +29 -32
  88. tomwer/core/process/reconstruction/axis/mode.py +3 -2
  89. tomwer/core/process/reconstruction/axis/params.py +35 -16
  90. tomwer/core/process/reconstruction/darkref/darkrefs.py +90 -707
  91. tomwer/core/process/reconstruction/darkref/darkrefscopy.py +44 -16
  92. tomwer/core/process/reconstruction/darkref/params.py +62 -67
  93. tomwer/core/process/reconstruction/lamino/tofu.py +1 -1
  94. tomwer/core/process/reconstruction/nabu/castvolume.py +21 -26
  95. tomwer/core/process/reconstruction/nabu/nabucommon.py +36 -38
  96. tomwer/core/process/reconstruction/nabu/nabuscores.py +28 -13
  97. tomwer/core/process/reconstruction/nabu/nabuslices.py +41 -14
  98. tomwer/core/process/reconstruction/nabu/nabuvolume.py +21 -12
  99. tomwer/core/process/reconstruction/nabu/utils.py +12 -1
  100. tomwer/core/process/reconstruction/normalization/normalization.py +9 -8
  101. tomwer/core/process/reconstruction/saaxis/saaxis.py +46 -20
  102. tomwer/core/process/reconstruction/sadeltabeta/sadeltabeta.py +38 -12
  103. tomwer/core/process/reconstruction/test/__init__.py +0 -39
  104. tomwer/core/process/reconstruction/test/test_axis_params.py +25 -3
  105. tomwer/core/process/reconstruction/test/test_darkref_copy.py +117 -1
  106. tomwer/core/process/script/python.py +16 -12
  107. tomwer/core/process/task.py +3 -7
  108. tomwer/core/process/test/test_axis.py +1 -1
  109. tomwer/core/process/test/test_dark_and_flat.py +41 -111
  110. tomwer/core/process/test/test_data_listener.py +0 -29
  111. tomwer/core/process/test/test_data_transfer.py +10 -14
  112. tomwer/core/process/test/test_nabu.py +1 -1
  113. tomwer/core/process/test/test_normalization.py +1 -1
  114. tomwer/core/process/visualization/liveslice.py +6 -0
  115. tomwer/core/scan/blissscan.py +37 -2
  116. tomwer/core/scan/edfscan.py +14 -4
  117. tomwer/core/scan/hdf5scan.py +10 -4
  118. tomwer/core/scan/scanbase.py +35 -29
  119. tomwer/core/scan/scanfactory.py +3 -17
  120. tomwer/core/scan/test/test_h5.py +1 -1
  121. tomwer/core/scan/test/test_process_registration.py +0 -11
  122. tomwer/core/scan/test/test_scan.py +32 -30
  123. tomwer/core/settings.py +2 -2
  124. tomwer/core/test/test_utils.py +1 -1
  125. tomwer/core/tomwer_object.py +19 -0
  126. tomwer/core/utils/__init__.py +0 -45
  127. tomwer/core/utils/char.py +2 -0
  128. tomwer/core/utils/gpu.py +5 -5
  129. tomwer/core/utils/nxtomoutils.py +2 -2
  130. tomwer/core/utils/scanutils.py +50 -0
  131. tomwer/core/utils/volumeutils.py +13 -0
  132. tomwer/core/volume/edfvolume.py +4 -0
  133. tomwer/core/volume/hdf5volume.py +4 -0
  134. tomwer/core/volume/jp2kvolume.py +4 -0
  135. tomwer/core/volume/rawvolume.py +4 -0
  136. tomwer/core/volume/tiffvolume.py +4 -0
  137. tomwer/core/volume/volumebase.py +19 -12
  138. tomwer/core/volume/volumefactory.py +20 -1
  139. tomwer/gui/cluster/slurm.py +1 -1
  140. tomwer/gui/cluster/test/test_cluster.py +2 -2
  141. tomwer/gui/control/datalist.py +109 -34
  142. tomwer/gui/control/datatransfert.py +1 -1
  143. tomwer/gui/control/datawatcher/datawatcher.py +23 -13
  144. tomwer/gui/control/datawatcher/datawatcherobserver.py +1 -1
  145. tomwer/gui/control/observations.py +0 -3
  146. tomwer/gui/control/selectorwidgetbase.py +42 -11
  147. tomwer/gui/control/serie/seriecreator.py +967 -0
  148. tomwer/{web/__init__.py → gui/control/serie/seriewaiter.py} +5 -7
  149. tomwer/gui/control/singletomoobj.py +15 -3
  150. tomwer/gui/control/test/test_datalist.py +1 -1
  151. tomwer/gui/control/test/test_datalistener.py +1 -1
  152. tomwer/gui/control/test/test_inputwidget.py +1 -1
  153. tomwer/gui/control/test/test_process_manager.py +1 -13
  154. tomwer/gui/control/test/test_scanselector.py +1 -1
  155. tomwer/gui/control/test/test_scanvalidator.py +1 -1
  156. tomwer/gui/control/test/test_single_tomo_obj.py +1 -1
  157. tomwer/gui/control/test/test_volume_dialog.py +19 -7
  158. tomwer/gui/control/test/test_volumeselector.py +4 -4
  159. tomwer/gui/debugtools/datasetgenerator.py +1 -8
  160. tomwer/gui/edit/dkrfpatch.py +2 -2
  161. tomwer/gui/edit/imagekeyeditor.py +12 -9
  162. tomwer/gui/edit/nxtomoeditor.py +475 -0
  163. tomwer/gui/edit/test/test_dkrf_patch.py +2 -14
  164. tomwer/gui/edit/test/test_image_key_editor.py +2 -2
  165. tomwer/gui/edit/test/test_nx_editor.py +155 -0
  166. tomwer/gui/qfolderdialog.py +11 -0
  167. tomwer/gui/reconstruction/axis/CompareImages.py +27 -29
  168. tomwer/gui/reconstruction/axis/axis.py +2 -0
  169. tomwer/gui/reconstruction/axis/radioaxis.py +67 -11
  170. tomwer/gui/reconstruction/darkref/darkrefcopywidget.py +7 -9
  171. tomwer/gui/reconstruction/darkref/darkrefwidget.py +22 -24
  172. tomwer/gui/reconstruction/lamino/tofu/projections.py +1 -1
  173. tomwer/gui/reconstruction/lamino/tofu/tofu.py +3 -3
  174. tomwer/gui/reconstruction/lamino/tofu/tofuexpert.py +4 -4
  175. tomwer/gui/reconstruction/lamino/tofu/tofuoutput.py +10 -4
  176. tomwer/gui/reconstruction/nabu/castvolume.py +80 -11
  177. tomwer/gui/reconstruction/nabu/check.py +1 -1
  178. tomwer/gui/reconstruction/nabu/nabuconfig/ctf.py +352 -0
  179. tomwer/gui/reconstruction/nabu/nabuconfig/nabuconfig.py +0 -9
  180. tomwer/gui/reconstruction/nabu/nabuconfig/output.py +1 -1
  181. tomwer/gui/reconstruction/nabu/nabuconfig/phase.py +18 -19
  182. tomwer/gui/reconstruction/nabu/nabuconfig/preprocessing.py +30 -7
  183. tomwer/gui/reconstruction/nabu/nabuconfig/reconstruction.py +26 -13
  184. tomwer/gui/reconstruction/nabu/slices.py +10 -2
  185. tomwer/gui/reconstruction/nabu/slurm.py +1 -1
  186. tomwer/gui/reconstruction/nabu/volume.py +13 -7
  187. tomwer/gui/reconstruction/normalization/intensity.py +1 -1
  188. tomwer/gui/reconstruction/saaxis/corrangeselector.py +10 -34
  189. tomwer/gui/reconstruction/saaxis/saaxis.py +11 -6
  190. tomwer/gui/reconstruction/saaxis/sliceselector.py +11 -26
  191. tomwer/gui/reconstruction/sadeltabeta/saadeltabeta.py +13 -8
  192. tomwer/gui/reconstruction/scores/scoreplot.py +67 -61
  193. tomwer/gui/reconstruction/test/test_axis.py +2 -2
  194. tomwer/gui/reconstruction/test/test_lamino.py +2 -2
  195. tomwer/gui/reconstruction/test/test_nabu.py +14 -1
  196. tomwer/gui/reconstruction/test/test_saaxis.py +8 -17
  197. tomwer/gui/reconstruction/test/test_sadeltabeta.py +7 -13
  198. tomwer/gui/stackplot.py +11 -28
  199. tomwer/gui/test/test_axis_gui.py +4 -4
  200. tomwer/gui/test/test_qfolder_dialog.py +12 -0
  201. tomwer/gui/utils/inputwidget.py +42 -21
  202. tomwer/gui/utils/lineselector/lineselector.py +13 -21
  203. tomwer/gui/utils/scandescription.py +2 -4
  204. tomwer/gui/utils/slider.py +1 -102
  205. tomwer/gui/utils/unitsystem.py +48 -11
  206. tomwer/gui/visualization/dataviewer.py +24 -17
  207. tomwer/gui/visualization/diffviewer/diffviewer.py +2 -11
  208. tomwer/gui/visualization/nxtomometadata.py +21 -0
  209. tomwer/gui/visualization/scanoverview.py +0 -1
  210. tomwer/gui/visualization/test/test_nx_tomo_metadata_viewer.py +72 -0
  211. tomwer/gui/visualization/test/test_stacks.py +1 -1
  212. tomwer/gui/visualization/tomoobjoverview.py +49 -0
  213. tomwer/gui/visualization/volumeoverview.py +64 -0
  214. tomwer/gui/visualization/volumeviewer.py +1 -1
  215. tomwer/resources/gui/icons/multi-document-save.png +0 -0
  216. tomwer/resources/gui/icons/multi-document-save.svg +101 -0
  217. tomwer/resources/gui/illustrations/ctf_z1.png +0 -0
  218. tomwer/resources/gui/illustrations/ctf_z1.svg +471 -0
  219. tomwer/synctools/datalistener.py +5 -1
  220. tomwer/synctools/imageloaderthread.py +2 -2
  221. tomwer/synctools/stacks/edit/imagekeyeditor.py +1 -1
  222. tomwer/synctools/stacks/processingstack.py +2 -2
  223. tomwer/synctools/stacks/reconstruction/castvolume.py +1 -0
  224. tomwer/synctools/stacks/reconstruction/lamino.py +1 -3
  225. tomwer/synctools/stacks/reconstruction/sadeltabeta.py +0 -2
  226. tomwer/synctools/test/test_darkRefs.py +32 -149
  227. tomwer/synctools/test/test_foldertransfer.py +1 -1
  228. tomwer/synctools/test/test_scanstages.py +2 -2
  229. tomwer/tests/__init__.py +0 -0
  230. tomwer/tests/conftest.py +51 -0
  231. tomwer/{test → tests}/test_scripts.py +1 -1
  232. tomwer/tests/test_utils.py +10 -0
  233. tomwer/{test → tests}/utils/utilstest.py +0 -11
  234. tomwer/version.py +3 -3
  235. {tomwer-1.0.4.dist-info → tomwer-1.1.0.dist-info}/METADATA +14 -16
  236. {tomwer-1.0.4.dist-info → tomwer-1.1.0.dist-info}/RECORD +245 -217
  237. {tomwer-1.0.4.dist-info → tomwer-1.1.0.dist-info}/WHEEL +1 -1
  238. {tomwer-1.0.4.dist-info → tomwer-1.1.0.dist-info}/entry_points.txt +6 -0
  239. orangecontrib/tomwer/setup.py +0 -45
  240. orangecontrib/tomwer/widgets/setup.py +0 -49
  241. tomwer/app/process.py +0 -153
  242. tomwer/core/process/reconstruction/nabu/slurm.py +0 -36
  243. tomwer/core/process/reconstruction/utils/nabu_slice_exec.py +0 -10
  244. tomwer/core/utils/laminoutils.py +0 -80
  245. tomwer/gui/utils/lineselector/lineselection.py +0 -76
  246. tomwer/setup.py +0 -52
  247. tomwer/web/client.py +0 -43
  248. tomwer/web/config.py +0 -36
  249. tomwer/web/test/test_graylog_connection.py +0 -59
  250. {tomwer/test → orangecontrib/tomwer/tutorials}/__init__.py +0 -0
  251. /tomwer/{web/test → gui/control/serie}/__init__.py +0 -0
  252. /tomwer/{test → tests}/utils/__init__.py +0 -0
  253. /tomwer-1.0.4-py3.8-nspkg.pth → /tomwer-1.1.0-py3.9-nspkg.pth +0 -0
  254. {tomwer-1.0.4.dist-info → tomwer-1.1.0.dist-info}/LICENSE +0 -0
  255. {tomwer-1.0.4.dist-info → tomwer-1.1.0.dist-info}/namespace_packages.txt +0 -0
  256. {tomwer-1.0.4.dist-info → tomwer-1.1.0.dist-info}/top_level.txt +0 -0
@@ -35,16 +35,13 @@ from orangewidget.settings import Setting
35
35
  from orangewidget.widget import Output
36
36
  from tomwer.core.scan.scanbase import TomwerScanBase
37
37
  from tomwer.gui.control.datawatcher import DataWatcherWidget
38
- from tomwer.web.client import OWClient
39
38
  import functools
40
39
  import logging
41
40
 
42
41
  logger = logging.getLogger(__name__)
43
42
 
44
43
 
45
- class DataWatcherOW(
46
- widget.OWBaseWidget, OWClient, WidgetLongProcessing, openclass=True
47
- ):
44
+ class DataWatcherOW(widget.OWBaseWidget, WidgetLongProcessing, openclass=True):
48
45
  """
49
46
  This widget is used to observe a selected folder and his sub-folders to
50
47
  detect if they are containing valid-finished acquisitions.
@@ -78,7 +75,9 @@ class DataWatcherOW(
78
75
 
79
76
  DEFAULT_DIRECTORY = "/lbsram/data/visitor"
80
77
 
81
- ewokstaskclass = tomwer.core.process.control.datawatcher.datawatcher.DataWatcher
78
+ ewokstaskclass = (
79
+ tomwer.core.process.control.datawatcher.datawatcher.DataWatcherEwoksTask
80
+ )
82
81
 
83
82
  class Outputs:
84
83
  data = Output(name="data", type=TomwerScanBase)
@@ -93,7 +92,6 @@ class DataWatcherOW(
93
92
  :param parent: the parent widget
94
93
  """
95
94
  widget.OWBaseWidget.__init__(self, parent)
96
- OWClient.__init__(self)
97
95
  WidgetLongProcessing.__init__(self)
98
96
  self._widget = DataWatcherWidget(parent=self)
99
97
  self._widget.setFolderObserved(self.folderObserved)
@@ -28,7 +28,6 @@ __license__ = "MIT"
28
28
  __date__ = "11/03/2020"
29
29
 
30
30
  from copy import copy
31
- import os
32
31
  from orangewidget import gui
33
32
  from tomwer.core.scan.edfscan import EDFTomoScan
34
33
  from orangecontrib.tomwer.orange.managedprocess import TomwerWithStackStack
@@ -37,8 +36,7 @@ from tomwer.gui.control.datalist import (
37
36
  EDFDataListMainWindow,
38
37
  )
39
38
  from nxtomomill.io.config import TomoEDFConfig as EDFConfig
40
- from .NXTomomillOW import _NXTomoMixIn
41
- from tomwer.gui.control.nxtomomill import NXTomomillInput
39
+ from orangecontrib.tomwer.widgets.control.NXTomomillMixIn import NXTomomillMixIn
42
40
  from tomwer.core.process.control.nxtomomill import EDFToNxProcess
43
41
  from silx.gui import qt
44
42
  import logging
@@ -46,7 +44,11 @@ import logging
46
44
  logger = logging.getLogger(__name__)
47
45
 
48
46
 
49
- class EDF2NXOW(TomwerWithStackStack, _NXTomoMixIn, ewokstaskclass=EDFToNxProcess):
47
+ class EDF2NXOW(
48
+ TomwerWithStackStack,
49
+ NXTomomillMixIn,
50
+ ewokstaskclass=EDFToNxProcess,
51
+ ):
50
52
  """
51
53
  Widget to allow user to pick some bliss files and that will convert them
52
54
  to HDF5scan.
@@ -74,12 +76,16 @@ class EDF2NXOW(TomwerWithStackStack, _NXTomoMixIn, ewokstaskclass=EDFToNxProcess
74
76
  resizing_enabled = True
75
77
  compress_signal = False
76
78
 
79
+ CONFIG_CLS = EDFConfig
80
+
81
+ LOGGER = logger
82
+
77
83
  def __init__(self, parent=None):
78
84
  self.__configuration_cache = None
79
85
  # cache updated for each folder in order to match `_execute_ewoks_task` design
80
86
 
81
87
  TomwerWithStackStack.__init__(self, parent=parent)
82
- _NXTomoMixIn.__init__(self)
88
+ NXTomomillMixIn.__init__(self)
83
89
  _layout = gui.vBox(self.mainArea, self.name).layout()
84
90
  self.widget = EDFDataListMainWindow(parent=self)
85
91
  _layout.addWidget(self.widget)
@@ -109,8 +115,7 @@ class EDF2NXOW(TomwerWithStackStack, _NXTomoMixIn, ewokstaskclass=EDFToNxProcess
109
115
  self._loadSettings()
110
116
 
111
117
  def _updateSettings(self):
112
- super()._updateSettings()
113
- self._static_input[
118
+ self._ewoks_default_inputs[ # pylint: disable=E1137
114
119
  "convert_auto_edfscan_channel"
115
120
  ] = self.convertAutoEDFScanReceivedFromChannel()
116
121
 
@@ -120,59 +125,26 @@ class EDF2NXOW(TomwerWithStackStack, _NXTomoMixIn, ewokstaskclass=EDFToNxProcess
120
125
  def setConvertAutoEDFScanReceivedFromChannel(self, checked: bool):
121
126
  self._convertAutoCB.setChecked(checked)
122
127
 
123
- def add(self, folder):
124
- self.widget.add(folder)
125
-
126
- def _saveNXTomoCfgFile(self, cfg_file):
127
- """save the nxtomofile to the setttings"""
128
- self._nxtomo_cfg_file = cfg_file
129
- self._static_input["nxtomomill_cfg_file"] = cfg_file
130
-
131
- if os.path.exists(cfg_file):
132
- try:
133
- configuration = EDFConfig.from_cfg_file(cfg_file)
134
- except Exception as e:
135
- logger.error(
136
- "Fail to use configuration file {}."
137
- "Error is {}. No conversion will be done."
138
- "".format(cfg_file, e)
139
- )
140
- else:
141
- self.update_default_inputs(
142
- edf_to_nx_configuration=configuration.to_dict()
143
- )
144
- else:
145
- self.update_default_inputs(edf_to_nx_configuration=EDFConfig().to_dict())
146
-
147
- def _sendSelected(self):
148
- self._inputGUI = NXTomomillInput()
149
- # reset the GUI for input (reset all the cache for answers)
150
- self._canOverwriteOutputs = False
151
- for scan_id in self.widget.datalist._myitems:
152
- tomo_obj = self.widget.datalist.getEDFTomoScan(scan_id, None)
153
- if tomo_obj:
154
- self._convertAndSend(tomo_obj)
155
-
156
- def _sendAll(self):
157
- self._inputGUI = NXTomomillInput()
158
- # reset the GUI for input (reset all the cache for answers)
159
- self._canOverwriteOutputs = False
160
- for scan_id in self.widget.datalist._myitems:
161
- tomo_obj = self.widget.datalist.getEDFTomoScan(scan_id, None)
162
- if tomo_obj:
163
- self._convertAndSend(tomo_obj)
164
-
165
128
  def _loadSettings(self):
166
- for scan in self._scans:
129
+ for scan in self._scans: # pylint: disable=E1133
167
130
  self.widget.add(scan)
168
- if "nxtomomill_cfg_file" in self._static_input:
169
- self._nxtomo_cfg_file = self._static_input["nxtomomill_cfg_file"]
131
+ if "nxtomomill_cfg_file" in self._ewoks_default_inputs: # pylint: disable=E1135
132
+ self._nxtomo_cfg_file = self._ewoks_default_inputs[ # pylint: disable=E1136
133
+ "nxtomomill_cfg_file"
134
+ ]
170
135
  self.widget.setCFGFilePath(self._nxtomo_cfg_file)
171
- if "output_dir" in self._static_input:
172
- self.widget.setOutputFolder(self._static_input["output_dir"])
173
- if "convert_auto_edfscan_channel" in self._static_input:
136
+ if "output_dir" in self._ewoks_default_inputs: # pylint: disable=E1135
137
+ self.widget.setOutputFolder(
138
+ self._ewoks_default_inputs["output_dir"] # pylint: disable=E1136
139
+ )
140
+ if (
141
+ "convert_auto_edfscan_channel"
142
+ in self._ewoks_default_inputs # pylint: disable=E1135
143
+ ):
174
144
  self.setConvertAutoEDFScanReceivedFromChannel(
175
- self._static_input["convert_auto_edfscan_channel"]
145
+ self._ewoks_default_inputs[ # pylint: disable=E1136
146
+ "convert_auto_edfscan_channel"
147
+ ]
176
148
  )
177
149
 
178
150
  def _convertAndSend(self, edf_scan: EDFTomoScan):
@@ -192,7 +164,9 @@ class EDF2NXOW(TomwerWithStackStack, _NXTomoMixIn, ewokstaskclass=EDFToNxProcess
192
164
  self.__configuration_cache.dataset_basename = edf_scan.dataset_basename
193
165
 
194
166
  output_file = EDFToNxProcess.deduce_output_file_path(
195
- folder_path=edf_scan.path, output_dir=self.widget.getOutputFolder()
167
+ folder_path=edf_scan.path,
168
+ output_dir=self.widget.getOutputFolder(),
169
+ scan=edf_scan,
196
170
  )
197
171
  output_entry = "entry"
198
172
  self.__configuration_cache.output_file = output_file
@@ -240,8 +214,21 @@ class EDF2NXOW(TomwerWithStackStack, _NXTomoMixIn, ewokstaskclass=EDFToNxProcess
240
214
  except Exception as e:
241
215
  logger.error(f"failed to handle task finished callback. Raiseon is {e}")
242
216
 
243
- def _get_task_arguments(self):
244
- adict = super()._get_task_arguments()
245
- # pop progress as does not fully exists on the orange-widget-base
246
- adict.pop("progress", None)
247
- return adict
217
+ def _saveNXTomoCfgFile(self, cfg_file):
218
+ super()._saveNXTomoCfgFile(cfg_file, keyword="edf_to_nx_configuration")
219
+
220
+ def _sendSelected(self):
221
+ """send all selected items to be converted"""
222
+ self._canOverwriteOutputs = False
223
+ for scan_id in self.widget.datalist._myitems:
224
+ tomo_obj = self.widget.datalist.getEDFTomoScan(scan_id, None)
225
+ if tomo_obj:
226
+ self._convertAndSend(tomo_obj)
227
+
228
+ def _sendAll(self):
229
+ """send all items to be converted"""
230
+ self._canOverwriteOutputs = False
231
+ for scan_id in self.widget.datalist._myitems:
232
+ tomo_obj = self.widget.datalist.getEDFTomoScan(scan_id, None)
233
+ if tomo_obj:
234
+ self._convertAndSend(tomo_obj)
@@ -33,7 +33,6 @@ from orangewidget import gui
33
33
  import tomwer.core.process.conditions.filters
34
34
  from orangecontrib.tomwer.orange.managedprocess import SuperviseOW
35
35
  from orangewidget.widget import Input, Output
36
- from tomwer.web.client import OWClient
37
36
  from tomwer.gui.conditions.filter import FileNameFilterWidget
38
37
  from tomwer.core.scan.scanbase import TomwerScanBase
39
38
  from processview.core.manager import DatasetState
@@ -44,7 +43,7 @@ import logging
44
43
  logger = logging.getLogger(__name__)
45
44
 
46
45
 
47
- class NameFilterOW(SuperviseOW, OWClient):
46
+ class NameFilterOW(SuperviseOW):
48
47
  name = "scan filter"
49
48
  id = "orange.widgets.tomwer.filterow"
50
49
  description = (
@@ -69,8 +68,7 @@ class NameFilterOW(SuperviseOW, OWClient):
69
68
 
70
69
  def __init__(self, parent=None):
71
70
  """ """
72
- SuperviseOW.__init__(self, parent)
73
- OWClient.__init__(self)
71
+ super().__init__(parent)
74
72
 
75
73
  self.widget = FileNameFilterWidget(parent=self)
76
74
  self.widget.setContentsMargins(0, 0, 0, 0)
@@ -0,0 +1,93 @@
1
+ import os
2
+ import logging
3
+ from orangewidget.settings import Setting
4
+
5
+ _logger = logging.getLogger(__name__)
6
+
7
+
8
+ class NXTomomillMixIn:
9
+ """
10
+ MixIn class for nxtomomill + ewoks
11
+ """
12
+
13
+ _scans = Setting(list())
14
+
15
+ _ewoks_default_inputs = Setting(dict())
16
+
17
+ CONFIG_CLS = None
18
+ # logger to be used. Expected to be redefine by child class
19
+
20
+ LOGGER = None
21
+ # logger to be used. Expected to be redefine by child class
22
+
23
+ def __init__(self, *args, **kwargs) -> None:
24
+ self.__configuration_cache = None
25
+ # cache updated for each folder in order to match `_execute_ewoks_task` design
26
+
27
+ def add(self, *args, **kwargs):
28
+ self.widget.add(*args, **kwargs)
29
+
30
+ def _updateSettings(self):
31
+ raise NotImplementedError("Base class")
32
+
33
+ def _saveNXTomoCfgFile(self, cfg_file, keyword: str):
34
+ """save the nxtomofile to the setttings"""
35
+ assert (
36
+ self.CONFIG_CLS is not None
37
+ ), "inheriting classes are expected to redefine CONFIG_CLS"
38
+ self._ewoks_default_inputs[
39
+ "nxtomomill_cfg_file"
40
+ ] = cfg_file # pylint: disable=E1137
41
+
42
+ if os.path.exists(cfg_file):
43
+ try:
44
+ configuration = self.CONFIG_CLS.from_cfg_file(
45
+ cfg_file
46
+ ) # pylint: disable=E1102
47
+ except Exception as e:
48
+ self._logger.error(
49
+ "Fail to use configuration file {}."
50
+ "Error is {}. No conversion will be done."
51
+ "".format(cfg_file, e)
52
+ )
53
+ else:
54
+ default_inputs = {
55
+ keyword: configuration.to_dict(),
56
+ }
57
+ else:
58
+ default_inputs = {
59
+ keyword: self.CONFIG_CLS().to_dict(), # pylint: disable=E1102
60
+ }
61
+
62
+ # hack: try to upgrade x_pixel_keys and y_pixels keys to list.
63
+ # otherwise has they have the same values and are tuples they have the same id and orange raises an
64
+ # dump_literals raise a ValueError - check_relaxed - is a recursive structure
65
+ try:
66
+ default_inputs[keyword]["KEYS_SECTION"]["x_pixel_keys"] = list(
67
+ default_inputs[keyword]["KEYS_SECTION"]["x_pixel_keys"]
68
+ )
69
+ default_inputs[keyword]["KEYS_SECTION"]["y_pixel_keys"] = list(
70
+ default_inputs[keyword]["KEYS_SECTION"]["y_pixel_keys"]
71
+ )
72
+ except KeyError:
73
+ pass
74
+
75
+ self.update_default_inputs(
76
+ **default_inputs,
77
+ )
78
+
79
+ def _get_task_arguments(self):
80
+ adict = super()._get_task_arguments()
81
+ # pop progress as does not fully exists on the orange-widget-base
82
+ adict.pop("progress", None)
83
+ return adict
84
+
85
+ def __new__(cls, *args, **kwargs):
86
+ # ensure backward compatibility with 'static_input'
87
+ static_input = kwargs.get("stored_settings", {}).get("static_input", None)
88
+ if static_input not in (None, {}):
89
+ _logger.warning(
90
+ "static_input has been deprecated. Will be replaced by _ewoks_default_inputs in the workflow file. Please save the workflow to apply modifications"
91
+ )
92
+ kwargs["stored_settings"]["_ewoks_default_inputs"] = static_input
93
+ return super().__new__(cls, *args, **kwargs)