fsleyes.controls.melodicclassificationpanel
¶
This module provides the MelodicClassificationPanel
class, a
FSLeyes control panel which allows the user to classify the components
of a MelodicImage
.
-
class
fsleyes.controls.melodicclassificationpanel.
MelodicClassificationPanel
(parent, overlayList, displayCtx, frame, canvasPanel)¶ Bases:
fsleyes.controls.controlpanel.ControlPanel
The
MelodicClassificationPanel
allows 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
MelodicClassificationPanel
displays two lists:The
ComponentGrid
contains list of components, and the labels associated with each.The
LabelGrid
contains 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
VolumeLabels
object is used to keep track of the component - label mappings. TheVolumeLabels
instance associated with each overlay is stored in theOverlayList
via itsOverlayList.setData()
method.-
__init__
(parent, overlayList, displayCtx, frame, canvasPanel)¶ Create a
MelodicClassificationPanel
.- Parameters
parent – The
wx
parent object.overlayList – The
OverlayList
.displayCtx – The
DisplayContext
instance.canvasPanel – The
CanvasPanel
that owns this classification panel.
-
destroy
()¶ Must be called when this
MelodicClassificaiionPanel
is no longer used. Removes listeners, and destroys widgets.
-
_MelodicClassificationPanel__deregisterOverlay
()¶ Called by
__selectedOverlayChanged()
. Deregisters from the currently selected overlay.
-
_MelodicClassificationPanel__enable
(enable=True, message='')¶ Called internally. Enables/disables this
MelodicClassificationPanel
.
-
_MelodicClassificationPanel__labelsChanged
(*a)¶ Called when the
VolumeLabels
object associated with the currently selected overlay changes. Calls__updateTextAnnotation()
Note
This method is only called if the view panel that owns this
MelodicClassificationPanel
is aLightBoxPanel
.
-
_MelodicClassificationPanel__onClearButton
(ev)¶ Called when the user pushes the Clear labels button. Resets all of the labels (sets the label for every component to
'Unknown'
).
-
_MelodicClassificationPanel__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.
-
_MelodicClassificationPanel__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.
-
_MelodicClassificationPanel__registerOverlay
(overlay)¶ Called by
__selectedOverlayChanged()
. Registers with the given overlay.Returns the
VolumeLabels
instance associated with the overlay (creating it if necessary).
-
_MelodicClassificationPanel__selectedOverlayChanged
(*a)¶ Called when the
DisplayContext.selectedOverlay
orOverlayList.overlays
changes.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()
).
-
_MelodicClassificationPanel__updateTextAnnotation
()¶ Updates a text annotation on the
LightBoxPanel
canvas to display the labels associated with the volume (i.e. the current component).
-
_MelodicClassificationPanel__volumeChanged
(*a)¶ Called when the
NiftiOpts.volume
property of the currently selected overlay changes. Calls__updateTextAnnotation()
Note
This method is only called if the view panel that owns this
MelodicClassificationPanel
is aLightBoxPanel
.
-
__module__
= 'fsleyes.controls.melodicclassificationpanel'¶