fsleyes.profiles.orthocropprofile

This module provides the OrthoCropProfile class, an interaction Profile for OrthoPanel views.

class fsleyes.profiles.orthocropprofile.OrthoCropProfile(viewPanel, overlayList, displayCtx)[source]

Bases: fsleyes.profiles.orthoviewprofile.OrthoViewProfile

The OrthoViewProfile class is a Profile for the OrthoPanel class, which allows the user to define a cropping region for Image overlays.

Ther OrthoCropProfile displays a cropping, or ROI, region on the OrthoPanel canvases, relative to the for the currently selected image, using Rect 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 the OrthoViewProfile 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. The CropImagePanel uses a DisplaySpaceWarning to inform the user.

cropBox = <MagicMock name='mock.Bounds()' id='139656530358912'>

This property keeps track of the current low/high limits of the cropping region, in the voxel coordinate system of the currently selected overlay.

__init__(viewPanel, overlayList, displayCtx)[source]

Create an OrthoCropProfile.

Parameters
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 the cropBox 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 a Image instance, it is set as the DisplayContext.displaySpace reference, and the cropBox is configured to be relative to the newly selected overlay.

__displaySpaceChanged(*a)

Called when the DisplayContext.displaySpace changes. Resets the cropBox.

__cropBoxChanged(*a)

Called when the cropBox changes. Updates the Rect annotations on the OrthoPanel 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.

__module__ = 'fsleyes.profiles.orthocropprofile'
_cropModeLeftMouseUp(ev, canvas, mousePos, canvasPos)[source]

Called on left mouse up events. Clears references used by the mouse down/drag handlers.