tomwer 1.4.18__py3-none-any.whl → 1.5.0rc0__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 (86) hide show
  1. orangecontrib/tomwer/tutorials/simple_volume_local_reconstruction.ows +11 -8
  2. orangecontrib/tomwer/tutorials/simple_volume_to_slurm_reconstruction.ows +12 -9
  3. orangecontrib/tomwer/widgets/cluster/SlurmClusterOW.py +11 -0
  4. orangecontrib/tomwer/widgets/control/DataDiscoveryOW.py +1 -1
  5. orangecontrib/tomwer/widgets/control/NXTomomillMixIn.py +21 -10
  6. tomwer/app/reducedarkflat.py +2 -2
  7. tomwer/core/process/edit/imagekeyeditor.py +4 -6
  8. tomwer/core/process/edit/nxtomoeditor.py +58 -20
  9. tomwer/core/process/output.py +6 -5
  10. tomwer/core/process/reconstruction/axis/anglemode.py +2 -2
  11. tomwer/core/process/reconstruction/axis/axis.py +1 -0
  12. tomwer/core/process/reconstruction/darkref/darkrefs.py +2 -2
  13. tomwer/core/process/reconstruction/darkref/darkrefscopy.py +1 -1
  14. tomwer/core/process/reconstruction/darkref/params.py +1 -1
  15. tomwer/core/process/reconstruction/nabu/castvolume.py +4 -1
  16. tomwer/core/process/reconstruction/nabu/helical.py +3 -1
  17. tomwer/core/process/reconstruction/nabu/nabuscores.py +1 -1
  18. tomwer/core/process/reconstruction/nabu/nabuslices.py +4 -4
  19. tomwer/core/process/reconstruction/nabu/plane.py +2 -2
  20. tomwer/core/process/reconstruction/nabu/test/test_castvolume.py +2 -0
  21. tomwer/core/process/reconstruction/nabu/utils.py +15 -14
  22. tomwer/core/process/reconstruction/normalization/params.py +1 -1
  23. tomwer/core/process/reconstruction/output.py +2 -2
  24. tomwer/core/process/reconstruction/tests/test_axis.py +1 -1
  25. tomwer/core/process/stitching/metadataholder.py +5 -5
  26. tomwer/core/process/stitching/nabustitcher.py +1 -4
  27. tomwer/core/scan/edfscan.py +3 -3
  28. tomwer/core/scan/nxtomoscan.py +3 -3
  29. tomwer/core/scan/scanbase.py +2 -2
  30. tomwer/core/tomwer_object.py +1 -1
  31. tomwer/core/utils/nxtomoutils.py +2 -2
  32. tomwer/core/utils/spec.py +6 -3
  33. tomwer/gui/cluster/slurm.py +9 -0
  34. tomwer/gui/control/datadiscovery.py +1 -1
  35. tomwer/gui/control/reducedarkflatselector.py +4 -4
  36. tomwer/gui/edit/imagekeyeditor.py +7 -9
  37. tomwer/gui/edit/nxtomoeditor.py +420 -112
  38. tomwer/gui/edit/tests/test_nx_editor.py +154 -82
  39. tomwer/gui/reconstruction/axis/CalculationWidget.py +1 -1
  40. tomwer/gui/reconstruction/axis/EstimatedCORWidget.py +12 -8
  41. tomwer/gui/reconstruction/darkref/darkrefwidget.py +2 -2
  42. tomwer/gui/reconstruction/nabu/castvolume.py +16 -1
  43. tomwer/gui/reconstruction/nabu/nabuconfig/base.py +1 -1
  44. tomwer/gui/reconstruction/nabu/nabuconfig/nabuconfig.py +1 -1
  45. tomwer/gui/reconstruction/nabu/nabuconfig/phase.py +2 -2
  46. tomwer/gui/reconstruction/nabu/nabuconfig/preprocessing.py +2 -4
  47. tomwer/gui/reconstruction/nabu/nabuconfig/reconstruction.py +71 -49
  48. tomwer/gui/reconstruction/nabu/nabuflow.py +3 -13
  49. tomwer/gui/reconstruction/nabu/slices.py +6 -6
  50. tomwer/gui/reconstruction/nabu/test/test_cast_volume.py +19 -0
  51. tomwer/gui/reconstruction/normalization/intensity.py +2 -2
  52. tomwer/gui/reconstruction/saaxis/dimensionwidget.py +71 -67
  53. tomwer/gui/reconstruction/scores/scoreplot.py +15 -7
  54. tomwer/gui/reconstruction/tests/test_saaxis.py +18 -16
  55. tomwer/gui/stitching/SingleAxisStitchingWidget.py +8 -8
  56. tomwer/gui/stitching/StitchingOptionsWidget.py +1 -1
  57. tomwer/gui/stitching/alignment.py +8 -8
  58. tomwer/gui/stitching/config/axisparams.py +2 -2
  59. tomwer/gui/stitching/config/output.py +1 -1
  60. tomwer/gui/stitching/config/stitchingstrategies.py +4 -6
  61. tomwer/gui/stitching/config/tomoobjdetails.py +21 -13
  62. tomwer/gui/stitching/normalization.py +6 -6
  63. tomwer/gui/stitching/tests/test_ZStitchingWindow.py +8 -1
  64. tomwer/gui/stitching/tests/test_preview.py +10 -7
  65. tomwer/gui/stitching/tests/utils.py +27 -18
  66. tomwer/gui/stitching/z_stitching/fineestimation.py +7 -9
  67. tomwer/gui/stitching/z_stitching/tests/test_raw_estimation.py +18 -7
  68. tomwer/gui/stitching/z_stitching/tests/test_stitching_window.py +7 -2
  69. tomwer/gui/utils/buttons.py +53 -35
  70. tomwer/gui/utils/flow.py +1 -1
  71. tomwer/gui/utils/unitsystem.py +44 -33
  72. tomwer/gui/visualization/diffviewer/diffviewer.py +4 -4
  73. tomwer/gui/visualization/diffviewer/shiftwidget.py +4 -6
  74. tomwer/gui/visualization/test/test_nx_tomo_metadata_viewer.py +25 -13
  75. tomwer/model/dataset.py +0 -0
  76. tomwer/tasks/reconstruction/cleardarkflat.py +42 -0
  77. tomwer/tests/app/test_stitching.py +1 -1
  78. tomwer/tests/orangecontrib/tomwer/widgets/edit/tests/test_nxtomo_editor.py +32 -20
  79. tomwer/tests/orangecontrib/tomwer/widgets/reconstruction/tests/test_nabu_widget.py +1 -1
  80. tomwer/version.py +3 -3
  81. {tomwer-1.4.18.dist-info → tomwer-1.5.0rc0.dist-info}/METADATA +8 -8
  82. {tomwer-1.4.18.dist-info → tomwer-1.5.0rc0.dist-info}/RECORD +86 -84
  83. {tomwer-1.4.18.dist-info → tomwer-1.5.0rc0.dist-info}/WHEEL +1 -1
  84. {tomwer-1.4.18.dist-info → tomwer-1.5.0rc0.dist-info}/entry_points.txt +0 -0
  85. {tomwer-1.4.18.dist-info → tomwer-1.5.0rc0.dist-info}/licenses/LICENSE +0 -0
  86. {tomwer-1.4.18.dist-info → tomwer-1.5.0rc0.dist-info}/top_level.txt +0 -0
