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 a Profile for the OrthoPanel class. It defines mouse/keyboard handlers which allow the user to navigate through the OrthoPanel display of the overlays in the OverlayList.

OrthoViewProfile defines the following modes (see the Profile 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 a Rect 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 a volume) 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 few actions:

resetDisplay

Resets the display bounds for all canvases.

centreCursor

Sets the DisplayContext.location to the centre of the DisplayContext.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 given viewPanel.

Note

The OrthoEditProfile is a sub-class of the OrthoViewProfile. It uses the extraModes argument to set up its edit-related modes.

Parameters:
destroy()[source]

Must be called when this OrthoViewProfile is no longer needed. Removes some property listeners, and calls Profile.destroy().

getEventTargets()[source]

Overrides Profile.getEventTargets().

Returns the three SliceCanvas instances displayed in the OrthoPanel instance that is using this OrthoViewProfile.

__selectedOverlayChanged(*a)

Called when the OverlayList or DisplayContext.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, and OrthoOpts.zzoom properties to 100%.

See the SliceCanvas.resetDisplay() method.

centreCursor()[source]

Sets the DisplayContext.location to the centre of the DisplayContext.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 the DisplayContext.location should be changed, according to the directions specified by the x, y, and z 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 the NiftiOpts.transform property. For example, if transform is id, the display should be moved by one unit (which corresponds to one voxel). But if the transform is pixdim, the display should be moved by one pixdim (e.g. 2, for a “math:2mm^3 image).

Each of the x, y and z 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.

_navModeLeftMouseDrag(ev, canvas, mousePos, canvasPos)[source]

Handles left mouse drags in nav mode.

Left mouse drags in nav mode update the DisplayContext.location to follow the mouse location.

_navModeChar(ev, canvas, key)[source]

Handles key presses in nav mode.

Arrow key presses in nav mode update the DisplayContext.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 current Display.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 a Mesh, identifies the mesh vertex which is nearest to the mouse click, and updates the DisplayContext.location. Otherwise, returns False.

_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 a volume) 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'