fsleyes.plugins.profiles.orthocropprofile
¶
This module provides the OrthoCropProfile
class, an interaction
Profile
for OrthoPanel
views, which is used by the
CropImagePanel
.
- class fsleyes.plugins.profiles.orthocropprofile.OrthoCropProfile(viewPanel, overlayList, displayCtx)[source]¶
Bases:
fsleyes.profiles.orthoviewprofile.OrthoViewProfile
The
OrthoCropProfile
class is aProfile
for theOrthoPanel
class, which allows the user to define a cropping region forImage
overlays.Ther
OrthoCropProfile
displays a cropping, or ROI, region on theOrthoPanel
canvases, relative to the for the currently selected image, usingRect
annotations. Mouse handlers are also defined, allowing the user to adjust the box.Once the user has selected a cropping region, the related
CropImagePanel
allows him/her to create a cropped copy of the image.The
OrthoCropProfile
class defines one mode, in addition to those inherited from theOrthoViewProfile
class:crop
Clicking and dragging allows the user to change the boundaries of a cropping region.
Note
The crop overlay will only be shown if the
DisplayContext.displaySpace
is set to the currently selected overlay. TheCropImagePanel
uses aDisplaySpaceWarning
to inform the user.- cropBox = <MagicMock name='mock.Bounds()' id='139907488751264'>¶
This property keeps track of the current low/high limits of the cropping region, in the voxel coordinate system of the currently selected overlay.
- static tempModes()[source]¶
Returns the temporary mode map for the
OrthoCropProfile
, 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.
- __init__(viewPanel, overlayList, displayCtx)[source]¶
Create an
OrthoCropProfile
.- Parameters
viewPanel – An
OrthoPanel
instance.overlayList – The
OverlayList
instance.displayCtx – The
DisplayContext
instance.
- destroy()[source]¶
Must be called when this
OrthoCropProfile
is no longer needed. Removes property listeners and does some other clean up.
- robustfov()[source]¶
Call
robustfov
for the current overlay and set thecropBox
based on the result.
- __deregisterOverlay()¶
Called by
__selectedOverlayChanged()
. Clears references associated with the previously selected overlay, if necessary.
- __registerOverlay(overlay)¶
Called by
__selectedOverlayChanged()
. Sets up references associated with the given (newly selected) overlay.
- __selectedOverlayChanged(*a)¶
Called when the
DisplayContext.selectedOverlay
changes. If the overlay is aImage
instance, it is set as theDisplayContext.displaySpace
reference, and thecropBox
is configured to be relative to the newly selected overlay.
- __displaySpaceChanged(*a)¶
Called when the
DisplayContext.displaySpace
changes. Resets thecropBox
.
- __cropBoxChanged(*a)¶
Called when the
cropBox
changes. Updates theRect
annotations on theOrthoPanel
canvases.
- __getVoxel(overlay, canvasPos)¶
Called by the mouse down/drag handlers. Figures out the voxel in the currently selected overlay which corresponds to the given canvas position.
- _cropModeLeftMouseDown(ev, canvas, mousePos, canvasPos)[source]¶
Called on mouse down events. Calculates the nearest crop box boundary to the mouse click, adjusts the boundary accordingly, and saves the boundary/axis information for subsequent drag events (see
_cropModeLeftMouseDrag()
).
- _cropModeLeftMouseDrag(ev, canvas, mousePos, canvasPos)[source]¶
Called on left mouse drags. Updates the
cropBox
boudary which was clicked on (see_cropModeLeftMouseDown()
), so it follows the mouse location.
- __annotations__ = {}¶
- __module__ = 'fsleyes.plugins.profiles.orthocropprofile'¶