@@ -97,7 +97,7 @@ class SliceGroupBox(qt.QGroupBox):
97
97
  )
98
98
 
99
99
  def setMode(self, mode: NabuSliceMode):
100
- mode = NabuSliceMode.from_value(mode)
100
+ mode = NabuSliceMode(mode)
101
101
  item_index = self._modeCB.findText(mode.value)
102
102
  self._modeCB.setCurrentIndex(item_index)
103
103
  old = self.blockSignals(True)
@@ -105,7 +105,7 @@ class SliceGroupBox(qt.QGroupBox):
105
105
  self.blockSignals(old)
106
106
 
107
107
  def getMode(self) -> NabuSliceMode:
108
- mode = NabuSliceMode.from_value(self._modeCB.currentText())
108
+ mode = NabuSliceMode(self._modeCB.currentText())
109
109
  return mode
110
110
 
111
111
  def _getSliceSelected(self):
@@ -334,45 +334,52 @@ class _NabuReconstructionConfig(qt.QWidget, _NabuStageConfigBase):
334
334
  self.registerWidget(self._methodLabel, "required")
335
335
  self.registerWidget(self._methodQCB, "required")
336
336
 
337
+ self._methodWarningLabel = qt.QLabel(
338
+ f"\tWARNING: \n\t1.' {_NabuReconstructionMethods.MLEM.value}' can be EXTREMELY SLOW on transmission\n\tdata and may produce erroneous results.\n\t2.MLEM should only be used with XRFCT data."
339
+ )
340
+ self._methodWarningLabel.setStyleSheet("color: red")
341
+ self._methodWarningLabel.setVisible(False)
342
+ self.layout().addWidget(self._methodWarningLabel, 3, 0, 1, 2)
343
+
337
344
  # angle_offset
