Select file(s) widgets
- class Sisyphe.widgets.selectFileWidgets.SelectionFilter
SelectionFilter class
Description
Base class for file selection widgets (FileSelectionWidget, FilesSelectionWidget, MultiExtFilesSelectionWidget and SynchronizedFilesSelectionWidget).
This class manages the filters used to define criteria for selecting files. The criteria are as follows: directory, file extension(s), DICOM, Nifti, Minc, Nrrd, Vtk, numpy, PySisyphe volume (.xvol), PySisyphe ROI (.xroi), PySisypheMesh (.xmesh), PySisyphe streamlines (.xtracts), identity fields, ID, template, ICBM152, FOV, matrtix size, modality, sequence, datatype, single component, multi component, orientation, scalar range, frame, filename prefix, filename suffix, filename contains a string, registered to a reference file.
Inheritance
object -> SelectionFilter
Last Revision: 20/10/2025
- clearExtensionFilter() None
Clears all currently set file extension filters.
- clearFilters() None
Clears all active filters and resets the internal state of the filter.
- filterCentroid() None
Set a filter to allow only PySisyphe streamlines (.xtracts) declared as centroid streamline.
- filterDICOM() None
Add Dicom file extensions and Sisyphe XML DICOM extension to the filter list.
- filterDirectory() None
Sets the filter to allow only directory selection.
- filterDisplacementField() None
Set a filter to allow only PySisyphe volumes (.xvol) that are displacement fields (float datatype, 3 components, and marked as displacement field sequence).
- filterExtension(ext: str) None
Add a single file extension to the filter list. Automatically handles Sisyphe-specific file types (.xvol, .xroi, etc.).
Parameters
- extstr
file extension to add (e.g., ‘.nii’ or ‘nii’).
- filterExtensions(exts: list[str] | tuple[str, ...]) None
Adds multiple file extensions to the filter list.
Parameters
- filterFilenameContains(string: str) None
Set a filename substring filter. Only files whose basename contains the specified substring (case-insensitive) will be allowed.
Parameters
- stringstr
substring to filter by.
- filterFrame() None
Set a filter to allow only PySisyphe volumes (.xvol) that have a stereotactic frame.
- filterICBM() None
Set a filter to allow only PySisyphe volumes (.xvol) that are in ICBM152 space.
- filterMinc() None
Add common Minc file extensions to the filter list.
- filterMultiComponent() None
Set the filter to allow only multi-component PySisyphe volumes (.xvol).
- filterNifti() None
Add common Nifti file extensions to the filter list.
- filterNotCentroid() None
Set a filter to allow only PySisyphe streamlines (.xtracts) not declared as centroid streamline.
- filterNotWhole() None
Set a filter to allow only PySisyphe streamlines (.xtracts) not declared as whole brain tractograms.
- filterNrrd() None
Add common Nrrd file extensions to the filter list.
- filterNumpy() None
Add common NumPy file extensions to the filter list.
- filterPrefix(prefix: str) None
Set a filename prefix filter. Only files whose basename starts with the specified prefix (case-insensitive) will be allowed.
Parameters
- prefixstr
prefix string to filter by.
- filterRange(v: SisypheVolume | SisypheDisplay | tuple[float, float] | None = None) None
Set a scalar range filter for PySisyphe volumes (.xvol). Only volumes with scalar values within the specified range will be allowed.
Parameters
- vSisypheVolume | SisypheDisplay | tuple[float, float] | None (optional)
SisypheVolume, SisypheDisplay, or a tuple (min, max) defining the range. If None, clears the range filter.
- filterRegisteredToReference(v: SisypheVolume | SisypheROI | str | None = None) None
Set a filter for files coregistered to a specific reference space/transform ID. Only PySisyphe volumes (.xvol) or ROI (.xroi) that have a geometric transformation to the specified ID will be allowed.
Parameters
- vSisypheVolume | SisypheROI | str | None (optional)
SisypheVolume, SisypheROI, a string representing the reference space/transform ID, or None to clear the filter.
- filterSameDatatype(v: SisypheVolume | str | None = None) None
Set a datatype filter. Only PySisyphe volumes (.xvol) with a datatype matching the provided SisypheVolume or datatype name (str) will be allowed.
Parameters
- vSisypheVolume | str | None (optional)
SisypheVolume, a string representing a datatype, or None to clear the filter.
- filterSameFOV(v: SisypheVolume | SisypheROI | list[float] | tuple[float, float, float] | None = None) None
Set a Field of View (FOV) filter. Only PySisyphe volumes (.xvol) or ROI (.xroi) with an FOV matching the provided SisypheVolume, SisypheROI, or a (x, y, z) tuple will be allowed.
Parameters
- vSisypheVolume | SisypheROI | list[float] | tuple[float, float, float] | None (optional)
SisypheVolume, SisypheROI, a list/tuple representing FOV (x, y, z), or None to clear the filter.
- filterSameID(v: SisypheVolume | SisypheROI | str | None = None) None
Set a filter for files with a specific space/transform ID. Only files whose ID matches the provided SisypheVolume, SisypheROI, or space/transform ID (str) will be allowed.
Parameters
- vSisypheVolume | SisypheROI | str | None (optional)
SisypheVolume, SisypheROI, a string representing the ID, or None to clear the filter.
- filterSameIdentity(v: SisypheVolume | SisypheIdentity | None = None) None
Set an identity filter. Only PySisyphe volumes (.xvol) with an identity matching the provided SisypheVolume or SisypheIdentity will be allowed.
Parameters
- vSisypheVolume | SisypheIdentity | None (optional)
SisypheVolume, SisypheIdentity, or None to clear the filter.
- filterSameModality(v: SisypheVolume | str | list[str] | tuple[str, ...] | None = None) None
Set a modality filter. Only PySisyphe volumes (.xvol) with a modality matching the provided SisypheVolume, modality name (str), or list/tuple of strings will be allowed.
Parameters
- vSisypheVolume | str | list[str] | tuple[str, …] | None (optional)
SisypheVolume, a string representing a modality code, a list/tuple of modality codes, or None to clear the filter.
- filterSameOrientation(v: SisypheVolume | str | None = None) None
Set an orientation filter. Only PySisyphe volumes (.xvol) with an orientation matching the provided SisypheVolume or orientation name (str; ‘axial’, ‘coronal’, ‘sagittal’) will be allowed.
Parameters
- vSisypheVolume | str | None (optional)
SisypheVolume, a string representing an orientation, or None to clear the filter.
- filterSameSequence(v: SisypheVolume | str | list[str] | tuple[str, ...] | None = None) None
Set a sequence filter. Only PySisyphe volumes (.xvol) with a sequence matching the provided SisypheVolume, sequence name (str), or list/tuple of strings will be allowed.
Parameters
- vSisypheVolume | str | list[str] | tuple[str, …] | None (optional)
SisypheVolume, a string representing a sequence, a list/tuple of sequences, or None to clear the filter.
- filterSameSize(v: SisypheVolume | SisypheROI | list[int] | tuple[int, int, int] | None = None) None
Set a matrix size filter. Only PySisyphe volumes (.xvol) or ROI (.xroi) with dimensions matching the provided SisypheVolume, SisypheROI, or a (x, y, z) tuple will be allowed.
Parameters
- vSisypheVolume | SisypheROI | list[int] | tuple[int, int, int] | None (optional)
SisypheVolume, SisypheROI, a list/tuple representing size (x, y, z), or None to clear the filter.
- filterSingleComponent() None
Set the filter to allow only single-component PySisyphe volumes (.xvol).
- filterSisypheMesh() None
Add the SisypheMesh file extension (.xmesh) to the filter list.
- filterSisypheROI() None
Adds the SisypheROI file extension (.xroi) to the filter list.
- filterSisypheStreamlines() None
Add the SisypheStreamlines file extension (.xtracts) to the filter list.
- filterSisypheVolume() None
Add the SisypheVolume file extension (.xvol) to the filter list.
- filterSuffix(suffix: str) None
Set a filename suffix filter. Only files whose basename ends with the specified suffix (case-insensitive) will be allowed.
Parameters
- suffixstr
suffix string to filter by.
- filterVtk() None
Add common VTK file extensions to the filter list.
- filterWhole() None
Set a filter to allow only PySisyphe streamlines (.xtracts) declared as whole brain tractograms.
- getBasename() str
Get the base name (filename with extension) of the currently selected file.
Returns
- str
The base name of the file.
- getDatatypeFilter() str | None
Get the current datatype filter value.
Returns
- str | None
datatype filter value, or None if not set.
- classmethod getDefaultIconDirectory() str
Get the path to the default icon directory based on the current system theme (dark/light).
Returns
- str
The absolute path to the icon directory.
- getExtensionFilter() list[str]
Get the list of currently active file extension filters.
Returns
- list[str]
list of file extensions (e.g., [‘.nii’, ‘.gz’]).
- getFOVFilter() tuple[float, float, float] | float | None
Get the current Field of View (FOV) filter value.
Returns
- tuple[float, float, float] | float | None
FOV filter value, or None if not set.
- getFilename() str
Get the full absolute path of the currently selected file or directory.
Returns
- str
The absolute path of the selected file or directory.
- getFilenameContainsFilter() str | None
Get the current filename contains substring filter value.
Returns
- str | None
substring filter value, or None if not set.
- getIDFilter() str
Get the current ID filter value.
Returns
- str
ID filter value, or an empty string if not set.
- getModalityFilter() list[str] | str | None
Get the current modality filter value.
Returns
- list[str] | str | None
modality filter value, or None if not set.
- getOrientationFilter() str | None
Get the current orientation filter value.
Returns
- str | None
orientation filter value, or None if not set.
- getPath() str
Get the full absolute directory path of the currently selected file.
Returns
- str
The absolute directory path of the selected file or directory.
- getPrefixFilter() str | None
Get the current filename prefix filter value.
Returns
- str | None
prefix filter value, or None if not set.
- getRangeFilter() tuple[float, float] | None
Gets the current scalar range filter values.
Returns
- tuple[float, float] | None
range filter values (min, max), or None if not set.
- getReferenceVolume() SisypheVolume
Get the reference SisypheVolume.
Returns
- SisypheVolume
Reference SisypheVolume instance, or None if not set.
- getSequenceFilter() list[str] | str | None
Get the current sequence filter value.
Returns
- list[str] | str | None
sequence filter value, or None if not set.
- getSizeFilter() tuple[int, int, int] | int | None
Get the current matrix size filter value.
Returns
- tuple[int, int, int] | int | None
size filter value, or None if not set.
- getSuffixFilter() str | None
Get the current filename suffix filter value.
Returns
- str | None
suffix filter value, or None if not set.
- getToolbarThumbnail() ToolBarThumbnail
Get the associated ToolBarThumbnail widget for accessing volumes with the IconLabel ‘<’ widget.
Returns
- ToolBarThumbnail
Associated ToolBarThumbnail widget, or None if not set.
- hasToolbarThumbnail() bool
Check if a ToolBarThumbnail widget is defined.
Returns
- bool
True if a ToolBarThumbnail is set, False otherwise.
- classmethod isDarkMode() bool
Checks if the system is currently in dark mode.
Returns
- bool
True if in dark mode, False otherwise.
- classmethod isLightMode() bool
Checks if the system is currently in light mode.
Returns
- bool
True if in light mode, False otherwise.
- isReferenceVolumeToFirst() bool
Checks if the flag to use the first selected volume as a reference is set.
Returns
- bool
True if the first selected volume is used as a reference, False otherwise.
- setFiltersToDefault(ext: bool = True) None
Resets all filters to their default state (no filter).
Parameters
- extbool (optional)
If True, clears extension filters as well. Defaults to True.
- setReferenceVolume(v: SisypheVolume) None
Set a SisypheVolume instance as a reference for subsequent filtering operations.
Parameters
- v: SisypheVolume
SisypheVolume instance to be used as a reference.
- setReferenceVolumeToFirst() None
Set a flag indicating that the first selected volume should be used as a reference for subsequent filtering.
- class Sisyphe.widgets.selectFileWidgets.FileSelectionWidget(parent: QWidget | None = None)
FileSelectionWidget class
Description
Widget that manages single file selection.
This widget consists of the following elements, which are displayed from left to right.
QLabel widget, descriptive text label
QLineEdit widget, selected file name
IconLabel widget with ‘<’ icon, to select a PySisypheVolume from the thumbnail bar (optional widget)
IconLabel widget with folder icon, to select a file from a dialog
IconLabel widget with ‘X’ icon, to clear the selected file name
Inheritance
QWidget, SelectionFilter -> FileSelectionWidget
Last revision: 20/10/2025
- alignLabels(w: QWidget) None
Align the labels of this widget and another FileSelectionWidget to ensure consistent width and right alignment.
Parameters
- clear(signal: bool = True) None
Clear the selected file from the QLineEdit field and resets internal state.
Parameters
- signalbool (optional)
If True, emits FieldChanged and FieldCleared signals. Defaults to True.
- dragEnterEvent(event: QDragEnterEvent | None) None
Handles drag enter events, accepting drops if the mime data contains text (e.g., file paths). This is the method used to manage the drag-and-drop of files from Finder on the macOS platform or File Explorer on the Windows platform.
Parameters
- eventQDragEnterEvent
Qt drag enter event.
- dropEvent(event: QDropEvent | None) None
Handles drop events, attempting to open the dropped file(s). This is the method used to manage the drag-and-drop of files from Finder on the macOS platform or File Explorer on the Windows platform.
Parameters
- event ! QDropEvent
Qt drop event.
- filterSisypheVolume() None
Set the filter to allow only PySisyphe volume files (.xvol) and updates the visibility of the ‘current volume’ button based on the presence of a thumbnail toolbar.
- getButtonsVisibility() bool
Get the visibility state of control buttons.
Returns
- bool
True if buttons are visible, False otherwise.
- getClearButtonVisibility() bool
Get the visibility state of the clear button.
Returns
- bool
True if the button is visible, False otherwise.
- getCurrentVolumeButtonVisibility() bool
Get the visibility state of the current volume ‘<’ button.
Returns
- bool
True if the button is visible, False otherwise.
- getFieldVisibility() bool
Get the visibility state of the QLineEdit field where the selected filename is displayed.
Returns
- bool
True if the field is visible, False otherwise.
- getLabel() QLabel
Get the QLabel widget used as the descriptive label.
Returns
- QLabel
QLabel instance.
- getLabelVisibility() bool
Get the visibility state of the descriptive label.
Returns
- bool
True if the label is visible, False otherwise.
- getRemoveButtonVisibility() bool
Get the visibility state of the remove button (alias for clear button).
Returns
- bool
True if the field is visible, False otherwise.
- getVolume() SisypheVolume
Load the selected file as a SisypheVolume. This method is intended for use when a SisypheVolume is expected.
Returns
- SisypheVolume
loaded SisypheVolume object.
- hideButtons() None
Hide all control buttons (open, clear, current volume).
- hideField() None
Hide the QLineEdit field where the selected filename is displayed.
- hideLabel() None
Hide the descriptive label.
- hideRemoveButton() None
Hide the remove button (alias for clear button).
- isEmpty() bool
Checks if the file selection field is empty.
Returns
- bool
True if no file is selected, False otherwise.
- open(filename: str = '', signal: bool = True) None
Open a file dialog to select a file or directory, applying configured filters. If a filename is provided, it attempts to open that file directly. Performs various checks (component, identity, FOV, size, modality, etc.) based on active filters before accepting the file.
Parameters
- filenamestr (optional)
pre-selected filename to open directly. Defaults to an empty string.
- signalbool (optional)
If True, emits FieldChanged signal upon successful selection. Defaults to True.
- setButtonsVisibility(v: bool) None
Sets the visibility of all control buttons (open, clear, current volume).
Parameters
- vbool
True to show buttons, False to hide them.
- setClearButtonVisibility(v: bool) None
Set the visibility of the clear button.
Parameters
- vbool
True to show the button, False to hide it.
- setCurrentVolumeButtonVisibility(v: bool) None
Set the visibility of the button that allows adding the current thumbnail volume to the field.
Parameters
- vbool
True to show the button, False to hide it.
- setFieldVisibility(v: bool) None
Set the visibility of the QLineEdit field where the selected filename is displayed.
Parameters
- vbool
True to show the field, False to hide it.
- setLabelVisibility(v: bool) None
Set the visibility of the descriptive label.
Parameters
- vbool
True to show the label, False to hide it.
- setRemoveButtonVisibility(v: bool) None
Set the visibility of the remove button (alias for clear button).
Parameters
- setTextLabel(txt: str) None
Set the text of the descriptive label and makes it visible.
Parameters
- txtstr
text to set for the label.
- setToolbarThumbnail(t: ToolBarThumbnail) None
Set the ToolBarThumbnail widget for accessing volumes and makes the current volume ‘<’ button visible if a thumbnail toolbar is provided.
Parameters
- tToolBarThumbnail
ToolBarThumbnail instance.
- showButtons() None
Show all control buttons (open, clear, current volume).
- showField() None
Show the QLineEdit field where the selected filename is displayed.
- showLabel() None
Show the descriptive label.
- showRemoveButton() None
Show the remove button (alias for clear button).
- class Sisyphe.widgets.selectFileWidgets.FilesSelectionWidget(maxcount: int = 100, checkbox: bool = False, parent: QWidget | None = None)
FilesSelectionWidget class
Description
Widget that manages files selection.
This widget consists of the following elements, which are displayed from left to right.
QLabel widget, descriptive text label
QListWidget widget, displays a list of selected files
IconLabel widget with ‘<’ icon, to add a PySisypheVolume from the thumbnail bar (optional widget)
QPushButton ‘add’, to add a file from a dialog
QPushButton ‘remove’, to remove the selected file(s) from the list
QPushButton ‘remove all’, to remove all the files from the list
Inheritance
QWidget, SelectionFilter -> FilesSelectionWidget
Last revision: 20/10/2025
- add(filenames: str = '', label: str = '', signal: bool = True, wait: DialogWait | None = None)
Open a file dialog to select one or more files/directories and adds them to the list. Applies all configured filters and performs checks (component, identity, FOV, size, modality, etc.) before adding each file. Displays a progress dialog for multiple file additions.
Parameters
- filenamesstr (optional)
pre-selected filename or directory to add directly. Defaults to an empty string.
- labelstr (optional)
an optional label for the file dialog title. Defaults to an empty string.
- signalbool (optional)
If True, emits FieldChanged and FilesSelectionChanged signals upon successful addition. Defaults to True.
- waitDialogWait | None (optional)
an optional DialogWait instance to use for progress reporting. If None, a new one is created for multiple files. Defaults to None.
- clear(signal: bool = True) None
Remove all currently selected files from the list.
Parameters
- signalbool (optional)
if True, emits FieldCleared and FilesSelectionWidgetCleared signals. Defaults to True.
- clearItem(i: int, signal: bool = True) None
Remove a file from the list at the specified index.
Parameters
- iint
index of the item to remove
- signalbool (optional)
If True, emits FieldCleared signal. Defaults to True.
- clearLastItem(signal: bool = True) None
Remove the last file from the list.
Parameters
- signalbool (optional)
if True, emits FieldCleared signal. Defaults to True.
- clearSelection() None
Clear the current selection in the list widget.
- clearall(signal: bool = True) None
Remove all files from the list.
Parameters
- signalbool (optional)
if True, emits FieldCleared and FilesSelectionWidgetCleared signals. Defaults to True.
- containsItem(v: QListWidgetItem) bool
Check if a QListWidgetItem with the same text and data (filename) is already present in the list.
Parameters
- vQListWidgetItem
QListWidgetItem to check for
Returns
- bool
True if the item is found, False otherwise.
- copySelectionFrom(widget: QWidget) None
Copy the selection state from another FilesSelectionWidget to this widget.
Parameters
- widgetQWidget
source FilesSelectionWidget to copy selection from
- copySelectionTo(widget: QWidget) None
Copy the selection state from this widget to another FilesSelectionWidget.
Parameters
- widgetQWidget
target FilesSelectionWidget to copy selection to
- dragEnterEvent(event: QDragEnterEvent | None) None
Handles drag enter events, accepting drops if the mime data contains text (e.g., file paths). This is the method used to manage the drag-and-drop of files from Finder on the macOS platform or File Explorer on the Windows platform.
Parameters
- eventQDragEnterEvent
Qt drag enter event.
- dropEvent(event: QDropEvent | None) None
Handles drop events, attempting to open the dropped file(s). This is the method used to manage the drag-and-drop of files from Finder on the macOS platform or File Explorer on the Windows platform.
Parameters
- event ! QDropEvent
Qt drop event.
- filterSisypheVolume() None
Set the filter to allow only PySisyphe volume files (.xvol) and updates the visibility of the ‘current volume’ button based on the presence of a thumbnail toolbar.
- getButtonsVisibility() bool
Get the visibility state of control buttons (add, remove, remove all, current volume).
Returns
- bool
True if buttons are visible, False otherwise.
- getCheckBoxVisibility() bool
Check whether checkboxes are displayed before each file name in the list.
Returns
- bool
True if checkboxes are visible, False otherwise.
- getCheckStateList() list[bool]
Get a list of boolean check states for all items in the list. If checkboxes are not enabled, it returns a list of True for all items.
Returns
- list[bool]
list where True indicates a checked item, False an unchecked item.
- getCheckedFilenames() list[str]
Get a list of filenames for all checked items in the list. If checkboxes are not enabled, it returns all filenames.
Returns
- list[str]
list of absolute file paths for checked items.
- getCheckedIndexes() list[int]
Get a list of indexes for all checked items in the list. If checkboxes are not enabled, it returns indexes for all items.
Returns
- list[int]
list of integer indexes for checked items.
- getCurrentVolumeButtonVisibility() bool
Get the visibility state of the ‘current volume’ button.
Returns
- bool
True if the button is visible, False otherwise.
- getFilenameFromIndex(i: int) str
Get the filename at a given index.
Parameters
- iint
element index
Returns
- str
filename at index i.
- getFilenames() list[str]
Get a list of all filenames currently in the widget’s list.
Returns
- list[str]
list of absolute file paths, or None if the list is empty.
- getIndexFromItem(v: QListWidgetItem) int
Get the row index of a given QListWidgetItem in the list.
Parameters
- vQListWidgetItem
QListWidgetItem to find the index for.
Returns
- int
row index of the item.
- getItemFromIndex(i: int) QListWidgetItem
Get the QListWidgetItem item at a given row index.
Parameters
- iint
row index
Returns
- QListWidgetItem
item at row index i.
- getLabel() QLabel
Get the QLabel widget used as the descriptive label.
Returns
- QLabel
QLabel instance.
- getLabelVisibility() bool
Get the visibility state of the descriptive label.
Returns
- bool
True if the label is visible, False otherwise.
- getMaximumNumberOfFiles() int
Get the maximum number of files allowed in the list.
Returns
- int
maximum number of files.
- getRemoveAllButtonVisibility() bool
Get the visibility state of the ‘remove all’ button.
Returns
- bool
True if buttons are visible, False otherwise.
- getRemoveButtonVisibility() bool
Get the visibility state of the ‘remove’ button.
Returns
- bool
True if buttons are visible, False otherwise.
- getSelectedFilenames() list[str]
Get a list of filenames for all currently selected items in the list.
Returns
- list[str]
list of absolute file paths for selected items, or None if no items are selected.
- getSelectionMode() int
Get the current selection mode of the list widget.
Returns
- int
current selection mode.
- getStopCheckAfterFailure() bool
Get the current setting for stopping file checks after a failure.
Returns
- bool
True if checks stop on first failure, False otherwise.
- hasSelection() bool
Checks if any file is currently selected in the list.
Returns
- bool
True if at least one item is selected, False otherwise.
- hideButtons() None
Hide all control buttons (add, remove, remove all, current volume).
- hideCurrentVolumeButton() None
Hide the ‘current volume’ button.
- hideLabel() None
Hide the descriptive label.
- hideRemoveAllButton() None
Hide ‘remove all’ button.
- hideRemoveButton() None
Hide ‘remove’ button.
- isEmpty() bool
Check if the list of files is empty.
Returns
- bool
True if the list contains no files, False otherwise.
- setButtonsVisibility(v: bool) None
Set the visibility of all control buttons (add, remove, remove all, current volume).
Parameters
- vbool
True to show buttons, False to hide them.
- setCurrentVolumeButtonVisibility(v: bool) None
Set the visibility of the button that allows adding the current thumbnail volume to the list.
Parameters
- vbool
True to show the button, False to hide it.
- setLabelVisibility(v: bool) None
Set the visibility of the descriptive label for the widget.
Parameters
- vbool
True to show the label, False to hide it.
- setMaximumNumberOfFiles(n: int) None
Set the maximum number of files allowed in the list.
Parameters
- nint
maximum number of files.
- setRemoveAllButtonVisibility(v: bool) None
Set the visibility of the ‘remove all’ button.
Parameters
- vbool
True to show the button, False to hide it.
- setRemoveButtonVisibility(v: bool) None
Set the visibility of the ‘Remove’ button.
Parameters
- vbool
True to show the button, False to hide it.
- setSelectionMode(v: int) None
Set the selection mode of the internal QListWidget.
Parameters
- vint
QAbstractItemView.selection mode (e.g., QAbstractItemView.SingleSelection, QAbstractItemView.ExtendedSelection).
- setSelectionModeToContiguous() None
Set the selection mode of the list widget to contiguous item selection.
- setSelectionModeToExtended() None
Set the selection mode of the list widget to extended item selection.
- setSelectionModeToSingle() None
Set the selection mode of the list widget to single item selection.
- setSelectionTo(index: str | int) None
Select a file in the list by its index or by matching its text.
Parameters
- indexstr | int
index (int) or text (str) of the item to select.
- setStopCheckAfterFailure(stop: bool) None
Set whether the file checking process should stop after the first file fails a filter check during an ‘add’ operation.
Parameters
- stopbool
True to stop on first failure, False to continue checking other files.
- setTextLabel(txt: str) None
Set the text of the descriptive label and makes it visible.
Parameters
- txtstr
text to set for the label.
- setToolbarThumbnail(t: ToolBarThumbnail) None
Set the ToolBarThumbnail widget for accessing volumes and makes the ‘current volume’ button visible if a thumbnail toolbar is provided.
Parameters
- tToolBarThumbnail
ToolBarThumbnail instance.
- showButtons() None
Show all control buttons (add, remove, remove all, current volume).
- showCurrentVolumeButton() None
Show the ‘current volume’ button.
- showLabel() None
Show the descriptive label.
- showRemoveAllButton() None
Show ‘remove all’ button.
- showRemoveButton() None
Show ‘remove’ button.
- class Sisyphe.widgets.selectFileWidgets.MultiExtFilesSelectionWidget(maxcount: int = 100, checkbox: bool = False, parent: QWidget | None = None)
MultiExtFilesSelectionWidget class
Description
FilesSelectionWidget to select multiple file types.
Inheritance
QWidget, SelectionFilter -> FilesSelectionWidget -> MultiExtFilesSelectionWidget
Last revision: 20/10/2025
- add(filenames: str = '', label: str = '', signal: str = True, wait: DialogWait | None = None)
Opens a file dialog to select one or more files, specifically designed for multiple Sisyphe-specific file types (e.g., .xvol, .xroi, .xmesh, .xtracts). It dynamically constructs the file filter based on the active Sisyphe-specific extension filters.
Parameters
- filenamesstr (optional)
pre-selected filename to add directly. Defaults to an empty string.
- labelstr (optional)
Aan optional label for the file dialog title. Defaults to an empty string.
- signalbool (optional)
if True, emits FieldChanged and FilesSelectionChanged signals upon successful addition. Defaults to True.
- waitDialogWait | None (optional)
an optional DialogWait instance to use for progress reporting. If None, a new one is created for multiple files. Defaults to None.
- class Sisyphe.widgets.selectFileWidgets.SynchronizedFilesSelectionWidget(single: list[str] | tuple[str, ...] | None, multiple: list[str] | tuple[str, ...] | None, maxcount: int = 100, parent: QWidget | None = None)
SynchronizedFileSelectionWidget class
Description
A composite widget that manages multiple synchronized FileSelectionWidget and/or FilesSelectionWidget widgets. It ensures consistency across linked widgets, for example, by checking if selected volumes have matching Field of View (FOV).
Inheritance
QWidget -> SynchronizedFileSelectionWidget
Last revision: 20/10/2025
- clearall(signal: bool = True) None
Clear all files from all contained single (FileSelectionWidget) and multiple file selection (FilesSelectionWidget) widgets.
Parameters
- signalbool (optional)
if True, emits clear signals from the child widgets. Defaults to True.
- getAvailability() dict[str, dict[str, bool]]
Get the visibility (availability) state of the contained single (FileSelectionWidget) and multiple file selection (FilesSelectionWidget) widgets.
Returns
- dict[str, dict[str, bool]]
dictionary containing visibility states for single and multiple widgets, mapped by their labels.
- getContainsStringFilters() dict[str, dict[str, str | None]]
Get the filename substring filters currently applied to the contained widgets.
Returns
- dict[str, dict[str, list[str] | str | None]]
dictionary containing filename substring filters for single and multiple widgets, mapped by their labels.
- getFilenames() dict[str, dict[str, str]]
Get a dictionary of all selected filenames from single (FileSelectionWidget) and multiple selection (FilesSelectionWidget) widgets, organized by their labels.
Returns
- dict[str, dict[str, str]]
dictionary with ‘single’ and ‘multiple’ keys, each mapping to a dictionary of widget labels and their filenames.
- getGetNumberOfLists() int
Get the total number of single (FileSelectionWidget) and multiple file selection widgets (FilesSelectionWidget) that are managed by this synchronized widget.
Returns
- int
total count of file selection widgets.
- getModalityFilters() dict[str, dict[str, list[str] | str | None]]
Get the modality filters currently applied to the contained widgets.
Returns
- dict[str, dict[str, list[str] | str | None]]
dictionary containing modality filters for single and multiple widgets, mapped by their labels.
- getMultipleListTitles() list[str]
Get a list of titles for all multiple file selection widgets (FilesSelectionWidget).
Returns
- list[str]
list of titles.
- getPrefixFilters() dict[str, dict[str, str | None]]
Get the prefix filters currently applied to the contained widgets.
Returns
- dict[str, dict[str, list[str] | str | None]]
dictionary containing prefix filters for single and multiple widgets, mapped by their labels.
- getSelectionWidget(label: str) QWidget
Get a specific FileSelectionWidget or FilesSelectionWidget instance by its label.
Parameters
- labelstr
label of the desired file selection widget.
Returns
- QWidget
FileSelectionWidget or FilesSelectionWidget instance.
- getSelectionWidgets() tuple[QWidget, ...]
Get a tuple of all contained FileSelectionWidget and FilesSelectionWidget instances.
Returns
- tuple[QWidget, …]
tuple containing all managed file selection widgets.
- getSequenceFilters() dict[str, dict[str, list[str] | str | None]]
Get the sequence filters currently applied to the contained widgets.
Returns
- dict[str, dict[str, list[str] | str | None]]
dictionary containing sequence filters for single and multiple widgets, mapped by their labels.
- getSingleListTitles() list[str]
Get a list of titles for all single file selection widgets (FileSelectionWidget).
Returns
- list[str]
list of titles.
- getSuffixFilters() dict[str, dict[str, str | None]]
Get the suffix filters currently applied to the contained widgets.
Returns
- dict[str, dict[str, list[str] | str | None]]
dictionary containing suffix filters for single and multiple widgets, mapped by their labels.
- getTitles() dict[str, list[str]]
Get a dictionary containing lists of titles for both single (FileSelectionWidget) and multiple file selection (FilesSelectionWidget) widgets.
Returns
- dict[str, list[str]]
dictionary with ‘single’ and ‘multiple’ keys, each mapping to a list of widget titles.
- getToolbarThumbnail() ToolBarThumbnail
Get the associated ToolBarThumbnail widget for accessing volumes with the ‘current volume’ button.
Returns
- ToolBarThumbnail
Associated ToolBarThumbnail widget, or None if not set.
- hasToolbarThumbnail() bool
Check if a ToolBarThumbnail widget is defined.
Returns
- bool
True if a ToolBarThumbnail is set, False otherwise.
- isEmpty() bool
Check if all contained file selection widgets (both single and multiple) are empty.
Returns
- bool
True if all widgets are empty, False otherwise.
- isMultipleEmpty() bool
Check if all multiple file selection widgets (FilesSelectionWidget) empty.
Returns
- bool
True if all multiple selection widgets are empty, False otherwise.
- isReady() bool
Check if the synchronized file selection widget is in a “ready” state. This means all visible single selection widgets (FileSelectionWidget) are not empty, and all visible multiple selection widgets (FileSelectionWidgets) have the same number of files.
Returns
- bool
True if the widget is ready, False otherwise.
- isSingleEmpy() bool
Check if all single file selection widgets (FileSelectionWidget) empty.
Returns
- bool
True if all single selection widgets are empty, False otherwise.
- setAvailability(flags: dict[str, dict[str, bool]]) None
Set the visibility (availability) of the contained single (FileSelectionWidget) and multiple file selection (FilesSelectionWidget) widgets.
Parameters
flags : dict[str, dict[str, bool]]:
dictionary specifying visibility flags for widgets.
expected format: {‘single’: {label: bool}, ‘multiple’: {label: bool}}
- setContainsStringFilters(filters: dict[str, dict[str, str | None]]) None
Set filename substring filters to the contained single (FileSelectionWidget) and multiple file selection (FilesSelectionWidget) widgets.
Parameters
filters : dict[str, dict[str, list[str] | str | None]
dictionary specifying filename substring filters for single and multiple widgets, mapped by their labels.
expected format: {‘single’: [substring_str | list[str] | None, …], ‘multiple’: [substring_str | list[str] | None, …]}
- setFilenames(filenames: dict[str, dict[str, str]]) None
Set the filenames for the contained single (FileSelectionWidget) and multiple selection (FilesSelectionWidget) widgets.
Parameters
filenames : dict[str, dict[str, str]]
dictionary specifying filenames to set.
expected format: {‘single’: {label: filename_str}, ‘multiple’: {label: filename_str | list[filename_str]}}
- setModalityFilters(filters: dict[str, dict[str, list[str] | str | None]]) None
Set modality filters to the contained single (FileSelectionWidget) and multiple file selection (FilesSelectionWidget) widgets.
Parameters
filters : dict[str, dict[str, list[str] | str | None]
dictionary specifying sequence filters for single and multiple widgets, mapped by their labels.
expected format: {‘single’: [modality_str | list[str] | None, …], ‘multiple’: [modality_str | list[str] | None, …]}
- setPrefixFilters(filters: dict[str, dict[str, str | None]]) None
Set prefix filters to the contained single (FileSelectionWidget) and multiple file selection (FilesSelectionWidget) widgets.
Parameters
filters : dict[str, dict[str, list[str] | str | None]
dictionary specifying prefix filters for single and multiple widgets, mapped by their labels.
expected format: {‘single’: [prefix_str | list[str] | None, …], ‘multiple’: [prefix_str | list[str] | None, …]}
- setSequenceFilters(filters: dict[str, dict[str, list[str] | str | None]]) None
Set sequence filters to the contained single (FileSelectionWidget) and multiple file selection (FilesSelectionWidget) widgets.
Parameters
filters : dict[str, dict[str, list[str] | str | None]
dictionary specifying sequence filters for single and multiple widgets, mapped by their labels.
expected format: {‘single’: [sequence_str | list[str] | None, …], ‘multiple’: [sequence_str | list[str] | None, …]}
- setSisypheVolumeFilters(filters: dict[str, list[bool] | bool | None]) None
Set PySisyphe volume (.xvol) filters to the contained single and multiple file selection widgets based on the provided filter configuration.
Parameters
filters : dict[str, dict[str, list[bool] | bool | None]
dictionary specifying which widgets should filter for SisypheVolumes.
expected format: {‘single’: [bool, …], ‘multiple’: [bool, …]}
- setSuffixFilters(filters: dict[str, dict[str, str | None]]) None
Set suffix filters to the contained single (FileSelectionWidget) and multiple file selection (FilesSelectionWidget) widgets.
Parameters
filters : dict[str, dict[str, list[str] | str | None]
dictionary specifying suffix filters for single and multiple widgets, mapped by their labels.
expected format: {‘single’: [suffix_str | list[str] | None, …], ‘multiple’: [suffix_str | list[str] | None, …]}