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
@@ -28,9 +28,8 @@ __license__ = "MIT"
28
28
  __date__ = "30/07/2020"
29
29
 
30
30
 
31
+ from tomwer.core.utils.scanutils import format_output_location
31
32
  from tomwer.core.process.task import TaskWithProgress
32
- from tomwer.core.process.task import Task
33
- from tomwer.core.scan.blissscan import BlissScan
34
33
  from tomwer.core.scan.hdf5scan import HDF5TomoScan
35
34
  from nxtomomill import converter as nxtomomill_converter
36
35
  from nxtomomill.io.config import TomoHDF5Config as HDF5Config
@@ -42,13 +41,18 @@ import logging
42
41
  _logger = logging.getLogger(__name__)
43
42
 
44
43
 
45
- class H5ToNxProcess(Task, input_names=("data",), output_names=("data",)):
44
+ class H5ToNxProcess(
45
+ TaskWithProgress,
46
+ input_names=("h5_to_nx_configuration",),
47
+ optional_input_names=("progress", "hdf5_scan"),
48
+ output_names=("data",),
49
+ ):
46
50
  """
47
51
  Process to convert from a bliss dataset to a nexus compliant dataset
48
52
  """
49
53
 
50
54
  @staticmethod
51
- def deduce_output_file_path(master_file_name, entry, outputdir=None):
55
+ def deduce_output_file_path(master_file_name, scan, entry, outputdir=None):
52
56
  if outputdir is not None:
53
57
  file_dir = outputdir
54
58
  else:
@@ -64,67 +68,37 @@ class H5ToNxProcess(Task, input_names=("data",), output_names=("data",)):
64
68
  output_file_name = "_".join(
65
69
  (os.path.splitext(file_name)[0], entry_for_file_name + ".nx")
66
70
  )
71
+ file_dir = format_output_location(file_dir, scan=scan)
67
72
  return os.path.join(file_dir, output_file_name)
68
73
 
69
74
  def run(self):
70
- scan = self.inputs.data
71
- if scan is None:
72
- self.outputs.data = None
73
- return
74
-
75
- _logger.processStarted("Start translate {} to NXTomo".format(str(scan)))
76
- if isinstance(scan, dict):
77
- scan = BlissScan.from_dict(scan)
78
-
79
- if not isinstance(scan, BlissScan):
80
- raise TypeError("Scan is expected to be an instance of BlissScan")
81
- output_file_path = self.deduce_output_file_path(
82
- master_file_name=scan.master_file, entry=scan.entry
83
- )
84
- _logger.info(" ".join(("write", str(scan), "to", output_file_path)))
75
+ config = self.inputs.h5_to_nx_configuration
76
+ if isinstance(config, dict):
77
+ config = HDF5Config.from_dict(config)
78
+ elif not isinstance(config, HDF5Config):
79
+ raise TypeError(
80
+ "h5_to_nx_configuration should be a dict or an instance of {HDF5Config}"
81
+ )
82
+ config.bam_single_file = True
85
83
  try:
86
- configuration = HDF5Config.from_dict(self.get_configuration())
87
- configuration.input_file = scan.master_file
88
- configuration.output_file = output_file_path
89
- configuration.entries = (scan.entry,)
90
- # overwrite some parameters
91
- configuration.single_file = False
92
- configuration.overwrite = True
93
- configuration.file_extension = ".nx"
94
- # ceinture et bretelle. Even if the file has only one
95
- # entry enforce creating a sub file.
96
- # Because at time T we might have only one file and then
97
- # at T+1 we might have another one. Just want to be safe here
98
- if hasattr(configuration, "bam_single_file"):
99
- configuration.bam_single_file = True
100
84
  convs = nxtomomill_converter.from_h5_to_nx(
101
- configuration=configuration,
85
+ configuration=config, progress=self.progress
102
86
  )
103
87
  except Exception as e:
