From 00a64d0355b85bb66a6e0dc1efb6ef9026c6b586 Mon Sep 17 00:00:00 2001 From: Paul McCarthy <pauld.mccarthy@gmail.com> Date: Sun, 16 Apr 2017 13:26:29 +0100 Subject: [PATCH] Updates to featimage docs. Clarification/fix to featanalysis.isFEATImage --- fsl/data/featanalysis.py | 6 ++++++ fsl/data/featimage.py | 21 ++++++++------------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/fsl/data/featanalysis.py b/fsl/data/featanalysis.py index f11fc261d..b0742ed18 100644 --- a/fsl/data/featanalysis.py +++ b/fsl/data/featanalysis.py @@ -61,6 +61,12 @@ def isFEATImage(path): """Returns ``True`` if the given path looks like it is the input data to a FEAT analysis, ``False`` otherwise. """ + + try: + path = fslimage.addExt(path, mustExist=True) + except: + return False + dirname = op.dirname( path) filename = op.basename(path) diff --git a/fsl/data/featimage.py b/fsl/data/featimage.py index 12d2b3af9..fa7c4681d 100644 --- a/fsl/data/featimage.py +++ b/fsl/data/featimage.py @@ -18,7 +18,7 @@ from . import featanalysis class FEATImage(fslimage.Image): - """An ``Image`` from a FEAT analysis. + """An ``Image`` which contains the input data from a FEAT analysis. The :class:`FEATImage` class makes use of the functions defined in the :mod:`.featanalysis` module. @@ -29,14 +29,14 @@ class FEATImage(fslimage.Image): import fsl.data.featimage as featimage # You can pass in the name of the - # .feat directory, or any file - # contained within that directory. + # .feat directory, or the filtered_func_data + # file contained within that directory. img = featimage.FEATImage('myanalysis.feat/filtered_func_data.nii.gz') # Query information about the FEAT analysis - print img.numEVs() - print img.contrastNames() - print img.numPoints() + print(img.numEVs()) + print(img.contrastNames()) + print(img.numPoints()) # Get the model fit residuals res4d = img.getResiduals() @@ -52,15 +52,10 @@ class FEATImage(fslimage.Image): def __init__(self, path, **kwargs): """Create a ``FEATImage`` instance. - :arg path: A FEAT analysis directory, or an image file contained - within such a directory. + :arg path: A FEAT analysis directory, or the input data image file + contained within such a directory. :arg kwargs: Passed to the :class:`.Image` constructor. - - .. note:: If a FEAT directory is passed in for the ``path`` - argument, this ``FEATImage`` instance will encapsulate - the model input data, typically called - ``<directory>.feat/filtered_func_data.nii.gz``. """ if op.isdir(path): -- GitLab