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

HistogramPanel shows a message if non-volumetric overlay is selected

parent e96d8ab2
No related branches found
No related tags found
No related merge requests found
......@@ -54,6 +54,8 @@ messages = TypeDict({
'saving the screenshot. Try '
'calling render directly with '
'this command: \n{}',
'HistogramPanel.noData' : 'Selected overlay has no data',
})
......
......@@ -71,7 +71,7 @@ class HistogramPanel(plotpanel.PlotPanel):
self._overlayList.addListener(
'overlays',
self._name,
self._selectedOveralyChanged)
self._selectedOverlayChanged)
self._displayCtx.addListener(
'selectedOverlay',
self._name,
......@@ -160,6 +160,7 @@ class HistogramPanel(plotpanel.PlotPanel):
overlay = self._displayCtx.getSelectedOverlay()
if not isinstance(overlay, fslimage.Image):
self._displayMessage(strings.messages[self, 'noData'])
return
minval = float(overlay.data.min())
......@@ -210,6 +211,18 @@ class HistogramPanel(plotpanel.PlotPanel):
self._domainHighlight = None
self.dataRange.x = newRange
def _displayMessage(self, msg):
axis = self.getAxis()
axis.clear()
axis.set_xlim((0.0, 1.0))
axis.set_ylim((0.0, 1.0))
axis.text(0.5, 0.5, msg, ha='center', va='center')
self.getCanvas().draw()
self.Refresh()
def _drawPlot(self, *a):
......
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