From 255baae62d80026aaa0a1e92060f952a3d2d1022 Mon Sep 17 00:00:00 2001 From: Paul McCarthy <pauldmccarthy@gmail.com> Date: Thu, 8 Feb 2018 12:17:59 +0000 Subject: [PATCH] Clean up looksLikeImage --- fsl/data/image.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/fsl/data/image.py b/fsl/data/image.py index 8fcaff967..ab36ce0cb 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): -- GitLab