fsleyes.profiles.orthocropprofile
¶
This module provides the OrthoCropProfile
class, an interaction
Profile
for OrthoPanel
views.
-
class
fsleyes.profiles.orthocropprofile.
OrthoCropProfile
(viewPanel, overlayList, displayCtx)¶ Bases:
fsleyes.profiles.orthoviewprofile.OrthoViewProfile
The
OrthoViewProfile
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='140736144610832'>¶ 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)¶ Create an
OrthoCropProfile
.- Parameters
viewPanel – An
OrthoPanel
instance.overlayList – The
OverlayList
instance.displayCtx – The
DisplayContext
instance.
-
destroy
()¶ Must be called when this
OrthoCropProfile
is no longer needed. Removes property listeners and does some other clean up.
-
_cropModeLeftMouseDown
(ev, canvas, mousePos, canvasPos)¶ 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)¶ Called on left mouse drags. Updates the
cropBox
boudary which was clicked on (see_cropModeLeftMouseDown()
), so it follows the mouse location.
-
_OrthoCropProfile__cropBoxChanged
(*a)¶ Called when the
cropBox
changes. Updates theRect
annotations on theOrthoPanel
canvases.
-
_OrthoCropProfile__deregisterOverlay
()¶ Called by
__selectedOverlayChanged()
. Clears references associated with the previously selected overlay, if necessary.
-
_OrthoCropProfile__displaySpaceChanged
(*a)¶ Called when the
DisplayContext.displaySpace
changes. Resets thecropBox
.
-
_OrthoCropProfile__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.
-
_OrthoCropProfile__registerOverlay
(overlay)¶ Called by
__selectedOverlayChanged()
. Sets up references associated with the given (newly selected) overlay.
-
_OrthoCropProfile__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.
-
__module__
= 'fsleyes.profiles.orthocropprofile'¶
-
_cropModeLeftMouseUp
(ev, canvas, mousePos, canvasPos)¶ Called on left mouse up events. Clears references used by the mouse down/drag handlers.
-