fsleyes.plugins.controls.melodicclassificationpanel.melodicclassificationpanel¶
This module provides the MelodicClassificationPanel class, a
FSLeyes control panel which allows the user to classify the components
of a MelodicImage.
-
class
fsleyes.plugins.controls.melodicclassificationpanel.melodicclassificationpanel.MelodicClassificationPanel(parent, overlayList, displayCtx, canvasPanel)[source]¶ Bases:
fsleyes.controls.controlpanel.ControlPanelThe
MelodicClassificationPanelallows the user to view and modify classification labels associated with the volumes of anImage, most typically the components of aMelodicImage(but any 4D image will work).A
MelodicClassificationPaneldisplays two lists:The
ComponentGridcontains list of components, and the labels associated with each.The
LabelGridcontains list of labels, and the components associated with each.
And a handful of buttons which allow the user to:
Load a label file
Save the current labels to a file
Clear/reset the current labels
Internally, a
VolumeLabelsobject is used to keep track of the component - label mappings. TheVolumeLabelsinstance associated with each overlay is stored in theOverlayListvia itsOverlayList.setData()method.-
static
supportedViews()[source]¶ The
MelodicClassificationPanelis restricted for use withOrthoPanel,LightBoxPanelandScene3DPanelviewws.
-
static
defaultLayout()[source]¶ Returns a dictionary of arguments to be passed to the
ViewPanel.togglePanel()method.
-
__init__(parent, overlayList, displayCtx, canvasPanel)[source]¶ Create a
MelodicClassificationPanel.- Parameters
parent – The
wxparent object.overlayList – The
OverlayList.displayCtx – The
DisplayContextinstance.canvasPanel – The
CanvasPanelthat owns this classification panel.
-
destroy()[source]¶ Must be called when this
MelodicClassificaiionPanelis no longer used. Removes listeners, and destroys widgets.
-
__enable(enable=True, message='')¶ Called internally. Enables/disables this
MelodicClassificationPanel.
-
__deregisterOverlay()¶ Called by
__selectedOverlayChanged(). Deregisters from the currently selected overlay.
-
__registerOverlay(overlay)¶ Called by
__selectedOverlayChanged(). Registers with the given overlay.Returns the
VolumeLabelsinstance associated with the overlay (creating it if necessary).
-
__selectedOverlayChanged(*a)¶ Called when the
DisplayContext.selectedOverlayorOverlayList.overlayschanges.The overlay is passed to the
ComponentGrid.setOverlay()andLabelGrid.setOverlay()methods.If the newly selected overlay is not a
MelodicImage, this panel is disabled (via__enable()).
-
__volumeChanged(*a)¶ Called when the
NiftiOpts.volumeproperty of the currently selected overlay changes. Calls__updateTextAnnotation()Note
This method is only called if the view panel that owns this
MelodicClassificationPanelis aLightBoxPanel.
-
__labelsChanged(*a)¶ Called when the
VolumeLabelsobject associated with the currently selected overlay changes. Calls__updateTextAnnotation()Note
This method is only called if the view panel that owns this
MelodicClassificationPanelis aLightBoxPanel.
-
__updateTextAnnotation()¶ Updates a text annotation on the
LightBoxPanelcanvas to display the labels associated with the volume (i.e. the current component).
-
__onLoadButton(ev)¶ Called when the Load labels button is pushed. Prompts the user to select a label file to load, then does the following:
If the selected label file refers to the currently selected melodic_IC overlay, the labels are applied to the overlay.
If the selected label file refers to a different melodic_IC overlay, the user is asked whether they want to load the different melodic_IC file (the default), or whether they want the labels applied to the existing overlay.
If the selected label file does not refer to any overlay (it only contains the bad component list), the user is asked whether they want the labels applied to the current melodic_IC overlay.
If the number of labels in the file is less than the number of melodic_IC components, the remaining components are labelled as unknown. If the number of labels in the file is greater than the number of melodic_IC components, an error is shown, and nothing is done.
-
__onSaveButton(ev)¶ Called when the user pushe the Save labels button. Asks the user where they’d like the label saved, then saves said labels.
-
__onClearButton(ev)¶ Called when the user pushes the Clear labels button. Resets all of the labels (sets the label for every component to
'Unknown').
-
__module__= 'fsleyes.plugins.controls.melodicclassificationpanel.melodicclassificationpanel'¶