Single viewport widgets

class Sisyphe.widgets.abstractViewWidget.AbstractViewWidget(parent: QWidget | None = None)

AbstractViewWidget class

Description

This abstract class is designed to provide a set of common methods and functionalities for all view widgets.

The main features are as follows:

  • Rendering Pipeline: establishes a multi-layered VTK rendering setup, separating the primary data display (i.e. SisyppheVolume display) from 2D information overlays.

  • User Interaction: implements handling for mouse and keyboard events, enabling standard viewport navigation like zooming, panning, and window/level adjustments.

  • Informational overlays: manages a set of configurable 2D VTK actors for displaying contextual information, such as a color bar, scale ruler, orientation marker, cross-shaped cursor, and detailed text attributes about the patient and image.

  • Tool management: provides a framework for adding, managing, and interacting with a variety of 2D and 3D tools, including distance, angle, target (point), and trajectory (line) widgets.

  • Context menus: features a right-click popup menu system that offers easy access to viewport actions, visibility settings, and tool-specific operations.

  • Synchronization: uses a Qt signal and slot mechanism to enable the synchronization of cursor position, zoom, and tool manipulations across multiple linked viewports.

  • Configuration and export: supports user settings (e.g. colors, fonts…) and includes functionality to save the current view to a bitmap image file or copy it to the system clipboard.

Inheritance

QWidget -> AbstractViewWidget

Creation: 20/03/2022 Last Revision: 20/10/2025

addAngleTool(name: str = '') None

Add a new 2D angle measurement tool to the viewport.

Parameters

namestr (optional)

optional name for the new tool (default ‘’).

addBoxTool(p: list[float] | tuple[float, float, float] | None = None, name: str = '') None

Add a new 2D box widget tool to the viewport.

Parameters

plist[float] | tuple[float, float, float] | None (optional)

initial world position for the tool. If None, the cross-shaped cursor position is used.

namestr (optional)

optional name for the new tool (default ‘’).

addDistanceTool(name: str = '') None

Add a new 2D distance measurement tool to the viewport.

Parameters

namestr (optional)

optional name for the new tool (default ‘’).

addOrthogonalDistanceTool(name: str = '') None

Add a new 2D orthogonal distance (bi-dimensional) measurement tool to the viewport.

Parameters

namestr (optional)

optional name for the new tool (default ‘’).

addTarget(p: list[float] | tuple[float, float, float] | None = None, name: str = '', signal: bool = True) HandleWidget

Add a 3D target (handle) widget to the viewport.

Parameters

plist[float] | tuple[float, float, float] | None (optional)

initial world position for the target. If None, the cross-shaped cursor position is used.

namestr (optional)

optional name for the new target (default ‘’).

signalbool (optional)

If True, emits the ToolAdded signal for synchronization (default True).

Returns

HandleWidget

The newly created handle widget.

addTextTool(p: list[float] | tuple[float, float, float] | None = None) None

Add a new 2D text annotation tool to the viewport. Opens a dialog to enter the text.

Parameters

plist[float] | tuple[float, float, float] | None (optional)

initial world position for the tool. If None, the cursor position is used.

addTrajectory(p1: list[float] | tuple[float, float, float] | None = None, p2: list[float] | tuple[float, float, float] | None = None, angles: list[float] | tuple[float, float] | None = None, length: float = 50.0, name: str = '', signal: bool = True) LineWidget

Add a 3D trajectory (line) widget to the viewport.

Parameters

p1list[float] | tuple[float, float, float] | None (optional)

world position of the entry point.

p2list[float] | tuple[float, float, float] | None (optional)

world position of the target point. If None, the cursor position is used.

angleslist[float] | tuple[float, float] | None (optional)

Azimuth and elevation angles to define the trajectory from the target.

lengthfloat (optional)

length in mm of the trajectory (default 50.0).

namestr (optional)

optional name for the new trajectory (default ‘’).

signalbool (optional)

If True, emits the ToolAdded signal for synchronization (default True).

Returns

LineWidget

The newly created line widget.

copyToClipboard() None

Copy the current viewport content to the system clipboard as an image.

copyToolAttributes(key: int | str | HandleWidget | LineWidget, tool: HandleWidget | LineWidget, signal: bool = True) None

Copy attributes from one tool to another.

Parameters

keyint | str | HandleWidget | LineWidget

source tool, identified by index, name, or instance.

toolHandleWidget | LineWidget

destination tool.

signalbool (optional)

If True, emits the ToolAttributesChanged signal for synchronization (default True).

displayOff() None

Hide the following items of the AbstractViewWidget instance:

  • information (top left, top right, bottom left, bottom right)

  • colorbar

  • orientation maker (bottom right)

  • ruler

  • cross-shaped cursor

displayOn() None

Show the following items of the AbstractViewWidget instance:

  • information (top left, top right, bottom left, bottom right)

  • colorbar

  • orientation maker (bottom right)

  • ruler

  • cross-shaped cursor

Items are displayed only if their individual visibility attribute is True.

finalize() None

Method to be called before AbstractViewWidget instance destruction. It is used to avoid vtk error on windows platform (vtkWin32OpenGLRenderWindow error: ‘wglMakeCurrent failed in MakeCurrent()’)

get2DRenderer() vtkRenderer

Get the vtkRenderer attribute of the AbstractViewWidget instance that manages the 2D display (information, colorbar, orientation maker, ruler, cross-shaped cursor) in front of the volume. https://vtk.org/doc/nightly/html/classvtkRenderer.html

Returns

vtkRenderer

getAcceptTools() bool

Check if the viewport is currently accepting new tool widgets.

Returns

bool

True if new tools can be added, False otherwise.

getAction() dict[str, QAction]

Get a dict of all the available QActions defined in the AbstractViewWidget instance. A str key is used to address each QAction. https://doc.qt.io/qt-6/qaction.html

Returns

dict[str, QAction]

key str, QAction name

getBottomLeftInfo() vtkTextActor

Get the text actor for the bottom-left information display.

Returns

vtkTextActor

The bottom-left text actor.

getBottomRightInfo() vtkTextActor

Get the text actor for the bottom-right information display.

Returns

vtkTextActor

The bottom-right text actor.

getCamera() vtkCamera

Get the vtkCamera attribute of the AbstractViewWidget instance. A camera class for 3D rendering that provides methods for positioning and orienting the viewpoint and focal point. https://vtk.org/doc/nightly/html/classvtkCamera.html

Returns

vtkCamera

getCenteredCursorFlag() bool

Check if the ‘Centered cursor’ action is active. The cross-shaped cursor remains at the viewport’s center.

Returns

bool

True if the centered cursor flag is set, False otherwise.

getCentralCrossOpacity() float

Get the opacity of the central cross.

Returns

float

opacity value.

getCentralCrossVisibility() bool

Check if the central cross is visible.

Returns

bool

True if the cross is visible, False otherwise.

getColorbar() vtkScalarBarActor

Get the vtkScalarBarActor instance.

Returns

vtkScalarBarActor

colorbar actor.

getColorbarPosition() str

Get the current position of the colorbar.

Returns

str

current colorbar position (‘Left’, ‘Right’, ‘Top’, or ‘Bottom’).

getColorbarVisibility() bool

Check if the colorbar is visible.

Returns

bool

True if the colorbar is visible, False otherwise.

getCursorArrayPosition() tuple[int, int, int]

Get the cross-shaped cursor position in array (voxel) coordinates.

Returns

tuple[int, int, int]

(i, j, k) array coordinates of the cursor.

getCursorOpacity() float

Get the opacity of the cross-shaped cursor.

Returns

float

opacity value.

getCursorVisibility() bool

Check if the cross-shaped cursor is visible.

Returns

bool

True if the cursor is visible, False otherwise.

getCursorWorldPosition() tuple[float, float, float]

Get the 3D world position of the cross-shaped cursor.

Returns

tuple[float, float, float]

(x, y, z) world coordinates of the cross-shaped cursor.

getDisplayScaleFactor() float

Get the scale (i.e. zoom) factor applied to the display of all QWidgets.

Returns

float

scale factor

getFollowFlag() bool

Check if the ‘Cursor follows mouse’ action is active.

Returns

bool

True if the follow flag is set, False otherwise.

getFontFamily() str

Get the current font family used for text overlays.

Returns

str

font family name or path.

getFontScale() float

Get the current font scale factor.

Returns

float

font scale factor.

getFontSize() int

Get the base font size for text overlays.

Returns

int

The base font size.

getInfoAcquisitionVisibility() bool

Check if the acquisition information is visible.

Returns

bool

True if acquisition information is visible, False otherwise.

getInfoIdentityVisibility() bool

Check if the identity information is visible.

Returns

bool

True if identity information is visible, False otherwise.

getInfoVisibility() bool

Check if the information text overlays are visible.

Returns

bool

True if information is visible, False otherwise.

getInfoVolumeVisibility() bool

Check if the volume attributes information is visible.

Returns

bool

True if volume information is visible, False otherwise.

getLevelFlag() bool

Check if the current mouse action is ‘Level/Window’.

Returns

bool

True if the level/window flag is set, False otherwise.

getLineColor() tuple[float, float, float]

Get the current color for non-selected overlays.

Returns

tuple[float, float, float]

(r, g, b) color tuple.

getLineOpacity() float

Get the current line opacity for overlays.

Returns

float

opacity value.

getLineSelectedColor() tuple[float, float, float]

Get the current color for selected tools.

Returns

tuple[float, float, float]

(r, g, b) color tuple.

getLineWidth() float

Get the current line width for overlays.

Returns

float

line width in pixels.

getMouseCursor() int

Get the current shape of the mouse pointer.

Returns

int

VTK cursor shape constant.

getMoveFlag() bool

Check if the current mouse action is ‘Move’.

Returns

bool

True if the move flag is set, False otherwise.

getName() str

Get the name attribute of the AbstractViewWidget instance.

Returns

str

name attribute of the AbstractViewWidget instance

getOrientationMarker() str

Get the current shape of the orientation marker.

Returns

str

marker shape (‘Cube’, ‘Head’, ‘Bust’, ‘Body’, or ‘Axes’).

getOrientationMarkerVisibility() bool

Check if the orientation marker is visible.

Returns

bool

True if the marker is visible, False otherwise.

getPixmapCapture() QPixmap

Capture the current viewport content as a QPixmap.

Returns

QPixmap

pixmap of the current render window content.

getPopup() QMenu

Get the popup menu of the AbstractViewWidget instance. https://doc.qt.io/qt-6/qmenu.html

Returns

QMenu

getPopupActions() QMenu

Get the popup submenu Actions of the AbstractViewWidget instance. This submenu provides the following options:

  • no action

  • zoom: left press + drag to change image zoom

  • move: left press + drag to change image position

  • windowing level: left press + drag to change windowing level

  • cursor follows mouse: the cross-shaped cursor follows the mouse pointer

  • centered cursor: the cross-shaped cursor always remains centered in the view

https://doc.qt.io/qt-6/qmenu.html

Returns

QMenu

getPopupColorbarPosition() QMenu

Get the popup submenu Colorbar position of the AbstractViewWidget instance. This submenu provides the following options:

  • Left colorbar

  • Right colorbar

  • Top colorbar

  • Bottom colorbar

https://doc.qt.io/qt-6/qmenu.html

Returns

QMenu

getPopupInformation() QMenu

Get the popup submenu Information of the AbstractViewWidget instance. This submenu provides the following options:

  • Identity (displayed at the top left of the view)

  • Image attributes (displayed at the top right of the view)

  • Acquisition attributes (displayed at the bottom left of the view)

  • Orientation marker shape:

    • Cube

    • Head

    • Bust

    • Body

    • Axes

    • Brain

https://doc.qt.io/qt-6/qmenu.html

Returns

QMenu

getPopupRulerPosition() QMenu

Get the popup submenu Ruler position of the AbstractViewWidget instance. This submenu provides the following options:

  • Left ruler

  • Right ruler

  • Top ruler

  • Bottom ruler

https://doc.qt.io/qt-6/qmenu.html

Returns

QMenu

getPopupTools() QMenu

Get the popup submenu Tools of the AbstractViewWidget instance. This submenu provides the following options:

  • Distance

  • Orthogonal distances

  • Angle

  • Box

  • Text

  • Remove all

  • Target

  • Trajectory

https://doc.qt.io/qt-6/qmenu.html

Returns

QMenu

getPopupVisibility() bool

Get the popup submenu Visibility of the AbstractViewWidget instance. This submenu provides the following options:

  • show cursor

  • show information

  • show orientation marker

  • show colorbar

  • show ruler

  • show tooltip

  • show all

  • hide all

https://doc.qt.io/qt-6/qmenu.html

Returns

QMenu

getRenderWindow() vtkRenderWindow

Get the vtkRenderWindow attribute of the AbstractViewWidget instance. Rendering window class where renderers draw their images. https://vtk.org/doc/nightly/html/classvtkRenderWindow.html

Returns

vtkRenderWindow

getRenderer() vtkRenderer

Get the vtkRenderer attribute of the AbstractViewWidget instance that manages the volume display. https://vtk.org/doc/nightly/html/classvtkRenderer.html

Returns

vtkRenderer

getRuler() vtkAxisActor2D

Get the vtkAxisActor2D instance used as a ruler.

Returns

vtkAxisActor2D

ruler actor.

getRulerPosition() str

Get the current position of the ruler.

Returns

str

current ruler position (‘Left’, ‘Right’, ‘Top’, or ‘Bottom’).

getRulerVisibility() bool

Check if the ruler is visible.

Returns

bool

True if the ruler is visible, False otherwise.

getSynchronisation() bool

Get the current synchronization state.

Returns

bool

True if synchronization is enabled, False otherwise.

getTitle() str

Get the title attribute of the AbstractViewWidget instance. This title is displayed in the middle of the top part of the view area.

Returns

str

title attribute of the AbstractViewWidget instance

getTool(key: int | str) NamedWidget | HandleWidget | LineWidget

Get a specific tool by its index or name.

Parameters

keyint | str

index or name of the tool to retrieve.

Returns

NamedWidget | HandleWidget | LineWidget

requested tool widget.

getToolCollection() ToolWidgetCollection

Get the collection of all tool widgets associated with this viewport.

Returns

ToolWidgetCollection

collection managing all tool widgets.

getToolCount() int

Get the number of tool widgets in the viewport.

Returns

int

total number of tools.

getTools() ToolWidgetCollection

Get the ToolWidgetCollection associated with this viewport.

Returns

ToolWidgetCollection

collection managing all tool widgets.

getTooltipVisibility() bool

Check if tooltips are visible.

Returns

bool

True if tooltips are visible, False otherwise.

getTopLeftInfo() vtkTextActor

Get the text actor for the top-left information display.

Returns

vtkTextActor

The top-left text actor.

getTopRightInfo() vtkTextActor

Get the text actor for the top-right information display.

Returns

vtkTextActor

The top-right text actor.

getVolume() SisypheVolume

Get the volume attribute of the AbstractViewWidget instance. This attribute is the SisypheVolume displayed in the AbstractViewWidget instance.

Returns

SisypheVolume

SisypheVolume displayed in the AbstractViewWidget instance.

getWindowInteractor() vtkRenderWindowInteractor

Get the vtkRenderWindowInteractor attribute of the AbstractViewWidget instance. Platform-independent class that handle routing of mouse/key/timer messages. https://vtk.org/doc/nightly/html/classvtkRenderWindowInteractor.html

Returns

vtkRenderWindowInteractor

getZoom() float

Get the current zoom level of the viewport.

Returns

float

parallel scale value of the camera.

getZoomFlag() bool

Check if the current mouse action is ‘Zoom’.

Returns

bool

True if the zoom flag is set, False otherwise.

hasHorizontalColorbar() bool

Check if the colorbar has a horizontal orientation.

Returns

bool

True if the colorbar is on the left or right, False otherwise.

hasTools() bool

Check if the viewport contains any tool widgets.

Returns

bool

True if at least one tool exists, False otherwise.

hasVerticalColorbar() bool

Check if the colorbar has a vertical orientation.

Returns

bool

True if the colorbar is on the top or bottom, False otherwise.

hasVolume() bool

Check whether the volume attribute of the AbstractViewWidget instance is not empty.

Returns

bool

True if a SisypheVolume is defined and displayed in the AbstractViewWidget instance, False otherwise

hideAll(signal: bool = True) None

Hide all optional overlays (cursor, info, colorbar, ruler, etc.).

Parameters

signalbool (optional)

If True, emits ViewMethodCalled signals for synchronization (default True).

isCursorEnabled() bool

Check if the cross-shaped cursor is enabled.

Returns

bool

True if the cursor is enabled, False otherwise.

isEmpty() bool

Check whether the volume attribute of the AbstractViewWidget instance is empty.

Returns

bool

True if no SisypheVolume is displayed in the AbstractViewWidget instance, False otherwise

isRoundedCursorCoordinatesEnabled() bool

Check if cross-shaped cursor coordinate rounding is enabled.

Returns

bool

True if rounding is enabled, False otherwise.

isSelectable() bool

Check whether the AbstractViewWidget instance is selectable.

Returns

bool

True if the AbstractViewWidget instance is selectable, False otherwise

isSelected() bool

Check whether the AbstractViewWidget instance is selected.

Returns

bool

True if the AbstractViewWidget instance is selected, False otherwise

isSynchronised() bool

Check if the viewport is synchronized with other viewports.

Returns

bool

True if synchronization is enabled, False otherwise.

isToolLocked(key: int | str | HandleWidget | LineWidget) bool

Check if a tool is locked.

Parameters

keyint | str | HandleWidget | LineWidget

tool to check, identified by index, name, or instance.

Returns

bool

True if the tool is locked, False otherwise.

lockTool(key: int | str | HandleWidget | LineWidget, signal: bool = True) None

Lock a tool, preventing it from being moved or modified by user interaction.

Parameters

keyint | str | HandleWidget | LineWidget

tool to lock, identified by index, name, or instance.

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

moveTool(key: int | str | HandleWidget | LineWidget, target: list[float] | tuple[float, float, float], entry: list[float] | tuple[float, float, float] | None = None, angles: list[float] | tuple[float, float] | None = None, length: float | None = None, signal: bool = True) None

Move a specified tool to a new position.

Parameters

keyint | str | HandleWidget | LineWidget

tool to move, identified by index, name, or instance.

targetlist[float] | tuple[float, float, float]

new target world position.

entrylist[float] | tuple[float, float, float] | None, optional

new entry world position (for LineWidget).

angleslist[float] | tuple[float, float] | None, optional

new angles to define the trajectory (for LineWidget).

lengthfloat | None, optional

new length in mm for the trajectory (for LineWidget).

signalbool (optional)

If True, emits the ToolMoved signal for synchronization (default True).

popupActionsDisabled() None

Disable the popup submenu Actions of the AbstractViewWidget instance.

popupActionsEnabled() None

Enable the popup submenu Actions of the AbstractViewWidget instance.

popupColorbarPositionDisabled() None

Disable the popup submenu Colorbar position of the AbstractViewWidget instance.

popupColorbarPositionEnabled() None

Enable the popup submenu Colorbar position of the AbstractViewWidget instance.

popupMenuDisabled() None

Disable the popup menu of the AbstractViewWidget instance.

popupMenuEnabled() None

Enable the popup menu of the AbstractViewWidget instance.

popupToolsDisabled() None

Disable the popup submenu Tools of the AbstractViewWidget instance.

popupToolsEnabled() None

Enable the popup submenu Tools of the AbstractViewWidget instance.

popupVisibilityDisabled() None

Disable the popup submenu Visibility of the AbstractViewWidget instance.

popupVisibilityEnabled() None

Enable the popup submenu Visibility of the AbstractViewWidget instance.

removeAll2DTools(signal: bool = True) None

Remove all 2D measurement tools (Distance, OrthogonalDistance, Angle) from the viewport.

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

removeAllTools(signal: bool = True) None

Remove all tool widgets (2D and 3D) from the viewport.

Parameters

signalbool (optional)

If True, emits a ToolRemoved signal for each 3D tool for synchronization (default True).

removeTool(key: int | str | HandleWidget | LineWidget, signal: bool = True) None

Remove a specified tool from the viewport.

Parameters

keyint | str | HandleWidget | LineWidget

tool to remove, identified by index, name, or instance.

signalbool (optional)

If True, emits the ToolRemoved signal for synchronization (default True).

removeVolume() None

Clear the volume attribute of the AbstractViewWidget instance. No volume is displayed in the AbstractViewWidget instance.

renameTool(key: int | str | HandleWidget | LineWidget, name: str, signal: bool = True) None

Rename a specified tool.

Parameters

keyint | str | HandleWidget | LineWidget

tool to rename, identified by index, name, or instance.

namestr

new name for the tool.

signalbool (optional)

If True, emits the ToolRenamed signal for synchronization (default True).

saveCapture() None

Open a file dialog to save the current viewport content to an image file. Supported formats are BMP, JPG, PNG, and TIFF.

select(signal: bool = True) None

Select the AbstractViewWidget instance. Selection is indicated by a white frame.

Parameters

signalbool (optional)

emit a selected PyQt signal if True (default True).

setAcceptTools(v: bool) None

Set whether the viewport can accept new tool widgets.

Parameters

vbool

True to allow adding new tools, False to prevent it.

setAcceptToolsOff() None

Prevent the viewport from accepting new tool widgets.

setAcceptToolsOn() None

Allow the viewport to accept new tool widgets.

setArrowMouseCursor(signal: bool = True) None

Set the mouse pointer to an arrow shape.

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setAxisConstraintToCursor(v: int, signal: bool = True) None

Constrain cross-shaped cursor movement to a specific axis.

Parameters

vint

axis constraint: 0=None, 1=x-axis, 2=y-axis, 3=z-axis.

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setCenteredCursorFlag(signal: bool = True) None

Set the mouse action to ‘Centered cursor’. The cross-shaped cursor remains at the viewport’s center.

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setCentralCrossOpacity(v: float)

Set the opacity of the central cross.

Parameters

vfloat

Opacity value between 0.0 (transparent) and 1.0 (opaque).

setCentralCrossVisibility(v: bool) None

Set the visibility of the central cross.

Parameters

vbool

True to show the cross, False to hide it.

setCentralCrossVisibilityOff() None

Hide the central cross.

setCentralCrossVisibilityOn() None

Show the central cross.

setColorbarPosition(pos: str = 'Left', signal: bool = True) None

Set the position of the colorbar in the viewport.

Parameters

posstr (optional)

position, one of ‘Left’, ‘Right’, ‘Top’, ‘Bottom’ (default ‘Left’).

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setColorbarPositionToBottom(signal: bool = True) None

Move the colorbar to the bottom of the viewport.

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setColorbarPositionToLeft(signal: bool = True) None

Move the colorbar to the left side of the viewport.

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setColorbarPositionToRight(signal: bool = True) None

Move the colorbar to the right side of the viewport.

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setColorbarPositionToTop(signal: bool = True) None

Move the colorbar to the top of the viewport.

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setColorbarVisibility(v, signal: bool = True) None

Set the visibility of the colorbar.

Parameters

vbool

True to show the colorbar, False to hide it.

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setColorbarVisibilityOff(signal: bool = True) None

Hide the colorbar.

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setColorbarVisibilityOn(signal: bool = True) None

Show the colorbar.

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setCrossHairMouseCursor(signal: bool = True) None

Set the mouse pointer to a crosshair shape.

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setCursorDisabled() None

Disable cross-shaped cursor updates.

setCursorEnabled() None

Enable cross-shaped cursor updates.

setCursorOpacity(v: float, signal: bool = True) None

Set the opacity of the cross-shaped cursor.

Parameters

vfloat

Opacity value between 0.0 (transparent) and 1.0 (opaque).

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setCursorVisibility(v: bool, signal: bool = True) None

Set the visibility of the cross-shaped cursor.

Parameters

vbool

True to show the cursor, False to hide it.

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setCursorVisibilityOff(signal: bool = True) None

Hide the cross-shaped cursor.

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setCursorVisibilityOn(signal: bool = True) None

Show the cross-shaped cursor.

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setCursorWorldPosition(x: float, y: float, z: float, signal: bool = True) None

Set the 3D world position of the cross-shaped cursor.

Parameters

xfloat

world x-coordinate.

yfloat

world y-coordinate.

zfloat

world z-coordinate.

signalbool (optional)

If True and synchronization is on, emits the CursorPositionChanged signal (default True).

setDefaultMouseCursor(signal: bool = True) None

Set the mouse pointer to the default shape.

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setFollowFlag(signal: bool = True) None

Set the mouse action to ‘Cursor follows mouse’. The cross-shaped cursor will track the mouse pointer.

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setFontFamily(s: str, signal: bool = True) None

Set the font family for all text overlays in the viewport.

Parameters

sstr

Font family name (‘Arial’, ‘Courier’, ‘Times’) or path to a .ttf/.otf file.

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setFontProperties(s: tuple[str | None, int | None, float | None], signal: bool = True) None

Set the font family, base size, and scale factor simultaneously.

Parameters

stuple[str | None, int | None, float | None]

A tuple containing font family, base size, and scale factor. None values are ignored.

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setFontScale(s: float, signal: bool = True) None

Set the scale factor for all text overlays. The final size is font_size * s.

Parameters

sfloat

font scale factor (clamped between 0.5 and 2.0).

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setFontSize(s: int, signal: bool = True) None

Set the base font size for all text overlays. The final size is s * font_scale.

Parameters

sint

base font size.

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setFontSizeScale(s: tuple[int, float], signal: bool = True) None

Set both the base font size and scale factor simultaneously.

Parameters

stuple[int, float]

A tuple containing the base font size and the scale factor.

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setHandMouseCursor(signal: bool = True) None

Set the mouse pointer to a hand shape.

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setInfoAcquisitionVisibility(v: bool, signal: bool = True) None

Set the visibility of the acquisition information (bottom-left).

Parameters

vbool

True to show the acquisition information, False to hide it.

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setInfoAcquisitionVisibilityOff(signal: bool = True) None

Hide the acquisition information text (bottom-left).

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setInfoAcquisitionVisibilityOn(signal: bool = True) None

Show the acquisition information text (bottom-left).

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setInfoIdentityVisibility(v: bool, signal: bool = True) None

Set the visibility of the identity information (top-left).

Parameters

vbool

True to show the identity information, False to hide it.

signalbool

If True, emits the ViewMethodCalled signal for synchronization.

setInfoIdentityVisibilityOff(signal: bool = True) None

Hide the identity information text (top-left).

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setInfoIdentityVisibilityOn(signal: bool = True) None

Show the identity information text (top-left).

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setInfoVisibility(v: bool, signal: bool = True) None

Set the visibility of the information text overlays.

Parameters

vbool

True to show the information, False to hide it.

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setInfoVisibilityOff(signal: bool = True) None

Hide the information text actors.

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setInfoVisibilityOn(signal: bool = True) None

Show the information text actors.

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setInfoVolumeVisibility(v: bool, signal: bool = True) None

Set the visibility of the volume attributes information (top-right).

Parameters

vbool

True to show the volume information, False to hide it.

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setInfoVolumeVisibilityOff(signal: bool = True) None

Hide the volume attributes information text (top-right).

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setInfoVolumeVisibilityOn(signal: bool = True) None

Show the volume attributes information text (top-right).

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setLevelFlag(signal: bool = True) None

Set the mouse action to ‘Level/Window’. Left-click and drag will adjust the windowing.

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setLineColor(c: list[float] | tuple[float, float, float], signal: bool = True) None

Set the color for all non-selected line-based overlays (text, cursors, tools).

Parameters

clist[float] | tuple[float, float, float]

color as an (r, g, b) tuple with values from 0.0 to 1.0.

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setLineOpacity(v: float, signal: bool = True) None

Set the opacity for all line-based overlays (text, cursors, tools).

Parameters

vfloat

Opacity value between 0.0 (transparent) and 1.0 (opaque).

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setLineSelectedColor(c: list[float] | tuple[float, float, float], signal: bool = True) None

Set the color for selected tools.

Parameters

clist[float] | tuple[float, float, float]

color as an (r, g, b) tuple with values from 0.0 to 1.0.

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setLineWidth(v: float, signal: bool = True) None

Set the line width for all line-based overlays (cursors, tools).

Parameters

vfloat

line width in pixels.

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setMouseCursor(shape: int, signal: bool = True) None

Set the shape of the mouse pointer in the render window.

Parameters

shapeint

VTK mouse pointer shape constant (e.g., VTK_CURSOR_ARROW).

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setMoveFlag(signal: bool = True) None

Set the mouse action to ‘Move’. Left-click and drag will pan the viewport.

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setName(name: str) None

Set the name attribute of the AbstractViewWidget instance.

Parameters

namestr

name attribute of the AbstractViewWidget instance

setNoActionFlag(signal: bool = True) None

Set the mouse action to ‘No action’. Disables move, zoom, and level/window actions.

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setNoAxisConstraintToCursor(signal: bool = True) None

Remove any axis constraint from the cross-shaped cursor movement.

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setOrientationMakerVisibility(v: bool, signal: bool = True) None

Set the visibility of the orientation marker.

Parameters

vbool

True to show the marker, False to hide it.

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setOrientationMarker(markertype: str, signal: bool = True) None

Set the shape and actor for the orientation marker widget.

Parameters

markertypestr

shape of marker to use (‘cube’, ‘head’, ‘bust’, ‘body’, ‘brain’, ‘axes’).

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setOrientationMarkerToAxes(signal: bool = True) None

Set the orientation marker to a 3D axes actor.

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setOrientationMarkerToBody(signal: bool = True) None

Set the orientation marker to a body shape.

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setOrientationMarkerToBrain(signal: bool = True) None

Set the orientation marker to a brain shape.

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setOrientationMarkerToBust(signal: bool = True) None

Set the orientation marker to a bust shape.

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setOrientationMarkerToCube(signal: bool = True) None

Set the orientation marker to an annotated cube.

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setOrientationMarkerToHead(signal: bool = True) None

Set the orientation marker to a head shape.

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setOrientationMarkerVisibilityOff(signal: bool = True) None

Hide the orientation marker.

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setOrientationMarkerVisibilityOn(signal: bool = True) None

Show the orientation marker.

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setRoundedCursorCoordinatesDisabled() None

Disable rounding of cross-shaped cursor coordinates. Coordinates will be continuous.

setRoundedCursorCoordinatesEnabled() None

Enable rounding of cross-shaped cursor coordinates to the nearest voxel.

setRulerPosition(pos: str = 'Left', signal: bool = True) None

Set the position of the ruler in the viewport.

Parameters

posstr (optional)

position, one of ‘Left’, ‘Right’, ‘Top’, ‘Bottom’ (default ‘left’).

signalbool

If True, emits the ViewMethodCalled signal for synchronization (default True).

setRulerPositionToBottom(signal: bool = True) None

Move the ruler to the bottom of the viewport.

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setRulerPositionToLeft(signal: bool = True) None

Move the ruler to the left side of the viewport.

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setRulerPositionToRight(signal: bool = True) None

Move the ruler to the right side of the viewport.

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setRulerPositionToTop(signal: bool = True) None

Move the ruler to the top of the viewport.

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setRulerVisibility(v, signal: bool = True) None

Set the visibility of the ruler.

Parameters

vbool

True to show the ruler, False to hide it.

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setRulerVisibilityOff(signal: bool = True) None

Hide the ruler.

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setRulerVisibilityOn(signal: bool = True) None

Show the ruler.

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setSelectable(v: bool) None

Choose if the AbstractViewWidget instance is selectable. An AbstractViewWidget instance is selected by left-click. Selection is indicated by a white frame.

setSizeAllMouseCursor(signal: bool = True) None

Set the mouse pointer to a ‘size all’ shape.

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setSynchronisation(v: bool) None

Set the synchronization state of the viewport.

Parameters

vbool

True to enable synchronization with other viewports, False to disable.

setTitle(title: str) None

Set the title attribute of the AbstractViewWidget instance. This title is displayed in the middle of the top part of the view area.

Parameters

titlestr

title attribute of the AbstractViewWidget instance

setToolInteractive(key: int | str | HandleWidget | LineWidget, v: bool, signal: bool = True) None

Set the interactive state of a specified tool.

Parameters

keyint | str | HandleWidget | LineWidget

tool to modify, identified by index, name, or instance.

vbool

True to make the tool interactive, False to make it non-interactive.

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setToolInteractiveOff(key: int | str | HandleWidget | LineWidget, signal: bool = True) None

Make a specified tool non-interactive.

Parameters

keyint | str | HandleWidget | LineWidget

tool to modify, identified by index, name, or instance.

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setToolInteractiveOn(key: int | str | HandleWidget | LineWidget, signal: bool = True) None

Make a specified tool interactive.

Parameters

keyint | str | HandleWidget | LineWidget

tool to modify, identified by index, name, or instance.

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setTooltipVisibility(v, signal: bool = True) None

Set the visibility of tooltips for VTK widgets.

Parameters

vbool

True to enable tooltips, False to disable them.

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setTooltipVisibilityOff(signal: bool = True) None

Disable tooltips for VTK widgets.

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setTooltipVisibilityOn(signal: bool = True) None

Enable tooltips for VTK widgets.

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setVolume(volume: SisypheVolume) None

Set the volume attribute of the AbstractViewWidget instance. This attribute is the SisypheVolume displayed in the AbstractViewWidget instance.

Parameters

volumeSisypheVolume

SisypheVolume to display in the AbstractViewWidget instance.

setXAxisConstraintToCursor(signal: bool = True) None

Constrain cross-shaped cursor movement to the x-axis.

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setYAxisConstraintToCursor(signal: bool = True) None

Constrain cross-shaped cursor movement to the y-axis.

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setZAxisConstraintToCursor(signal: bool = True) None

Constrain cross-shaped cursor movement to the z-axis.

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setZoom(z: float, signal: bool = True) None

Set the zoom level of the viewport to a specific value.

Parameters

zfloat

parallel scale value for the camera. Smaller values mean more zoom.

signalbool (optional)

If True, emits the ZoomChanged signal for synchronization (default True).

setZoomFlag(signal: bool = True) None

Set the mouse action to ‘Zoom’. Left-click and drag will zoom the viewport.

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

showAll(signal: bool = True) None

Show all optional overlays (cursor, info, colorbar, ruler, etc.).

Parameters

signalbool (optional)

If True, emits ViewMethodCalled signals for synchronization (default True).

synchronisationOff() None

Disable synchronization with other viewports.

synchronisationOn() None

Enable synchronization with other viewports.

synchroniseCursorPositionChanged(obj: QWidget, x: float, y: float, z: float) None

Method of synchronisation between AbstractViewWidget instances. This method is called by CursorPositionChanged PyQt signal. It is responsible for synchronizing the cross-shaped cursor position between AbstractViewWidget instances.

Parameters

objQWidget

AbstractViewWidget instances that emit CursorPositionChanged signal.

xfloat

x-axis world coordinate of the cross-shaped cursor.

yfloat

