Commit bb81f123 authored by Paul McCarthy's avatar Paul McCarthy 🚵
Browse files

ENH: Command-line options to invert ortho canvases

parent d17a1169
......@@ -72,6 +72,30 @@ class OrthoOpts(sceneopts.SceneOpts):
"""Controls zoom on the Z canvas. """
invertXHorizontal = copy.copy(canvasopts.SliceCanvasOpts.invertX)
"""Invert the X canvas along the horizontal axis. """
invertXVertical = copy.copy(canvasopts.SliceCanvasOpts.invertY)
"""Invert the X canvas along the vertical axis. """
invertYHorizontal = copy.copy(canvasopts.SliceCanvasOpts.invertX)
"""Invert the Y canvas along the horizontal axis. """
invertYVertical = copy.copy(canvasopts.SliceCanvasOpts.invertY)
"""Invert the Y canvas along the vertical axis. """
invertZHorizontal = copy.copy(canvasopts.SliceCanvasOpts.invertX)
"""Invert the Z canvas along the horizontal axis. """
invertZVertical = copy.copy(canvasopts.SliceCanvasOpts.invertY)
"""Invert the Z canvas along the vertical axis. """
def __init__(self, *args, **kwargs):
"""Create an ``OrthoOpts`` instance. All arguments are passed
through to the :class:`.SceneOpts` constructor.
......
......@@ -453,7 +453,13 @@ OPTIONS = td.TypeDict({
'showZCanvas',
'xcentre',
'ycentre',
'zcentre'],
'zcentre',
'invertXVertical',
'invertXHorizontal',
'invertYVertical',
'invertYHorizontal',
'invertZVertical',
'invertZHorizontal'],
'LightBoxOpts' : ['zax',
'sliceSpacing',
'zrange',
......@@ -778,20 +784,24 @@ ARGUMENTS = td.TypeDict({
'SceneOpts.movieSyncRefresh' : ('ms', 'movieSync', False),
'SceneOpts.labelSize' : ('ls', 'labelSize', True),
'OrthoOpts.xzoom' : ('xz', 'xzoom', True),
'OrthoOpts.yzoom' : ('yz', 'yzoom', True),
'OrthoOpts.zzoom' : ('zz', 'zzoom', True),
'OrthoOpts.cursorGap' : ('cg', 'cursorGap', False),
'OrthoOpts.layout' : ('lo', 'layout', True),
'OrthoOpts.showXCanvas' : ('xh', 'hidex', False),
'OrthoOpts.showYCanvas' : ('yh', 'hidey', False),
'OrthoOpts.showZCanvas' : ('zh', 'hidez', False),
'OrthoOpts.showLabels' : ('hl', 'hideLabels', False),
'OrthoOpts.xcentre' : ('xc', 'xcentre', True),
'OrthoOpts.ycentre' : ('yc', 'ycentre', True),
'OrthoOpts.zcentre' : ('zc', 'zcentre', True),
'OrthoOpts.xzoom' : ('xz', 'xzoom', True),
'OrthoOpts.yzoom' : ('yz', 'yzoom', True),
'OrthoOpts.zzoom' : ('zz', 'zzoom', True),
'OrthoOpts.cursorGap' : ('cg', 'cursorGap', False),
'OrthoOpts.layout' : ('lo', 'layout', True),
'OrthoOpts.showXCanvas' : ('xh', 'hidex', False),
'OrthoOpts.showYCanvas' : ('yh', 'hidey', False),
'OrthoOpts.showZCanvas' : ('zh', 'hidez', False),
'OrthoOpts.showLabels' : ('hl', 'hideLabels', False),
'OrthoOpts.xcentre' : ('xc', 'xcentre', True),
'OrthoOpts.ycentre' : ('yc', 'ycentre', True),
'OrthoOpts.zcentre' : ('zc', 'zcentre', True),
'OrthoOpts.invertXHorizontal' : ('ixh', 'invertXHorizontal', False),
'OrthoOpts.invertXVertical' : ('ixv', 'invertXVertical', False),
'OrthoOpts.invertYHorizontal' : ('iyh', 'invertYHorizontal', False),
'OrthoOpts.invertYVertical' : ('iyv', 'invertYVertical', False),
'OrthoOpts.invertZHorizontal' : ('izh', 'invertZHorizontal', False),
'OrthoOpts.invertZVertical' : ('izv', 'invertZVertical', False),
'LightBoxOpts.sliceSpacing' : ('ss', 'sliceSpacing', True),
'LightBoxOpts.ncols' : ('nc', 'ncols', True),
......@@ -1038,6 +1048,18 @@ HELP = td.TypeDict({
'OrthoOpts.showYCanvas' : 'Hide the Y canvas',
'OrthoOpts.showZCanvas' : 'Hide the Z canvas',
'OrthoOpts.showLabels' : 'Hide orientation labels',
'OrthoOpts.invertXHorixontal' :
'Invert the X canvas along the horizontal axis',
'OrthoOpts.invertXVertical' :
'Invert the X canvas along the vertical axis',
'OrthoOpts.invertYHorizontal' :
'Invert the Y canvas along the horizontal axis',
'OrthoOpts.invertYVertical' :
'Invert the Y canvas along the vertical axis',
'OrthoOpts.invertZHorizontal' :
'Invert the Z canvas along the horizontal axis',
'OrthoOpts.invertZVertical' :
'Invert the Z canvas along the vertical axis',
'OrthoOpts.xcentre' : 'X canvas centre ([-1, 1])',
......
......@@ -472,18 +472,25 @@ def createOrthoCanvases(namespace,
canvasAxes = []
zooms = []
centres = []
inverts = []
if sceneOpts.showXCanvas:
canvasAxes.append((1, 2))
zooms .append(sceneOpts.xzoom)
centres .append(sceneOpts.panel.getGLCanvases()[0].centre)
inverts .append((sceneOpts.invertXHorizontal,
sceneOpts.invertXVertical))
if sceneOpts.showYCanvas:
canvasAxes.append((0, 2))
zooms .append(sceneOpts.yzoom)
centres .append(sceneOpts.panel.getGLCanvases()[1].centre)
inverts .append((sceneOpts.invertYHorizontal,
sceneOpts.invertYVertical))
if sceneOpts.showZCanvas:
canvasAxes.append((0, 1))
zooms .append(sceneOpts.zzoom)
centres .append(sceneOpts.panel.getGLCanvases()[2].centre)
inverts .append((sceneOpts.invertZHorizontal,
sceneOpts.invertZVertical))
# Grid layout only makes sense if
# we're displaying 3 canvases
......@@ -494,6 +501,7 @@ def createOrthoCanvases(namespace,
canvasAxes = [canvasAxes[1], canvasAxes[0], canvasAxes[2]]
centres = [centres[ 1], centres[ 0], centres[ 2]]
zooms = [zooms[ 1], zooms[ 0], zooms[ 2]]
inverts = [inverts[ 1], inverts[ 0], inverts[ 2]]
# Calculate the size in pixels for each canvas
sizes = calculateOrthoCanvasSizes(overlayList,
......@@ -504,10 +512,15 @@ def createOrthoCanvases(namespace,
sceneOpts.layout)
# Configure the properties on each canvas
for ((width, height), (xax, yax), zoom, centre) in zip(sizes,
canvasAxes,
zooms,
centres):
for ((width, height),
(xax, yax),
zoom,
centre,
(invertx, inverty)) in zip(sizes,
canvasAxes,
zooms,
centres,
inverts):
zax = 3 - xax - yax
......@@ -524,6 +537,8 @@ def createOrthoCanvases(namespace,
opts.cursorGap = sceneOpts.cursorGap
opts.bgColour = sceneOpts.bgColour
opts.renderMode = sceneOpts.renderMode
opts.invertX = invertx
opts.invertY = inverty
if zoom is not None:
opts.zoom = zoom
......@@ -537,7 +552,6 @@ def createOrthoCanvases(namespace,
canvases.append(c)
return canvases
......
......@@ -178,6 +178,13 @@ class OrthoPanel(canvaspanel.CanvasPanel):
# its name is stored here.
self.__editMenuTitle = None
# The OrthoOpts and DisplayContext objects
# contains the properties that the user
# interacts with, but the slice canvases
# are controlled by properties on a
# SliceCanvsOpts object (one for each
# canvas). So we bind properties of these
# objects together.
xopts = self.__xcanvas.opts
yopts = self.__ycanvas.opts
zopts = self.__zcanvas.opts
......@@ -214,6 +221,13 @@ class OrthoPanel(canvaspanel.CanvasPanel):
yopts.bindProps('highDpi', sceneOpts)
zopts.bindProps('highDpi', sceneOpts)
xopts.bindProps('invertX', sceneOpts, 'invertXHorizontal')
xopts.bindProps('invertY', sceneOpts, 'invertXVertical')
yopts.bindProps('invertX', sceneOpts, 'invertYHorizontal')
yopts.bindProps('invertY', sceneOpts, 'invertYVertical')
zopts.bindProps('invertX', sceneOpts, 'invertZHorizontal')
zopts.bindProps('invertY', sceneOpts, 'invertZVertical')
# Callbacks for ortho panel layout options
sceneOpts.addListener('layout', name, self.__refreshLayout)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment