fsleyes.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.controls.lookuptablepanel.LookupTablePanel(parent, overlayList, displayCtx, frame)[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.-
__init__(parent, overlayList, displayCtx, frame)[source]¶ Create a
LookupTablePanel.- Parameters
parent – The
wxparent object.overlayList – The
OverlayListinstance.displayCtx – The
DisplayContextinstance.frame – The
FSLeyesFrameinstance.
-
destroy()[source]¶ Must be called when this
LookupTablePanelis no longer needed. Removes some property listeners, and calls theControlPanel.destroy()method.
-
_LookupTablePanel__createLabelList()¶ Refreshes the contents of the class:.LookupTable label list, from the currently selected
LookupTable.
-
_LookupTablePanel__lutChanged(*a)¶ Called when the
LabelOpts.lutproperty associated with the currently selected overlay changes. Changes theLookupTabledisplayed on thisLookupTablePanel(see the__setLut()method).
-
_LookupTablePanel__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.
-
_LookupTablePanel__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.
-
_LookupTablePanel__lutSaveStateChanged(*a)¶ Called when the
LookupTable.savedproperty of the currentLookupTableinstance changes. Sets the state of the save button accordingly.
-
_LookupTablePanel__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.
-
_LookupTablePanel__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.
-
_LookupTablePanel__onLabelRemove(ev)¶ Called when the user pushes the remove button on the lookup table label list. Removes the selected label from the current
LookupTable.
-
_LookupTablePanel__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.
-
_LookupTablePanel__onLutChoice(ev)¶ Called when the user changes the selected
LookupTablevia the lookup table drop down box. See the__setLut()method..
-
_LookupTablePanel__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.
-
_LookupTablePanel__onSaveLut(ev)¶ Called when the user presses the Save LUT button. Makes sure that the current
LookupTableis saved (see thecolourmaps.installLookupTable()function).
-
_LookupTablePanel__onSelectAll(ev)¶ Called when the user pushes the Select all button. Enables every label on the current LUT.
-
_LookupTablePanel__onSelectNone(ev)¶ Called when the user pushes the Select none button. Disables every label on the current LUT.
-
_LookupTablePanel__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.
-
_LookupTablePanel__selectedOverlayChanged(*a)¶ Called when the
OverlayListorDisplayContext.selectedOverlaychanges. Refreshes theLookupTablePanelaccordingly.
-
_LookupTablePanel__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.
-
_LookupTablePanel__updateLutChoices()¶ Refreshes the contents of the lookup table drop down box, using the
LookupTableinstances returned by thecolourmaps.getLookupTables()function.
-
__module__= 'fsleyes.controls.lookuptablepanel'¶
-
fsleyes.controls.lookuptablepanel.promptForLutName(initial=None)[source]¶ Prompts the user to enter a name for a newly created
LookupTable.
-
class
fsleyes.controls.lookuptablepanel.LabelWidget(lutPanel, lut, label)[source]¶ Bases:
__main__.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.
-
__module__= 'fsleyes.controls.lookuptablepanel'¶
-
-
class
fsleyes.controls.lookuptablepanel.LutLabelDialog(parent, value, name, colour)[source]¶ Bases:
__main__.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.
-
_LutLabelDialog__onCancel(ev)¶ Called when the user cancells the dialog. Closes the dialog.
-
_LutLabelDialog__onOk(ev)¶ Called when the user confirms the dialog. Saves the name, colour, and value that were entered, and closes the dialog.
-
__module__= 'fsleyes.controls.lookuptablepanel'¶
-