338
345
  self._labelOffsetLabel = qt.QLabel("angle offset (in degree)", self)
339
- self.layout().addWidget(self._labelOffsetLabel, 3, 0, 1, 1)
346
+ self.layout().addWidget(self._labelOffsetLabel, 4, 0, 1, 1)
340
347
  self._angleOffsetQDSB = QDoubleSpinBoxIgnoreWheel(self)
341
348
  self._angleOffsetQDSB.setMaximum(-180)
342
349
  self._angleOffsetQDSB.setMaximum(180)
343
- self.layout().addWidget(self._angleOffsetQDSB, 3, 1, 1, 1)
350
+ self.layout().addWidget(self._angleOffsetQDSB, 4, 1, 1, 1)
344
351
  self.registerWidget(self._labelOffsetLabel, "advanced")
345
352
  self.registerWidget(self._angleOffsetQDSB, "advanced")
346
353
 
347
354
  # fbp filter type
348
355
  self._fbpFilterCB = qt.QCheckBox("fbp filter", self)
349
- self.layout().addWidget(self._fbpFilterCB, 4, 0, 1, 1)
356
+ self.layout().addWidget(self._fbpFilterCB, 5, 0, 1, 1)
350
357
  self._fbpFilterType = QComboBoxIgnoreWheel(self)
351
358
  for filter_type in _NabuFBPFilterType:
352
359
  self._fbpFilterType.addItem(filter_type.value)
353
- self.layout().addWidget(self._fbpFilterType, 4, 1, 1, 1)
360
+ self.layout().addWidget(self._fbpFilterType, 5, 1, 1, 1)
354
361
  self.registerWidget(self._fbpFilterCB, "advanced")
355
362
  self.registerWidget(self._fbpFilterType, "advanced")
356
363
 
357
364
  # padding type
358
365
  self._paddingTypeLabel = qt.QLabel("padding type", self)
359
- self.layout().addWidget(self._paddingTypeLabel, 5, 0, 1, 1)
366
+ self.layout().addWidget(self._paddingTypeLabel, 6, 0, 1, 1)
360
367
  self._paddingType = QComboBoxIgnoreWheel(self)
361
368
  for fbp_padding_type in _NabuPaddingType:
362
369
  self._paddingType.addItem(fbp_padding_type.value)
363
- self.layout().addWidget(self._paddingType, 5, 1, 1, 1)
370
+ self.layout().addWidget(self._paddingType, 6, 1, 1, 1)
364
371
  self.registerWidget(self._paddingTypeLabel, "optional")
365
372
  self.registerWidget(self._paddingType, "optional")
366
373
 
367
374
  # sub region
368
375
  self._subRegionSelector = _NabuReconstructionSubRegion(parent=self)
369
- self.layout().addWidget(self._subRegionSelector, 7, 0, 1, 2)
376
+ self.layout().addWidget(self._subRegionSelector, 8, 0, 1, 2)
370
377
 
371
378
  # iterations
372
379
  self._iterationsLabel = qt.QLabel("iterations", self)
373
- self.layout().addWidget(self._iterationsLabel, 8, 0, 1, 1)
380
+ self.layout().addWidget(self._iterationsLabel, 9, 0, 1, 1)
374
381
  self._iterationSB = qt.QSpinBox(parent=self)
375
- self.layout().addWidget(self._iterationSB, 8, 1, 1, 1)
382
+ self.layout().addWidget(self._iterationSB, 9, 1, 1, 1)
376
383
  self._iterationSB.setMinimum(1)
