Skip to content

Commit

Permalink
source axistags from input, allow for singleton axes when changing order
Browse files Browse the repository at this point in the history
* sources the `inputAxes` from the input's original shape
* allow to have singleton axes (that were present in original shape) when
  reordering
  • Loading branch information
k-dominik committed Apr 17, 2020
1 parent e66ca67 commit e1dadc6
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions volumina/widgets/dataExportOptionsDlg.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,9 +374,7 @@ def _handleAxisOrderChecked(checked):

self.outputAxisOrderEdit.editingFinished.connect(_handleNewAxisOrder)
self.outputAxisOrderEdit.textChanged.connect(partial(self._updateAxisOrderColor, True))
self.outputAxisOrderEdit.setValidator(
DataExportOptionsDlg._AxisOrderValidator(self, self._opDataExport.ConvertedImage)
)
self.outputAxisOrderEdit.setValidator(DataExportOptionsDlg._AxisOrderValidator(self, self._opDataExport.Input))
self.outputAxisOrderEdit.installEventFilter(DataExportOptionsDlg._AxisOrderEventFilter(self))
self.axisOrderCheckbox.toggled.connect(_handleAxisOrderChecked)

Expand Down Expand Up @@ -410,7 +408,8 @@ def __init__(self, parent, inputSlot):

def validate(self, userAxes, pos):
taggedShape = self._inputSlot.meta.getTaggedShape()
inputAxes = list(taggedShape.keys())
originalAxes = self._inputSlot.meta.getOriginalAxisKeys()
inputAxes = list(originalAxes)
inputSet = set(inputAxes)
userSet = set(str(userAxes))

Expand All @@ -425,7 +424,7 @@ def validate(self, userAxes, pos):
# If missing non-singleton axes, maybe intermediate entry
# (It's okay to omit singleton axes)
for key in inputSet - userSet:
if taggedShape[key] != 1:
if taggedShape.get(key, 1) != 1:
return (QValidator.Intermediate, userAxes, pos)

return (QValidator.Acceptable, userAxes, pos)
Expand Down

0 comments on commit e1dadc6

Please sign in to comment.