diff --git a/fsl/data/image.py b/fsl/data/image.py index 8fcaff967594bfa1c9f5662e3b8b1e4185fd7bb1..ab36ce0cbcda566c6cbc66a0978042d6ab8f819a 100644 --- a/fsl/data/image.py +++ b/fsl/data/image.py @@ -1332,12 +1332,10 @@ def looksLikeImage(filename, allowedExts=None): extensions - defaults to :attr:`ALLOWED_EXTENSIONS`. """ - if allowedExts is None: allowedExts = ALLOWED_EXTENSIONS + if allowedExts is None: + allowedExts = ALLOWED_EXTENSIONS - # TODO A much more robust approach would be - # to try loading the file using nibabel. - - return any([filename.endswith(ext) for ext in allowedExts]) + return fslpath.hasExt(filename, allowedExts) def addExt(prefix, mustExist=True, unambiguous=True):