377
384
  self._iterationSB.setMaximum(9999)
378
385
  # not supported for now so hidden
@@ -383,20 +390,20 @@ class _NabuReconstructionConfig(qt.QWidget, _NabuStageConfigBase):
383
390
  self._binSubSamplingGB = _BinSubSampling(
384
391
  "binning and sub-sampling", parent=self
385
392
  )
386
- self.layout().addWidget(self._binSubSamplingGB, 9, 0, 1, 2)
393
+ self.layout().addWidget(self._binSubSamplingGB, 10, 0, 1, 2)
387
394
 
388
395
  # optimization algorithm:
389
396
  # set has default value for now, because has only one at the moment
390
397
 
391
398
  # weight total variation
392
399
  self._tvLabel = qt.QLabel("total variation weight", self)
393
- self.layout().addWidget(self._tvLabel, 10, 0, 1, 1)
400
+ self.layout().addWidget(self._tvLabel, 11, 0, 1, 1)
394
401
  self._totalVariationWeight = qt.QDoubleSpinBox(self)
395
402
  self._totalVariationWeight.setMinimum(0.0)
396
403
  self._totalVariationWeight.setMaximum(1.0)
397
404
  self._totalVariationWeight.setDecimals(4)
398
405
  self._totalVariationWeight.setSingleStep(0.002)
399
- self.layout().addWidget(self._totalVariationWeight, 9, 1, 1, 1)
406
+ self.layout().addWidget(self._totalVariationWeight, 10, 1, 1, 1)
400
407
  # not supported for now so hidden
401
408
  self._tvLabel.hide()
402
409
  self._totalVariationWeight.hide()
@@ -406,7 +413,7 @@ class _NabuReconstructionConfig(qt.QWidget, _NabuStageConfigBase):
406
413
  self._preconditioningFilter.setToolTip(
407
414
  'Whether to enable "filter ' 'preconditioning" for iterative' " methods"
408
415
  )
409
- self.layout().addWidget(self._preconditioningFilter, 10, 0, 1, 2)
416
+ self.layout().addWidget(self._preconditioningFilter, 11, 0, 1, 2)
410
417
  # not supported for now so hidden
411
418
  self._preconditioningFilter.hide()
412
419
 
@@ -415,7 +422,7 @@ class _NabuReconstructionConfig(qt.QWidget, _NabuStageConfigBase):
415
422
  self._positivityConstraintCB.setToolTip(
416
423
  "Whether to enforce a " "positivity constraint in the " "reconstruction."
417
424
  )
418
- self.layout().addWidget(self._positivityConstraintCB, 11, 0, 1, 2)
425
+ self.layout().addWidget(self._positivityConstraintCB, 12, 0, 1, 2)
419
426
  # not supported for now so hidden
420
427
  self._positivityConstraintCB.hide()
421
428
 
@@ -424,13 +431,13 @@ class _NabuReconstructionConfig(qt.QWidget, _NabuStageConfigBase):
424
431
  self._clipOuterCircleCB.setToolTip(
425
432
  "Whether to set to zero voxels falling outside of the reconstruction region"
426
433
  )
427
- self.layout().addWidget(self._clipOuterCircleCB, 12, 0, 1, 2)
434
+ self.layout().addWidget(self._clipOuterCircleCB, 13, 0, 1, 2)
428
435
  self.registerWidget(self._clipOuterCircleCB, "optional")
429
436
 
430
437
  # centered axis option
431
438
  self._centeredAxisCB = qt.QCheckBox("centered axis", self)
432
439
  self._centeredAxisCB.setToolTip("")
433
- self.layout().addWidget(self._centeredAxisCB, 13, 0, 1, 2)
440
+ self.layout().addWidget(self._centeredAxisCB, 14, 0, 1, 2)
434
441
  self.registerWidget(self._centeredAxisCB, "optional")
435
442
 
436
443
  # translation movement file
@@ -440,6 +447,12 @@ class _NabuReconstructionConfig(qt.QWidget, _NabuStageConfigBase):
440
447
  self.layout().addWidget(self._transMvtFileWidget, 22, 1, 1, 1)
441
448
  self.registerWidget(self._transMvtFileLabel, "advanced")
442
449
  self.registerWidget(self._transMvtFileWidget, "advanced")
