From 7778bf0d8dac34e499f9ad1f8d03f65bbf459660 Mon Sep 17 00:00:00 2001 From: Paul McCarthy <pauld.mccarthy@gmail.com> Date: Wed, 21 Sep 2016 16:37:56 +0100 Subject: [PATCH] Bugfix in Nifti1.__determineTransform - a scaling matrix should be used when both q/sforms are unknown. Otherwise should default to nibabel. Also added method to MelodicClassification to return all labels. --- fsl/data/image.py | 2 +- fsl/data/melodiclabels.py | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/fsl/data/image.py b/fsl/data/image.py index ba2ae2d78..90a1c8e63 100644 --- a/fsl/data/image.py +++ b/fsl/data/image.py @@ -137,7 +137,7 @@ class Nifti(object): # corresponds to world location (0, 0, 0). # This goes against the NIFTI spec - it # should just be a straight scaling matrix. - elif header['qform_code'] == 0 or header['sform_code'] == 0: + elif header['qform_code'] == 0 and header['sform_code'] == 0: pixdims = header.get_zooms() voxToWorldMat = transform.scaleOffsetXform(pixdims, 0) diff --git a/fsl/data/melodiclabels.py b/fsl/data/melodiclabels.py index 7b00eacbf..39de23ed2 100644 --- a/fsl/data/melodiclabels.py +++ b/fsl/data/melodiclabels.py @@ -163,6 +163,13 @@ class MelodicClassification(notifier.Notifier): return list(self.__labels[component]) + def getAllLabels(self): + """Returns all labels that are currently associated with any + component. + """ + return list(self.__components.keys()) + + def hasLabel(self, component, label): """Returns ``True`` if the specified component has the specified label, ``False`` otherwise. -- GitLab