y-axis world coordinate of the cross-shaped cursor.

zfloat

z-axis world coordinate of the cross-shaped cursor.

synchroniseToolAdded(obj: QWidget, tool: HandleWidget | LineWidget) None

Method of synchronisation between AbstractViewWidget instances. This method is called by ToolAdded PyQt signal. It is responsible for synchronizing tool creation between AbstractViewWidget instances.

Parameters

objQWidget

AbstractViewWidget instances that emit ToolAdded signal.

toolHandleWidget | LineWidget

synchronize the creation of this tool.

synchroniseToolAttributesChanged(obj: QWidget, tool: HandleWidget | LineWidget) None

Method of synchronisation between AbstractViewWidget instances. This method is called by ToolAttributesChanged PyQt signal. It is responsible for synchronizing tool attributes between AbstractViewWidget instances.

Tool attributes are as follows: text, text visbility, text offset, font size, font style (bold, italic), font family, color, selected color, opacity, point size, line width, handle size, tolerance, rendering attributes (render points as spheres, render lines as tube, interpolation, tube radius, metallic, roughness, ambient, specular, specular power).

Parameters

objQWidget

AbstractViewWidget instances that emit ToolAttributesChanged signal.

toolHandleWidget | LineWidget

synchronize attributes of this tool.

synchroniseToolColorChanged(obj: QWidget, tool: HandleWidget | LineWidget) None

Method of synchronisation between AbstractViewWidget instances. This method is called by ToolColorChanged PyQt signal. It is responsible for synchronizing tool color between AbstractViewWidget instances.

Parameters

objQWidget

AbstractViewWidget instances that emit ToolColorChanged signal.

toolHandleWidget | LineWidget

synchronize the color of this tool.

synchroniseToolMoved(obj: QWidget, tool: HandleWidget | LineWidget) None

Method of synchronisation between AbstractViewWidget instances. This method is called by ToolMoved PyQt signal. It is responsible for synchronizing tool movement between AbstractViewWidget instances.

Parameters

objQWidget

AbstractViewWidget instances that emit ToolMoved signal

toolHandleWidget | LineWidget

tool to move

synchroniseToolRemoved(obj: QWidget, tool: HandleWidget | LineWidget | None, alltools: bool = False) None

Method of synchronisation between AbstractViewWidget instances. This method is called by ToolRemoved PyQt signal. It is responsible for synchronizing tool removal between AbstractViewWidget instances.

Parameters

objQWidget

AbstractViewWidget instances that emit ToolRemoved signal.

toolHandleWidget | LineWidget | None

tool to remove.

alltoolsbool (optional)

remove all tools if True (default False).

synchroniseToolRenamed(obj: QWidget, tool: HandleWidget | LineWidget, name: str) None

Method of synchronisation between AbstractViewWidget instances. This method is called by ToolRenamed PyQt signal. It is responsible for synchronizing tool name between AbstractViewWidget instances.

Parameters

objQWidget

AbstractViewWidget instances that emit ToolRenamed signal.

toolHandleWidget | LineWidget

synchronize the name of this tool.

namestr

tool name.

synchroniseViewMethodCalled(obj: QWidget, function: str, param: Any) None

Method of synchronisation between AbstractViewWidget instances. This method is called by ViewMethodCalled PyQt signal.

Parameters

objQWidget

AbstractViewWidget instances that emit ViewMethodCalled signal.

functionstr

name of the synchronisation function.

paramAny

parameter of the synchronisation function.

synchroniseZoomChanged(obj: QWidget, z: float) None

Method of synchronisation between AbstractViewWidget instances. This method is called by ZoomChanged PyQt signal. It is responsible for synchronizing zoom factor between AbstractViewWidget instances.

Parameters

objQWidget

AbstractViewWidget instances that emit ZoomChanged signal.

zfloat

zoom factor.

unlockTool(key: int | str | HandleWidget | LineWidget, signal: bool = True) None

Unlock a tool, allowing it to be moved or modified by user interaction.

Parameters

keyint | str | HandleWidget | LineWidget

tool to unlock, identified by index, name, or instance.

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

unselect() None

Unselect the AbstractViewWidget instance.

updateRender() None

Force a re-render of the vtkRenderWindow.

zoomDefault() None

Reset the viewport to the default zoom level.

zoomIn() None

Zoom in on the viewport by a fixed factor (1.1).

zoomOut() None

Zoom out of the viewport by a fixed factor (0.9).

class Sisyphe.widgets.sliceViewWidgets.SliceViewWidget(parent: QWidget | None = None)

SliceViewWidget class

Description

Base class used for displaying and interacting with 2D orthogonal slices (axial, coronal, and sagittal) from a SisypheVolume. It is specialized subclass of the AbstractViewWidget class.

The main features are as follows:

  • Orthogonal slice viewing: allows users to dynamically switch between axial, coronal, and sagittal orientations, automatically reconfiguring the camera and orientation labels.

  • Interactive slice navigation: implements controls for scrolling through the volume’s slices using the mouse wheel or keyboard shortcuts.

  • Advanced information display: enhances the standard information overlays with slice-specific information, including orientation markers (e.g., A/P, L/R), the voxel value at the cursor, and multiple coordinate systems (world, AC-PC, Leksell Frame, ICBM).

  • Slice and Camera Control: manages a vtkImageResliceMapper to extract and render the current slice, with the camera’s focal point controlling the slice position. It also manages a narrow clipping range around the slice to optimize rendering performance.

  • Display properties: provides methods to control the visibility and opacity of the slice.

  • Synchronization: emits and receives Qt signals to synchronize the slice position (cursor), zoom/pan, and display properties across multiple linked viewports.

  • Export: includes a utility to save a series of captures, stepping through the volume along the current orientation and saving each slice as a bitmap image file.

This widget serves as the base class for more specialized viewers, such as those for overlays, reorientation, and ROI editing.

Inheritance

QWidget -> AbstractViewWidget -> SliceViewWidget

Creation: 30/03/2022 Last revision: 20/10/2025

applyTransformToVolume(tx: float, ty: float, tz: float, rx: float, ry: float, rz: float, signal: bool = True) None

Applies a rigid transformation (translation and rotation) to the displayed SisypheVolume.

Parameters

txfloat

translation along the X-axis.

tyfloat

translation along the Y-axis.

tzfloat

translation along the Z-axis.

rxfloat

rotation around the X-axis (in degrees).

ryfloat

rotation around the Y-axis (in degrees).

rzfloat

rotation around the Z-axis (in degrees).

signalbool (optional)

If True, emits the TransformApplied signal for synchronization (default to True).

displayOff() None

Hide the slice-specific display elements. Currently, this method calls the superclass’s implementation.

displayOn() None

Shows the slice-specific display elements, including orientation labels and updates the visibility of information based on current settings. Currently, this method calls the superclass’s implementation.

getClippingFactor() float

Get the current clipping factor. The clipping range is calculated as slice thickness * _clipfactor. This ensures that only a specific depth around the current slice is rendered.

Returns

float

current clipping factor.

getDistanceFromSliceToPoint(p: list[float] | tuple[float, float, float]) float

Calculate the signed distance from the current slice plane to a given 3D world point.

Parameters

plist[float] | tuple[float, float, float]

3D world coordinates (x, y, z) of the point.

Returns

float

signed distance from the slice plane to the point.

getDistanceFromSliceToTool(key: int | str | HandleWidget | LineWidget) list[float]

Calculate the signed distance from the current slice plane to the position(s) of a given tool.

Parameters

keyint | str | HandleWidget | LineWidget

tool to measure distance to, identified by index, name, or instance.

Returns

list[float]

  • A list of signed distances.

  • For HandleWidget, it’s a single distance.

  • For LineWidget, it’s distances to both its start and end points.

getFrameCoordinatesVisibility() bool

Get the current visibility state of the stereotactic frame coordinates.

Returns

bool

True if frame coordinates are visible, False otherwise.

getICBMCoordinatesVisibility() bool

Get the current visibility state of the ICBM coordinates.

Returns

bool

True if ICBM coordinates are visible, False otherwise.

getInfoPositionVisibility() bool

Get the current visibility state of the mouse pointer world coordinates.

Returns

bool

True if coordinates are visible, False otherwise.

getInfoValueVisibility() bool

Get the current visibility state of the voxel value information.

Returns

bool

True if voxel value is visible, False otherwise.

getOffset() int

Get the current offset for multi-view display, which determines the current slice index relative to the first slice in a series. If the offset is non-zero, the cursor visibility is turned off.

Returns

int

current offset value.

getOrientation() int

Get the current slice orientation (0 for DIM0, 1 for DIM1, 2 for DIM2).

Returns

int

current slice orientation.

getOrientationAsString() str

Get the current slice orientation as a descriptive string (e.g., ‘axial’, ‘coronal’, ‘sagittal’). The mapping depends on the original orientation of the loaded volume.

Returns

str

current slice orientation as a string.

getOrientationLabelsVisibility() bool

Get the current visibility state of the orientation labels.

Returns

bool

True if the labels are visible, False otherwise.

getPopupOrientation() QMenu

Get the ‘Orientation’ submenu of the popup menu.

Returns

QMenu

‘Orientation’ submenu.

getRelativeACCoordinatesVisibility() bool

Get the current visibility state of the AC-relative coordinates.

Returns

bool

True if AC-relative coordinates are visible, False otherwise.

getRelativeACPCCoordinatesVisibility() bool

Get the current visibility state of the mid AC-PC point relative coordinates.

Returns

bool

True if mid AC-PC point relative coordinates are visible, False otherwise.

getRelativePCCoordinatesVisibility() bool

Get the current visibility state of the PC-relative coordinates.

Returns

bool

True if PC-relative coordinates are visible, False otherwise.

getVolumeOpacity() float

Gets the current opacity of the displayed SisypheVolume.

Returns

float

current opacity value (0.0 to 1.0).

getVolumeVisibility() bool

Get the current visibility state of the displayed SisypheVolume.

Returns

bool

True if the volume is visible, False otherwise.

getVtkImageSliceVolume() vtkImageSlice

Get the vtkImageSlice actor representing the current SisypheVolume slice.

Returns

vtkImageSlice

vtkImageSlice actor.

getVtkPlane() vtkPlane

Get the vtkPlane instance that defines the current slice plane.

Returns

vtkPlane

current slice plane.

isCurrentOrientationIsotropic(tol: float = 0.25) bool

Check if the current slice orientation has approximately isotropic pixel spacing.

Parameters

tolfloat (optional)

Tolerance for checking isotropy (default 0.25).

Returns

bool

True if the current orientation is isotropic within the given tolerance, False otherwise.

isSliceNavigationEnabled() bool

Check if slice navigation is currently enabled.

Returns

bool

True if slice navigation is enabled, False otherwise.

popupOrientationDisabled() None

Disable the ‘Orientation’ submenu in the popup menu.

popupOrientationEnabled() None

Enable the ‘Orientation’ submenu in the popup menu.

removeVolume() None

Remove the currently displayed volume from the slice view. Clears the VTK image stack and slice actor. Currently, this method calls the superclass’s implementation.

replaceVolume(volume: SisypheVolume) None

Replace the current displayed SisypheVolume with a new one, preserving display properties if the new volume has the same dimensions.

Parameters

volumeSisypheVolume

new SisypheVolume to display.

saveSeriesCaptures(step: int = 2) None

Saves a series of slice captures from the current SisypheVolume along the current orientation. The captures are saved to a user-specified directory, with each slice saved as an image file.

Parameters

stepint (optional)

step size (in number of slices) between consecutive captures (default 2).

setAxialOrientation() None

Set the slice orientation to Axial.

setCameraPlanePosition(p: list[float] | tuple[float, float, float], signal: bool = True) None

Set the camera’s position and focal point, effectively moving the slice plane to a new world coordinate.

Parameters

plist[float] | tuple[float, float, float]

new world coordinates (x, y, z) for the camera’s focal point.

signalbool, optional

If True, emits the CameraPositionChanged signal for synchronization (default True).

setClippingFactor(v: float = 2.0) None

Set the clipping factor used to determine the camera’s clipping range. The clipping range is calculated as slice thickness * _clipfactor. This ensures that only a specific depth around the current slice is rendered.

Parameters

vfloat (optional)

new clipping factor (default 2.0).

setColorbarVisibility(v: bool, signal: bool = True) None

Sets the visibility of the colorbar and updates its title with the SisypheVolume’s unit. Currently, this method calls the superclass’s implementation.

Parameters

vbool

True to show the colorbar, False to hide it.

signalbool, optional

If True, emits the ViewMethodCalled signal for synchronization (default True).

setCoronalOrientation() None

Set the slice orientation to Coronal.

setCursorFromDisplayPosition(x: float, y: float) None

Set the cross-shaped cursor’s world position based on 2D display coordinates. The depth of the cursor is aligned with the current slice plane.

Parameters

xfloat

x-coordinate in display pixels.

yfloat

y-coordinate in display pixels.

setCursorVisibility(v: bool, signal: bool = True) None

Set the visibility of the cross-shaped cursor. If an offset is applied (multi-view mode), the cursor is always hidden. Currently, this method calls the superclass’s implementation.

Parameters

vbool

True to make the cursor visible, False to hide it.

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (defaults True).

setCursorWorldPosition(x: float, y: float, z: float, signal: bool = True) None

Set the 3D world position of the cross-shaped cursor and updates the camera’s focal depth to match the cursor’s depth along the current slice normal. Currently, this method calls the superclass’s implementation.

Parameters

xfloat

world X-coordinate.

yfloat

world Y-coordinate.

zfloat

world Z-coordinate.

signalbool, optional

If True, emits the CursorPositionChanged signal for synchronization (default True).

setDefaultCursorPosition() None

Set the cross-shaped cursor’s world position to the current camera’s focal point.

setDim0Orientation() None

Set the slice orientation to the first dimension (DIM0).

setDim1Orientation() None

Set the slice orientation to the second dimension (DIM1).

setDim2Orientation() None

Set the slice orientation to the third dimension (DIM2).

setFrameCoordinatesVisibility(v: bool, signal: bool = True) None

Set the visibility of stereotactic frame coordinates (e.g., Leksell) in the bottom-right information display.

Parameters

vbool

True to show the frame coordinates, False to hide them.

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setFrameCoordinatesVisibilityOff(signal: bool = True) None

Hide the stereotactic frame coordinates.

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setFrameCoordinatesVisibilityOn(signal: bool = True) None

Make the stereotactic frame coordinates visible.

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setICBMCoordinatesVisibility(v: bool, signal: bool = True) None

Sets the visibility of ICBM space coordinates in the bottom-right information display.

Parameters

vbool

True to show the ICBM coordinates, False to hide them.

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setICBMCoordinatesVisibilityOff(signal: bool = True) None

Hide the ICBM coordinates.

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (defaults True).

setICBMCoordinatesVisibilityOn(signal: bool = True) None

Make the ICBM coordinates visible.

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (defaults True).

setInfoPositionVisibility(v: bool, signal: bool = True) None

Sets the visibility of the mouse pointer world coordinates in the bottom-right information display.

Parameters

vbool

True to show the coordinates, False to hide them.

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setInfoPositionVisibilityOff(signal: bool = True) None

Hide the mouse pointer world coordinates.

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setInfoPositionVisibilityOn(signal: bool = True) None

Make the mouse pointer world coordinates visible.

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setInfoValueVisibility(v: bool, signal: bool = True) None

Set the visibility of the voxel value information in the bottom-right information display.

Parameters

vbool

True to show the voxel value, False to hide it.

signalbool, optional

If True, emits the ViewMethodCalled signal for synchronization (default to True).

setInfoValueVisibilityOff(signal: bool = True) None

Hide the voxel value information.

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setInfoValueVisibilityOn(signal: bool = True) None

Make the voxel value information visible.

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setOffset(v: int = 0) None

Sets the offset for multi-view display, which determines the current slice index relative to the first slice in a series. If the offset is non-zero, the cursor visibility is turned off.

Parameters

vint (optional)

new offset value (default 0, no offset).

setOrientation(orient: int) None

Set the slice orientation to a specific dimension.

Parameters

orientint

dimension to set as orientation (0 for DIM0, 1 for DIM1, 2 for DIM2).

setOrientationLabelsVisibility(v: bool, signal: bool = True) None

Set the visibility of the orientation labels (A, P, L, R, T, B) in the viewport.

Parameters

vbool

True to make the labels visible, False to hide them.

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setOrientationLabelsVisibilityOff(signal: bool = True) None

Hide the orientation labels.

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setOrientationLabelsVisibilityOn(signal: bool = True) None

Make the orientation labels visible.

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setRelativeACCoordinatesVisibility(v: bool, signal: bool = True) None

Set the visibility of coordinates relative to the Anterior Commissure (AC) in the bottom-right information display.

Parameters

vbool

True to show the AC-relative coordinates, False to hide them.

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setRelativeACCoordinatesVisibilityOff(signal: bool = True) None

Hide the AC-relative coordinates.

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (defaults True).

setRelativeACCoordinatesVisibilityOn(signal: bool = True) None

Make the AC-relative coordinates visible.

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setRelativeACPCCoordinatesVisibility(v, signal: bool = True) None

Set the visibility of coordinates relative to the mid AC-PC point in the bottom-right information display.

Parameters

vbool

True to show themid AC-PC point relative coordinates, False to hide them.

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setRelativeACPCCoordinatesVisibilityOff(signal: bool = True) None

Hide the mid AC-PC point relative coordinates.

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (defaults True).

setRelativeACPCCoordinatesVisibilityOn(signal: bool = True) None

