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): ...@@ -749,11 +749,7 @@ class Image(Nifti, notifier.Notifier):
self.notify(notifier_topic='dataRange') self.notify(notifier_topic='dataRange')
# TODO The wx.FileDialog does not ALLOWED_EXTENSIONS = ['.nii.gz', '.nii', '.img', '.hdr', '.img.gz', '.hdr.gz']
# 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']
"""The file extensions which we understand. This list is used as the default """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 if the ``allowedExts`` parameter is not passed to any of the functions
below. below.
...@@ -769,7 +765,7 @@ EXTENSION_DESCRIPTIONS = ['Compressed NIFTI images', ...@@ -769,7 +765,7 @@ EXTENSION_DESCRIPTIONS = ['Compressed NIFTI images',
"""Descriptions for each of the extensions in :data:`ALLOWED_EXTENSIONS`. """ """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 """Suffix replacements used by :func:`addExt` to resolve file path
ambiguities - see :func:`fsl.utils.path.addExt`. ambiguities - see :func:`fsl.utils.path.addExt`.
""" """
...@@ -789,10 +785,14 @@ def looksLikeImage(filename, allowedExts=None): ...@@ -789,10 +785,14 @@ def looksLikeImage(filename, allowedExts=None):
"""Returns ``True`` if the given file looks like an image, ``False`` """Returns ``True`` if the given file looks like an image, ``False``
otherwise. otherwise.
.. note:: The ``filename`` cannot just be a file prefix - it must
include the file suffix (e.g. ``myfile.nii.gz``, not
``myfile``).
:arg filename: The file name to test. :arg filename: The file name to test.
:arg allowedExts: A list of strings containing the allowed file :arg allowedExts: A list of strings containing the allowed file
extensions. extensions - defaults to :attr:`ALLOWED_EXTENSIONS`.
""" """
if allowedExts is None: allowedExts = ALLOWED_EXTENSIONS if allowedExts is None: allowedExts = ALLOWED_EXTENSIONS
......
...@@ -170,9 +170,6 @@ def addExt(prefix, ...@@ -170,9 +170,6 @@ def addExt(prefix,
replacements = [replace.get(s) for s in suffixes] replacements = [replace.get(s) for s in suffixes]
hasReplace = [r is not None for r in replacements] 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 # If any replacement has been specified
# for any of the existing suffixes, # for any of the existing suffixes,
# see if we have a unique match for # 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