Skip to content

Commit 3042ddb

Browse files
committed
Allow to add singleton axes on export
1 parent 2ba0494 commit 3042ddb

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

volumina/pixelpipeline/datasources/lazyflowsource.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ def __init__(self, outslot, priority=0):
108108
self._op5 = opReorderAxes.OpReorderAxes(
109109
parent=outslot.getRealOperator().parent, graph=outslot.getRealOperator().graph
110110
)
111+
self._op5.name = "hehehe"
111112
self._op5.Input.connect(outslot)
112113
self._op5.AxisOrder.setValue("txyzc")
113114

volumina/widgets/dataExportOptionsDlg.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -405,8 +405,9 @@ def eventFilter(self, watched, event):
405405

406406
class _AxisOrderValidator(QValidator):
407407
def __init__(self, parent, inputSlot):
408-
super(DataExportOptionsDlg._AxisOrderValidator, self).__init__(parent)
408+
super().__init__(parent)
409409
self._inputSlot = inputSlot
410+
self._valid_axes = set("tzyxc")
410411

411412
def validate(self, userAxes, pos):
412413
taggedShape = self._inputSlot.meta.getTaggedShape()
@@ -415,17 +416,16 @@ def validate(self, userAxes, pos):
415416
userSet = set(str(userAxes))
416417

417418
# Ensure all user axes appear in the input
418-
if not (userSet <= inputSet):
419+
if not userSet.issubset(self._valid_axes):
419420
return (QValidator.Invalid, userAxes, pos)
420421

421422
# Ensure no repeats
422423
if len(userSet) != len(userAxes):
423424
return (QValidator.Invalid, userAxes, pos)
424425

425-
# If missing non-singleton axes, maybe intermediate entry
426-
# (It's okay to omit singleton axes)
427-
for key in inputSet - userSet:
428-
if taggedShape[key] != 1:
426+
# Ensure no non-singleton axis was omitted:
427+
for key in self._valid_axes - userSet:
428+
if taggedShape.get(key, 1) != 1:
429429
return (QValidator.Intermediate, userAxes, pos)
430430

431431
return (QValidator.Acceptable, userAxes, pos)

0 commit comments

Comments
 (0)