450
+ translation_movement_tooltip = """
451
+ A file where each line describes the horizontal and vertical translations of the sample (or detector).
452
+ The order is 'horizontal, vertical'
453
+ It can be created from a numpy array saved with 'numpy.savetxt'"""
454
+ self._transMvtFileLabel.setToolTip(translation_movement_tooltip)
455
+ self._transMvtFileWidget.setToolTip(translation_movement_tooltip)
443
456
 
444
457
  # angle files (if the user want's to overwrite rotation angles)
445
458
  self._angleFileLabel = qt.QLabel("angles file", self)
@@ -527,8 +540,12 @@ class _NabuReconstructionConfig(qt.QWidget, _NabuStageConfigBase):
527
540
  def _slicesChanged(self, *args, **kwargs):
528
541
  self._signalConfChanged("tomwer_slices")
529
542
 
530
- def _methodChanged(self, *args, **kwargs):
543
+ def _methodChanged(self, index): # *args, **kwargs):
531
544
  self._signalConfChanged("method")
545
+ selected_method = self.getMethod()
546
+ self._methodWarningLabel.setVisible(
547
+ selected_method == _NabuReconstructionMethods.MLEM
548
+ )
532
549
 
533
550
  def _angleOffsetChanged(self, *args, **kwargs):
534
551
  self._signalConfChanged("angle_offset")
@@ -574,10 +591,10 @@ class _NabuReconstructionConfig(qt.QWidget, _NabuStageConfigBase):
574
591
  raise NotImplementedError()
575
592
 
576
593
  def getMethod(self) -> _NabuReconstructionMethods:
577
- return _NabuReconstructionMethods.from_value(self._methodQCB.currentText())
594
+ return _NabuReconstructionMethods(self._methodQCB.currentText())
578
595
 
579
596
  def setMethod(self, method):
580
- method = _NabuReconstructionMethods.from_value(method)
597
+ method = _NabuReconstructionMethods(method)
581
598
  item_index = self._methodQCB.findText(method.value)
582
599
  self._methodQCB.setCurrentIndex(item_index)
583
600
 
@@ -589,7 +606,7 @@ class _NabuReconstructionConfig(qt.QWidget, _NabuStageConfigBase):
589
606
 
590
607
  def getFBPFilterType(self) -> _NabuFBPFilterType | None:
591
608
  if self._fbpFilterCB.isChecked():
592
- return _NabuFBPFilterType.from_value(self._fbpFilterType.currentText())
609
+ return _NabuFBPFilterType(self._fbpFilterType.currentText())
593
610
  else:
594
611
  return None
595
612
 
@@ -605,10 +622,10 @@ class _NabuReconstructionConfig(qt.QWidget, _NabuStageConfigBase):
605
622
  self._fbpFilterType.setCurrentIndex(filter_index)
606
623
 
607
624
  def getFBPPaddingType(self) -> _NabuPaddingType:
608
- return _NabuPaddingType.from_value(self._paddingType.currentText())
625
+ return _NabuPaddingType(self._paddingType.currentText())
609
626
 
610
627
  def setFBPPaddingType(self, padding):
611
- padding = _NabuPaddingType.from_value(padding)
628
+ padding = _NabuPaddingType(padding)
612
629
  padding_index = self._paddingType.findText(padding.value)
613
630
  self._paddingType.setCurrentIndex(padding_index)
614
631
 
@@ -1012,17 +1029,22 @@ class _BinSubSampling(qt.QGroupBox):
1012
1029
  def __init__(self, text, parent):
1013
1030
  qt.QGroupBox.__init__(self, text)
1014
1031
  self.setLayout(qt.QFormLayout())
