fsleyes.plugins.controls.lookuptablepanel
This module provides the LookupTablePanel, a FSLeyes control
panel which allows the user to manage lookup tables. See the
colourmaps module for more details on lookup tables.
A few other classes and functions are defined in this module, all for use by
the LookupTablePanel:
Prompts the user to enter a name for a newly created |
|
A |
|
A dialog which is displayed when the user adds a new label to the |
- class fsleyes.plugins.controls.lookuptablepanel.LookupTablePanel(parent, overlayList, displayCtx, viewPanel)[source]
Bases:
fsleyes.controls.controlpanel.ControlPanelA
LookupTablePanelis aControlPanelwhich allows users to manageLookupTableinstances. ALookupTablePanellooks something like this:
A
LookupTablePanelallows the user to do the following:Add/remove labels to/from a
LookupTable.Change the colour, name, and visibility of a label in a
LookupTable.Create a new
LookupTable, or copy an existing one.Save/load a
LookupTableto/from a file.
The
LookupTablePanelkeeps track of the currently selected overlay (see theDisplayContext.selectedOverlayproperty). If the overlay is associated with aLabelOptsinstance, itsLabelopts.lutproperty will be updated when theLookupTableis changed through theLookupTablePanel, and vice versa.- static supportedViews()[source]
The
LookupTablePanelis restricted for use withOrthoPanel,LightBoxPanelandScene3DPanelviews.
- static defaultLayout()[source]
Returns a dictionary containing layout settings to be passed to
ViewPanel.togglePanel.
- __init__(parent, overlayList, displayCtx, viewPanel)[source]
Create a
LookupTablePanel.- Parameters
parent – The
wxparent object.overlayList – The
OverlayListinstance.displayCtx – The
DisplayContextinstance.viewPanel – The
ViewPanelinstance.
- destroy()[source]
Must be called when this
LookupTablePanelis no longer needed. Removes some property listeners, and calls theControlPanel.destroy()method.
- __updateLutChoices()
Refreshes the contents of the lookup table drop down box, using the
LookupTableinstances returned by thecolourmaps.getLookupTables()function.
- __createLabelList()
Refreshes the contents of the class:.LookupTable label list, from the currently selected
LookupTable.
- __setLut(lut)
Updates this
LookupTablePanelto display the labels for the givenlut(assumed to be aLookupTableinstance).If the currently selected overlay is associated with a
LabelOptsinstance, itsLabelOpts.lutproperty is set to the newLookupTable.
- __lutSaveStateChanged(*a)
Called when the
LookupTable.savedproperty of the currentLookupTableinstance changes. Sets the state of the save button accordingly.
- __lutLabelAdded(lut, topic, label)
Called when the current
LookupTablesends an'added'notification, indicating that a label has been added. Updates the list of displayed labels.
- __lutLabelRemoved(lut, topic, label)
Called when the current
LookupTablesends a'removed'notification, indicating that a label has been removed. Updates the list of displayed labels.
- __onLutChoice(ev)
Called when the user changes the selected
LookupTablevia the lookup table drop down box. See the__setLut()method..
- __onSelectAll(ev)
Called when the user pushes the Select all button. Enables every label on the current LUT.
- __onSelectNone(ev)
Called when the user pushes the Select none button. Disables every label on the current LUT.
- __onNewLut(ev)
Called when the user presses the New LUT button.
Prompts the user to enter a name (via
promptForLutName()), and then creates and registers a newLookupTableinstance. Updates thisLookupTablePanelvia the__updateLutChoices()and__setLut()methods.
- __onCopyLut(ev)
Called when the user presses the Copy LUT button.
Prompts the user to enter a name (via
promptForLutName()), and then creates and registers a newLookupTableinstance which is initialised with the same labels as the previously selectedLookupTable. Updates thisLookupTablePanelvia the__updateLutChoices()and__setLut()methods.
- __onLoadLut(ev)
Called when the user presses the Load LUT button. Does the following:
Prompts the user to select a LUT file with a
wx.FileDialogPrompts the user to enter a name for the LUT via the
promptForLutName()function.Creates and registers a new
LookupTableinstance, initialising it with the selected file.Updates this
LookupTablePanelvia the__updateLutChoices()and__setLut()methods.
- __onSaveLut(ev)
Called when the user presses the Save LUT button. Makes sure that the current
LookupTableis saved (see thecolourmaps.installLookupTable()function).
- __onLabelAdd(ev)
Called when the user pushes the add button on the lookup table label list. Displays a
LutLabelDialog, prompting the user to select a name, value and colour, and then adds a new label to the currentLookupTableinstance.
- __onLabelRemove(ev)
Called when the user pushes the remove button on the lookup table label list. Removes the selected label from the current
LookupTable.
- __selectedOverlayChanged(*a)
Called when the
OverlayListorDisplayContext.selectedOverlaychanges. Refreshes theLookupTablePanelaccordingly.
- __overlayTypeChanged(*a)
Called when the
Display.overlayTypeproperty of the currently selected overlay changes. If theDisplayOptsinstance associated with the new overlay type is aLabelOpts, a listener is addd to itslutproperty.
- __lutChanged(*a)
Called when the
LabelOpts.lutproperty associated with the currently selected overlay changes. Changes theLookupTabledisplayed on thisLookupTablePanel(see the__setLut()method).
- __annotations__ = {}
- __module__ = 'fsleyes.plugins.controls.lookuptablepanel'
- fsleyes.plugins.controls.lookuptablepanel.promptForLutName(initial=None)[source]
Prompts the user to enter a name for a newly created
LookupTable.
- class fsleyes.plugins.controls.lookuptablepanel.LabelWidget(lutPanel, lut, label)[source]
Bases:
__main__.docbuilder.run.<locals>.MockClassA
LabelWidgetis shown for each label of theLookupTablewhich is currently displayed on aLookupTablePanel. ALabelWidgetallows the user to change the colour and visibility of the label value.- __init__(lutPanel, lut, label)[source]
Create a
LabelWidget.- Parameters
lutPanel – The
LookupTablePanelthat is displaying thisLabelWidget.lut – The
LookupTablecurrently being displayed.label – The
LutLabelthat thisLabelWidgetis associated with.
- __annotations__ = {}
- __module__ = 'fsleyes.plugins.controls.lookuptablepanel'
- class fsleyes.plugins.controls.lookuptablepanel.LutLabelDialog(parent, value, name, colour)[source]
Bases:
__main__.docbuilder.run.<locals>.MockClassA dialog which is displayed when the user adds a new label to the
LookupTablecurrently displayed in theLookupTablePanel.Prompts the user to enter a label value, name, and colour. After the dialog is dismissed, the entered information is available via the following methods:
Returns the value that was entered by the user.
Returns the name that was entered by the user.
Returns the colour that was entered by the user.
- __init__(parent, value, name, colour)[source]
Create a
LutLabelDialog.- Parameters
parent – The
wxparent object.
- GetValue()[source]
Returns the value that was entered by the user. Or, returns
Noneif the user cancelled the dialog, or the dialog has not yet been closed.
- GetName()[source]
Returns the name that was entered by the user. Or, returns
Noneif the user cancelled the dialog, or the dialog has not yet been closed.
- GetColour()[source]
Returns the colour that was entered by the user. Or, returns
Noneif the user cancelled the dialog, or the dialog has not yet been closed.
- __onOk(ev)
Called when the user confirms the dialog. Saves the name, colour, and value that were entered, and closes the dialog.
- __onCancel(ev)
Called when the user cancells the dialog. Closes the dialog.
- __annotations__ = {}
- __module__ = 'fsleyes.plugins.controls.lookuptablepanel'