From a8ed58f3f05057c90bbfbfcd4c17f41126db97a1 Mon Sep 17 00:00:00 2001
From: Paul McCarthy <pauld.mccarthy@gmail.com>
Date: Fri, 16 Oct 2015 17:27:25 +0100
Subject: [PATCH] AtlasPanel works with non-MNI152 overlays, but shows a
 warning if NIFTI header does not say that it's in MNI152 space.

---
 fsl/data/strings.py                    |  7 +++----
 fsl/fsleyes/controls/atlasinfopanel.py | 18 ++++++++++--------
 2 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/fsl/data/strings.py b/fsl/data/strings.py
index 84de93380..716fefb07 100644
--- a/fsl/data/strings.py
+++ b/fsl/data/strings.py
@@ -76,10 +76,9 @@ messages = TypeDict({
 
     'AtlasOverlayPanel.loadRegions' : 'Loading region descriptions for {} ...',
 
-    'AtlasInfoPanel.notMNISpace'   : 'Atlas lookup can only be performed on '
-                                     'images oriented to MNI152 space',
-
-    'AtlasInfoPanel.noReference' : 'No reference image available',
+    'AtlasInfoPanel.notMNISpace'   : 'The selected overlay does not appear to '
+                                     'be in MNI152 space - atlas '
+                                     'information might not be accurate!' ,
 
     'AtlasInfoPanel.chooseAnAtlas' : 'Choose an atlas!',
     'AtlasInfoPanel.atlasDisabled' : 'Atlases are not available',
diff --git a/fsl/fsleyes/controls/atlasinfopanel.py b/fsl/fsleyes/controls/atlasinfopanel.py
index d488b8d53..367e43d5b 100644
--- a/fsl/fsleyes/controls/atlasinfopanel.py
+++ b/fsl/fsleyes/controls/atlasinfopanel.py
@@ -154,18 +154,17 @@ class AtlasInfoPanel(fslpanel.FSLEyesPanel):
         text    = self.__infoPanel
         overlay = self._displayCtx.getReferenceImage(
             self._displayCtx.getSelectedOverlay())
+
+        topText = None
         
         if len(atlases.listAtlases()) == 0:
             text.SetPage(strings.messages['AtlasInfoPanel.atlasDisabled'])
             return
 
-        if overlay is None:
-            text.SetPage(strings.messages['AtlasInfoPanel.noReference'])
-            return 
-
-        if overlay.getXFormCode() != constants.NIFTI_XFORM_MNI_152:
-            text.SetPage(strings.messages['AtlasInfoPanel.notMNISpace'])
-            return
+        if overlay is None or \
+           overlay.getXFormCode() != constants.NIFTI_XFORM_MNI_152:
+            topText = strings.messages['AtlasInfoPanel.notMNISpace']
+            topText = '<font color="red">{}</font>'.format(topText)
 
         if len(self.__enabledAtlases) == 0:
             text.SetPage(strings.messages['AtlasInfoPanel.chooseAnAtlas'])
@@ -175,7 +174,10 @@ class AtlasInfoPanel(fslpanel.FSLEyesPanel):
         loc  = self._displayCtx.location
         loc  = opts.transformCoords([loc], 'display', 'world')[0]
 
-        lines         = []
+        lines = []
+
+        if topText is not None:
+            lines.append(topText)
         
         # Three types of hyperlink:
         #   - one for complete (summary) label atlases,
-- 
GitLab