1015
- # horizontal binning
1016
- self._hBinningSB = QSpinBoxIgnoreWheel(self)
1017
- self._hBinningSB.setMinimum(1)
1018
- self._hBinningSB.setMaximum(3)
1019
- self.layout().addRow("horizontal binning", self._hBinningSB)
1020
- # vertical binning
1021
- self._vBinningSB = qt.QSpinBox(self)
1022
- self._vBinningSB.setMinimum(1)
1023
- self._vBinningSB.setMaximum(100)
1024
- # self.layout().addRow('vertical binning', self._vBinningSB)
1025
- self._vBinningSB.setVisible(False)
1032
+ # binning
1033
+ self._binningSB = QSpinBoxIgnoreWheel(self)
1034
+ self._binningSB.setMinimum(1)
1035
+ self._binningSB.setMaximum(3)
1036
+ self.layout().addRow("binning", self._binningSB)
1037
+ self._binningSB.setToolTip(
1038
+ "Binning factor in the horizontal dimension when reading the data. \nThe final slices dimensions will be divided by this factor."
1039
+ )
1040
+ # z binning
1041
+ self._zBinningSB = qt.QSpinBox(self)
1042
+ self._zBinningSB.setMinimum(1)
1043
+ self._zBinningSB.setMaximum(100)
1044
+ self.layout().addRow("vertical binning", self._zBinningSB)
1045
+ self._zBinningSB.setToolTip(
1046
+ "Binning factor in the vertical dimension when reading the data. \nThis results in a lesser number of reconstructed slices."
1047
+ )
1026
1048
  # projection sub-sampling
1027
1049
  self._projSubsamplingSB = QSpinBoxIgnoreWheel(self)
1028
1050
  self._projSubsamplingSB.setMinimum(1)
@@ -1030,35 +1052,35 @@ class _BinSubSampling(qt.QGroupBox):
1030
1052
  self.layout().addRow("projection sub-sampling", self._projSubsamplingSB)
1031
1053
 
1032
1054
  # connect signal / slot
1033
- self._vBinningSB.valueChanged.connect(self._valueUpdated)
1034
- self._hBinningSB.valueChanged.connect(self._valueUpdated)
1055
+ self._zBinningSB.valueChanged.connect(self._valueUpdated)
1056
+ self._binningSB.valueChanged.connect(self._valueUpdated)
1035
1057
 
1036
- def getHorizontalBinning(self):
1037
- return self._hBinningSB.value()
1058
+ def getHorizontalBinning(self) -> int:
1059
+ return self._binningSB.value()
1038
1060
 
1039
- def setHorizontalBinning(self, binning):
1040
- return self._hBinningSB.setValue(int(binning))
1061
+ def setHorizontalBinning(self, binning: int):
1062
+ return self._binningSB.setValue(int(binning))
1041
1063
 
1042
- def getVerticalBinning(self):
1043
- return self._vBinningSB.value()
1064
+ def getVerticalBinning(self) -> int:
1065
+ return self._zBinningSB.value()
1044
1066
 
1045
- def setVerticalBinning(self, binning):
1046
- return self._vBinningSB.setValue(int(binning))
1067
+ def setVerticalBinning(self, binning: int):
1068
+ return self._zBinningSB.setValue(int(binning))
1047
1069
 
1048
- def getProjSubsampling(self):
1070
+ def getProjSubsampling(self) -> int:
1049
1071
  return self._projSubsamplingSB.value()
1050
1072
 
1051
- def setProjSubsampling(self, subsampling):
1073
+ def setProjSubsampling(self, subsampling: int):
1052
1074
  return self._projSubsamplingSB.setValue(int(subsampling))
1053
1075
 
1054
- def getConfiguration(self):
1076
+ def getConfiguration(self) -> dict:
1055
1077
  return {
1056
1078
  "binning": self.getHorizontalBinning(),
1057
1079
  "binning_z": self.getVerticalBinning(),
1058
1080
  "projections_subsampling": self.getProjSubsampling(),
1059
1081
  }
1060
1082
 
1061
- def setConfiguration(self, config):
1083
+ def setConfiguration(self, config: dict):
1062
1084
  if "binning" in config:
1063
1085
  self.setHorizontalBinning(config["binning"])
1064
1086
  if "binning_z" in config:
@@ -9,7 +9,6 @@ from silx.gui import qt
9
9
 
10
10
  from tomwer.core.process.reconstruction.nabu.utils import _NabuStages
11
11
  from tomwer.gui import icons
12
- from tomwer.gui.utils.illustrations import _IllustrationWidget
13
12
  from tomwer.utils import docstring
14
13
 
15
14
  from ...utils.flow import FlowCanvas, FlowDirection
@@ -32,7 +31,7 @@ class NabuFlowControl(qt.QWidget):
32
31
  def __init__(self, parent, direction):
