From aca3637574eeaa689195c83cb6dc2a02ec19436a Mon Sep 17 00:00:00 2001 From: Paul McCarthy <pauldmccarthy@gmail.com> Date: Sun, 21 Jan 2018 16:31:24 +0000 Subject: [PATCH] Cosmetics in image module. --- fsl/data/image.py | 59 +++++++++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 30 deletions(-) diff --git a/fsl/data/image.py b/fsl/data/image.py index 4c22ad402..8fcaff967 100644 --- a/fsl/data/image.py +++ b/fsl/data/image.py @@ -36,7 +36,6 @@ import os import os.path as op import string import logging -import collections import six import deprecation @@ -58,6 +57,35 @@ import fsl.data.imagewrapper as imagewrapper log = logging.getLogger(__name__) +ALLOWED_EXTENSIONS = ['.nii.gz', '.nii', '.img', '.hdr', '.img.gz', '.hdr.gz'] +"""The file extensions which we understand. This list is used as the default +if the ``allowedExts`` parameter is not passed to any of the functions +below. +""" + + +EXTENSION_DESCRIPTIONS = ['Compressed NIFTI images', + 'NIFTI images', + 'ANALYZE75 images', + 'NIFTI/ANALYZE75 headers', + 'Compressed NIFTI/ANALYZE75 images', + 'Compressed NIFTI/ANALYZE75 headers'] +"""Descriptions for each of the extensions in :data:`ALLOWED_EXTENSIONS`. """ + + +FILE_GROUPS = [('.hdr', '.img'), + ('.hdr.gz', '.img.gz')] +"""File suffix groups used by :func:`addExt` to resolve file path +ambiguities - see :func:`fsl.utils.path.addExt`. +""" + + +PathError = fslpath.PathError +"""Error raised by :mod:`fsl.utils.path` functions when an error occurs. +Made available in this module for convenience. +""" + + class Nifti(notifier.Notifier, meta.Meta): """The ``Nifti`` class is intended to be used as a base class for things which either are, or are associated with, a NIFTI image. @@ -1290,35 +1318,6 @@ class Image(Nifti): self.notify(topic='dataRange') -ALLOWED_EXTENSIONS = ['.nii.gz', '.nii', '.img', '.hdr', '.img.gz', '.hdr.gz'] -"""The file extensions which we understand. This list is used as the default -if the ``allowedExts`` parameter is not passed to any of the functions -below. -""" - - -EXTENSION_DESCRIPTIONS = ['Compressed NIFTI images', - 'NIFTI images', - 'ANALYZE75 images', - 'NIFTI/ANALYZE75 headers', - 'Compressed NIFTI/ANALYZE75 images', - 'Compressed NIFTI/ANALYZE75 headers'] -"""Descriptions for each of the extensions in :data:`ALLOWED_EXTENSIONS`. """ - - -FILE_GROUPS = [('.hdr', '.img'), - ('.hdr.gz', '.img.gz')] -"""File suffix groups used by :func:`addExt` to resolve file path -ambiguities - see :func:`fsl.utils.path.addExt`. -""" - - -PathError = fslpath.PathError -"""Error raised by :mod:`fsl.utils.path` functions when an error occurs. -Made available in this module for convenience. -""" - - def looksLikeImage(filename, allowedExts=None): """Returns ``True`` if the given file looks like a NIFTI image, ``False`` otherwise. -- GitLab