fsleyes.plugins.controls.annotationpanel

This module contains the AnnotationPanel class, a FSLeyes control panel which allows the user to annotate the canvases of an OrthoPanel.

class fsleyes.plugins.controls.annotationpanel.AnnotationPanel(parent, overlayList, displayCtx, ortho)[source]

Bases: fsleyes.controls.controlpanel.ControlPanel

The AnnotationPanel contains controls allowing the user to add annotations to the canvases in an OrthoPanel. The user is able to add points, lines, rectangles, ellipses, and text to any canvas, and can adjust the properties (e.g. colour, thickness) of each annotation.

When a user selects an annotation to add, the OrthoAnnotateProfile is enabled on the OrthoPanel, which provides user interaction.

The SaveAnnotationsAction and LoadAnnotationsAction actions, for saving/loading annotations to/from files, are bound to buttons in the AnnotationPanel.

colour = <MagicMock name='mock.Colour()' id='4022090000'>
fontSize = <MagicMock name='mock.Int()' id='4022090168'>
lineWidth = <MagicMock name='mock.Int()' id='4022090216'>
filled = <MagicMock name='mock.Boolean()' id='4022090264'>
border = <MagicMock name='mock.Boolean()' id='4022393488'>
honourZLimits = <MagicMock name='mock.Boolean()' id='4022679440'>
alpha = <MagicMock name='mock.Percentage()' id='4022678048'>
DISPLAY_PROPERTIES = ['colour', 'fontSize', 'lineWidth', 'filled', 'border', 'honourZLimits', 'alpha']
static supportedViews()[source]

Overrides ControlMixin.supportedViews(). The CropImagePanel is only intended to be added to OrthoPanel views.

static profileCls()[source]

Returns the OrthoAnnotateProfile class, which needs to be activated in conjunction with the AnnotationPanel.

static defaultLayout()[source]

Returns a dictionary containing layout settings to be passed to ViewPanel.togglePanel.

__init__(parent, overlayList, displayCtx, ortho)[source]

Create an AnnotationPanel.

Parameters
destroy()[source]

Must be called when this AnnoationPanel is no longer needed. Removes property listeners and clears references.

__annotationsChanged(*a)

Called when the Annotations.annotations list of any SliceCanvas changes. Makes sure that the contents of the annotations list box is up to date, and selects the most recently added annotation.

__displayPropertyChanged(*a)

Called when any display property changes. Refreshes all canvases.

__onRemove(ev)

Called when the “remove item” button is pushed. Removes the item from the list box widget, and from the corresponding Annotations.annotations list.

__onMoveUp(ev)

Called when the “move item up” button is pushed.

__onMoveDown(ev)

Called when the “move item down” button is pushed.

__onMove(offset)

Called when one of the move buttons is pushed. Moves the item in the list box, then syncs the new item order on the corresponding Annotations.annotations list.

__annotListItemSelected(ev=None, obj=None)

Called when an item is selected in the annotations listbox, or programmatically at various times. If the properties of an AnnotationObject are bound to the display settings widgets, they are unbound. If an annotation has been selected in the annotations list box, the display settings widgets are bound to its properties.

__onAnnotOption(ev)

Called when the user selects an annnotation type to draw. Changes the OrthoAnnotateProfile mode.

__module__ = 'fsleyes.plugins.controls.annotationpanel'