Make the mid AC-PC point relative coordinates visible.

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setRelativePCCoordinatesVisibility(v: bool, signal: bool = True) None

Set the visibility of coordinates relative to the Posterior Commissure (PC) in the bottom-right information display.

Parameters

vbool

True to show the PC-relative coordinates, False to hide them.

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setRelativePCCoordinatesVisibilityOff(signal: bool = True) None

Hide the PC-relative coordinates.

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (defaults True).

setRelativePCCoordinatesVisibilityOn(signal: bool = True) None

Make the PC-relative coordinates visible.

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setSagittalOrientation() None

Set the slice orientation to Sagittal.

setSliceNavigationDisabled() None

Disable slice navigation using mouse wheel or keyboard.

setSliceNavigationEnabled() None

Enable slice navigation using mouse wheel or keyboard.

setTitle(title: str) None

Set the title attribute of the SliceViewWidget instance. This title is displayed in the middle of the top part of the view area, along with the current slice orientation. Currently, this method calls the superclass’s implementation.

Parameters

titlestr

title attribute of the SliceViewWidget instance.

setVolume(volume: SisypheVolume) None

Set the SisypheVolume to be displayed in the widget. Initializes the VTK image stack and slice actor, and updates the camera orientation. Currently, this method calls the superclass’s implementation.

Parameters

volumeSisypheVolume

Sisyphevolume to display.

setVolumeOpacity(alpha: float, signal: bool = True) None

Set the opacity of the displayed SisypheVolume.

Parameters

alphafloat

new opacity value (0.0 to 1.0).

signalbool (optional)

If True, emits the OpacityChanged signal for synchronization (default True).

setVolumeVisibility(v: bool, signal: bool = True) None

Set the visibility of the displayed SisypheVolume.

Parameters

vbool

True to make the SisypheVolume visible, False to hide it.

signalbool, optional

If True, emits the VisibilityChanged signal for synchronization (default True).

setVolumeVisibilityOff() None

Hide the displayed SisypheVolume.

setVolumeVisibilityOn() None

Show the displayed SisypheVolume visible.

sliceMinus() None

Navigate to the previous slice in the SisypheVolume, if slice navigation is enabled. Currently, this method calls the superclass’s implementation.

slicePlus() None

Navigate to the next slice in the SisypheVolume, if slice navigation is enabled. Currently, this method calls the superclass’s implementation.

synchroniseCameraPositionChanged(obj: QWidget, x: float, y: float, z: float) None

Synchronizes the camera’s focal point (plane position) from another AbstractViewWidget instance.

Parameters

objQWidget

AbstractViewWidget instance that emitted the signal.

xfloat

x-coordinate of the camera’s focal point.

yfloat

y-coordinate of the camera’s focal point.

zfloat

z-coordinate of the camera’s focal point.

synchroniseRenderUpdated(obj: QWidget) None

Synchronizes a render update from another AbstractViewWidget instance.

Parameters

objQWidget

AbstractViewWidget instance that emitted the signal.

synchroniseTransformApplied(obj: QWidget, tx: float, ty: float, tz: float, rx: float, ry: float, rz: float) None

Synchronizes the application of a transformation (translation and rotation) from another AbstractViewWidget instance.

Parameters

objQWidget

AbstractViewWidget instance that emitted the signal.

txfloat

translation along the X-axis.

tyfloat

translation along the Y-axis.

tzfloat

translation along the Z-axis.

rxfloat

rotation around the X-axis (in degrees).

ryfloat

rotation around the Y-axis (in degrees).

rzfloat

rotation around the Z-axis (in degrees).

synchronisedOpacityChanged(obj: QWidget, alpha: float) None

Synchronizes the volume’s opacity change from another AbstractViewWidget instance.

Parameters

objQWidget

AbstractViewWidget instance that emitted the signal.

alphafloat

new opacity value (0.0 to 1.0).

synchronisedVisibilityChanged(obj: QWidget, v: bool) None

Synchronizes the volume’s visibility change from another AbstractViewWidget instance.

Parameters

objQWidget

AbstractViewWidget instance that emitted the signal.

vbool

True if the volume is visible, False otherwise.

updateCursorDepthFromFocal() None

Update the depth of the cross-shaped cursor to match the camera’s focal depth, adjusted by any multi-view offset.

class Sisyphe.widgets.sliceViewWidgets.SliceReorientViewWidget(parent: QWidget | None = None)

SliceReorientViewWidget class

Description

Specialized subclass of the SliceViewWidget base class to provide interactive tools for reorienting a SisypheVolume.

The main features are as follows:

  • Interactive geometric transformation: it introduces a reslice cursor that users can manipulate with the mouse to apply rigid transformations. Dragging the cursor’s center translates the volume, while dragging its edges applies rotations.

  • Field of View (FOV) Visualization: a wireframe box is rendered to represent the volume’s current field of view. This box dynamically updates with every transformation, providing clear visual feedback on the volume’s alignment in 3D space.

  • Resampling space control: the widget allows users to modify the target resampling space by adjusting the output volume’s size (dimensions) and spacing (voxel size).

  • Synchronization: it uses Qt signals and slots to synchronize transformations, resampling parameters, and cursor state across multiple linked SliceReorientViewWidget instances.

  • Export: the geometric transformation can be retrieved as a SisypheTransform instance, which encapsulates the translations, rotations, and resampling parameters needed to perform the final resampling operation.

Inheritance

QWidget -> AbstractViewWidget -> SliceViewWidget -> SliceReorientViewWidget

Creation: 05/04/2022 Last revision: 20/10/2025

getFOV() tuple[float, float, float]

Get the current Field of View (FOV) of the SisypheVolume, calculated from its size and spacing.

Returns

tuple[float, float, float]

FOV dimensions (x, y, z) in world coordinates (mm)

getFOVBoxVisibility() bool

Get the current visibility state of the Field of View (FOV) box.

Returns

bool

True if the FOV box is visible, False otherwise.

getFovBoxColor() tuple[float, float, float]

Get the current color of the Field of View (FOV) box.

Returns

tuple[float, float, float]

color as an (r, g, b) tuple.

getFovBoxLineWidth() float

Get the current line width of the Field of View (FOV) box.

Returns

float

line width in pixels.

getFovBoxOpacity() float

Get the current opacity of the Field of View (FOV) box.

Returns

float

opacity value.

getResliceCursorColor() tuple[float, float, float]

Get the current color of the reslice cursor.

Returns

tuple[float, float, float]

color as an (r, g, b) tuple.

getResliceCursorLineWidth() float

Get the current line width of the reslice cursor.

Returns

float

line width in pixels.

getResliceCursorOpacity() float

Get the current opacity of the reslice cursor.

Returns

float

opacity value.

getResliceCursorPosition() tuple[float, float, float]

Get the current world position of the reslice cursor.

Returns

tuple[float, float, float]

world coordinates (x, y, z) of the reslice cursor.

getRotations() list[float]

Gets the current rotations applied to the reslice cursor.

Returns

list[float]

rotations (rx, ry, rz) in degrees.

getSize() tuple[int, int, int]

Get the current size (number of voxels) of the SisypehVolume.

Returns

tuple[int, int, int]

size (nx, ny, nz) in voxels.

getSpacing() tuple[float, float, float]

Get the current spacing (voxel dimensions) of the volume.

Returns

tuple[float, float, float]

spacing (sx, sy, sz) in world units (mm).

getTransform() SisypheTransform

Get the SisypheTransform instancve representing the current geometric transformation (translations and rotations) applied to the SisypheVolume.

Returns

SisypheTransform

current geometric transformation.

getTranslations() tuple[float, float, float]

Gets the current translations of the reslice cursor relative to the volume’s center.

Returns

tuple[float, float, float]

translations (tx, ty, tz) in world coordinates.

reset() None

Reset the reslice cursor’s position and orientation to the volume’s center and zero rotations, respectively.

rotationXDisabled() None

Disable rotation around the x-axis for the reslice cursor.

rotationXEnabled() None

Enable rotation around the x-axis for the reslice cursor.

rotationYDisabled() None

Disable rotation around the y-axis for the reslice cursor.

rotationYEnabled() None

Enable rotation around the y-axis for the reslice cursor.

rotationZDisabled() None

Disable rotation around the z-axis for the reslice cursor.

rotationZEnabled() None

Enable rotation around the z-axis for the reslice cursor.

rotationsDisabled() None

Disable rotations of the reslice cursor via user interaction.

rotationsEnabled() None

Enable rotations of the reslice cursor via user interaction.

setDefaultFOV(signal: bool = True) None

Resets the SisypheVolume’s size and spacing to its default values (from the original SisypheVolume). Updates the FOV box accordingly.

Parameters

signalbool (optional)

If True, emits SizeChanged and SpacingChanged signals for synchronization (default True).

setFOVBoxVisibility(v: bool) None

Set the visibility of the Field of View (FOV) box.

Parameters

vbool

True to make the FOV box visible, False to hide it.

setFovBoxColor(rgb: list[float] | tuple[float, float, float]) None

Set the color of the Field of View (FOV) box.

Parameters

rgblist[float] | tuple[float, float, float]

color as an (r, g, b) tuple with values from 0.0 to 1.0.

setFovBoxLineWidth(v: float) None

Set the line width of the Field of View (FOV) box.

Parameters

vfloat

line width in pixels.

setFovBoxOpacity(v: float) None

Set the opacity of the Field of View (FOV) box.

Parameters

vfloat

opacity value (0.0 to 1.0).

setLineOpacity(v: bool, signal: bool = True) None

Set the opacity for all line-based overlays, including the reslice cursor. Currently, this method calls the superclass’s implementation.

Parameters

vbool

opacity value (0.0 to 1.0).

signalbool, optional

If True, emits the ViewMethodCalled signal for synchronization (default True).

setResliceCursorColor(rgb: list[float] | tuple[float, float, float]) None

Set the color of the reslice cursor.

Parameters

rgblist[float] | tuple[float, float, float]

color as an (r, g, b) tuple with values from 0.0 to 1.0.

setResliceCursorLineWidth(v: float) None

Set the line width of the reslice cursor.

Parameters

vfloat

line width in pixels.

setResliceCursorOpacity(v: float) None

Set the opacity of the reslice cursor.

Parameters

vfloat

opacity value (0.0 to 1.0).

setResliceCursorPosition(p: list[float] | tuple[float, float, float]) None

Set the world position of the reslice cursor.

Parameters

plist[float] | tuple[float, float, float]

new world coordinates (x, y, z) for the reslice cursor.

setRotations(rx: float, ry: float, rz: float, signal: bool = True) None

Set the rotations of the reslice cursor.

Parameters

rxfloat

rotation around the x-axis (in degrees).

ryfloat

rotation around the y-axis (in degrees).

rzfloat

rotation around the z-axis (in degrees).

signalbool (optional)

If True, emits the RotationsChanged signal for synchronization (default True).

setSize(size: list[int] | tuple[int, int, int], signal: bool = True) None

Sets the size (number of voxels) of the SisypheVolume and updates the FOV box accordingly.

Parameters

sizelist[int] | tuple[int, int, int]

new size (nx, ny, nz) in voxels.

signalbool (optional)

If True, emits the SizeChanged signal for synchronization (default True).

setSpacing(spacing: list[float] | tuple[float, float, float], signal: bool = True) None

Set the spacing (voxel dimensions) of the SisypheVolume and updates the FOV box accordingly.

Parameters

spacinglist[float] | tuple[float, float, float]

new spacing (sx, sy, sz) in world units (mm).

signalbool, optional

If True, emits the SpacingChanged signal for synchronization (default True).

setTranslations(tx: float, ty: float, tz: float, signal: bool = True) None

Sets the translations of the reslice cursor relative to the volume’s center.

Parameters

txfloat

translation along the x-axis.

tyfloat

translation along the y-axis.

tzfloat

translation along the z-axis.

signalbool (optional)

If True, emits the TranslationsChanged signal for synchronization (default True).

setVolume(volume: SisypheVolume) None

Set the SisypheVolume to be displayed and reoriented. Initialize the FOV box and reslice cursor actors based on the volume’s properties. Currently, this method calls the superclass’s implementation.

Parameters

volumeSisypheVolume

SisypheVolume to display.

synchroniseResliceCursorChanged(obj: QWidget, x: float, y: float, z: float, rx: float, ry: float, rz: float) None

Synchronizes the reslice cursor’s position and orientation from another SliceReorientViewWidget instance.

Parameters

objQWidget

SliceReorientViewWidget instance that emitted the signal.

xfloat

x-coordinate of the reslice cursor.

yfloat

y-coordinate of the reslice cursor.

zfloat

z-coordinate of the reslice cursor.

rxfloat

rotation around the x-axis (in degrees).

ryfloat

rotation around the y-axis (in degrees).

rzfloat

rotation around the z-axis (in degrees).

synchroniseRotationsChanged(obj: QWidget, rx: float, ry: float, rz: float) None

Synchronizes the volume’s rotations from another SliceReorientViewWidget instance.

Parameters

objQWidget

SliceReorientViewWidget instance that emitted the signal.

rxfloat

rotation around the x-axis (in degrees).

ryfloat

rotation around the y-axis (in degrees).

rzfloat

rotation around the z-axis (in degrees).

synchroniseSizeChanged(obj: QWidget, sx: int, sy: int, sz: int) None

Synchronizes the volume’s size (dimensions) from another SliceReorientViewWidget instance.

Parameters

objQWidget

SliceReorientViewWidget instance that emitted the signal.

sxint

size along the x-dimension.

syint

size along the y-dimension.

szint

size along the z-dimension.

synchroniseSpacingChanged(obj: QWidget, sx: float, sy: float, sz: float) None

Synchronizes the volume’s spacing from another SliceReorientViewWidget instance.

Parameters

objQWidget

SliceReorientViewWidget instance that emitted the signal.

sxfloat

spacing along the x-axis.

syfloat

spacing along the y-axis.

szfloat

spacing along the z-axis.

synchroniseTranslationsChanged(obj: QWidget, tx: float, ty: float, tz: float) None

Synchronizes the volume’s translations from another SliceReorientViewWidget instance.

Parameters

objQWidget

SliceReorientViewWidget instance that emitted the signal.

txfloat

translation along the x-axis.

tyfloat

translation along the y-axis.

tzfloat

translation along the z-axis.

translationsDisabled() None

Disable translations of the reslice cursor via user interaction.

translationsEnabled() None

Enable translations of the reslice cursor via user interaction.

class Sisyphe.widgets.sliceViewWidgets.SliceOverlayViewWidget(overlays: SisypheVolumeCollection | None = None, meshes: SisypheMeshCollection | None = None, parent: QWidget | None = None)

SliceOverlayViewWidget class

Description

Specialized subclass of the SliceViewWidget base class that displays two-dimensional, orthogonal slices of one or more SisypheVolume instances as overlays on a primary reference volume.

Additional features are as follows:

  • mesh management: ability to display 2D cross-sections of SisypheMesh instances and to generate contour lines (isolines) for any displayed volume (reference or overlay).

  • Enhanced information display: voxel values from a selected overlay.

  • Synchronization: it uses Qt signals and slots to synchronize transformations, mesh visibility, and isoline settings across multiple linked SliceOverlayViewWidget.

Inheritance

QWidget -> AbstractViewWidget -> SliceViewWidget -> SliceOverlayViewWidget

Creation: 07/04/2022 Last revision: 20/10/2025

addMesh(mesh: SisypheMesh) None

Add a new SisypheMesh instance to the widget.

Parameters

meshSisypheMesh

SisypheMesh instance to add.

addOverlay(volume: SisypheVolume, alpha: float = 0.5) None

Adds a SisypheVolume as an overlay to the current viewport.

Parameters

volumeSisypheVolume

volume to add as an overlay.

alphafloat, optional

opacity of the overlay (0.0 to 1.0). Defaults to 0.5.

alignCentersOff() None

Disables automatic alignment of new overlays by their centers.

alignCentersOn() None

Disable automatic alignment of new overlays by their centers.

displayOff() None

Hide all display elements, including overlay-specific voxel value menus. Currently, this method calls the superclass’s implementation.

getAlignCenters() bool

Check if automatic alignment of new overlays by their centers is enabled.

Returns

bool

True if alignment is enabled, False otherwise.

getInfoOverlayValueVisibility() str

Get the name of the overlay whose voxel value is currently displayed in the viewport.

Returns

str

name of the active overlay for voxel value display, or ‘No’ if none.

getIsoIndex() int

Get the index of the SisypheVolume currently used for displaying isolines.

Returns

int

  • -1 if no isolines are displayed.

  • 0 if isolines are from the reference SisypheVolume.

  • >0 if isolines are from an overlay SisypheVolume (index + 1).

getIsoLinesColor() list[float]

Get the current color of the isolines.

Returns

list[float]

RGB color as a list of 3 floats.

getIsoLinesOpacity() float

Get the current opacity of the isolines.

Returns

float

opacity value.

getIsoLinesVisibility() bool

Check if isolines are currently visible.

Returns

bool

True if isolines are visible, False otherwise.

getIsoValues() list[float]

Get the current values at which isolines are generated.

Returns

list[float]

list of float values.

getMeshCollection() SisypheMeshCollection

Get the collection of SisypheMesh instances associated with this widget.

Returns

SisypheMeshCollection

collection of meshes.

getMeshVisibility() bool

Check if SisypheMesh instances associated with this widget are currently visible.

Returns

bool

True if SisypheMesh instances are visible, False otherwise.

getMoveOverlayFlag() bool

Check if the ‘Move overlay’ interaction mode is currently active. In this mode, overlay volume can be moved or rotated with mouse.

