LUT widgets
- class Sisyphe.widgets.LUTWidgets.LutWidget(volume: SisypheVolume | None = None, view: IconBarViewWidgetCollection | IconBarWidget | MultiViewWidget | AbstractViewWidget | None = None, size: int = 512, ratio: float = 0.1, parent: QWidget | None = None)
LutWidget class
Description
Custom QWidget to control LUT (colormap selection, window settings)
Functionalities:
Displaying the histogram of the associate SisypheVolume.
Providing a visual representation of the current Lut and colormap.
Allowing the user to select a Lut from a predefined list or from a file on disk.
Enabling the user to reverse the current Lut.
Providing a range slider to adjust the image windowing settings.
Displaying the current windowing settings (min and max values) in editable text boxes.
Handling mouse events for adjusting the windowing settings and moving the windowing range.
This widget consists of the following elements:
Figure, histogram and Lut display, interactive left and right span to change window
QDoubleSpinBox, minimum range value
QDoubleSpinBox, maximum range value
ComboBoxLut, Lut selection
QCheckBox, reverse Lut
Inheritance
QWidget -> LutWidget
Creation: 01/11/2022 Last revision: 20/10/2025
- autoWindow(cmin: int = 1, cmax: int = 99) None
Automatically adjust the window based on intensity percentiles.
Parameters
- cminint, optional
lower percentile (1-99).
- cmaxint, optional
upper percentile (1-99).
- defaultWindow() None
Reset the window to the full intensity range of the volume.
- getDisplay()
Get the SisypheDisplay attribute of the associated Sisyphevolume.
Returns
- SisypheDisplay
SisypheDisplay instance.
- getLut() SisypheLut
Get the SisypheLut instanvce from the associated Sisyphevolume.
Returns
- SisypheLut
SisypheLut instance.
- getRange() tuple[float, float] | tuple[int, int]
Get the current display range settings (min, max).
Returns
- tuple[float, float] | tuple[int, int]
minimum and maximum range values.
- getRangeMax() float | int
Get the maximum value of the current display range.
Returns
- float | int
maximum range value.
- getRangeMin() float | int
Get the minimum value of the current display range.
Returns
- float | int
minimum range value.
- getViewWidget() IconBarViewWidgetCollection | IconBarWidget | MultiViewWidget | AbstractViewWidget | None
Get the associated view widget.
Returns
- IconBarViewWidgetCollection | IconBarWidget | MultiViewWidget | AbstractViewWidget | None
associated view widget, or None.
- getVolume() SisypheVolume
Get the Sisyphevolume associated with the widget.
Returns
- SisypheVolume
associated Sisyphevolume.
- getWindow() tuple[float, float] | tuple[int, int]
Get the current windowing settings (min, max).
Returns
- tuple[float, float] | tuple[int, int]
minimum and maximum window values.
- getWindowMax() float | int
Get the maximum value of the current window.
Returns
- float | int
maximum window value.
- getWindowMin() float | int
Get the minimum value of the current window.
Returns
- float | int
minimum window value.
- hasViewWidget() bool
Check if a view widget is associated.
Returns
- bool
True if a view widget is associated, False otherwise.
- hasVolume() bool
Check if a SisypheVolume is associated with the widget.
Returns
- bool
True if a SisypheVolume is associated, False otherwise.
- classmethod isDarkMode() bool
Check if the system is currently in dark mode.
Returns
- bool
True if dark mode is detected, False otherwise.
- classmethod isLightMode() bool
Check if the system is currently in light mode.
Returns
- bool
True if light mode is detected, False otherwise.
- loadLut() None
Opens a file dialog to load a LUT from disk.
- removeVolume() None
Remove the current SisypheVolume and disables the widget.
- reverseLut() None
Reverses the current LUT and updates the display.
- setCTBoneWindow() None
Apply a preset windowing for CT bone visualization.
- setCTBrainWindow() None
Apply a preset windowing for CT brain visualization.
- setCTMetallicWindow() None
Apply a preset windowing for CT metallic implant visualization.
- setDisplay(display: SisypheDisplay) None
Set new SisypheDisplay attribute.
Parameters
- displaySisypheDisplay
SisypheDisplay instance.
- setRange(rmin: float, rmax: float) None
Set the display range values.
Parameters
- rminfloat
minimum range value.
- rmaxfloat
maximum range value.
- setRangeMax(rmax: float) None
Set the maximum display range value.
Parameters
- rmaxfloat
maximum range value.
- setRangeMin(rmin: float) None
Set the minimum display range value.
Parameters
- rminfloat
minimum range value.
- setViewWidget(view: IconBarViewWidgetCollection | IconBarWidget | MultiViewWidget | AbstractViewWidget) None
Set the associated view widget to be updated.
Parameters
- viewIconBarViewWidgetCollection | IconBarWidget | MultiViewWidget | AbstractViewWidget
view widget to associate.
- setVolume(volume: SisypheVolume) None
Associate a Sisyphevolume with the widget and re-initializes the display.
Parameters
- volumeSisypheVolume
SisypheVolume instance to associate.
- setWindow(wmin: float | int, wmax: float | int) None
Set the windowing values.
Parameters
- wminfloat | int
minimum window value.
- wmaxfloat | int
maximum window value.
- class Sisyphe.widgets.LUTWidgets.LutEditWidget(size: int = 512, parent: QWidget | None = None)
LutEditWidget class
Description
Custom QWidget to edit Lut.
It provides a graphical user interface for users to interactively add, remove, and modify color points in the Lut.
Inheritance
QWidget -> LutEditWidget
Creation: 08/11/2022 Last revision: 20/10/2025
- copyTo(display: SisypheDisplay) None
Copy the created SisypheLut to a SisypheDisplay instance.
Parameters
- displaySisypheDisplay
target SisypheDisplay instance to update.
- classmethod getDefaultLutDirectory() str
Get the path to the default Lut directory.
Returns
- str
The absolute path to the Lut directory.
- getMatplotlibLut() LinearSegmentedColormap
Get a Matplotlib colormap from the current control points.
Returns
- LinearSegmentedColormap
generated colormap instance.
- getSisypheLut() SisypheLut
Get a SisypheLut from the current control points.
Returns
- SisypheLut
generated SisypheLut instance.
- save() None
Open a file dialog to save the current SisypheLut.
- class Sisyphe.widgets.LUTWidgets.ComboBoxLut(pathname: str | None = None, parent: QWidget | None = None)
ComboBoxLut class
Description
Custom ComboBox to select Lut for visualization purposes.
It provides a user-friendly interface for selecting and displaying different Lut, both internal and external files.
Inheritance
QComboBox -> ComboBoxLut
Creation: 20/11/2022 Last revision: 20/10/2025
- addFileLut(name: str) None
Add a Lut from a file path to the combo box.
Parameters
- namestr
The file path of the Lut.
- addFilesLut(pathname: str) None
Add all supported Lut files from a given directory to the combo box.
Parameters
- pathnamestr
directory path to search for Lut files.
- addLut(lut: ListedColormap | LinearSegmentedColormap | SisypheLut) None
Add a Lut instance to the combo box.
Parameters
- lutListedColormap | LinearSegmentedColormap | SisypheLut
Lut instance to add.
- getCurrentAsMatplotlibColormap() ListedColormap
Get the currently selected Lut as a Matplotlib colormap.
Returns
- ListedColormap
selected colormap instance.
- getCurrentAsSisypheLut() SisypheLut
Gets the currently selected Lut as a SisypheLut object.
Returns
- SisypheLut
selected Lut instance.
- classmethod getDefaultLutDirectory() str
Get the path to the default Lut directory.
Returns
- str
The absolute path to the Lut directory.
- insertFileLut(index: int, name: str) None
Inserts a Lut from a file path at a specific index.
Parameters
- indexint
index at which to insert the item.
- namestr
file path of the Lut.
- insertLut(index: int, lut: ListedColormap | LinearSegmentedColormap | SisypheLut) None
Insert a Lut instance at a specific index in the combo box.
Parameters
- indexint
index at which to insert the item.
- lutListedColormap | LinearSegmentedColormap | SisypheLut
Lut instance to insert.
- class Sisyphe.widgets.LUTWidgets.PopupMenuLut(pathname: str | None = None, parent: QWidget | None = None)
PopupMenuLut class
Description
PopupMenu to select Lut for visualization purposes.
It provides a user-friendly interface for selecting and displaying different LUTs, both internal and external files.
Inheritance
QMenu -> PopupMenuLut
Creation: 20/10/2022 Last revision: 20/10/2025
- addFileLut(name: str) None
Add a Lut from a file path as a menu action.
Parameters
- namestr
file path of the LUT.
- addFilesLut(pathname: str) None
Add all supported Lut files from a given directory as menu actions.
Parameters
- pathnamestr
directory path to search for Lut files.
- addLut(lut: SisypheLut) None
Add a Lut instance as a menu action.
Parameters
- lutSisypheLut
Lut instance to add.
- static getCurrentAsMatplotlibColormap(action: QAction) ListedColormap
Get the Lut from a QAction menu item.
Parameters
- actionQAction
QAction instance of a menu item.
Returns
- ListedColormap
Lut as Matplotlib colormap instance.
- static getCurrentAsSisypheLut(action: QAction) SisypheLut
Get the Lut from a QAction menu item.
Parameters
- actionQAction
QAction instance of a menu item.
Returns
- SisypheLut
Lut as SisypheLut instance.
- class Sisyphe.widgets.LUTWidgets.ColorTransferWidget(volume: SisypheVolume, view: VolumeViewWidget | None = None, transfer: SisypheColorTransfer | None = None, size: int = 512, parent: QWidget | None = None)
ColorTransferWidget class
Description
Custom QWidget to edit and control color transfer function for volume rendering.
It provides a user-friendly interface for editing color transfer functions, including adding, removing, and modifying color points, as well as saving and loading color transfer functions in various formats.
Inheritance
QWidget - > LutEditWidget - > ColorTransferWidget
Creation: 10/11/2022 Last revision: 20/10/2025
- getTransfer() SisypheColorTransfer
Get the SisypheColorTransfer instance edited with the widget.
Returns
- SisypheColorTransfer
edited SisypheColorTransfer instance.
- getViewWidget() VolumeViewWidget
Get the associated VolumeViewWidget.
Returns
- VolumeViewWidget
associated VolumeViewWidget.
- getVolume() SisypheVolume
Get the SisypheVolume associated with the widget.
Returns
- SisypheVolume
associated SisypheVolume instance.
- hasViewWidget() bool
Check if a VolumeViewWidget is associated to the widget.
Returns
- bool
True if a VolumeViewWidget is associated, False otherwise.
- hasVolume() bool
Check if a SisypheVolume is associated with the widget.
Returns
- bool
True if a SisypheVolume is associated, False otherwise.
- setTransfer(transfer: SisypheColorTransfer) None
Set a new SisypheColorTransfer instance to be edited and updates the widget.
Parameters
- transferSisypheColorTransfer
SisypheColorTransfer instance to edit
- setViewWidget(view: VolumeViewWidget, getinfos: bool = True) None
Set the VolumeViewWidget and optionally syncs its SisypheVolume and transfer function.
Parameters
- viewVolumeViewWidget
VolumeViewWidget to associate.
- getinfosbool (optional)
If True, the widget’s SisypheVolume and transfer function are updated from the VolumeViewWidget.
- setVolume(volume: SisypheVolume) None
Associate a new SisypheVolume and resets the color transfer function to its default for that volume.
Parameters
- volumeSisypheVolume
SisypheVolume associated to.
- class Sisyphe.widgets.LUTWidgets.AlphaTransferWidget(volume: SisypheVolume | None = None, view: VolumeViewWidget | None = None, transfer: SisypheColorTransfer | None = None, functype: str = 'alpha', size: int = 512, parent: QWidget | None = None)
AlphaTransferWidget class
Description
Custom QWidget to edit and control alpha transfer function for volume rendering.
It provides a visual representation of the alpha transfer function, allowing users to interactively add, remove, and modify alpha transfer elements. It also includes features to save, load, and clear the alpha transfer function.
The widget displays a histogram of the volume’s intensity values, along with markers representing the alpha transfer elements. Users can add new alpha transfer elements by double-clicking on the background of the histogram, remove existing elements by right-clicking on the markers, and modify the alpha values by dragging the markers vertically.
Inheritance
QWidget -> AlphaTransferWidget
Creation: 12/11/2022 Last revision: 20/10/2025
- getTransfer() SisypheColorTransfer
Get the associated SisypheColorTransfer instance.
Returns
- SisypheColorTransfer
Associated SisypheColorTransfer.
- getViewWidget() VolumeViewWidget
Get the associated VolumeViewWidget.
Returns
- VolumeViewWidget
associated VolumeViewWidget.
- getVolume() SisypheVolume
Get the SisypheVolume associated with the widget.
Returns
- SisypheVolume
associated SisypheVolume instance.
- hasViewWidget() bool
Check if a VolumeViewWidget is associated to the widget.
Returns
- bool
True if a VolumeViewWidget is associated, False otherwise.
- hasVolume() bool
Check if a SisypheVolume is associated with the widget.
Returns
- bool
True if a SisypheVolume is associated, False otherwise.
- save() None
Open a file dialog to save the current transfer function.
- setTransfer(transfer: SisypheColorTransfer) None
Associate SisypheColorTransfer instance and updates the widget.
Parameters
- transferSisypheColorTransfer
SisypheColorTransfer to associate.
- setViewWidget(view: VolumeViewWidget, getinfos: bool = True)
Associate VolumeViewWidget and optionally syncs its SisypheVolume and transfer function.
Parameters
- viewVolumeViewWidget
VolumeViewWidget to associate.
- getinfosbool (optional)
If True, the widget’s SisypheVolume and transfer function are updated from the VolumeViewWidget.
- setVolume(volume: SisypheVolume) None
Associate a new SisypheVolume.
Parameters
- volumeSisypheVolume
SisypheVolume associated to.
- class Sisyphe.widgets.LUTWidgets.TransferWidget(volume: SisypheVolume | None = None, view: VolumeViewWidget | None = None, transfer: SisypheColorTransfer | None = None, gradient: bool = True, size: int = 512, parent: QWidget | None = None)
TransferWidget class
Description
Custom QWidget to edit and control color and alpha transfer functions for volume rendering. It is a complex widget that integrates multiple functionalities, such as color transfer widget, alpha transfer widget, gradient transfer widget, and a file dialog for loading and saving color transfer functions.
Inheritance
QWidget - > TransferWidget
Creation: 12/11/2022 Last revision: 20/10/2025
- getTransfer() SisypheColorTransfer
Get the associated SisypheColorTransfer instance.
Returns
- SisypheColorTransfer
Associated SisypheColorTransfer.
- getViewWidget() VolumeViewWidget
Get the associated VolumeViewWidget.
Returns
- VolumeViewWidget
associated VolumeViewWidget.
- getVolume() SisypheVolume
Get the SisypheVolume associated with the widget.
Returns
- SisypheVolume
associated SisypheVolume instance.
- hasViewWidget() bool
Check if a VolumeViewWidget is associated to the widget.
Returns
- bool
True if a VolumeViewWidget is associated, False otherwise.
- hasVolume() bool
Check if a SisypheVolume is associated with the widget.
Returns
- bool
True if a SisypheVolume is associated, False otherwise.
- load() None
Open a file dialog to load a transfer function from an XML file.
- save() None
Save the current color transfer function to a file.
- setTransfer(transfer: SisypheColorTransfer, gradient: bool = True) None
Associate a new SisypheColorTransfer instance for all child editor widgets.
Parameters
- transferSisypheColorTransfer
SisypheColorTransfer to associate.
- gradientbool, optional
Flag to indicate if gradient-related components should be updated.
- setViewWidget(view: VolumeViewWidget, gradient: bool = True)
Associate a new VolumeViewWidget for all child editor widgets.
Parameters
- viewVolumeViewWidget
VolumeViewWidget to associate.
- gradientbool, optional
Flag to indicate if gradient-related components should be updated.
- setVolume(volume: SisypheVolume, gradient: bool = True) None
Associate a new SisypheVolume for all child editor widgets.
Parameters
- volumeSisypheVolume
SisypheVolume to associate.
- gradientbool (optional)
Flag to indicate if gradient-related components should be updated.