From 852f6a982ac0079a86ec0ce288b76cb157e4e5da Mon Sep 17 00:00:00 2001
From: Paul McCarthy <pauld.mccarthy@gmail.com>
Date: Wed, 2 Dec 2015 14:16:57 +0000
Subject: [PATCH] Bugfix - images within melodic/FEAT directories, specified on
 command line, without file suffix, were not being recognised.

---
 fsl/fsleyes/overlay.py | 24 +++++++++---------------
 1 file changed, 9 insertions(+), 15 deletions(-)

diff --git a/fsl/fsleyes/overlay.py b/fsl/fsleyes/overlay.py
index 0dbe9ef6c..053bb0d9c 100644
--- a/fsl/fsleyes/overlay.py
+++ b/fsl/fsleyes/overlay.py
@@ -202,28 +202,22 @@ def guessDataSourceType(path):
     if path.endswith('.vtk'):
         return fslmodel.Model, path
 
-
+    # Analysis directory?
     if op.isdir(path):
         if melresults.isMelodicDir(path):
             return fslmelimage.MelodicImage, path
 
-        if featresults.isFEATDir(path):
+        elif featresults.isFEATDir(path):
             return fslfeatimage.FEATImage, path
 
-    elif melresults.isMelodicImage(path):
-        return fslmelimage.MelodicImage, path
-    
-    elif featresults.isFEATImage(path):
-        return fslfeatimage.FEATImage, path
-
-    # A regular NIFTI image?
-    try:
-        path = fslimage.addExt(path, mustExist=True)
-        return fslimage.Image, path
-    
-    except ValueError:
-        pass
+    # Assume it's a NIFTI image
+    try:               path = fslimage.addExt(path, mustExist=True)
+    except ValueError: return None, path
 
+    if   melresults.isMelodicImage(path): return fslmelimage.MelodicImage, path
+    elif featresults.isFEATImage(  path): return fslfeatimage.FEATImage,   path
+    else:                                 return fslimage.Image,           path
+        
     # Otherwise, I don't
     # know what to do
     return None, path
-- 
GitLab