Returns

bool

True if ‘Move overlay’ is active, False otherwise.

getNumberOfMeshes() int

Get the number of SisypheMesh instances associated with this widget.

Returns

int

total number of SisypheMesh instances.

getOverlayCollection() SisypheVolumeCollection

Get the collection of SisypheVolume instances representing the overlays.

Returns

SisypheVolumeCollection

collection of overlay volumes.

getOverlayCount() int

Get the number of overlays currently displayed.

Returns

int

total number of overlays.

getOverlayFromIndex(index: int) SisypheVolume

Get an overlay volume by its index.

Parameters

indexint

index of the overlay to retrieve.

Returns

SisypheVolume

SisypheVolume instance at the specified index.

getOverlayIndex(o: SisypheVolume) int | None

Gets the index of a given overlay volume in the collection.

Parameters

oSisypheVolume

overlay volume to find.

Returns

int | None

index of the overlay, or None if not found.

getOverlayOpacity(o: int | SisypheVolume) float | None

Get the current opacity of a specific overlay.

Parameters

oint | SisypheVolume

overlay to query, identified by its index or SisypheVolume instance.

Returns

float | None

opacity value (0.0 to 1.0), or None if the overlay is not found.

getOverlayVisibility(o: int | SisypheVolume) bool | None

Get the current visibility state of a specific overlay.

Parameters

oint | SisypheVolume

overlay to query, identified by its index or SisypheVolume instance.

Returns

bool | None

True if the overlay is visible, False otherwise, or None if not found.

getRotations(index: int = 0, deg: bool = True) tuple[float, float, float]

Get the current rotations applied to a specific overlay.

Parameters

indexint (optional)

index of the overlay to query (default 0).

degbool (optional)

If True, rotations are in degrees; otherwise, in radians (default True).

Returns

tuple[float, float, float]

rotations (tx, ty, tz) applied to specified overlay.

getTransform(index: int = 0) SisypheTransform

Get the SisypheTransform representing the current geometric transformation applied to a specific overlay.

Parameters

indexint (optional)

index of the overlay to query (default 0).

Returns

SisypheTransform

geometric transformation applied to specified overlay.

getTranslations(index: int = 0) tuple[float, float, float]

Get the current translations applied to a specific overlay.

Parameters

indexint (optional)

index of the overlay to query (default 0).

Returns

tuple[float, float, float]

translations (tx, ty, tz) applied to specified overlay.

getVTKTransform(index: int = 0) vtkTransform

Get the vtkTransform representing the current geometric transformation applied to a specific overlay.

Parameters

indexint (optional)

index of the overlay to query (default 0).

Returns

vtkTransform

geometric transformation applied to specified overlay.

getVtkImageSliceOverlay(index: int) vtkImageSlice

Get a specific vtkImageSlice actor for an overlay by its index.

Parameters

indexint

index of the overlay slice to retrieve.

Returns

vtkImageSlice

vtkImageSlice actor.

getVtkImageSliceOverlayList() list[vtkImageSlice]

Get a list of all vtkImageSlice actors representing the overlays.

Returns

list[vtkImageSlice]

list of VTK image slice actors.

hasMesh() bool

Check if there are any SisypheMesh instances associated with this widget.

Returns

bool

True if at least one SisypheMesh instance exists, False otherwise.

hasOverlay() bool

Check if there are any overlays currently displayed.

Returns

bool

True if at least one overlay exists, False otherwise.

hasVtkImageSliceOverlay(o: vtkImageSlice) int | None

Check if a given vtkImageSlice is present in the list of overlay slices.

Parameters

ovtkImageSlice

vtkImageSlice to check for.

Returns

int | None

index of the slice if found, otherwise None.

removeAllMeshes() None

Remove all SisypheMesh instances from the widget.

removeAllOverlays() None

Removes all overlays from the viewport.

removeIsoLines() None

Remove all isolines and their labels from the viewport.

removeMesh(mesh: SisypheMesh) None

Remove a specific SisypheMesh instances from the widget.

Parameters

meshSisypheMesh

SisypheMesh instance to remove.

removeOverlay(o: int | SisypheVolume) None

Remove a specific overlay from the viewport.

Parameters

oint | SisypheVolume

overlay to remove, identified by its index or SisypheVolume instance.

removeVolume() None

Remove the main SisypheVolume, all overlays, and isolines from the viewport. Currently, this method calls the superclass’s implementation.

setAlignCenters(v: bool) None

Enable automatic alignment of new overlays by their centers.

setInfoOverlayValueVisibility(name: str, signal: bool = True) None

Set which overlay’s voxel value should be displayed in the information area.

Parameters

namestr

name of the overlay volume whose voxel value should be displayed. Use ‘No’ to hide overlay voxel value information.

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setInfoOverlayValueVisibilityOff(signal: bool = True) None

Hide the overlay voxel value information from the display viewport.

Parameters

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setIsoIndex(v: int, signal: bool = True) None

Set the SisypheVolume to be used for displaying isolines.

Parameters

v : int

  • -1 to hide isolines.

  • 0 to display isolines from the reference volume.

  • >0 to display isolines from an overlay volume (index + 1).

signalbool (optional)

If True, emits the IsoIndexChanged signal for synchronization (default True).

setIsoLinesColor(c: list[float], signal: bool = True) None

Set the color of the isolines and their labels.

Parameters

clist[float]

RGB color as a list of 3 floats (0.0 to 1.0).

signalbool, optional

If True, emits the IsoLinesColorChanged signal for synchronization (default True).

setIsoLinesOpacity(v: float, signal: bool = True) None

Set the opacity of the isolines and their labels.

Parameters

vfloat

opacity value (0.0 to 1.0).

signalbool (optional)

If True, emits the IsoLinesOpacityChanged signal for synchronization (default True).

setIsoValues(iso: list[float], signal: bool = True) None

Set the specific values at which isolines should be generated.

Parameters

isolist[float]

list of float values defining the isolines.

signalbool (optional)

If True, emits the IsoValuesChanged signal for synchronization (default True).

setMeshCollection(mesh: SisypheMeshCollection) None

Set the collection of SisypheMesh instances for this widget.

Parameters

meshSisypheMeshCollection

new collection of meshes.

setMeshVisibility(v: bool, signal: bool = True) None

Set the visibility of all SisypheMesh instances associated with this widget.

Parameters

vbool

True to make meshes visible, False to hide them.

signalbool (optional)

If True, emits the MeshVisibilityChanged signal for synchronization (default True).

setMoveOverlayFlag(signal: bool = True) None

Activate the ‘Move overlay’ interaction mode. In this mode, overlay volume can be moved or rotated with mouse.

Parameters

signalbool (optional)

If True, emits the ViewOverlayMethodCalled signal for synchronization (default True).

setMoveOverlayOff(signal: bool = True) None

Disable the ‘Move overlay’ interaction mode.

Parameters

signalbool, optional

If True, emits the ViewMethodCalled signal for synchronization (default True).

setMoveOverlayToRotate(signal: bool = True) None

Set the ‘Move overlay’ mode to allow rotation of overlays. In this mode, overlay volume can be rotated with mouse.

Parameters

signalbool, optional

If True, emits the ViewOverlayMethodCalled signal for synchronization (default True).

setMoveOverlayToTranslate(signal: bool = True) None

Set the ‘Move overlay’ mode to allow translation of overlays. In this mode, overlay volume can be moved with mouse.

Parameters

signalbool, optional

If True, emits the ViewOverlayMethodCalled signal for synchronization (default True).

setOverlayColorbar(index: int = 0) None

Set the colorbar to display the lookup table of a specific overlay.

Parameters

indexint (optional)

index of the overlay whose colorbar should be displayed (default 0).

setOverlayOpacity(o: int | SisypheVolume, alpha: float, signal: bool = True) None

Set the opacity of a specific overlay.

Parameters

oint | SisypheVolume

overlay to modify, identified by its index or SisypheVolume instance.

alphafloat

new opacity value (0.0 to 1.0).

signalbool (optional)

If True, emits the ViewOverlayMethodCalled signal for synchronization (default True).

setOverlayVisibility(o: int | SisypheVolume, v: bool, signal: bool = True) None

Set the visibility of a specific overlay.

Parameters

oint | SisypheVolume

overlay to modify, identified by its index or SisypheVolume instance.

vbool

True to make the overlay visible, False to hide it.

signalbool (optional)

If True, emits the ViewOverlayMethodCalled signal for synchronization (default True).

setOverlayVisibilityOff(o: int | SisypheVolume) None

Hide a specific overlay.

Parameters

oint | SisypheVolume

overlay to hide identified by its index or SisypheVolume instance.

setOverlayVisibilityOn(o: int | SisypheVolume) None

Make a specific overlay visible.

Parameters

oint | SisypheVolume

overlay to make visible identified by its index or SisypheVolume instance.

setRotations(r: list[float] | tuple[float, float, float], index: int | None = 0, deg: bool = True, signal: bool = True) None

Set the rotations for one or all overlays.

Parameters

rlist[float] | tuple[float, float, float]

new rotations (rx, ry, rz).

indexint | None (optional)

index of the overlay to rotate. If None, all overlays with the same FOV as the first overlay are translated (default 0).

degbool (optional)

If True, rotations are in degrees; otherwise, in radians (default True).

signalbool (optional)

If True, emits the RotationsChanged signal for synchronization (default True).

setTransform(trf: SisypheTransform, index: int = 0) None

Apply a SisypheTransform geomatric transformation to a specific overlay.

Parameters

trfSisypheTransform

geometric transformation to apply.

indexint (optional)

index of the overlay to transform (default 0).

Raises

TypeError

If trf is not a SisypheTransform.

IndexError

If the index is out of range.

setTranslations(t: list[float] | tuple[float, float, float], index: int | None = 0, signal: bool = True) None

Set the translations for one or all overlays.

Parameters

tlist[float] | tuple[float, float, float]

new translations (tx, ty, tz).

indexint | None (optional)

index of the overlay to translate. If None, all overlays with the same FOV as the first overlay are translated (default 0).

signalbool (optional)

If True, emits the TranslationsChanged signal for synchronization (default True).

setVTKTransform(trf: vtkTransform, index: int = 0) None

Apply a vtkTransform geomatric transformation to a specific overlay.

Parameters

trfvtkTransform

geometric transformation to apply.

indexint (optional)

index of the overlay to transform (default 0).

setVolumeColorbar() None

Set the colorbar to display the lookup table of the main reference volume.

synchroniseIsoIndexChanged(obj: QWidget, index: int) None

Synchronize the active isoline volume index from another SliceOverlayViewWidget instance.

Parameters

objQWidget

TSliceOverlayViewWidget instance that emitted the signal.

indexint

index of the volume for isolines (-1 for none, 0 for reference, >0 for overlay).

synchroniseIsoLinesColorChanged(obj: QWidget, c: list[float]) None

Synchronize the isoline color from another SliceOverlayViewWidget instance.

Parameters

objQWidget

SliceOverlayViewWidget instance that emitted the signal.

clist[float]

RGB color (tuple of r, g, b floats) of the isolines (0.0 to 1.0).

synchroniseIsoLinesOpacityChanged(obj: QWidget, v: float) None

Synchronize the isoline opacity from another SliceOverlayViewWidget instance.

Parameters

objQWidget

SliceOverlayViewWidget instance that emitted the signal.

vfloat

opacity of the isolines (0.0 to 1.0).

synchroniseIsoValuesChanged(obj: QWidget, v: list[float]) None

Synchronize the isoline values from another SliceOverlayViewWidget instance.

Parameters

objQWidget

SliceOverlayViewWidget instance that emitted the signal.

vlist[float]

list of float values defining the isolines.

synchroniseMeshVisibilityChanged(obj: QWidget, v: bool) None

Synchronize the visibility of meshes from another SliceOverlayViewWidget instance.

Parameters

objQWidget

TSliceOverlayViewWidget instance that emitted the signal.

vbool

True if meshes are visible, False otherwise.

synchroniseRotationsChanged(obj: QWidget, r: tuple[float, float, float], index: int) None

Synchronize an overlay’s rotations from another SliceOverlayViewWidget instance.

Parameters

objQWidget

SliceOverlayViewWidget instance that emitted the signal.

rtuple[float, float, float]

new rotation (rx, ry, rz) of the overlay (in degrees).

indexint

index of the affected overlay.

synchroniseTranslationsChanged(obj: QWidget, t: tuple[float, float, float], index: int) None

Synchronize an overlay’s translations from another SliceOverlayViewWidget instance.

Parameters

objQWidget

SliceOverlayViewWidget instance that emitted the signal.

ttuple[float, float, float]

new translation (tx, ty, tz) of the overlay.

indexint

index of the affected overlay.

synchroniseViewOverlayMethodCalled(obj: QWidget, function: str, param1: Any, param2: Any) None

Synchronize a method call related to overlays from another SliceOverlayViewWidget instance.

Parameters

objQWidget

SliceOverlayViewWidget instance that emitted the signal.

functionstr

name of the method called.

param1Any

first parameter passed to the method.

param2Any

second parameter passed to the method.

updateRender() None

Force a re-render of the VTK window, updating mesh displays if present. Currently, this method calls the superclass’s implementation.

class Sisyphe.widgets.sliceViewWidgets.SliceRegistrationViewWidget(overlays: SisypheVolumeCollection | None = None, parent: QWidget | None = None)

Description

Specialized subclass of the SliceOverlayViewWidget class designed to facilitate the visual assessment of image coregistration quality.

The main features are as follows:

  • Interactive crop box: a BoxWidget that creates a “spyglass” effect. The moving volume is displayed exclusively inside this box, while the reference volume is shown outside. Users can drag and resize the box to closely inspect alignment at various locations.

  • Multiple display modes: the moving volume can be displayed in several ways:

    • ‘Native’ original moving volume.

    • ‘Edge’ edge-detected (gradient) version of the moving volume.

    • ‘Edge and Native’ combining both the original and edge-detected images.

  • Registration area aefinition: a BoxWidget allows the user to define a specific sub-region (area of interest) for registration. The coordinates and size of this area can be retrieved for use in registration algorithms.

  • Synchronization: it uses Qt signals and slots to synchronize registration-specific properties, such as the crop box state, registration area, and display modes, across linked SliceRegistrationViewWidget.

Inheritance

QWidget -> AbstractViewWidget -> SliceViewWidget -> SliceOverlayViewWidget -> SliceRegistrationViewWidget

Creation: 12/04/2022 Last revision: 20/10/2025

addOverlay(volume: SisypheVolume, gradient: SisypheVolume | None = None, alpha: float = 0.5) None

Adds a moving SisypheVolume as an overlay, along with its edge-detected version (gradient). If no gradient is provided, it is computed automatically. The native and edge overlays are managed for registration-specific display modes. Currently, this method calls the superclass’s implementation.

Parameters

volumeSisypheVolume

moving SisypheVolume to add as an overlay.

gradientSisypheVolume | None (optional)

pre-computed edge-detected version of the volume. If None, it is computed automatically (default None).

alphafloat (optional)

opacity of the overlay (0.0 to 1.0, Default 0.5).

cropOff(signal: bool = True) None

Disable the registration crop mode. In crop mode, the reference SisypheVolume is displayed only outside a user-interactive box, while the overlay is displayed inside.

Parameters

signalbool (optional)

If True, emits the CropChanged signal for synchronization (default True).

cropOn(signal: bool = True) None

Enable the registration crop mode. In crop mode, the reference SisypheVolume is displayed only outside a user-interactive box, while the overlay is displayed inside.

Parameters

signalbool (optional)

If True, emits the CropChanged signal for synchronization (default True).

displayEdge() None

Sets the display mode to show only the edge-detected (gradient) overlay. The reference SisypheVolume is hidden.

displayEdgeAndNative() None

Sets the display mode to show the reference SisypheVolume, the native overlay, and the edge-detected overlay blended together.

displayNative() None

Set the display mode to show the reference SisypheVolume and the native overlay. The edge-detected overlay is hidden.

getCrop() bool

Get the current state of the registration crop mode. In crop mode, the reference SisypheVolume is displayed only outside a user-interactive box, while the overlay is displayed inside.

Returns

bool

True if crop mode is enabled, False otherwise.

getRegistrationBoxMaskArea() SisypheVolume | None

Generate a SisypheVolume binary mask corresponding to the registration area box.

Returns

SisypheVolume | None

new SisypheVolume instance representing the binary mask, or None if the box covers the full volume.

getRegistrationBoxMatrixArea() list[float] | tuple[float, float, float, float, float, float]

Get the registration area defined by the box in matrix (voxel) coordinates.

Returns

list[float] | tuple[float, float, float, float, float, float]
list or tuple [x, y, z, width, height, depth] representing the box’s position and size in voxel coordinates.

If the box covers the full volume, it returns the volume’s dimensions.

getRegistrationBoxVisibility() bool

Get the current visibility of the registration area box.

Returns

bool

True if the registration box is visible, False otherwise.

getRegistrationBoxWorldArea() list[float]

Get the registration area defined by the box in world coordinates.

Returns

list[float]

list [x, y, z, width, height, depth] representing the box’s position and size in world coordinates.

popupCropDisabled() None

Disable the ‘Box crop’ action in the popup menu.

popupCropEnabled() None

Enable the ‘Box crop’ action in the popup menu.

registrationBoxOff() None

Hide the registration area box.

registrationBoxOn() None

Show the registration area box.

removeAllOverlays() None

Remove all overlays and hides the crop action. Currently, this method calls the superclass’s implementation.

removeOverlay(o: int | SisypheVolume) None

Remove a specific overlay and hide the crop action if no overlays remain. Currently, this method calls the superclass’s implementation.

Parameters

oint | SisypheVolume

overlay to remove, identified by its index or SisypheVolume instance.

setCameraPlanePosition(p: list[float] | tuple[float, float, float], signal: bool = True) None

Overrides the base class method to update the registration box area after changing the camera plane position. Currently, this method calls the superclass’s implementation.

Parameters

plist[float] | tuple[float, float, float]

new world coordinates (x, y, z) for the camera’s focal point.

signalbool, optional

If True, emits the CameraPositionChanged signal for synchronization (default True).

setCrop(crop: bool, signal: bool = True) None

Enable or disable the registration crop mode. In crop mode, the reference SisypheVolume is displayed only outside a user-interactive box, while the overlay is displayed inside.

Parameters

cropbool

True to enable crop mode, False to disable it.

signalbool (optional)

If True, emits the CropChanged signal for synchronization (default True).

setRegistrationBoxArea(area: list[float] | tuple[float, float, float, float, float, float], signal: bool = True) None

Set the registration area box from world coordinates.

Parameters

arealist[float] | tuple[float, float, float, float, float, float]

new registration area as [x, y, z, width, height, depth] in world coordinates.

signalbool, optional

If True, emits the RegistrationBoxChanged signal for synchronization (default True).

setRegistrationBoxVisibility(v: bool, signal: bool = True) None

Set the visibility of the registration area box.

Parameters

vbool

True to show the registration box, False to hide it.

signalbool (optional)

If True, emits the RegistrationBoxVisibilityChanged signal for synchronization (default True).

setVolume(volume: SisypheVolume) None

Set the reference SisypheVolume and initializes the registration area to the volume’s full field of view. Currently, this method calls the superclass’s implementation.

Parameters

volumeSisypheVolume

reference SisypheVolume to display.

setZoom(z: float, signal: bool = True) None

Overrides the base class method to update the registration box area after setting a new zoom level. Currently, this method calls the superclass’s implementation.

Parameters

zfloat

new zoom factor.

signalbool, optional

If True, emits the ViewMethodCalled signal for synchronization (default True).

showEvent(a0: QShowEvent | None)

Handles the Qt show event. Overrides the base class method to ensure the registration box area is correctly set when the widget is shown. Currently, this method calls the superclass’s implementation.

Parameters

a0QShowEvent

show event.

sliceMinus() None

Overrides the base class method to update the registration box area after navigating to the previous slice. Currently, this method calls the superclass’s implementation.

slicePlus() None

Overrides the base class method to update the registration box area after navigating to the next slice. Currently, this method calls the superclass’s implementation.

synchroniseCropChanged(obj: QWidget, v: bool) None

Synchronizes the crop state from another SliceRegistrationViewWidget instance.

Parameters

objQWidget

SliceRegistrationViewWidget instance that emitted the signal.

vbool

new crop state (True for cropped, False otherwise).

synchroniseRegistrationBoxChanged(obj: QWidget, area: list) None

Synchronizes the registration box area from another SliceRegistrationViewWidget instance.

Parameters

objQWidget

SliceRegistrationViewWidget instance that emitted the signal.

arealist

new registration area as a list of world coordinates [x, y, z, width, height, depth].

synchroniseRegistrationBoxVisibilityChanged(obj: QWidget, v: bool) None

Synchronizes the registration box visibility from another SliceRegistrationViewWidget instance.

Parameters

objQWidget

SliceRegistrationViewWidget instance that emitted the signal.

vbool

new visibility state (True for visible, False otherwise).

zoomDefault() None

Overrides the base class method to update the registration box area after resetting to default zoom. Currently, this method calls the superclass’s implementation.

zoomIn() None

Overrides the base class method to update the registration box area after zooming in. Currently, this method calls the superclass’s implementation.

zoomOut() None

Overrides the base class method to update the registration box area after zooming out. Currently, this method calls the superclass’s implementation.

class Sisyphe.widgets.sliceViewWidgets.SliceROIViewWidget(overlays: SisypheVolumeCollection | None = None, rois: SisypheROICollection | None = None, draw: SisypheROIDraw | None = None, meshes: SisypheMeshCollection | None = None, parent: QWidget | None = None)

SliceROIViewWidget class

Description

Specialized subclass of the SliceOverlayViewWidget class that adds comprehensive Region of Interest (ROI) management and editing capabilities.

The main features are as follows:

  • ROI management: supports creating new ROIs, loading from and saving to files, and removing individual or all ROIs. It manages a collection of SisypheROI instances, allowing users to easily switch the active ROI for editing.

  • Interactive drawing and editing:

    • Advanced brush tools: features multiple brush types, including a solid disk (2D) or sphere (3D) for painting, and a threshold-based brush that applies the ROI only to voxels within a specific intensity range under the mouse pointer.

    • Adjustable brush size: the brush radius can be changed interactively using the mouse wheel combined with a modifier key, with a circular mouse pointer providing real-time visual feedback.

    • Eraser: Simple right-click functionality to erase parts of a ROI.

  • 2D and 3D processing functions: algorithms that can be applied to the current slice (2D) or the entire volume (3D).

    • Morphological operations: erode, dilate, opening, and closing.

    • Blob-based editing: allows users to select individual connected components (blobs) within a ROI and apply operations like copy, cut, paste, remove, or keep-only.

    • Segmentation algorithms: includes region growing (standard and confidence-based), active contours, and simple object/background segmentation based on intensity.

  • Undo/Redo functionality: maintains a history of modifications, allowing users to undo and redo drawing and processing steps for non-destructive editing.

  • Synchronization: it uses Qt signals and slots to synchronize all ROI-related actions, such as ROI selection, data modifications, attribute changes (e.g., color, opacity), tool settings (brush size, active tool), across linked SliceOverlayViewWidget.

Inheritance

QWidget -> AbstractViewWidget -> SliceViewWidget -> SliceOverlayViewWidget -> SliceROIViewWidget

Creation: 12/04/2022 Last revision: 20/10/2025

addROI(roi: SisypheROI) None

Add a pre-existing SisypheROI instance to the collection and sets it as active.

Parameters

roiSisypheROI

SisypheROI instance to add.

get2DBrushFlag() bool

Check if any 2D brush tool is active.

Returns

bool

True if a 2D brush is active, False otherwise.

get3DBrushFlag() bool

Check if any 3D brush tool is active.

Returns

bool

True if a 3D brush is active, False otherwise.

getActiveROI() SisypheROI | None

Get the currently active SisypheROI instance.

Returns

SisypheROI | None

active SisypheROI instance, or None if no ROI is active.

getBrushFlag() int

Get an integer code representing the currently active brush tool.

Returns

int

1 for solid 2D, 2 for threshold 2D, 3 for solid 3D, 4 for threshold 3D, 0 for none.

getBrushRadius() int

Get the current radius of the drawing brush.

Returns

int

current brush radius in pixels.

getBrushVisibility() bool

Get the current visibility of the brush cursor.

Returns

bool

True if the brush is visible, False otherwise.

getDrawInstance() SisypheROIDraw

Get the SisypheROIDraw instance used for drawing operations.

Returns

SisypheROIDraw

current drawing utility instance.

getFillHolesFlag() bool

Get the state of the automatic hole filling feature.

Returns

bool

True if hole filling is active, False otherwise.

getMorphologyRadius() int

Get the current radius for morphological operations.

Returns

int

current morphological kernel radius.

getNumberOfROI() int

Gets the total number of SisypheROI instance in the collection.

Returns

int

number of SisypheROI instance.

getPopupROI() QMenu

Get the ‘ROI’ tools submenu from the popup menu.

Returns

QMenu

‘ROI’ submenu.

getROI(name: str) SisypheROI

Get a specific SisypheROI instance by its name.

Parameters

namestr

name of the ROI to retrieve.

Returns

SisypheROI

SisypheROI instance with the specified name.

getROICollection() SisypheROICollection

Get the SisypheROICollection instance of the widget.

Returns

SisypheROICollection

managed ROI collection.

getROIMenuVisibility() bool

Get the enabled state of the ROI tools menu.

Returns

bool

True if the menu is enabled, False otherwise.

getROINames() list[str]

Get a list of all SisypheROI instance names in the collection.

Returns

list[str]

list of SisypheROI instance names.

getROIVisibility() bool

Get the visibility state of the active ROI layer.

Returns

bool

True if the active ROI is visible, False otherwise.

getSliceIndex() int

Get the integer index of the currently displayed slice.

Returns

int

current slice index.

getSolidBrush3Flag() bool

Get the active state of the solid 3D sphere brush tool.

Returns

bool

True if the tool is active, False otherwise.

getSolidBrushFlag() bool

Get the active state of the solid 2D disk brush tool.

Returns

bool

True if the tool is active, False otherwise.

getThresholdBrush3Flag() bool

Gets the active state of the threshold-based 3D sphere brush tool.

Returns

bool

True if the tool is active, False otherwise.

getThresholdBrushFlag() bool

Get the active state of the threshold-based 2D disk brush tool.

Returns

bool

True if the tool is active, False otherwise.

getUndo() bool

Get the current state of the undo/redo functionality.

Returns

bool

True if undo/redo is enabled, False otherwise.

hasROI() bool

Check if the widget contains any SisypheROI instances.

Returns

bool

True if at least one SisypheROI instance exists, False otherwise.

loadROI(filenames: str | list[str] | None = None) None

Load one or more SisypheROI instances from files (.xroi) and adds them to the collection.

Parameters

filenamesstr | list[str] | None, optional

single path or list of paths to SisypheROI files (.xroi). If None, a file dialog is shown.

newROI() None

Create a new, empty SisypheROI instance, adds it to the collection, and sets it as active.

popupROIDisabled() None

Disable the ‘ROI’ tools submenu in the popup menu.

popupROIEnabled() None

Enable the ‘ROI’ tools submenu in the popup menu.

redo() None

Perform a redo operation on the active ROI.

removeAllROI() None

Removes all SisypheROI instance from the collection.

removeROI() None

Remove the currently active SisypheROI instance from the collection.

removeVolume() None

Remove the reference SisypheVolume and all associated ROIs. Currently, this method calls the superclass’s implementation.

roiBackground() None

Segment the background of the entire reference volume and adds it to the active ROI.

roiClear() None

Clear all voxels in the entire active ROI.

roiClose() None

Apply a 3D morphological closing to the entire active ROI.

roiDilate() None

Apply a 3D morphological dilation to the entire active ROI.

roiErode() None

Apply a 3D morphological erosion to the entire active ROI.

roiInvert() None

Invert the binary values of the entire active ROI.

roiObject() None

Segment the foreground object of the entire reference volume and adds it to the active ROI.

roiOpen() None

Apply a 3D morphological opening to the entire active ROI.

saveAllROI() None

Save all SisypheROI instances in the collection to their respective files.

saveROI() None

Save the currently active SisypheROI instance to its file. If no file is associated, a save dialog is shown.

set2DBlobCloseFlagOn(signal: bool = True) None

Activate the ‘2D Closing on Selected Blob’ tool. The processing of this 2D tool is limited to the current displayed slice. In this mode, the left-clicked blob undergoes a 2D morphological closing.

Parameters

signalbool (optional)

If True, emits the ROIFlagChanged signal (default True).

set2DBlobCopyFlagOn(signal: bool = True) None

Activates the ‘2D Copy Selected Blob’ tool. The processing of this 2D tool is limited to the current displayed slice. In this mode, the left-clicked blob is copied to the clipboard.

Parameters

signalbool (optional)

If True, emits the ROIFlagChanged signal (default True).

set2DBlobCutFlagOn(signal: bool = True) None

Activate the ‘2D Cut Selected Blob’ tool. The processing of this 2D tool is limited to the current displayed slice. In this mode, the left-clicked blob is cut to the clipboard.

Parameters

signalbool (optional)

If True, emits the ROIFlagChanged signal (default True).

set2DBlobDilateFlagOn(signal: bool = True) None

Activate the ‘2D Dilate Selected Blob’ tool. The processing of this 2D tool is limited to the current displayed slice. In this mode, the left-clicked blob undergoes a 2D morphological dilatation.

Parameters

signalbool (optional)

If True, emits the ROIFlagChanged signal (default True).

set2DBlobErodeFlagOn(signal: bool = True) None

Activate the ‘2D Erode Selected Blob’ tool. The processing of this 2D tool is limited to the current displayed slice. In this mode, the left-clicked blob undergoes a 2D morphological erosion.

Parameters

signalbool (optional)

If True, emits the ROIFlagChanged signal (default True).

set2DBlobKeepFlagOn(signal: bool = True) None

Activates the ‘2D Keep Only Selected Blob’ tool. The processing of this 2D tool is limited to the current displayed slice. In this mode, all the blobs are removed except for the blob that is left-clicked.

Parameters

signalbool (optional)

If True, emits the ROIFlagChanged signal (default True).

set2DBlobOpenFlagOn(signal: bool = True) None

Activates the ‘2D Opening on Selected Blob’ tool. The processing of this 2D tool is limited to the current displayed slice. In this mode, the left-clicked blob undergoes a 2D morphological opening.

Parameters

signalbool (optional)

If True, emits the ROIFlagChanged signal (default True).

set2DBlobPasteFlagOn(signal: bool = True) None

Activate the ‘2D Paste Selected Blob’ tool. The processing of this 2D tool is limited to the current displayed slice. In this mode, the blob on the clipboard is copied wherever the cross-shaped cursor is positioned.

Parameters

signalbool (optional)

If True, emits the ROIFlagChanged signal (default True).

set2DBlobRegionConfidenceFlagOn(signal: bool = True) None

Activate the ‘2D Confidence Connected Region Growing in Selected Blob’ tool. The processing of this 2D tool is limited to the current displayed slice. In this mode, the left-clicked pixel of a blob is used as the seed. The region confidence processing is restricted to the blob area.

Parameters

signalbool (optional)

If True, emits the ROIFlagChanged signal (default True).

set2DBlobRegionGrowingFlagOn(signal: bool = True) None

Activate the ‘2D Region Growing in Selected Blob’ tool. The processing of this 2D tool is limited to the current displayed slice. In this mode, the left-clicked pixel of a blob is used as the seed. The region growing processing is restricted to the blob area.

Parameters

signalbool (optional)

If True, emits the ROIFlagChanged signal (default True).

set2DBlobRemoveFlagOn(signal: bool = True) None

Activate the ‘2D Remove Selected Blob’ tool. The processing of this 2D tool is limited to the current displayed slice. In this mode, the left-clicked blob is removed.

Parameters

signalbool (optional)

If True, emits the ROIFlagChanged signal (default True).

set2DBlobThresholdFlagOn(signal: bool = True) None

Activate the ‘2D Thresholding in Selected Blob’ tool. The processing of this 2D tool is limited to the current displayed slice. In this mode, a threshold is apllied in the left-clicked blob.

Parameters

signalbool (optional)

If True, emits the ROIFlagChanged signal (default True).

set2DFillFlagOn(signal: bool = True) None

Activate the ‘2D Fill from Seed’ tool. The processing of this 2D tool is limited to the current displayed slice. In this mode, the left-clicked hole is filled.

Parameters

signalbool (optional)

If True, emits the ROIFlagChanged signal (default True).

set2DRegionConfidenceFlagOn(signal: bool = True) None

Activate the ‘2D Confidence Connected Region Growing’ tool. The processing of this 2D tool is limited to the current displayed slice. In this mode, the left-clicked pixel is used as the seed for the region confidence processing.

Parameters

signalbool (optional)

If True, emits the ROIFlagChanged signal (default True).

set2DRegionGrowingFlagOn(signal: bool = True) None

Activate the ‘2D Region Growing’ tool. The processing of this 2D tool is limited to the current displayed slice. In this mode, the left-clicked pixel is used as the seed for the region growing processing.

Parameters

signalbool (optional)

If True, emits the ROIFlagChanged signal (default True).

set3DBlobCloseFlagOn(signal: bool = True) None

Activate the ‘3D Closing on Selected Blob’ tool. In this mode, the left-clicked blob undergoes a 3D morphological closing.

Parameters

signalbool (optional)

If True, emits the ROIFlagChanged signal (default True).

set3DBlobCopyFlagOn(signal: bool = True) None

Activates the ‘3D Copy Selected Blob’ tool. In this mode, the left-clicked blob is copied to the clipboard.

Parameters

signalbool (optional)

If True, emits the ROIFlagChanged signal (default True).

set3DBlobCutFlagOn(signal: bool = True) None

Activate the ‘3D Cut Selected Blob’ tool. In this mode, the left-clicked blob is cut to the clipboard.

Parameters

signalbool (optional)

If True, emits the ROIFlagChanged signal (default True).

set3DBlobDilateFlagOn(signal: bool = True) None

Activate the ‘3D Dilate Selected Blob’ tool. In this mode, the left-clicked blob undergoes a 3D morphological dilatation.

Parameters

signalbool (optional)

If True, emits the ROIFlagChanged signal (default True).

set3DBlobErodeFlagOn(signal: bool = True) None

Activate the ‘3D Erode Selected Blob’ tool. In this mode, the left-clicked blob undergoes a 3D morphological erosion.

Parameters

signalbool (optional)

If True, emits the ROIFlagChanged signal (default True).

set3DBlobExpandFlagOn(v: float, signal: bool = True) None

Activate the ‘3D Expand Selected Blob’ tool. In this mode, the left-clicked blob is expanded with a margin.

Parameters

vfloat

margin, in mm, to expand the blob.

signalbool (optional)

If True, emits the ROIFlagChanged signal (default True).

set3DBlobKeepFlagOn(signal: bool = True) None

Activates the ‘3D Keep Only Selected Blob’ tool. In this mode, all the blobs are removed except for the blob that is left-clicked.

Parameters

signalbool (optional)

If True, emits the ROIFlagChanged signal (default True).

set3DBlobOpenFlagOn(signal: bool = True) None

Activates the ‘3D Opening on Selected Blob’ tool. In this mode, the left-clicked blob undergoes a 3D morphological opening.

Parameters

signalbool (optional)

If True, emits the ROIFlagChanged signal (default True).

set3DBlobPasteFlagOn(signal: bool = True) None

Activate the ‘3D Paste Selected Blob’ tool. In this mode, the blob on the clipboard is copied wherever the cross-shaped cursor is positioned.

Parameters

signalbool (optional)

If True, emits the ROIFlagChanged signal (default True).

set3DBlobRegionConfidenceFlagOn(signal: bool = True) None

Activate the ‘3D Confidence Connected Region Growing in Selected Blob’ tool. In this mode, the left-clicked voxel of a blob is used as the seed. The region confidence processing is restricted to the blob area.

Parameters

signalbool (optional)

If True, emits the ROIFlagChanged signal (default True).

set3DBlobRegionGrowingFlagOn(signal: bool = True) None

Activate the ‘3D Region Growing in Selected Blob’ tool. In this mode, the left-clicked voxel of a blob is used as the seed. The region growing processing is restricted to the blob area.

Parameters

signalbool (optional)

If True, emits the ROIFlagChanged signal (default True).

set3DBlobRemoveFlagOn(signal: bool = True) None

Activate the ‘3D Remove Selected Blob’ tool. In this mode, the left-clicked blob is removed.

Parameters

signalbool (optional)

If True, emits the ROIFlagChanged signal (default True).

set3DBlobShrinkFlagOn(v: float, signal: bool = True) None

Activates the ‘3D Shrink Selected Blob’ tool. In this mode, the left-clicked blob is shrinked with a margin.

Parameters

vfloat

margin, in mm, to shrink the blob.

signalbool (optional)

If True, emits the ROIFlagChanged signal (default True).

set3DBlobThresholdFlagOn(signal: bool = True) None

Activate the ‘3D Thresholding in Selected Blob’ tool. In this mode, a threshold is apllied in the left-clicked blob.

Parameters

signalbool (optional)

If True, emits the ROIFlagChanged signal (default True).

set3DFillFlagOn(signal: bool = True) None

Activate the ‘3D Fill from Seed’ tool. In this mode, the left-clicked hole is filled.

Parameters

signalbool (optional)

If True, emits the ROIFlagChanged signal (default True).

set3DRegionConfidenceFlagOn(signal: bool = True) None

Activate the ‘3D Confidence Connected Region Growing’ tool. In this mode, the left-clicked pixel is used as the seed for the region confidence processing.

Parameters

signalbool (optional)

If True, emits the ROIFlagChanged signal (default True).

set3DRegionGrowingFlagOn(signal: bool = True) None

Activate the ‘3D Region Growing’ tool. In this mode, the left-clicked voxel is used as the seed for the region growing processing.

Parameters

signalbool (optional)

If True, emits the ROIFlagChanged signal (default True).

setActiveContourFlagOn(signal: bool = True) None

Activate the ‘Active Contour’ segmentation tool. In this mode, the left-clicked voxel is used to initialize the active contour.

Parameters

signalbool (optional)

If True, emits the ROIFlagChanged signal (default True).

setActiveROI(r: str | SisypheROI, blended: int | None = None, signal: bool = True) None

Set the specified SisypheROI instance as the active one for drawing and editing.

Parameters

rstr | SisypheROI

SisypheROI instance to activate, identified by its name or instance.

blendedvtkImageBlend | None (optional)

pre-blended image of non-active SisypheROI instances for synchronization (default None).

signalbool, optional

If True, emits the ROISelectionChanged signal (default True).

setBrushRadius(r: int, signal: bool = True) None

Sets the radius of the drawing brush.

Parameters

rint

new brush radius in pixels.

signalbool, optional

If True, emits the BrushRadiusChanged signal (default True).

setBrushVisibility(v: bool) None

Set the visibility of the brush cursor.

Parameters

vbool

True to show the brush, False to hide it.

setBrushVisibilityOff() None

Hide the brush cursor.

setBrushVisibilityOn() None

Show the brush cursor.

setDrawInstance(draw: SisypheROIDraw) None

Set the SisypheROIDraw instance to be used for drawing operations.

Parameters

drawSisypheROIDraw

new drawing utility instance.

setFillHolesFlag(f: bool, signal: bool = True) None

Activate or deactivate automatic hole filling after a brush stroke.

Parameters

fbool

True to activate hole filling, False to deactivate.

signalbool (optional)

If True, emits the ROIFlagChanged signal (default True).

setFillHolesFlagOff(signal: bool = True) None

Deactivate automatic hole filling.

Parameters

signalbool (optional)

If True, emits the ROIFlagChanged signal (default True).

setFillHolesFlagOn(signal: bool = True) None

Activate automatic hole filling.

Parameters

signalbool (optional)

If True, emits the ROIFlagChanged signal (default True).

setMorphologyRadius(r: int | float) None

Set the radius for morphological operations (e.g., erode, dilate).

Parameters

rint | float

new radius for morphological kernels.

setNoROIFlag(signal: bool = True) None

Deactivate all ROI drawing and editing tool flags.

Parameters

signalbool (optional)

If True, emits the ROIFlagChanged signal (default True).

setROICollection(rois: SisypheROICollection) None

Set the SisypheROICollection instance for the widget and activates the first ROI.

Parameters

roisSisypheROICollection

collection of ROIs to manage.

setROIMenuVisibility(v: bool) None

Enable or disable the ROI tools in the popup menu.

Parameters

vbool

True to enable the menu, False to disable it.

setROIMenuVisibilityOff() None

Disable the ROI tools in the popup menu.

setROIMenuVisibilityOn() None

Enable the ROI tools in the popup menu.

setROIVisibility(v: bool, signal: bool = True) None

Set the visibility of all ROI layers.

Parameters

vbool

True to show ROIs, False to hide them.

signalbool, optional

If True, emits the ROIFlagChanged signal (default True).

setROIVisibilityOff(signal: bool = True) None

Hide all ROI layers.

Parameters

signalbool (optional)

If True, emits the ROIFlagChanged signal (default True).

setROIVisibilityOn(signal: bool = True) None

Show all ROI layers.

Parameters

signalbool (optional)

If True, emits the ROIFlagChanged signal (default True).

setSolidBrush3Flag(f: bool, signal: bool = True) None

Activate or deactivate the solid 3D sphere brush tool.

Parameters

fbool

True to activate the tool, False to deactivate.

signalbool, optional

If True, emits the ROIFlagChanged signal (default True).

setSolidBrush3FlagOff(signal: bool = True) None

Deactivate the solid 3D sphere brush tool.

Parameters

signalbool (optional)

If True, emits the ROIFlagChanged signal (default True).

setSolidBrush3FlagOn(signal: bool = True) None

Activate the solid 3D sphere brush tool.

Parameters

signalbool (optional)

If True, emits the ROIFlagChanged signal (default True).

setSolidBrushFlag(f: bool, signal: bool = True) None

Activate or deactivate the solid 2D disk brush tool.

Parameters

fbool

True to activate the tool, False to deactivate.

signalbool, optional

If True, emits the ROIFlagChanged signal (default True).

setSolidBrushFlagOff(signal: bool = True) None

Deactivate the solid 2D disk brush tool.

Parameters

signalbool, optional

If True, emits the ROIFlagChanged signal (default True).

setSolidBrushFlagOn(signal: bool = True) None

Activate the solid 2D disk brush tool.

Parameters

signalbool, optional

If True, emits the ROIFlagChanged signal (default True).

setThresholdBrush3Flag(f: bool, signal: bool = True) None

Activate or deactivate the threshold-based 3D sphere brush tool.

Parameters

fbool

True to activate the tool, False to deactivate.

signalbool (optional)

If True, emits the ROIFlagChanged signal (default True).

setThresholdBrush3FlagOff(signal: bool = True) None

Deactivate the threshold-based 3D sphere brush tool.

Parameters

signalbool (optional)

If True, emits the ROIFlagChanged signal (default True).

setThresholdBrush3FlagOn(signal: bool = True) None

Activate the threshold-based 3D sphere brush tool.

Parameters

signalbool (optional)

If True, emits the ROIFlagChanged signal (default True).

setThresholdBrushFlag(f: bool, signal: bool = True) None

Activate or deactivate the threshold-based 2D disk brush tool.

Parameters

fbool

True to activate the tool, False to deactivate.

signalbool (optional)

If True, emits the ROIFlagChanged signal (default True).

setThresholdBrushFlagOff(signal: bool = True) None

Deactivate the threshold-based 2D disk brush tool.

Parameters

signalbool (optional)

If True, emits the ROIFlagChanged signal (default True).

setThresholdBrushFlagOn(signal: bool = True) None

Activate the threshold-based 2D disk brush tool.

Parameters

signalbool (optional)

If True, emits the ROIFlagChanged signal (default True).

setUndo(v: bool, signal: bool = True) None

Set the state of the undo/redo functionality.

Parameters

vbool

True to enable undo/redo, False to disable.

signalbool (optional)

If True, emits the ROIFlagChanged signal (default True).

setUndoOff(signal: bool = True) None

Disable the undo/redo functionality.

Parameters

signalbool (optional)

If True, emits the ROIFlagChanged signal (default True).

setUndoOn(signal: bool = True) None

Enable the undo/redo functionality.

Parameters

signalbool (optional)

If True, emits the ROIFlagChanged signal (default True).

setVolume(volume: SisypheVolume) None

Set the reference SisypheVolume and configures ROI-related components. Currently, this method calls the superclass’s implementation.

Parameters

volumeSisypheVolume

reference SisypheVolume to display.

sliceBackground() None

Segment the background of the reference SisypheVolume on the current slice and adds it to the active ROI.

sliceClear() None

Clear all voxels on the current slice of the active ROI.

sliceClose() None

Apply a 2D morphological closing to the current slice of the active ROI.

sliceDilate() None

Apply a 2D morphological dilation to the current slice of the active ROI.

sliceErode() None

Apply a 2D morphological erosion to the current slice of the active ROI.

sliceFlip(flipx: bool, flipy: bool) None

Flip the current slice of the active ROI horizontally and/or vertically.

Parameters

flipxbool

True to flip horizontally.

flipybool

True to flip vertically.

sliceInvert() None

Invert the binary values of the current slice of the active ROI.

sliceMinus() None

Navigate to the previous slice and updates the brush position. Currently, this method calls the superclass’s implementation.

sliceMove(movex: int, movey: int) None

Shift the current slice of the active ROI by a given offset.

Parameters

movexint

shift amount in the x-direction (in voxels).

moveyint

shift amount in the y-direction (in voxels).

sliceObject() None

Segment the foreground object of the reference SisypheVolume on the current slice and adds it to the active ROI.

sliceOpen() None

Apply a 2D morphological opening to the current slice of the active ROI.

slicePlus() None

Navigate to the next slice and updates the brush position. Currently, this method calls the superclass’s implementation.

synchroniseBrushRadiusChanged(obj: QWidget, radius: int) None

Synchronizes the brush radius from another SliceROIViewWidget instance.

Parameters

objQWidget

SliceROIViewWidget instance that emitted the signal.

radiusint

new brush radius in voxels.

synchroniseROIAttributesChanged(obj: QWidget) None

Synchronizes ROI attribute changes (e.g., color, visibility) from another SliceROIViewWidget instance.

Parameters

objQWidget

SliceROIViewWidget instance that emitted the signal.

synchroniseROIFlagChanged(obj: QWidget, function: str, param: Any) None

Synchronizes a generic ROI-related flag or method call from another SliceROIViewWidget instance.

Parameters

objQWidget

SliceROIViewWidget instance that emitted the signal.

functionstr

name of the method to call.

paramAny

parameter to pass to the method.

synchroniseROIModified(obj: QWidget) None

Synchronizes ROI data modifications from another SliceROIViewWidget instance.

Parameters

objQWidget

SliceROIViewWidget instance that emitted the signal.

synchroniseROISelectionChanged(obj: QWidget, r: str) None

Synchronizes the active ROI selection from another SliceROIViewWidget instance.

Parameters

objQWidget

SliceROIViewWidget instance that emitted the signal.

rstr

name of the new active ROI.

undo() None

Perform an undo operation on the active ROI.

updateROIAttributes(blended: int | None = None, signal: bool = False)

Perform a full update of all ROI-related visual components.

Parameters

blendedvtkImageBlend | None (optional)

pre-blended image of non-active ROIs for synchronization (default None).

signalbool (optional)

If True, emits the ROIAttributesChanged signal (default False).

updateROIDisplay(signal: bool = False) None

Force a modification and re-render of the ROI data.

Parameters

signalbool (optional)

If True, emits the ROIModified signal (default False).

updateROIName(old: str, name: str) None

Update the internal active SisypheROI instance name if it has been changed externally.

Parameters

oldstr

old name of the SisypheROI instance.

namestr

new name of the SisypheROI instance.

updateRender() None

Force a modification of the ROI data and re-renders the scene. Currently, this method calls the superclass’s implementation.

class Sisyphe.widgets.projectionViewWidget.ProjectionViewWidget(direction: str = 'left', operator: str = 'max', thickness: float = 10.0, cut: int = 0, parent: QWidget | None = None)

ProjectionViewWidget class

Description

Specialized subclass of SliceOverlayViewWidget designed to display 2D projections of a SisypheVolume. It generates pre-calculated surface-like views from various angles, which are particularly useful for visualizing data distributed across the brain’s cortex.

The main features are as follows:

  • Multi-directional projections: generates projections from six standard anatomical directions: left, right, anterior, posterior, top, and bottom.

  • Configurable projection operators: the value at each pixel in the projection is computed by applying an operator to the voxels along a line perpendicular to the view. Supported operators include maximum, mean, median, standard deviation, and cumulative sum.

  • Adjustable projection depth: user can specify the thickness (depth in mm) of the volume slab to be included in the projection, starting from the outer surface of the volume.

  • Internal surface views: can “cut” the volume at a specified slice index before performing the projection. This feature allows for the creation of views of internal structures, such as the medial walls of the cerebral hemispheres.

  • Anatomical underlay and labeling: can display a projected anatomical atlas (e.g., ICBM152 T1) as a background layer. When corresponding AAL or Brodmann atlas projections are loaded, it provides real-time anatomical labels based on the mouse pointer position.

  • Foreground/Background blending: manages a primary (foreground) projection and an optional background (atlas) projection, with controls for adjusting the foreground’s opacity.

Inheritance

QFame -> AbstractViewWidget -> SliceViewWidget -> SliceOverlayViewWidget -> ProjectionViewWidget

Creation: 12/10/2024 Last Revision: 10/10/2025

getCuttingSliceIndex() int

Get the current cutting slice index. This slice is used as the new surface. The signal of a pixel in the projection image is calculated from the values of the voxels located up to a specified depth below this new surface.

Returns

int

current cutting slice index.

getDepthOfProjection() float

Get the current projection depth. The signal of a pixel in the projection image is calculated from an operator applied to the signals of the voxels located up to a specified depth below the head’s surface along the projection line. This operator may be the mean, median, maximum, standard deviation, or cumulative sum of these voxels.

Returns

float

current projection depth in mm.

getDirectionOfProjection() str

Get the current projection direction.

Returns

str

current projection direction (‘left’, ‘right’, ‘ant’, ‘post’, ‘top’, ‘bottom’).

getOperatorOfProjection() str

Get the current projection operator. The signal of a pixel in the projection image is calculated from an operator applied to the signals of the voxels located up to a specified depth below the head’s surface along the projection line. This operator may be the mean, median, maximum, standard deviation, or cumulative sum of these voxels.

Returns

str

current projection operator (‘max’, ‘mean’, ‘median’, ‘std’, ‘sum’).

getProjection() SisypheVolume | None

Get the currently displayed projected SisypheVolume instance.

Returns

SisypheVolume | None

projected SisypheVolume instance, or None if no volume is set.

getProjectionOpacity() float

Get the opacity of the foreground projection.

Returns

float

current opacity value.

getVolume() SisypheVolume | None

Get the original, un-projected SisypheVolume reference. Currently, this method overrides the superclass’s implementation.

Returns

SisypheVolume | None

original SisypheVolume reference, or None if not set.

hasVolume() bool

Check if a SisypheVolume reference is set. Currently, this method overrides the superclass’s implementation.

Returns

bool

True if a reference volume is set, False otherwise.

isAnteriorProjection() bool

Check if the current projection direction is ‘ant’.

Returns

bool

True if direction is ‘ant’, False otherwise.

isBottomProjection() bool

Check if the current projection direction is ‘bottom’.

Returns

bool

True if direction is ‘bottom’, False otherwise.

isLeftProjection() bool

Check if the current projection direction is ‘left’.

Returns

bool

True if direction is ‘left’, False otherwise.

isPosteriorProjection() bool

Check if the current projection direction is ‘post’.

Returns

bool

True if direction is ‘post’, False otherwise.

isRightProjection() bool

Check if the current projection direction is ‘right’.

Returns

bool

True if direction is ‘right’, False otherwise.

isTopProjection() bool

Check if the current projection direction is ‘top’.

Returns

bool

True if direction is ‘top’, False otherwise.

isWholeBrainProjection() bool

Check if the projection is of the whole brain (i.e. no cutting).

Returns

bool

True if no cut is applied, False otherwise.

removeVolume() None

Removes the SisypheVolume reference and all associated data. Currently, this method calls the superclass’s implementation.

replaceVolume(foreground: SisypheVolume) None

Replace the reference SisypheVolume instance for the projection. Currently, this method overrides the superclass’s implementation.

Parameters

foregroundSisypheVolume

new reference volume.

setCuttingSliceIndex(v: int = 0) None

Set the slice index at which to cut the volume before projection. This slice is used as the new surface. The signal of a pixel in the projection image is calculated from the values of the voxels located up to a specified depth below this new surface.

Parameters

vint, optional

slice index for cutting (Ddefault 0, no cut).

setDepthOfProjection(v: float = 10.0) None

Set the depth (thickness) of the projection and update the viewport. The signal of a pixel in the projection image is calculated from an operator applied to the signals of the voxels located up to a specified depth below the head’s surface along the projection line. This operator may be the mean, median, maximum, standard deviation, or cumulative sum of these voxels.

Parameters

vfloat (optional)

projection depth in mm (must be between 5.0 and 20.0,default 10.0).

setDirectionOfProjection(d: str = 'left') None

Sets the direction for the projection.

Parameters

dstr (optional)

projection direction. Must be one of ‘left’, ‘right’, ‘ant’, ‘post’, ‘top’, ‘bottom’ (default ‘left’).

setDirectionOfProjectionToAnterior() None

Set the projection direction to ‘ant’.

setDirectionOfProjectionToBottom() None

Set the projection direction to ‘bottom’.

setDirectionOfProjectionToLeft() None

Set the projection direction to ‘left’.

setDirectionOfProjectionToPosterior() None

Set the projection direction to ‘post’.

setDirectionOfProjectionToRight() None

Set the projection direction to ‘right’.

setDirectionOfProjectionToTop() None

Set the projection direction to ‘top’.

setOperatorOfProjection(v: str = 'max')

Set the operator for the projection and updates the viewport. The signal of a pixel in the projection image is calculated from an operator applied to the signals of the voxels located up to a specified depth below the head’s surface along the projection line. This operator may be the mean, median, maximum, standard deviation, or cumulative sum of these voxels.

Parameters

vstr (optional)

projection operator. Must be one of ‘max’, ‘mean’, ‘median’, ‘std’, ‘sum’ (default ‘max’).

setProjectionOpacity(alpha: float = 1.0)

Set the opacity of the foreground projection.

Parameters

alphafloat (optional)

opacity value (0.0 to 1.0, default 1.0).

setVolume(foreground: SisypheVolume, background: SisypheVolume | None = None, mask: SisypheVolume | None = None) None

Set the SisypheVolume instances for projection display. Generates and displays a projection of the foreground volume. If a background volume is provided, its projection is displayed behind the foreground. If the foreground is an ICBM152 volume, standard ICBM152 atlas projections are loaded as background and for anatomical labeling. Currently, this method calls the superclass’s implementation.

Parameters

foregroundSisypheVolume

SisypheVolume instance to be projected and displayed.

backgroundSisypheVolume | None (optional)

SisypheVolume instance to be projected and used as a background (default None).

maskSisypheVolume | None, optional

mask to apply before projection processing (default to None).

showAll(signal: bool = True) None

Show all relevant information overlays (info, colorbar, labels, tooltip). Currently, this method overrides the superclass’s implementation.

Parameters

signalbool, optional

If True, emits signals for synchronization (default True).

showEvent(a0: QShowEvent | None) None

Handles the Qt show event to set initial projection opacity. Currently, this method overrides the superclass’s implementation.

Parameters

a0QShowEvent

show event.

synchroniseRenderUpdated(obj: QWidget) None

Synchronizes a render update from another widget, updating the windowing. Currently, this method overrides the superclass’s implementation.

Parameters

objQWidget

widget that emitted the signal.

updateLutFromReference() None

Update the lookup table of the projected volume from the original SisypheVOlume reference.

updateWindowingFromReference() None

Update the windowing of the projected volume from the original SisypheVolume reference.

class Sisyphe.widgets.volumeViewWidget.VolumeViewWidget(parent: QWidget | None = None)

Specialized subclass of the AbstractViewWidget class that provides a comprehensive 3D visualization component designed for the interactive rendering of a SisypheVolume instance.

The main features are as follows:

  • Multi-modal visualization:

    • Volume rendering: a texture-based 3D rendering of the SisypheVolume, with support for multiple blend modes such as composite, minimum intensity projection (MIP), and isosurface.

    • Orthogonal slices: three vtkImageSlice actors representing the axial, coronal, and sagittal planes. The position of each slice is interactively linked to the 3D cursor.

    • Mesh and tractography overlays: displays SisypheMeshCollection (3D models) and SisypheTractCollection (streamlines) within the same scene.

  • Interactive navigation and tools:

    • Full 3D camera control: mouse-driven rotation, panning, and zooming. Predefined camera positions (top, bottom, front, back, left, right) allow standardized views.

    • 3D cursor: A cross-shaped cursor, with an optional spherical marker, indicates the current 3D focal point. Its position can be set interactively and drives the location of the orthogonal slices.

    • Streamline navigation: allows user to select a streamline and move through its points using the mouse wheel, updating the cursor position accordingly.

  • Rendering control:

    • Transfer function management: manages SisypheColorTransfer instances to control the color and opacity mapping of the volume rendering. Functions can be loaded from and saved to files.

    • Interactive cropping: provides tools to dynamically crop the volume rendering, enabling focused inspection of specific regions.

    • Outer surface generation: can compute and display an outer surface mesh of the SisypheVolume.

  • Data and scene Export:

    • Image capture: captures the current viewport to bitmap image formats.

    • Series capture: generate and save a series of captures from multiple standard camera angles, either as individual files or as a single montage image.

  • Context-Sensitive Interaction: right-click context popup menus provide quick access to settings specific to the picked object, such as volume rendering properties, mesh appearance, or tool options.

Description

Class for displaying volume rendering.

Inheritance

QWidget -> AbstractViewWidget -> VolumeViewWidget

Last revision: 24/07/2025

addMesh(mesh: SisypheMesh) None

Add a SisypheMesh instance to the widget.

Parameters

meshSisypheMesh

SisypheMesh instance to add.

cropTexture() None

Crop the volume rendering based on the picked region relative to the cursor position.

editActorProperties() None

Open a dialog to edit the properties of the picked vtkActor.

classmethod getBlendAsString(k: int) str

Convert a blend mode integer code to its string representation.

Parameters

kint

integer code for the blend mode.

Returns

str

string representation of the blend mode.

classmethod getBlendFromString(k: str) int

Convert a blend mode string representation to its integer code.

Parameters

kstr

string representation of the blend mode.

Returns

int

integer code for the blend mode.

getBlendMode() int

Get the current blend mode used for the rendering as an integer code.

Returns

int

integer code of the current blend mode.

getBlendModeAsString() str

Get the current blend mode used for the rendering as a string.

Returns

str

string representation of the current blend mode.

getCropping() bool

Get the cropping state of the volume rendering.

Returns

bool

True if cropping is enabled, False otherwise.

getGradientOpacity() bool

Get the state of the gradient opacity.

Returns

bool

True if gradient opacity is enabled, False otherwise.

getMeshCollection() SisypheMeshCollection

Get the SisypheMeshCollection (collections of meshes) displayed in the widget.

Returns

SisypheMeshCollection

collection of meshes.

getMeshOnSliceVisibility() bool

Get the visibility of the meshes.

Returns

bool

True if meshes are visible, False otherwise.

getNumberOfMeshes() int

Get the number of SisypheMesh instance in the collection.

Returns

int

total number of SisypheMesh instances.

getPopupCameraPosition() QMenu

Get the ‘Position’ submenu from the popup menu.

Returns

QMenu

‘Position’ submenu.

getPopupTextureActor() QMenu

Get the popup menu for texture (volume rendering) settings.

Returns

QMenu

texture settings popup menu.

getSeriesPixmapCaptures() list[QPixmap]

Capture bitmap images from the six standard camera positions and returns them as a list of QPixmaps.

Returns

list[QPixmap]

list of six QPixmap objects, one for each camera position.

getSlice0Visibility() bool

Get the visibility of the axial vtkImageSlice actor (slice 0).

Returns

bool

True if the slice is visible, False otherwise.

getSlice1Visibility() bool

Get the visibility of the coronal vtkImageSlice actor (slice 1).

Returns

bool

True if the slice is visible, False otherwise.

getSlice2Visibility() bool

Gets the visibility of the sagittal vtkImageSlice actor (slice 2).

Returns

bool

True if the slice is visible, False otherwise.

getSphereCursorOpacity() int

Get the opacity of the spherical part of the cross-shaped cursor.

Returns

int

opacity value (0-100).

getSphereCursorRadius() int

Get the radius, in mm, of the spherical part of the cross-shaped cursor.

Returns

int

radius in mm of the sphere.

getSurfaceVisibility() bool

Gets the visibility of the outer surface SisypheMesh instance.

Returns

bool

True if the outer surface SisypheMesh instance is visible, False otherwise.

getTextureVisibility() bool

Get the visibility of the texture rendering of the vtkVolume actor.

Returns

bool

True if the texture rendering is visible, False otherwise.

getTractCollection() SisypheTractCollection

Get the SisypheTractCollection (collections of streamlines) displayed in the widget.

Returns

SisypheTractCollection

collection of streamlines.

getTransfer() SisypheColorTransfer

Get the current SisypheColorTransfer instance.

Returns

SisypheColorTransfer

current color transfer function instance.

gradientOpacityOff() None

Disable gradient opacity for volume rendering.

gradientOpacityOn() None

Enable gradient opacity for volume rendering.

hasMesh() bool

Check if there are any SisypheMesh instance in the collection.

Returns

bool

True if meshes are present, False otherwise.

hasSurfaceMesh() bool

Check if an outer surface SisypheMesh instance has been generated and is available.

Returns

bool

True if the outer surface SisypheMesh instance exists, False otherwise.

hasTracts() bool

Check if there are any streamlines (tracts) in the collection.

Returns

bool

True if streamlines (tracts) are present, False otherwise.

hideAll(signal: bool = True) None

Hide all the 3D VTK objects (3 vtkImageSlice, vtkVolume). Currently, this method overrides superclass’s implementation.

Parameters

signalbool (optional)

If True, emits ViewMethodCalled signals for synchronization (default True).

hideAllSlices() None

Hide all three orthogonal vtkImageSlice actors.

loadTransfer() None

Load a SisypheColorTransfer instance from a file (.xtfer).

removeAllMeshes() None

Remove all SisypheMesh instances from the widget.

removeMesh(mesh: SisypheMesh) None

Remove a SisypheMesh instance from the widget.

Parameters

meshSisypheMesh

SisypheMesh instance to remove.

removeVolume() None

Remove the currently displayed SisypheVolume from the widget. Currently, this method calls the superclass’s implementation.

replaceVolume(volume: SisypheVolume) None

Replace the current displayed SisypheVolume with a new one.

Parameters

volumeSisypheVolume

new SisypheVolume to display.

saveSeriesCapture() None

Captures bitmap images from six standard camera positions, montages them into a single image, and saves it to a file (supported formats BMP, JPG, PNG, TIFF).

saveSeriesCaptures() None

Captures bitmap images from six standard camera positions, and saves them to six files (supported formats BMP, JPG, PNG, TIFF) suffixed with ‘top’, ‘bottom’, ‘front’, ‘back’, ‘left’, ‘right’.

saveTransfer() None

Save the current SisypheColorTransfer instance to a file (.xtfer).

setBlendMode(k: int | str) None

Set the blend mode used for the rendering .

Parameters

kint | str

The blend mode to set, either as an integer code or a string.

setBlendModeToAdditive() None

Set the blend mode for the rendering to ‘Additive’.

setBlendModeToAverageIntensity() None

Set the blend mode for the rendering to ‘Average Intensity Projection’.

setBlendModeToComposite() None

Sets the blend mode for the rendering to ‘Composite’.

setBlendModeToIsoSurface() None

Sets the blend mode for the rendering to ‘IsoSurface’.

setBlendModeToMaximumIntensity() None

Set the blend mode for the rendering to ‘Maximum Intensity Projection’ (MIP).

setBlendModeToMinimumIntensity() None

Set the blend mode for the rendering to ‘Minimum Intensity Projection’.

setCameraPosition(pos: str) None

Set the camera to a predefined position.

Parameters

posstr

The desired position (‘top’, ‘bottom’, ‘front’, ‘back’, ‘left’, ‘right’).

setCameraToBack() None

Set the camera to a view from the back (posterior).

setCameraToBottom() None

Set the camera to a bottom-up view.

setCameraToFront() None

Set the camera to a view from the front (anterior).

setCameraToLeft() None

Set the camera to a view from the left.

setCameraToRight() None

Set the camera to a view from the right.

setCameraToTop() None

Set the camera to a top-down view.

setCropping(v: bool) None

Enable or disable cropping for the volume rendering.

Parameters

vbool

True to enable cropping, False to disable it.

setCroppingOff() None

Disable cropping for the volume rendering.

setCroppingOn() None

Enable cropping for the volume rendering.

setCursorVisibility(v: bool, signal: bool = True) None

Set the visibility of the cross-shaped cursor. Currently, this method calls superclass’s implementation.

Parameters

vbool

True to show the cursor, False to hide it.

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setCursorWorldPosition(x: float, y: float, z: float, signal: bool = True) None

Set the 3D world position of the cross-shaped cursor. Currently, this method overrides superclass’s implementation.

Parameters

xfloat

world x-coordinate.

yfloat

world y-coordinate.

zfloat

world z-coordinate.

signalbool (optional)

If True and synchronization is on, emits the CursorPositionChanged signal (default True).

setGradientOpacity(v: bool) None

Enable or disable the gradient opacity for volume rendering. Use a gradient transfer function in addition to the color transfer function for volume rendering.

Parameters

vbool

True to enable gradient opacity, False to disable it.

setLineColor(c: list[float] | tuple[float, float, float], signal: bool = True) None

Set the color of the cross-shaped cursor. Currently, this method calls superclass’s implementation.

Parameters

clist[float] | tuple[float, float, float]

color as an (r, g, b) tuple with values from 0.0 to 1.0.

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setLineOpacity(v: float, signal=True) None

Set the line opacity of the cross-shaped cursor. Currently, this method calls superclass’s implementation.

Parameters

vfloat

Opacity value between 0.0 (transparent) and 1.0 (opaque).

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setLineWidth(v: float, signal=True) None

Set the line width of the cross-shaped cursor. Currently, this method calls superclass’s implementation.

Parameters

vfloat

The line width in pixels.

signalbool (optional)

If True, emits the ViewMethodCalled signal for synchronization (default True).

setMeshCollection(mesh: SisypheMeshCollection) None

Get the SisypheMeshCollection (collections of meshes) displayed in the widget.

Returns

SisypheMeshCollection

collection of meshes.

setMeshOnSliceVisibility(v: bool, signal: bool = True) None

Set the visibility of the meshes.

Parameters

vbool

True to show meshes, False to hide it.

signalbool (optional)

If True, emits the MeshOnSliceVisibilityChanged signal for synchronization (default True).

setSlice0Visibility(v: bool) None

Set the visibility of the axial vtkImageSlice actor (slice 0).

Parameters

vbool

True to show the slice, False to hide it.

setSlice1Visibility(v: bool) None

Set the visibility of the coronal vtkImageSlice actor (slice 1).

Parameters

vbool

True to show the slice, False to hide it.

setSlice2Visibility(v: bool) None

Set the visibility of the sagittal vtkImageSlice actor (slice 2).

Parameters

vbool

True to show the slice, False to hide it.

setSphereCursorOpacity(r: int = 0) None

Set the opacity of the spherical part of the cross-shaped cursor.

Parameters

rint (optional)

The new opacity value (0-100, default 0).

setSphereCursorRadius(r: int = 0) None

Sets the radius of the spherical part of the cross-shaped cursor.

Parameters

rint (optional)

new radius in mm for the sphere (default 0).

setSurfaceVisibility(v: bool) None

Set the visibility of the outer surface SisypheMesh instance. If the mesh doesn’t exist, it is created first.

Parameters

vbool

True to show the outer surface SisypheMesh instance, False to hide it.

setTextureVisibility(v: bool) None

Set the visibility of the texture rendering of the vtkVolume actor.

Parameters

vbool

True to show the texture rendering, False to hide it.

setTractCollection(tracts: SisypheTractCollection) None

Set the SisypheTractCollection (collections of streamlines) to be displayed in the widget.

Parameters

tractsSisypheTractCollection

collection of streamlines.

setTransfer(transfer: SisypheColorTransfer) None

Set the SisypheColorTransfer instance for volume rendering.

Parameters

transferSisypheColorTransfer

new transfer function instance to apply.

setVolume(volume: SisypheVolume) None

Set the SisypheVolume to be displayed in the widget. Currently, this method calls the superclass’s implementation.

Parameters

volumeSisypheVolume

Sisyphevolume to display.

showAll(signal: bool = True) None

Show all the 3D VTK objects (3 vtkImageSlice, vtkVolume). Currently, this method overrides superclass’s implementation.

Parameters

signalbool (optional)

If True, emits ViewMethodCalled signals for synchronization (default True).

showAllSlices() None

Show all three orthogonal vtkImageSlice actors.

sliceMinus() None

Move to the previous slice along the currently selected orientation.

slicePlus() None

Move to the next slice along the currently selected orientation.

uncropTexture() None

Reset the volume rendering cropping to show the full volume.