Skip to content
Snippets Groups Projects
Commit 097dff7d authored by Paul McCarthy's avatar Paul McCarthy
Browse files

Atlas functions return None if ATLAS_DIR is not

available. ImageSelectPanel works if image list is empty
parent 0f75a4e6
No related branches found
No related tags found
No related merge requests found
...@@ -84,6 +84,8 @@ def listAtlases(refresh=False): ...@@ -84,6 +84,8 @@ def listAtlases(refresh=False):
:attr:`ATLAS_DESCRIPTIONS`). :attr:`ATLAS_DESCRIPTIONS`).
""" """
if ATLAS_DIR is None:
return []
if len(ATLAS_DESCRIPTIONS) == 0: if len(ATLAS_DESCRIPTIONS) == 0:
refresh = True refresh = True
...@@ -109,6 +111,9 @@ def getAtlasDescription(atlasID): ...@@ -109,6 +111,9 @@ def getAtlasDescription(atlasID):
"""Returns an :class:`AtlasDescription` instance describing the """Returns an :class:`AtlasDescription` instance describing the
atlas with the given ``atlasID``. atlas with the given ``atlasID``.
""" """
if ATLAS_DIR is None:
return None
if len(ATLAS_DESCRIPTIONS) == 0: if len(ATLAS_DESCRIPTIONS) == 0:
listAtlases() listAtlases()
...@@ -124,6 +129,9 @@ def loadAtlas(atlasID, loadSummary=False): ...@@ -124,6 +129,9 @@ def loadAtlas(atlasID, loadSummary=False):
loaded. Otherwise, if the atlas is probabilistic, loaded. Otherwise, if the atlas is probabilistic,
a 4D :class:`ProbabilisticAtlas` image is loaded. a 4D :class:`ProbabilisticAtlas` image is loaded.
""" """
if ATLAS_DIR is None:
return None
if len(ATLAS_DESCRIPTIONS) == 0: if len(ATLAS_DESCRIPTIONS) == 0:
listAtlases() listAtlases()
......
...@@ -163,11 +163,13 @@ class ImageSelectPanel(fslpanel.FSLViewPanel): ...@@ -163,11 +163,13 @@ class ImageSelectPanel(fslpanel.FSLViewPanel):
allImages = self._displayCtx.getOrderedImages() allImages = self._displayCtx.getOrderedImages()
image = self._displayCtx.getSelectedImage() image = self._displayCtx.getSelectedImage()
idx = allImages.index(image)
nimgs = len(allImages) nimgs = len(allImages)
if nimgs > 0: idx = allImages.index(image)
else: idx = -1
self._prevButton.Enable(nimgs > 0 and idx != 0) self._prevButton.Enable(nimgs > 0 and idx > 0)
self._nextButton.Enable(nimgs > 0 and idx != nimgs - 1) self._nextButton.Enable(nimgs > 0 and idx < nimgs - 1)
if self._imageLabel is None: if self._imageLabel is None:
return return
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment