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.OrthoViewProfileThe
OrthoViewProfileclass is aProfilefor theOrthoPanelclass, which allows the user to define a cropping region forImageoverlays.Ther
OrthoCropProfiledisplays a cropping, or ROI, region on theOrthoPanelcanvases, relative to the for the currently selected image, usingRectannotations. Mouse handlers are also defined, allowing the user to adjust the box.Once the user has selected a cropping region, the related
CropImagePanelallows him/her to create a cropped copy of the image.The
OrthoCropProfileclass defines one mode, in addition to those inherited from theOrthoViewProfileclass:cropClicking and dragging allows the user to change the boundaries of a cropping region.
Note
The crop overlay will only be shown if the
DisplayContext.displaySpaceis set to the currently selected overlay. TheCropImagePaneluses aDisplaySpaceWarningto inform the user.-
cropBox= <MagicMock name='mock.Bounds()' id='281473494326624'>¶ 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
viewPanel – An
OrthoPanelinstance.overlayList – The
OverlayListinstance.displayCtx – The
DisplayContextinstance.
-
destroy()[source]¶ Must be called when this
OrthoCropProfileis no longer needed. Removes property listeners and does some other clean up.
-
robustfov()[source]¶ Call
robustfovfor the current overlay and set thecropBoxbased on the result.
-
_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
cropBoxboudary which was clicked on (see_cropModeLeftMouseDown()), so it follows the mouse location.
-
_OrthoCropProfile__cropBoxChanged(*a)¶ Called when the
cropBoxchanges. Updates theRectannotations on theOrthoPanelcanvases.
-
_OrthoCropProfile__deregisterOverlay()¶ Called by
__selectedOverlayChanged(). Clears references associated with the previously selected overlay, if necessary.
-
_OrthoCropProfile__displaySpaceChanged(*a)¶ Called when the
DisplayContext.displaySpacechanges. 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.selectedOverlaychanges. If the overlay is aImageinstance, it is set as theDisplayContext.displaySpacereference, and thecropBoxis configured to be relative to the newly selected overlay.
-
__module__= 'fsleyes.profiles.orthocropprofile'¶
-