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.ControlPanel
A
LookupTablePanel
is aControlPanel
which allows users to manageLookupTable
instances. ALookupTablePanel
looks something like this:A
LookupTablePanel
allows 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
LookupTable
to/from a file.
The
LookupTablePanel
keeps track of the currently selected overlay (see theDisplayContext.selectedOverlay
property). If the overlay is associated with aLabelOpts
instance, itsLabelopts.lut
property will be updated when theLookupTable
is changed through theLookupTablePanel
, and vice versa.-
__init__
(parent, overlayList, displayCtx, frame)[source]¶ Create a
LookupTablePanel
.- Parameters
parent – The
wx
parent object.overlayList – The
OverlayList
instance.displayCtx – The
DisplayContext
instance.frame – The
FSLeyesFrame
instance.
-
destroy
()[source]¶ Must be called when this
LookupTablePanel
is 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
LookupTable
instances returned by thecolourmaps.getLookupTables()
function.
-
__createLabelList
()¶ Refreshes the contents of the class:.LookupTable label list, from the currently selected
LookupTable
.
-
__setLut
(lut)¶ Updates this
LookupTablePanel
to display the labels for the givenlut
(assumed to be aLookupTable
instance).If the currently selected overlay is associated with a
LabelOpts
instance, itsLabelOpts.lut
property is set to the newLookupTable
.
-
__lutSaveStateChanged
(*a)¶ Called when the
LookupTable.saved
property of the currentLookupTable
instance changes. Sets the state of the save button accordingly.
-
__lutLabelAdded
(lut, topic, label)¶ Called when the current
LookupTable
sends an'added'
notification, indicating that a label has been added. Updates the list of displayed labels.
-
__lutLabelRemoved
(lut, topic, label)¶ Called when the current
LookupTable
sends 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
LookupTable
via 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 newLookupTable
instance. Updates thisLookupTablePanel
via 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 newLookupTable
instance which is initialised with the same labels as the previously selectedLookupTable
. Updates thisLookupTablePanel
via 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.FileDialog
Prompts the user to enter a name for the LUT via the
promptForLutName()
function.Creates and registers a new
LookupTable
instance, initialising it with the selected file.Updates this
LookupTablePanel
via the__updateLutChoices()
and__setLut()
methods.
-
__onSaveLut
(ev)¶ Called when the user presses the Save LUT button. Makes sure that the current
LookupTable
is 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 currentLookupTable
instance.
-
__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
OverlayList
orDisplayContext.selectedOverlay
changes. Refreshes theLookupTablePanel
accordingly.
-
__overlayTypeChanged
(*a)¶ Called when the
Display.overlayType
property of the currently selected overlay changes. If theDisplayOpts
instance associated with the new overlay type is aLabelOpts
, a listener is addd to itslut
property.
-
__lutChanged
(*a)¶ Called when the
LabelOpts.lut
property associated with the currently selected overlay changes. Changes theLookupTable
displayed on thisLookupTablePanel
(see the__setLut()
method).
-
__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__.docbuilder.run.<locals>.MockClass
A
LabelWidget
is shown for each label of theLookupTable
which is currently displayed on aLookupTablePanel
. ALabelWidget
allows the user to change the colour and visibility of the label value.-
__init__
(lutPanel, lut, label)[source]¶ Create a
LabelWidget
.- Parameters
lutPanel – The
LookupTablePanel
that is displaying thisLabelWidget
.lut – The
LookupTable
currently being displayed.label – The
LutLabel
that thisLabelWidget
is associated with.
-
__module__
= 'fsleyes.controls.lookuptablepanel'¶
-
-
class
fsleyes.controls.lookuptablepanel.
LutLabelDialog
(parent, value, name, colour)[source]¶ Bases:
__main__.docbuilder.run.<locals>.MockClass
A dialog which is displayed when the user adds a new label to the
LookupTable
currently 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
wx
parent object.
-
GetValue
()[source]¶ Returns the value that was entered by the user. Or, returns
None
if 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
None
if 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
None
if 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.
-
__module__
= 'fsleyes.controls.lookuptablepanel'¶
-