104
- _logger.processFailed(
105
- "Fail to convert from bliss file: %s to NXTomo."
106
- "Conversion error is: %s" % (scan.master_file, e)
88
+ _logger.error(e)
89
+ pass
90
+
91
+ if not len(convs) <= 1:
92
+ raise RuntimeError(
93
+ f"the H5ToNxProcess expects to create at most one NXtomo. {len(convs)} created"
107
94
  )
108
- self.outputs.data = None
109
- return
110
- else:
111
- for conv in convs:
112
- conv_file, conv_entry = conv
113
- scan_converted = HDF5TomoScan(scan=conv_file, entry=conv_entry)
114
- _logger.processSucceed(
115
- "{} has been translated to {}"
116
- "".format(str(scan), str(scan_converted))
117
- )
118
- self.outputs.data = scan_converted
119
-
120
- def set_configuration(self, configuration):
121
- # for now the NXProcess cannot be tune
122
- if isinstance(configuration, HDF5Config):
123
- self._settings = configuration.to_dict()
124
- elif isinstance(configuration, dict):
125
- self._settings = configuration
126
- else:
127
- raise TypeError("invalid type: {}".format(type(configuration)))
95
+ for conv in convs:
96
+ conv_file, conv_entry = conv
97
+ scan_converted = HDF5TomoScan(scan=conv_file, entry=conv_entry)
98
+ _logger.processSucceed(
99
+ f"{config.input_file} {config.entries} has been translated to {scan_converted}"
100
+ )
101
+ self.outputs.data = scan_converted
128
102
 
129
103
 
130
104
  class EDFToNxProcess(
@@ -151,8 +125,9 @@ class EDFToNxProcess(
151
125
  self.outputs.data = HDF5TomoScan(entry=entry, scan=file_path)
152
126
 
153
127
  @staticmethod
154
- def deduce_output_file_path(folder_path, output_dir):
128
+ def deduce_output_file_path(folder_path, output_dir, scan):
155
129
  if output_dir is None:
156
130
  output_dir = os.path.dirname(folder_path)
157
131
 
132
+ folder_path = format_output_location(folder_path, scan=scan)
158
133
  return os.path.join(output_dir, os.path.basename(folder_path) + ".nx")
@@ -32,6 +32,7 @@ __date__ = "05/07/2017"
32
32
 
33
33
 
34
34
  from tomwer.core.process.task import Task
35
+ from tomwer.core.utils.scanutils import data_identifier_to_scan
35
36
  import logging
36
37
 
37
38
  logger = logging.getLogger(__name__)
@@ -46,4 +47,4 @@ class _ScanListPlaceHolder(
46
47
  when part of a orange workflow. Those can be added interactively"""
47
48
 
48
49
  def run(self):
49
- self.outputs.data = self.inputs.data
50
+ self.outputs.data = data_identifier_to_scan(self.inputs.data)
@@ -0,0 +1,7 @@
1
+ from ewokscore.task import Task as EwoksTask
2
+ from tomwer.core.utils.scanutils import data_identifier_to_scan
3
+
4
+
5
+ class _ScanSelectorPlaceHolder(EwoksTask, input_names=["data"], output_names=["data"]):
6
+ def run(self):
7
+ self.outputs.data = data_identifier_to_scan(self.inputs.data)
@@ -33,7 +33,7 @@ import shutil
33
33
  import fnmatch
34
34
 
35
35
  from tomwer.core.process.task import Task
36
-
36
+ from tomwer.core.utils.scanutils import data_identifier_to_scan
37
37
  from tomwer.core.scan.scanfactory import ScanFactory
38
38
  from tomwer.core.settings import get_lbsram_path, get_dest_path
39
39
  from tomwer.core.process.reconstruction.nabu.settings import NABU_CFG_FILE_FOLDER
@@ -444,7 +444,7 @@ class ScanTransfer(Task, input_names=("data",), output_names=("data",)):
444
444
  exists
445
445
  :param bool noRSync: True if we wan't do sue shutil instead of rsync.
446
446
  """
447
- scan = self.inputs.data
447
+ scan = data_identifier_to_scan(self.inputs.data)
448
448
  if scan is None:
449
449
  raise ValueError("'scan' should be provided")
450
450
 
@@ -500,17 +500,11 @@ class ScanTransfer(Task, input_names=("data",), output_names=("data",)):
500
500
  return
501
501
  for _file in os.listdir(scanfolder):
502
502
  if _file.lower().endswith(".par"):
503
- par_file_path = os.path.join(scanfolder, _file)
504
- try:
505
- rebaseParFile(
506
- par_file_path,
507
- oldfolder=scanfolder,
508
- newfolder=outputdir,
509
- )
510
- except Exception as e:
511
- logger.warning(
512
- f"Fail to rebase par file {par_file_path}. Reason is {e}"
513
- )
503
+ rebaseParFile(
504
+ os.path.join(scanfolder, _file),
505
+ oldfolder=scanfolder,
506
+ newfolder=outputdir,
507
+ )
514
508
 
515
509
  def __noticeTransfertSuccess(self, input_scan, output_scan):
516
510
  self._signalCopySucceed()
@@ -612,11 +606,8 @@ class ScanTransfer(Task, input_names=("data",), output_names=("data",)):
612
606
  return None
613
607
 
614
608
  def _getOutputDirLBS(self, scanPath):
615
- scanPath = os.path.realpath(scanPath)
616
- lbsram_path = os.path.realpath(get_lbsram_path())
617
- if scanPath.startswith(lbsram_path):
618
- dest_path = os.path.realpath(get_dest_path())
619
- return scanPath.replace(lbsram_path, dest_path, 1)
609
+ if scanPath.startswith(get_lbsram_path()):
610
+ return scanPath.replace(get_lbsram_path(), get_dest_path(), 1)
620
611
  else:
621
612
  return None
622
613
 
@@ -33,6 +33,7 @@ from tomwer.core import utils
33
33
  from tomwer.core.process.task import BaseProcessInfo
34
34
  from tomwer.core.scan.scanfactory import ScanFactory
35
35
  from tomwer.core.utils import logconfig
36
+ from tomwer.core.utils.scanutils import data_identifier_to_scan
36
37
  import logging
37
38
  from tomwer.core.scan.scanbase import TomwerScanBase, _TomwerBaseDock
38
39
  from ewokscore.task import Task as EwoksTask
@@ -42,7 +43,7 @@ logger = logging.getLogger(__name__)
42
43
 
43
44
  class _ScanValidatorPlaceHolder(EwoksTask, input_names=["data"], output_names=["data"]):
44
45
  def run(self):
45
- self.outputs.data = self.inputs.data
46
+ self.outputs.data = data_identifier_to_scan(self.inputs.data)
46
47
 
47
48
 
48
49
  class ScanValidator(BaseProcessInfo):
@@ -72,7 +73,7 @@ class ScanValidator(BaseProcessInfo):
72
73
  def _clearMemoryReleaser(self):
73
74
  if self._memoryReleaser is not None:
74
75
  self._memoryReleaser.should_be_stopped = True
75
- self._memoryReleaser.wait()
76
+ self._memoryReleaser.wait(4000)
76
77
  self._memoryReleaser = None
77
78
 
78
79
  def addScan(self, scan):
@@ -237,13 +238,13 @@ class ScanValidator(BaseProcessInfo):
237
238
  """
238
239
  return self._manualValidation
239
240
 
240
- def _sendScanReady(self):
241
+ def _sendScanReady(self, scan):
241
242
  raise RuntimeError("ScanValidator is a pure virtual class.")
242
243
 
243
- def _sendScanCanceledAt(self):
244
+ def _sendScanCanceledAt(self, scan):
244
245
  raise RuntimeError("ScanValidator is a pure virtual class.")
245
246
 
246
- def _sendUpdateReconsParam(self):
247
+ def _sendUpdateReconsParam(self, scan):
247
248
  raise RuntimeError("ScanValidator is a pure virtual class.")
248
249
 
249
250
  def clear(self):
@@ -1,4 +1,5 @@
1
1
  from tomwer.core.process.task import Task
2
+ from tomwer.core.utils.scanutils import data_identifier_to_scan
2
3
 
3
4
 
4
5
  class SingleTomoObjProcess(
@@ -10,4 +11,4 @@ class SingleTomoObjProcess(
10
11
  when part of a orange workflow. Those can be added interactively"""
11
12
 
12
13
  def run(self):
13
- self.outputs.tomo_obj = self.inputs.tomo_obj
14
+ self.outputs.tomo_obj = data_identifier_to_scan(self.inputs.tomo_obj)
@@ -31,6 +31,7 @@ __date__ = "12/12/2018"
31
31
  from tomwer.core.process.task import Task
32
32
  from tomwer.core.scan.scanbase import TomwerScanBase
33
33
  from tomwer.core.scan.scanfactory import ScanFactory
34
+ from tomwer.core.utils.scanutils import data_identifier_to_scan
34
35
  import time
35
36
  import logging
36
37
 
@@ -66,7 +67,7 @@ class Timer(Task, input_names=("data",), output_names=("data",)):
66
67
  self._waiting_time = wait
67
68
 
68
69
  def run(self):
69
- scan = self.inputs.data
70
+ scan = data_identifier_to_scan(self.inputs.data)
70
71
  if type(scan) is dict:
71
72
  scan = ScanFactory.create_scan_object_frm_dict(scan)
72
73
  else:
@@ -0,0 +1,8 @@
1
+ from ewokscore.task import Task as EwoksTask
2
+
3
+
4
+ class _TomoobjseriePlaceHolder(
5
+ EwoksTask, input_names=["serie"], output_names=["serie"]
6
+ ):
7
+ def run(self):
8
+ self.outputs.serie = self.inputs.serie
@@ -1,8 +1,9 @@
1
1
  from ewokscore.task import Task as EwoksTask
2
+ from tomwer.core.utils.scanutils import data_identifier_to_scan
2
3
 
3
4
 
4
5
  class _VolumeSelectorPlaceHolder(
5
6
  EwoksTask, input_names=["volume"], output_names=["volume"]
6
7
  ):
7
8
  def run(self):
8
- self.outputs.volume = self.inputs.volume
9
+ self.outputs.volume = data_identifier_to_scan(self.inputs.volume)
@@ -34,6 +34,7 @@ from tomoscan.factory import Factory
34
34
  from tomoscan.volumebase import VolumeBase
35
35
  from tomwer.core.process.task import Task
36
36
  from tomwer.core.scan.scanfactory import ScanFactory
37
+ from tomwer.core.utils.scanutils import data_identifier_to_scan
37
38
  from silx.utils.enum import Enum as _Enum
38
39
  from tomwer.utils import docstring
39
40
  import tomwer.version
@@ -118,7 +119,7 @@ class VolumeSymbolicLinkProcess(Task, input_names=("data",), output_names=("data
118
119
 
119
120
  @docstring(Task.run)
120
121
  def run(self):
121
- scan = self.inputs.data
122
+ scan = data_identifier_to_scan(self.inputs.data)
122
123
  if type(scan) is dict:
123
124
  scan = ScanFactory.create_scan_object_frm_dict(scan)
124
125
  else:
@@ -30,6 +30,7 @@ __date__ = "04/11/2020"
30
30
 
31
31
  from tomwer.core.scan.scanbase import TomwerScanBase
32
32
  from tomwer.core.scan.hdf5scan import HDF5TomoScan
33
+ from tomwer.core.utils.scanutils import data_identifier_to_scan
33
34
  from nxtomomill.utils import add_dark_flat_nx_file
34
35
  from tomwer.core.process.task import Task
35
36
  from tomwer.core.scan.scanfactory import ScanFactory
@@ -69,7 +70,7 @@ class DarkFlatPatch(Task, input_names=("data",), output_names=("data",)):
69
70
  """
70
71
 
71
72
  def run(self):
72
- scan = self.inputs.data
73
+ scan = data_identifier_to_scan(self.inputs.data)
73
74
  if type(scan) is dict:
74
75
  scan = ScanFactory.create_scan_object_frm_dict(scan)
75
76
  else:
@@ -28,13 +28,14 @@ __license__ = "MIT"
28
28
  __date__ = "26/10/2020"
29
29
 
30
30
 
31
- from tomoscan.esrf.hdf5scan import ImageKey as _ImageKey
31
+ from tomoscan.esrf.scan.hdf5scan import ImageKey as _ImageKey
32
32
  from tomwer.core.scan.hdf5scan import HDF5TomoScan
33
33
  from tomwer.core.scan.scanbase import TomwerScanBase
34
34
  from nxtomomill.utils import change_image_key_control as _change_image_key_control
35
35
  from tomwer.core.process.task import Task
36
- from tomoscan.esrf.hdf5scan import ImageKey
36
+ from tomoscan.esrf.scan.hdf5scan import ImageKey
37
37
  from tomwer.core.scan.scanfactory import ScanFactory
38
+ from tomwer.core.utils.scanutils import data_identifier_to_scan
38
39
  import nxtomomill.version
39
40
  import logging
40
41
 
@@ -108,7 +109,7 @@ class ImageKeyEditor(Task, input_names=("data",), output_names=("data",)):
108
109
  self.set_configuration(inputs.get("image_key_edition", {}))
109
110
 
110
111
  def run(self):
111
- scan = self.inputs.data
112
+ scan = data_identifier_to_scan(self.inputs.data)
112
113
  if type(scan) is dict:
113
114
  scan = ScanFactory.create_scan_object_frm_dict(scan)
114
115
  else:
@@ -29,7 +29,12 @@ __authors__ = ["C.Nemoz", "H.Payno"]
29
29
  __license__ = "MIT"
30
30
  __date__ = "19/03/2019"
31
31
 
32
- from tomwer.core.process.reconstruction.utils.cor import absolute_pos_to_relative
32
+ import nabu
33
+ import numpy
34
+ import logging
35
+ from processview.core.manager import ProcessManager
36
+ from processview.core.manager import DatasetState
37
+ import tomwer.version
33
38
  from .params import (
34
39
  AxisRP,
35
40
  DEFAULT_CMP_TAKE_LOG,
@@ -45,16 +50,13 @@ from .anglemode import CorAngleMode
45
50
  from tomwer.core.process.task import Task
46
51
  from processview.core.superviseprocess import SuperviseProcess
47
52
  from tomwer.core.scan.scanbase import TomwerScanBase
48
- from processview.core.manager import ProcessManager
49
- from processview.core.manager import DatasetState
53
+ from tomwer.core.process.reconstruction.utils.cor import absolute_pos_to_relative
50
54
  from tomwer.core.scan.scanfactory import ScanFactory
51
- import logging
55
+ from tomwer.core.utils.scanutils import data_identifier_to_scan
52
56
  from tomwer.core.utils import logconfig
53
- import numpy
54
57
  from typing import Optional, Union
55
58
  from tomwer.utils import docstring
56
59
  from tomwer.core.utils import image
57
- import tomwer.version
58
60
  from tomwer.core.scan.hdf5scan import HDF5TomoScan
59
61
  from nabu.estimation.cor import (
60
62
  CenterOfRotation,
@@ -73,7 +75,6 @@ else:
73
75
  from silx.io.url import DataUrl
74
76
  from tomoscan.io import HDF5File
75
77
  from silx.io.utils import h5py_read_dataset
76
- import nabu
77
78
 
78
79
  _logger = logging.getLogger(__name__)
79
80
  if not has_composite_cor_finder:
@@ -119,7 +120,7 @@ def adapt_tomwer_scan_to_nabu(scan: TomwerScanBase):
119
120
  "processes_file"
120
121
  in inspect.signature(update_dataset_info_flats_darks).parameters
121
122
  ):
122
- update_dataset_info_flats_darks(
123
+ update_dataset_info_flats_darks( # pylint: disable=E1123
123
124
  dataset_infos,
124
125
  processes_file=scan.get_relative_file(
125
126
  "nabu_processes.h5", with_dataset_prefix=True
@@ -186,14 +187,15 @@ def compute_cor_nabu_growing_window_sinogram(
186
187
  :return:
187
188
  """
188
189
  corfinder = SinoCORFinder(
189
- adapt_tomwer_scan_to_nabu(scan),
190
+ dataset_info=adapt_tomwer_scan_to_nabu(scan),
191
+ method="growing-window",
190
192
  slice_idx=scan.axis_params.sinogram_line or "middle",
191
193
  subsampling=scan.axis_params.sinogram_subsampling,
192
194
  do_flatfield=True,
193
- cor_options=scan.axis_params.get_nabu_cor_options(),
195
+ cor_options=scan.axis_params.get_nabu_cor_options_as_dict(),
194
196
  logger=_logger,
195
197
  )
196
- res = corfinder.find_cor(method="growing-window")
198
+ res = corfinder.find_cor()
197
199
  if isinstance(res, numpy.ndarray):
198
200
  if len(res) == 1:
199
201
  res = res[0]
@@ -215,14 +217,15 @@ def compute_scan_sino_coarse_to_fine(scan):
215
217
  :return:
216
218
  """
217
219
  corfinder = SinoCORFinder(
218
- adapt_tomwer_scan_to_nabu(scan),
220
+ dataset_info=adapt_tomwer_scan_to_nabu(scan),
221
+ method=AxisMode.sino_coarse_to_fine.value,
219
222
  slice_idx=scan.axis_params.sinogram_line or "middle",
220
223
  subsampling=scan.axis_params.sinogram_subsampling,
221
224
  do_flatfield=True,
222
- cor_options=scan.axis_params.get_nabu_cor_options(),
225
+ cor_options=scan.axis_params.get_nabu_cor_options_as_dict(),
223
226
  logger=_logger,
224
227
  )
225
- res = corfinder.find_cor(method=AxisMode.sino_coarse_to_fine.value)
228
+ res = corfinder.find_cor()
226
229
  return _absolute_pos_to_relative_with_warning(
227
230
  absolute_pos=res, det_width=scan.dim_1
228
231
  )
@@ -255,11 +258,11 @@ def compute_scan_composite_coarse_to_fine(scan: TomwerScanBase):
255
258
  extra_args = {}
256
259
 
257
260
  corfinder = CompositeCOREstimator(
258
- adapt_tomwer_scan_to_nabu(scan),
261
+ dataset_info=adapt_tomwer_scan_to_nabu(scan),
259
262
  theta_interval=theta,
260
263
  n_subsampling_y=n_subsampling_y,
261
264
  oversampling=oversampling,
262
- cor_options=scan.axis_params.get_nabu_cor_options(),
265
+ cor_options=scan.axis_params.get_nabu_cor_options_as_dict(),
263
266
  logger=_logger,
264
267
  take_log=take_log,
265
268
  **extra_args
@@ -378,14 +381,15 @@ def compute_cor_nabu_sliding_window_sinogram(
378
381
  :return:
379
382
  """
380
383
  corfinder = SinoCORFinder(
381
- adapt_tomwer_scan_to_nabu(scan),
384
+ dataset_info=adapt_tomwer_scan_to_nabu(scan),
385
+ method="sliding-window",
382
386
  slice_idx=scan.axis_params.sinogram_line or "middle",
383
387
  subsampling=scan.axis_params.sinogram_subsampling,
384
388
  do_flatfield=True,
385
- cor_options=scan.axis_params.get_nabu_cor_options(),
389
+ cor_options=scan.axis_params.get_nabu_cor_options_as_dict(),
386
390
  logger=_logger,
387
391
  )
388
- res = corfinder.find_cor(method="sliding-window")
392
+ res = corfinder.find_cor()
389
393
  # now fixed but on some version nabu could return a numpy array instead of float
390
394
  if isinstance(res, numpy.ndarray):
391
395
  if len(res) == 1:
@@ -630,9 +634,11 @@ class AxisProcess(
630
634
  """Recons parameters register before locking the position"""
631
635
 
632
636
  def set_configuration(self, configuration):
633
- self.set_recons_params(
634
- recons_params=AxisRP.from_dict(configuration["_rpSetting"])
635
- )
637
+ if "_rpSetting" in configuration:
638
+ recons_params = AxisRP.from_dict(configuration["_rpSetting"])
639
+ else:
640
+ recons_params = AxisRP.from_dict(configuration)
641
+ self.set_recons_params(recons_params=recons_params)
636
642
 
637
643
  def set_recons_params(self, recons_params):
638
644
  assert isinstance(recons_params, AxisRP)
@@ -664,7 +670,7 @@ class AxisProcess(
664
670
  .. note:: this simply call `compute`.
665
671
  But this is needed for the AxisProcessThreaded class
666
672
  """
667
- scan = self.inputs.data
673
+ scan = data_identifier_to_scan(self.inputs.data)
668
674
  if scan is None:
669
675
  return
670
676
 
@@ -702,14 +708,6 @@ class AxisProcess(
702
708
  self._process_end(scan, cor=cor, error=error)
703
709
  self.outputs.data = scan_res
704
710
 
705
- def reprocess(self, scan):
706
- """
707
- Reprocess the scan. For now simply call process
708
-
709
- :param scan:
710
- """
711
- return self.process(scan)
712
-
713
711
  def _process_end(self, scan, cor, error=None):
714
712
  assert isinstance(scan, TomwerScanBase)
715
713
  if scan.process_file is not None:
@@ -869,7 +867,6 @@ class AxisProcess(
869
867
  "".format(scan_name, e)
870
868
  )
871
869
  else:
872
- print("position is", position)
873
870
  scan.axis_params.set_relative_value(position)
874
871
  self._axis_params.frame_width = scan.dim_1
875
872
  self._axis_params.set_relative_value(position)
@@ -58,16 +58,17 @@ class AxisMode(_Enum):
58
58
 
59
59
  @classmethod
60
60
  def from_value(cls, value):
61
+ # ensure backward compatiblity with workflow defined before COR method on sinograms
61
62
  if value == "growing-window":
62
63
  _logger.warning(
63
64
  "Axis mode requested is 'growing-window'. To insure backward compatibility replace it by 'growing-window-radios'"
64
65
  )
65
- value = "growing-window-radios"
66
+ value = AxisMode.growing_window_radios
66
67
  elif value == "sliding-window":
67
68
  _logger.warning(
68
69
  "Axis mode requested is 'sliding-window'. To insure backward compatibility replace it by 'sliding-window-radios'"
69
70
  )
70
- value = "sliding-window-radios"
71
+ value = AxisMode.sliding_window_radios
71
72
 
72
73
  return super().from_value(value=value)
73
74
 
@@ -77,7 +77,7 @@ class AxisCalculationInput(_Enum):
77
77
  transmission = _calculation_conf(ProjectionType.transmission, False)
78
78
  transmission_pag = _calculation_conf(ProjectionType.transmission, True)
79
79
 
80
- def name(self):
80
+ def name(self): # pylint: disable=E0102
81
81
  if self.value.paganin is True:
82
82
  return " ".join((self.value.projection_type.value, "paganin"))
83
83
  else:
@@ -677,7 +677,7 @@ class AxisRP:
677
677
  res = float(values[0])
678
678
  except Exception:
679
679
  _logger.info(
680
- "fail to load center of rotation " "from ", file_path
680
+ f"fail to load center of rotation from {file_path}"
681
681
  )
682
682
  return None
683
683
  else:
@@ -875,28 +875,47 @@ class AxisRP:
875
875
  results = ", ".join((results, extra_info))
876
876
  return results
877
877
 
878
- def get_nabu_cor_options(self) -> str:
879
- """return cor option for nabu"""
878
+ def get_nabu_cor_options_as_dict(self) -> str:
879
+ options = {}
880
880
  if self.mode in (
881
881
  AxisMode.sliding_window_sinogram,
882
882
  AxisMode.sliding_window_radios,
883
883
  AxisMode.growing_window_sinogram,
884
884
  AxisMode.growing_window_radios,
885
885
  ):
886
- options = "side='{}'".format(self.side)
886
+ options["side"] = self.side
887
887
  elif self.mode in (AxisMode.composite_coarse_to_fine,):
888
888
  near_pos = self.composite_options.get("near_pos", 0.0)
889
889
  near_width = self.composite_options.get("near_width", 20.0)
890
- options = (
891
- f"side='{self.side}'; near_pos={near_pos}; near_width={near_width}"
892
- )
893
- else:
894
- options = None
890
+ options["side"] = self.side
891
+ options["near_pos"] = near_pos
892
+ options["near_width"] = near_width
895
893
 
896
894
  # append "extra_cor_options" to already handled cor options
897
- if self.extra_cor_options.replace(" ", "") == "":
898
- return options
899
- elif options is None:
900
- return self.extra_cor_options
901
- else:
902
- return " ; ".join([options, self.extra_cor_options])
895
+ extra_cor_options = self.extra_cor_options.replace(" ", "")
896
+
897
+ if extra_cor_options != "":
898
+ for opt in self.extra_cor_options.replace(" ", "").split(";"):
899
+ key, value = opt.split("=")
900
+ options[key] = value
901
+ return options
902
+
903
+ @deprecated(replacement="get_nabu_cor_options_as_str", since_version="1.1")
904
+ def get_nabu_cor_options(self) -> str:
905
+ return self.get_nabu_cor_options_as_str()
906
+
907
+ def get_nabu_cor_options_as_str(self) -> str:
908
+ """return cor option for nabu"""
909
+
910
+ def cast_key_value(key, value):
911
+ if key in ("side",):
912
+ return f"{key}='{value}'"
913
+ else:
914
+ return f"{key}={value}"
915
+
916
+ return " ; ".join(
917
+ [
918
+ cast_key_value(key, value)
919
+ for key, value in self.get_nabu_cor_options_as_dict().items()
920
+ ]
921
+ )