Commit b118b488 authored by Paul McCarthy's avatar Paul McCarthy
Browse files

.gz suffix removed from fslimage.ALLOWED_EXTENSIONS

parent b5e00855
......@@ -749,11 +749,7 @@ class Image(Nifti, notifier.Notifier):
# TODO The wx.FileDialog does not
# seem to handle wildcards with
# multiple suffixes (e.g. '.nii.gz'),
# so i'm just providing '*.gz'for now
ALLOWED_EXTENSIONS = ['.nii.gz', '.nii', '.img', '.hdr', '.img.gz', '.gz']
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
......@@ -769,7 +765,7 @@ EXTENSION_DESCRIPTIONS = ['Compressed NIFTI images',
"""Descriptions for each of the extensions in :data:`ALLOWED_EXTENSIONS`. """
REPLACEMENTS = {'.hdr' : ['.img', '.img.gz']}
REPLACEMENTS = {'.hdr' : ['.img'], '.hdr.gz' : ['.img.gz']}
"""Suffix replacements used by :func:`addExt` to resolve file path
ambiguities - see :func:`fsl.utils.path.addExt`.
......@@ -789,10 +785,14 @@ def looksLikeImage(filename, allowedExts=None):
"""Returns ``True`` if the given file looks like an image, ``False``
.. note:: The ``filename`` cannot just be a file prefix - it must
include the file suffix (e.g. ``myfile.nii.gz``, not
:arg filename: The file name to test.
:arg allowedExts: A list of strings containing the allowed file
extensions - defaults to :attr:`ALLOWED_EXTENSIONS`.
if allowedExts is None: allowedExts = ALLOWED_EXTENSIONS
......@@ -170,9 +170,6 @@ def addExt(prefix,
replacements = [replace.get(s) for s in suffixes]
hasReplace = [r is not None for r in replacements]
for p, r in zip(allPaths, replacements):
print ' {} replacements: {}'.format(p, r)
# If any replacement has been specified
# for any of the existing suffixes,
# see if we have a unique match for
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment