From 792c5a748b7c3a1b32e69967a304a68c25f381a4 Mon Sep 17 00:00:00 2001
From: Paul McCarthy <pauld.mccarthy@gmail.com>
Date: Wed, 7 Jan 2015 14:17:10 +0000
Subject: [PATCH] Couple of little tweaks - testing on jalapeno (remote
 server), so there may be a few more miniscule commits

---
 fsl/data/imageio.py       | 28 ++++++++++++++--------------
 fsl/fslview/gl/glimage.py |  2 +-
 2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/fsl/data/imageio.py b/fsl/data/imageio.py
index 204c19f01..88cb0a9f7 100644
--- a/fsl/data/imageio.py
+++ b/fsl/data/imageio.py
@@ -23,18 +23,20 @@ log = logging.getLogger(__name__)
 # seem to handle wildcards with      
 # multiple suffixes (e.g. '.nii.gz'),
 # so i'm just providing '*.gz'for now
-ALLOWED_EXTENSIONS = ['.nii', '.img', '.hdr', '.gz', '.nii.gz', '.img.gz']
+ALLOWED_EXTENSIONS = ['.nii.gz', '.nii', '.img', '.hdr', '.img.gz', '.gz']
 """The file extensions which we understand. This list is used as the default
 if if the ``allowedExts`` parameter is not passed to any of the functions in
 this module.
 """
 
-EXTENSION_DESCRIPTIONS = ['NIFTI1 images',
+ALLOWED_EXTENSIONS     = [';'.join(ALLOWED_EXTENSIONS)] + ALLOWED_EXTENSIONS
+EXTENSION_DESCRIPTIONS = ['All supported files'
+                          'Compressed NIFTI1 images',
+                          'NIFTI1 images',
                           'ANALYZE75 images',
                           'NIFTI1/ANALYZE75 headers',
-                          'Compressed images',
-                          'Compressed NIFTI1 images',
-                          'Compressed NIFTI1/ANALYZE75 images']
+                          'Compressed NIFTI1/ANALYZE75 images'
+                          'Compressed images']
 """Descriptions for each of the extensions in :data:`ALLOWED_EXTENSIONS`. """
 
 
@@ -56,14 +58,9 @@ def makeWildcard(allowedExts=None):
     else:
         descs        = allowedExts
 
-    exts = ['*{}'.format(ext) for ext in allowedExts]
-
-    allDesc = 'All supported files'
-    allExts = ';'.join(exts)
-
+    exts    = ['*{}'.format(ext) for ext in allowedExts]
     wcParts = ['|'.join((desc, ext)) for (desc, ext) in zip(descs, exts)]
-    wcParts = ['|'.join((allDesc, allExts))] + wcParts
-
+    
     return '|'.join(wcParts)
 
 
@@ -284,7 +281,7 @@ def saveImage(image, imageList=None, fromDir=None):
     lastDir = getattr(saveImage, 'lastDir', None)
 
     if lastDir is None:
-        if image.imageFile is None: lastDir = os.cwd()
+        if image.imageFile is None: lastDir = os.getcwd()
         else:                       lastDir = op.dirname(image.imageFile)
 
     # TODO make image.name safe (spaces to 
@@ -331,6 +328,9 @@ def saveImage(image, imageList=None, fromDir=None):
         # are identical
         pass
 
+
+    # TODO handle error
+
     # this is just a normal image
     # which has been loaded from
     # a file, or an in-memory image
@@ -381,7 +381,7 @@ def addImages(imageList, fromDir=None, addToEnd=True):
         if len(imageList) > 0 and imageList[-1].imageFile is not None:
             lastDir = op.dirname(imageList[-1].imageFile)
         else:
-            lastDir = os.cwd()
+            lastDir = os.getcwd()
 
     saveLastDir = False
     if fromDir is None:
diff --git a/fsl/fslview/gl/glimage.py b/fsl/fslview/gl/glimage.py
index 5a236d34c..4151e9df7 100644
--- a/fsl/fslview/gl/glimage.py
+++ b/fsl/fslview/gl/glimage.py
@@ -175,7 +175,7 @@ class GLImage(object):
         # Another GLImage object may have
         # already deleted the image texture
         try:
-            imageTexture = self.image.delAttribute('glImageTexture')
+            imageTexture = self.image.delAttribute('GLImageTexture')
             gl.glDeleteTextures(1, imageTexture)
             
         except KeyError:
-- 
GitLab