fsleyes.profiles.orthoviewprofile
This module provides the OrthoViewProfile
class, an interaction
Profile
for OrthoPanel
views.
- class fsleyes.profiles.orthoviewprofile.OrthoViewProfile(*args, **kwargs)[source]
Bases:
Profile
The
OrthoViewProfile
class is aProfile
for theOrthoPanel
class. It defines mouse/keyboard handlers which allow the user to navigate through theOrthoPanel
display of the overlays in theOverlayList
.OrthoViewProfile
defines the following modes (see theProfile
class documentation):nav
The user can change the currently displayed location. This is accomplished by updating the
DisplayContext.location
property on left mouse drags.slice
The user can change the current slice shown on a single canvas.
zoom
The user can zoom in/out of a canvas with the mouse wheel, and draw a rectangle on a canvas in which to zoom. This is accomplished by updating the
SliceCanvasOpts.zoom
property on mouse wheel changes, and displaying aRect
annotation on left mouse drags.pan
The user can pan around a canvas (if the canvas is zoomed in). This is accomplished by calling the
SliceCanvas.panDisplayBy()
on left mouse drags.bricon
The user can drag the mouse along a canvas to change the brightness/contrast of the currently selected overlay.
regionBricon
The user can draw a rectangle on a canvas; the minimum / maximum display range of the currently selected overlay (assuming it is an
Image
being displayed as avolume
) is set to the minimum/maxmimum intensity within the region.pick
If the currently selected overlay is a
Mesh
, the user can select the mesh vertex which is nearest to the mouse click.The
OrthoViewProfile
class also defines a fewactions
:Resets the display bounds for all canvases.
Sets the
DisplayContext.location
to the centre of theDisplayContext.bounds
.- static supportedView()[source]
Returns the
OrthoPanel
class.
- static tempModes()[source]
Returns the temporary mode map for the
OrthoViewProfile
, which controls the use of modifier keys to temporarily enter other interaction modes.
- static altHandlers()[source]
Returns the alternate handlers map, which allows event handlers defined in one mode to be re-used whilst in another mode.
- static fallbackHandlers()[source]
Returns the fallback handler map, which allows an event to be forwarded to a second handler if the primary handler returns
False
.
- __init__(viewPanel, overlayList, displayCtx, extraModes=None)[source]
Creates an
OrthoViewProfile
, which can be registered with the givenviewPanel
.Note
The
OrthoEditProfile
is a sub-class of theOrthoViewProfile
. It uses theextraModes
argument to set up its edit-related modes.- Parameters:
viewPanel – An
OrthoPanel
instance.overlayList – The
OverlayList
instance.displayCtx – The
DisplayContext
instance.extraModes – Extra modes to pass through to the
Profile
constructor.
- destroy()[source]
Must be called when this
OrthoViewProfile
is no longer needed. Removes some property listeners, and callsProfile.destroy()
.
- getEventTargets()[source]
Overrides
Profile.getEventTargets()
.Returns the three
SliceCanvas
instances displayed in theOrthoPanel
instance that is using thisOrthoViewProfile
.
- __selectedOverlayChanged(*a)
Called when the
OverlayList
orDisplayContext.selectedOverlay
changes. Enables/disables the action methods based on the newly selected overlay.
- resetDisplay()[source]
Resets the display bounds for all canvases. Also resets the
SceneOpts.zoom
,OrthoOpts.xzoom
,OrthoOpts.yzoom
, andOrthoOpts.zzoom
properties to 100%.See the
SliceCanvas.resetDisplay()
method.
- centreCursor()[source]
Sets the
DisplayContext.location
to the centre of theDisplayContext.bounds
.
- centreCursorWorld()[source]
Sets the
DisplayContext.location
to world location (0, 0, 0), where the ‘world’ is in terms of the currently selected ovelray.
- __offsetLocation(x, y, z)
Used by some
nav
mode handlers. Returns a sequence of three values, one per display space axis, which specify the amount by which theDisplayContext.location
should be changed, according to the directions specified by thex
,y
, andz
arguments.If the currently selected overlay is an
Nifti
instance, the distance that a navigation operation should shift the display will differ depending on the value of theNiftiOpts.transform
property. For example, iftransform
isid
, the display should be moved by one unit (which corresponds to one voxel). But if thetransform
ispixdim
, the display should be moved by one pixdim (e.g. 2, for a “math:2mm^3 image).Each of the
x
,y
andz
arguments are interpreted as being positive, zero, or negative. A positive/negative value indicates that the display location should be increased/decreased along the corresponding axis, and zero indicates that the location should stay the same along an axis.
Handles left mouse drags in
nav
mode.Left mouse drags in
nav
mode update theDisplayContext.location
to follow the mouse location.
Handles key presses in
nav
mode.Arrow key presses in
nav
mode update theDisplayContext.location
. Arrow keys map to the horizontal/vertical axes, and -/+ keys map to the depth axis of the canvas which was the target of the event.
- _sliceModeMouseWheel(ev, canvas, wheel, mousePos=None, canvasPos=None)[source]
Handles mouse wheel movement in
slice
mode.Mouse wheel movement on a canvas changes the depth location displayed on that canvas.
- _sliceModeChar(ev, canvas, key)[source]
Handles character events in
slice
mode.Up/down and Page-up/Page-down keys will increase/decrease the depth location on the current canvas.
- _zoomModeMouseWheel(ev, canvas, wheel, mousePos=None, canvasPos=None)[source]
Handles mouse wheel events in
zoom
mode.Mouse wheel motion in zoom mode increases/decreases the zoom level of the target canvas.
- _zoomModeChar(ev, canvas, key)[source]
Handles key presses in
zoom
mode.The +/- keys in zoom mode increase/decrease the zoom level of the target canvas.
- _zoomModeRightMouseDrag(ev, canvas, mousePos, canvasPos)[source]
Handles right mouse drags in
zoom
mode.Right mouse drags in zoom mode draw a rectangle on the target canvas.
When the user releases the mouse (see
_zoomModeLeftMouseUp()
), the canvas will be zoomed in to the drawn rectangle.
- _zoomModeRightMouseUp(ev, canvas, mousePos, canvasPos)[source]
Handles right mouse up events in
zoom
mode.When the right mouse is released in zoom mode, the target canvas is zoomed in to the rectangle region that was drawn by the user.
- _panModeLeftMouseDrag(ev, canvas, mousePos, canvasPos)[source]
Handles left mouse drags in
pan
mode.Left mouse drags in pan mode move the target canvas display about to follow the mouse.
If the target canvas is not zoomed in, this has no effect.
- _panModeChar(ev, canvas, key)[source]
Handles key presses in
pan
mode.The arrow keys in pan mode move the target canvas display around (unless the canvas is not zoomed in).
- _briconModeLeftMouseDown(ev, canvas, mousePos, canvasPos)[source]
Handles left mouse down events in
bricon
mode. Stores the currentDisplay.brightness
/Display.contrast
for the currently selected overlay.
- _briconModeLeftMouseUp(ev, canvas, mousePos, canvasPos)[source]
Handles left mouse up events in
bricon
mode.
- _briconModeLeftMouseDrag(ev, canvas, mousePos, canvasPos)[source]
Handles left mouse drags in
bricon
mode.The brightness and contrast of the currently selected overlay are adjusted according to the location of the mouse, relative to the canvas.
- _pickModeLeftMouseDrag(ev, canvas, mousePos, canvasPos)[source]
Handles left mouse drag events in
pick
mode. If the currently selected overlay is aMesh
, identifies the mesh vertex which is nearest to the mouse click, and updates theDisplayContext.location
. Otherwise, returnsFalse
.
- _regionBriconModeLeftMouseDrag(ev, canvas, mousePos, canvasPos)[source]
Handles mouse drags in
regionBricon
mode.Right mouse drags in this mode draw a rectangle on the target canvas. When the user releases the mouse (see
_regionBriconModeLeftMouseUp()
), the min/max display range of the currently selected overlay (assuming it is avolume
) is set to the minimum/maximum intensities within the region.
- _regionBriconModeLeftMouseUp(ev, canvas, mousePos, canvasPos)[source]
Handles mouse up events in
regionBricon
mode.Sets the min/max display range of the currently selected overlay (assuming it is a
volume
) to the minimum/maximum intensities within the region.
- __annotations__ = {}
- __module__ = 'fsleyes.profiles.orthoviewprofile'