fsleyes.profiles.orthoviewprofile¶
This module provides the OrthoViewProfile class, an interaction
Profile for OrthoPanel views.
-
class
fsleyes.profiles.orthoviewprofile.OrthoViewProfile(viewPanel, overlayList, displayCtx, extraModes=None)[source]¶ Bases:
fsleyes.profiles.ProfileThe
OrthoViewProfileclass is aProfilefor theOrthoPanelclass. It defines mouse/keyboard handlers which allow the user to navigate through theOrthoPaneldisplay of the overlays in theOverlayList.OrthoViewProfiledefines the following modes (see theProfileclass documentation):navThe user can change the currently displayed location. This is accomplished by updating the
DisplayContext.locationproperty on left mouse drags.sliceThe user can change the current slice shown on a single canvas.
zoomThe 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.zoomproperty on mouse wheel changes, and displaying aRectannotation on left mouse drags.panThe user can pan around a canvas (if the canvas is zoomed in). This is accomplished by calling the
SliceCanvas.panDisplayBy()on left mouse drags.briconThe user can drag the mouse along a canvas to change the brightness/contrast of the currently selected overlay.
pickIf the currently selected overlay is a
Mesh, the user can select the mesh vertex which is nearest to the mouse click.The
OrthoViewProfileclass also defines a fewactions:Resets the display bounds for all canvases.
Sets the
DisplayContext.locationto the centre of theDisplayContext.bounds.-
__init__(viewPanel, overlayList, displayCtx, extraModes=None)[source]¶ Creates an
OrthoViewProfile, which can be registered with the givenviewPanel.Note
The
OrthoEditProfileis a sub-class of theOrthoViewProfile. It uses theextraModesargument to set up its edit-related modes.- Parameters
viewPanel – An
OrthoPanelinstance.overlayList – The
OverlayListinstance.displayCtx – The
DisplayContextinstance.extraModes – Extra modes to pass through to the
Profileconstructor.
-
destroy()[source]¶ Must be called when this
OrthoViewProfileis no longer needed. Removes some property listeners, and callsProfile.destroy().
-
getEventTargets()[source]¶ Overrides
Profile.getEventTargets().Returns the three
SliceCanvasinstances displayed in theOrthoPanelinstance that is using thisOrthoViewProfile.
-
resetDisplay()[source]¶ Resets the display bounds for all canvases. Also resets the
SceneOpts.zoom,OrthoOpts.xzoom,OrthoOpts.yzoom, andOrthoOpts.zzoomproperties to 100%.See the
SliceCanvas.resetDisplay()method.
-
centreCursor()[source]¶ Sets the
DisplayContext.locationto the centre of theDisplayContext.bounds.
-
centreCursorWorld()[source]¶ Sets the
DisplayContext.locationto world location (0, 0, 0), where the ‘world’ is in terms of the currently selected ovelray.
Handles left mouse drags in
navmode.Left mouse drags in
navmode update theDisplayContext.locationto follow the mouse location.
Handles key presses in
navmode.Arrow key presses in
navmode 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
slicemode.Mouse wheel movement on a canvas changes the depth location displayed on that canvas.
-
_sliceModeChar(ev, canvas, key)[source]¶ Handles character events in
slicemode.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
zoommode.Mouse wheel motion in zoom mode increases/decreases the zoom level of the target canvas.
-
_zoomModeChar(ev, canvas, key)[source]¶ Handles key presses in
zoommode.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
zoommode.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
zoommode.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
panmode.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
panmode.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
briconmode. Stores the currentDisplay.brightness/Display.contrastfor the currently selected overlay.
-
_briconModeLeftMouseUp(ev, canvas, mousePos, canvasPos)[source]¶ Handles left mouse up events in
briconmode.
-
_briconModeLeftMouseDrag(ev, canvas, mousePos, canvasPos)[source]¶ Handles left mouse drags in
briconmode.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
pickmode. If the currently selected overlay is aMesh, identifies the mesh vertex which is nearest to the mouse click, and updates theDisplayContext.location. Otherwise, returnsFalse.
-
_OrthoViewProfile__offsetLocation(x, y, z)¶ Used by some
navmode handlers. Returns a sequence of three values, one per display space axis, which specify the amount by which theDisplayContext.locationshould be changed, according to the directions specified by thex,y, andzarguments.If the currently selected overlay is an
Niftiinstance, the distance that a navigation operation should shift the display will differ depending on the value of theNiftiOpts.transformproperty. For example, iftransformisid, the display should be moved by one unit (which corresponds to one voxel). But if thetransformispixdim, the display should be moved by one pixdim (e.g. 2, for a “math:2mm^3 image).Each of the
x,yandzarguments 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.
-
_OrthoViewProfile__selectedOverlayChanged(*a)¶ Called when the
OverlayListorDisplayContext.selectedOverlaychanges. Enables/disables the action methods based on the newly selected overlay.
-
__module__= 'fsleyes.profiles.orthoviewprofile'¶
-