33
32
  qt.QWidget.__init__(self, parent=parent)
34
33
 
35
- self._direction = FlowDirection.from_value(direction)
34
+ self._direction = FlowDirection(direction)
36
35
 
37
36
  if self._direction is FlowDirection.VERTICAL:
38
37
  self.setLayout(qt.QVBoxLayout())
@@ -113,7 +112,7 @@ class NabuFlowControl(qt.QWidget):
113
112
  self.setPostVisible(True)
114
113
 
115
114
  def _updateActiveProcess(self, stage):
116
- stage = _NabuStages.from_value(stage)
115
+ stage = _NabuStages(stage)
117
116
 
118
117
  if stage is _NabuStages.INI:
119
118
  activeWidget = self._iniProcessWidgets
@@ -330,20 +329,13 @@ class NabuFlowArea(qt.QWidget):
330
329
 
331
330
  def __init__(self, parent, direction):
332
331
  qt.QWidget.__init__(self, parent=parent)
333
- direction = FlowDirection.from_value(direction)
332
+ direction = FlowDirection(direction)
334
333
 
335
334
  if direction is FlowDirection.VERTICAL:
336
335
  self.setLayout(qt.QHBoxLayout(self))
337
- img_flow = "flow_down"
338
336
  else:
339
337
  self.setLayout(qt.QVBoxLayout(self))
340
- img_flow = "flow_right"
341
338
 
342
- self._flowIllustration = _IllustrationWidget(parent=self, img=img_flow)
343
- self._flowIllustration.setFixedWidth(50)
344
- self._flowIllustration.setSizePolicy(
345
- qt.QSizePolicy.Minimum, qt.QSizePolicy.Minimum
346
- )
347
339
  self._control = NabuFlowControl(parent=self, direction=direction)
348
340
  self._control.setSizePolicy(qt.QSizePolicy.Minimum, qt.QSizePolicy.Minimum)
349
341
  self._addRmWidget = _AddRemoveProcessWidget(parent=self, direction=direction)
@@ -352,13 +344,11 @@ class NabuFlowArea(qt.QWidget):
352
344
 
353
345
  if direction is FlowDirection.VERTICAL:
354
346
  # if vertical illustration left sided
355
- self.layout().addWidget(self._flowIllustration)
356
347
  self.layout().addWidget(self._control)
357
348
  self.layout().addWidget(self._addRmWidget)
358
349
  else:
359
350
  # if horizontal illustration bottom sided
360
351
  self.layout().addWidget(self._control)
361
- self.layout().addWidget(self._flowIllustration)
362
352
  self.layout().addWidget(self._addRmWidget)
363
353
 
364
354
  # set up
@@ -56,7 +56,7 @@ class _NabuStages(_Enum):
56
56
  @staticmethod
57
57
  def getProcessEnum(stage):
58
58
  """Return the process Enum associated to the stage"""
59
- stage = _NabuStages.from_value(stage)
59
+ stage = _NabuStages(stage)
60
60
  if stage is _NabuStages.INI:
61
61
  raise NotImplementedError()
62
62
  elif stage is _NabuStages.PRE:
@@ -147,7 +147,7 @@ class _NabuConfiguration(qt.QWidget):
147
147
  self.addStage(stage=stage, processes=processes)
148
148
 
149
149
  def addStage(self, stage, processes):
150
- stage = _NabuStages.from_value(value=stage)
150
+ stage = _NabuStages(value=stage)
151
151
  for process in processes:
152
152
  _NabuStages.getProcessEnum(stage=stage)
153
153
 
@@ -436,7 +436,7 @@ class NabuWidget(qt.QWidget):
436
436
 
437
437
  def __init__(self, parent, flow_direction="vertical"):
438
438
  qt.QWidget.__init__(self, parent=parent)
439
- flow_direction = FlowDirection.from_value(flow_direction)
439
+ flow_direction = FlowDirection(flow_direction)
440
440
  self.setLayout(qt.QGridLayout())
441
441
  self._filteringActive = True
442
442
  self._configuration_level = ConfigurationLevel.OPTIONAL
@@ -485,7 +485,7 @@ class NabuWidget(qt.QWidget):
485
485
  qt.QSizePolicy.Minimum, qt.QSizePolicy.Minimum
486
486
  )
