fsleyes.controls.componentgrid¶
This module provides the ComponentGrid class, which is used by
the MelodicClassificationPanel.
-
class
fsleyes.controls.componentgrid.ComponentGrid(parent, overlayList, displayCtx, frame, lut)[source]¶ Bases:
fsleyes.panel.FSLeyesPanelThe
ComponentGriduses aWidgetGrid, and a set ofTextTagPanelwidgets, to display the component classifications stored in theVolumeLabelsobject that is associated with anImage(typically aMelodicImage). TheImageandVolumeLabelsinstance is specified via thesetOverlay()method.The grid contains one row for each component, and a
TextTagPanelis used to display the labels associated with each component. EachTextTagPanelallows the user to add and remove labels to/from the corresponding component.See also the
LabelGridclass, which displays the same information, but organised by label.-
__init__(parent, overlayList, displayCtx, frame, lut)[source]¶ Create a
ComponentGrid.- Parameters
parent – The
wxparent object.overlayList – The
OverlayList.displayCtx – The
DisplayContext.frame – The
FSLeyesFrameinstance.lut – The
LookupTableinstance used to colour each label tag.
-
destroy()[source]¶ Must be called when this
ComponentGridis no longer needed. De-registers various property listeners, and callsFSLeyesPanel.destroy().
-
setOverlay(overlay, volLabels, refreshGrid=True)[source]¶ Sets the
Imageto display component labels for. TheWidgetGridis re-populated to display the component-label mappings contained in theVolumeLabelsinstance associated with the overlay.- Parameters
refreshGrid – If
True(the default), theWidgetGriddisplaying component labels is refreshed. This flag is used internally (see__overlayTypeChanged()).
-
refreshTags(comps=None)[source]¶ Clears and refreshes the tags on every
TextTagPanelin the grid.- Parameters
comps – Components to refresh. If
None, the tags for all components are refreshed.
-
_ComponentGrid__deregisterCurrentOverlay()¶ Called when the selected overlay changes. De-registers listeners associated with the previously selected overlay, if necessary.
-
_ComponentGrid__labelsChanged(volLabels, topic, components)¶ Called on
VolumeLabelsnotifications. Re-generates the tags shown on everyTextTagPanel.
-
_ComponentGrid__lutChanged(*a)¶ Called when the
LookupTable.labelschange. Updates the options on everyTextTagPanel.
-
_ComponentGrid__onGridSelect(ev)¶ Called when a row is selected on the
WidgetGrid. Makes sure that the ‘new tag’ control in the correspondingTextTagPanelis focused.
-
_ComponentGrid__onTagAdded(ev)¶ Called when a tag is added to a
TextTagPanel. Adds the corresponding component-label mapping to theVolumeLabelsinstance.
-
_ComponentGrid__onTagRemoved(ev)¶ Called when a tag is removed from a
TextTagPanel. Removes the corresponding component-label mapping from theVolumeLabelsinstance.
-
_ComponentGrid__overlayTypeChanged(*a)¶ Called when the
Display.overlayTypeof the currently displayed overlay changes. When the type of an overlay changes, a newDisplayOptsinstance is created, so we need to re-register various property listeners with this newDisplayOptsinstance.
-
_ComponentGrid__recreateTags()¶ Called by
setOverlay(). Re-creates aTextTagPanelfor every component in theImage.
-
_ComponentGrid__refreshTagOptions()¶ Updates the options available on each
TextTagPanel, from the entries in the melodic classificationLookupTable.
-
_ComponentGrid__volumeChanged(*a)¶ Called when the
NiftiOpts.volumeproperty changes. Selects the corresponding row in theWidgetGrid.
-
__module__= 'fsleyes.controls.componentgrid'¶
-