487
487
  self._configurationScrollArea.setSizePolicy(
488
- qt.QSizePolicy.Minimum, qt.QSizePolicy.Minimum
488
+ qt.QSizePolicy.Expanding, qt.QSizePolicy.Minimum
489
489
  )
490
490
 
491
491
  # expose API
@@ -575,10 +575,10 @@ class NabuWidget(qt.QWidget):
575
575
  self._configuration.hidePaganinInterface()
576
576
 
577
577
  def getMode(self):
578
- return _NabuMode.from_value(self._nabuModeCB.currentText())
578
+ return _NabuMode(self._nabuModeCB.currentText())
579
579
 
580
580
  def setMode(self, mode):
581
- mode = _NabuMode.from_value(mode)
581
+ mode = _NabuMode(mode)
582
582
  idx = self._nabuModeCB.findText(mode.value)
583
583
  self._nabuModeCB.setCurrentIndex(idx)
584
584
 
@@ -15,6 +15,7 @@ def test_CastVolumeWidget(qtapp): # noqa F811
15
15
  "overwrite": True,
16
16
  "rescale_max_percentile": 90,
17
17
  "rescale_min_percentile": 10,
18
+ "remove_input_volume": False,
18
19
  }
19
20
 
20
21
  widget._minMaxAuto.setChecked(False)
@@ -28,6 +29,7 @@ def test_CastVolumeWidget(qtapp): # noqa F811
28
29
  "overwrite": True,
29
30
  "rescale_max_percentile": None,
30
31
  "rescale_min_percentile": None,
32
+ "remove_input_volume": False,
31
33
  }
32
34
 
33
35
  widget.setDataMin(1.0)
@@ -43,6 +45,7 @@ def test_CastVolumeWidget(qtapp): # noqa F811
43
45
  "overwrite": True,
44
46
  "rescale_max_percentile": None,
45
47
  "rescale_min_percentile": None,
48
+ "remove_input_volume": False,
46
49
  }
47
50
  widget.setOutputFileformat("edf")
48
51
  assert widget.getConfiguration() == {
@@ -55,6 +58,7 @@ def test_CastVolumeWidget(qtapp): # noqa F811
55
58
  "overwrite": True,
56
59
  "rescale_max_percentile": None,
57
60
  "rescale_min_percentile": None,
61
+ "remove_input_volume": False,
58
62
  }
59
63
  widget.setOverwrite(False)
60
64
  assert widget.getConfiguration() == {
@@ -67,6 +71,7 @@ def test_CastVolumeWidget(qtapp): # noqa F811
67
71
  "overwrite": False,
68
72
  "rescale_max_percentile": None,
69
73
  "rescale_min_percentile": None,
74
+ "remove_input_volume": False,
70
75
  }
71
76
  widget.setOutputDataType("float32")
72
77
  assert widget.getConfiguration() == {
@@ -79,4 +84,18 @@ def test_CastVolumeWidget(qtapp): # noqa F811
79
84
  "overwrite": False,
80
85
  "rescale_max_percentile": None,
81
86
  "rescale_min_percentile": None,
87
+ "remove_input_volume": False,
88
+ }
89
+ widget.setRemoveInputVolume(True)
90
+ assert widget.getConfiguration() == {
91
+ "compression_ratios": None,
92
+ "data_max": 10.0,
93
+ "data_min": 1.0,
94
+ "output_data_type": "float32",
95
+ "output_dir": "{volume_data_parent_folder}/cast_volume",
96
+ "output_file_format": "edf",
97
+ "overwrite": False,
98
+ "rescale_max_percentile": None,
99
+ "rescale_min_percentile": None,
100
+ "remove_input_volume": True,
82
101
  }
@@ -493,10 +493,10 @@ class _NormIntensityOptions(qt.QWidget):
493
493
  self._lockButton.hide()
494
494
 
495
495
  def getCurrentMethod(self):
496
- return Method.from_value(self._modeCB.currentText())
496
+ return Method(self._modeCB.currentText())
497
497
 
498
498
  def setCurrentMethod(self, method):
499
- method = Method.from_value(method)
499
+ method = Method(method)
500
500
  idx = self._modeCB.findText(method.value)
501
501
  self._modeCB.setCurrentIndex(idx)
502
502