pydetecdiv.app.gui
Main widgets to use with persistent windows
- class pydetecdiv.app.gui.FileMenu(parent: MainWindow, *args, **kwargs)
Bases:
QMenu
The main window File menu
- class pydetecdiv.app.gui.DataMenu(parent: MainWindow, *args, **kwargs)
Bases:
QMenu
The main window File menu
- class pydetecdiv.app.gui.PluginMenu(parent: MainWindow, *args, **kwargs)
Bases:
QMenu
Plugin menus
- class pydetecdiv.app.gui.MainToolBar(parent: MainWindow, name: str = 'Main toolbar', **kwargs)
Bases:
QToolBar
The main toolbar of the main window
- class pydetecdiv.app.gui.MainStatusBar
Bases:
QStatusBar
The status bar of the main window
- show_memory_usage() None
Show memory usage in status bar
- class pydetecdiv.app.gui.Quit(parent: MainWindow | MainToolBar)
Bases:
QAction
Quit action, interrupting the application
- class pydetecdiv.app.gui.Help(parent: MainWindow | MainToolBar)
Bases:
QAction
Action requesting global help
- show_info() None
Shows information about the application (version, authors, licence)
pydetecdiv.app.gui.Windows
Classes for persistent windows of the GUI
- class pydetecdiv.app.gui.Windows.MainWindow
Bases:
QMainWindow
The principal window
- closeEvent(_: QCloseEvent) None
Response to close event signal. Settings are saved in order to save the current window geometry and state.
- add_tabbed_window(title: str) TabbedWindow
Add a new Tabbed Mdi subwindow to visualize related information and analyses
- Parameters:
title – the title for the tabbed viewer window
- Returns:
the new tabbed viewer widget
- subwindow_activation(subwindow: QMdiArea) None
When a tabbed viewer is activated (its focus is set), then the Image resource selector should be fed with the corresponding image resource information(FOV name, stage dataset, channel)
- Parameters:
subwindow – the activated sub-window
- property active_subwindow: QMdiArea | None
A property returning the currently active subwindow in the MDI area
- Returns:
the currently active tabbed window in the MDI area
- class pydetecdiv.app.gui.Windows.ImageResourceChooser(parent: MainWindow)
Bases:
QDockWidget
A dockable widget with a form for choosing an image resource to display in a new tabbed viewer. The image resource is determined by the FOV name, the dataset (stage) and a channel
- set_choice(p_name: str) None
Set the available values for FOVs, datasets and channels given a project name
- Parameters:
p_name – the project name
- accept() None
When the OK button is clicked, then open a new TabbedViewer window and display the selected Image resource
- class pydetecdiv.app.gui.Windows.DrawingToolsPalette(parent: MainWindow)
Bases:
QDockWidget
A dockable window with tools for drawing ROIs and other items.
- unset_tools() None
Unset all available tools
- current_tool() QToolButton | None
Return the currently checked tool
- Returns:
the currently checked tool
- set_item_width(width: int)
Sets the width of the currently selected item, using the spinbox in drawing tools
- Parameters:
width – the desired width
- set_item_height(height: int)
Sets the height of the currently selected item, using the spinbox in drawing tools
- Parameters:
height – the desired height
- class pydetecdiv.app.gui.Windows.Cursor(parent: DrawingToolsPalette)
Bases:
QToolButton
QToolButton to activate the tool for selecting and dragging items in the view
- select_tool() None
Select the Cursor tool
- class pydetecdiv.app.gui.Windows.DrawRect(parent: DrawingToolsPalette)
Bases:
QToolButton
A QToolButton to activate the tool for drawing a ROI
- select_tool() None
Select the DrawRect tool
- class pydetecdiv.app.gui.Windows.DuplicateItem(parent: DrawingToolsPalette)
Bases:
QToolButton
A QToolButton to activate the tool for duplicating a ROI
- select_tool() None
Select the DuplicateItem tool
- class pydetecdiv.app.gui.Windows.DrawPoint(parent: DrawingToolsPalette)
Bases:
QToolButton
A QToolButton to activate the tool for duplicating a ROI
- select_tool() None
Select the DuplicateItem tool
- class pydetecdiv.app.gui.Windows.AnalysisToolsTree(parent: MainWindow)
Bases:
QDockWidget
A dockable window with tools for image analysis.
pydetecdiv.app.gui.ActionsSettings
Handling actions to edit and manage settings
- class pydetecdiv.app.gui.ActionsSettings.SettingsDialog
Bases:
QDialog
A dialog window to edit application settings
- toggle_buttons() None
Enable or disable OK and Apply buttons depending upon the validity of input text
- select_workspace() None
Method opening a Directory chooser to select the workspace directory
- select_appdata_path() None
Method opening a Directory chooser to select the toolbox directory
- select_toolbox_path() None
Method opening a Directory chooser to select the toolbox directory
- clicked(button: QPushButton)
Slot responding to a click on one of the buttons in the button box.
- Parameters:
button – the clicked button
- apply()
Save the contents of the settings editor into the settings file when the OK button has been clicked
- reset()
Reset the contents of the settings editor to the values currently in the settings file
- class pydetecdiv.app.gui.ActionsSettings.Settings(parent: QWidget)
Bases:
QAction
Action to open a session editor window
pydetecdiv.app.gui.ActionsProject
Handling actions to open, create and interact with projects
- class pydetecdiv.app.gui.ActionsProject.ProjectAction(value)
An Enum class of the various actions applicable to projects (New, Open, Delete)
- class pydetecdiv.app.gui.ActionsProject.ProjectDialog(list_projects: list[str], project_action: ProjectAction = ProjectAction.Open)
A generic dialog window to create or open a project
- static project_name_validator() QRegularExpressionValidator
Name validator to filter invalid character in project name
- Returns:
the validator
- project_name_changed() None
Slot checking whether the project name input is empty or not and enabling or disabling Ok button accordingly
- get_project_name() str
Method returning the chosen project name, either from QLineEdit (new project) or QComboBox (open project)
- Returns:
the project name
- accept() None
Action triggered by clicking on the accept button in the button box. It is either create a new project if the project name does not exist yet or open an existing project otherwise. This method also checks whether the project name is empty.
- open_create_project(project_name: str) None
Open a project called project_name, create a new project if it does not exist, and set the Window title accordingly before closing the project connexion.
- Parameters:
project_name – the name of the project to open/create
- delete_project(project_name: str) None
Delete project called project_name,
- Parameters:
project_name – the name of the project to delete
- class pydetecdiv.app.gui.ActionsProject.NewProject(parent: QWidget)
Action to open a for project creation
- static create_project() None
Opens dialog window to create a new project
- class pydetecdiv.app.gui.ActionsProject.OpenProject(parent: QWidget)
Action to open a project chooser window
- open_project() None
Opens dialog window to open a project
- class pydetecdiv.app.gui.ActionsProject.DeleteProject(parent: QWidget)
Action to open a project chooser window
pydetecdiv.app.gui.ActionsData
Handling actions to open, create and interact with projects
- class pydetecdiv.app.gui.ActionsData.FileListView(parent: QWidget)
Bases:
QListView
A class extending QListView to display source for image data. Defines a context menu to clear or toggle selection, remove selected sources, clear list
- contextMenuEvent(e: QContextMenuEvent) None
Definition of a context menu to clear or toggle selection of sources in list model, remove selected sources from the list model, clear the source list model
- Parameters:
e – mouse event providing the position of the context menu
- unselect() None
Clear selection model
- toggle() None
Toggle selection model, selected sources are deselected and unselected ones are selected
- remove_items() None
Delete selected sources
- clear_list() None
Clear the source list
- class pydetecdiv.app.gui.ActionsData.ImportMetaDataDialog
Bases:
QDialog
A dialog window to choose sources for metadata files to import images and create Image resources
- add_files() None
Open a file chooser dialog box and add selected files to the source model
- add_dir() None
Open a directory chooser dialog box and add selected directory to the source model
- add_path(path: str) None
Add the input path to the source model
- Parameters:
path – the metadata file path
- accept() None
Launches import of data in response to Ok button
- import_data() None
Import files whose list is defined by the sources in self.list_model
- class pydetecdiv.app.gui.ActionsData.ImportDataDialog
Bases:
QDialog
A dialog window to choose sources for image data files to import into the project raw dataset
- add_files() None
Open a file chooser dialog box and add selected files to the source model
- add_dir() None
Open a directory chooser dialog box and add selected directory to the source model
- add_path(path: str) None
Add the input path to the source model
- Parameters:
path – the Data path
- get_destinations() list[str]
Get the list of subdirectories in the destination raw dataset directory
- Returns:
list of subdirectories in the destination raw dataset directory
- file_list() list[str]
Expands all source specification to return a list of files to import
- Returns:
file name list
- accept() None
Import files whose list is defined by the sources in self.list_model
- import_data() None
Import image data from source specified in list_model into project raw dataset and triggers a progress signal with the number of files that have been copied so far
- count_imported_files(destination: str, n_start: int) int
Count imported files in destination directory to assess progress
- Parameters:
destination – destination directory which files are imported into
n_start – the number of files already in the destination directory before import
- Returns:
the number of imported files
- cancel_import(initial_files: set[str], n_files0: int, project: Project, processes: list[Popen]) None
Manage cancellation of import. Terminate all copy processes before launching deletion of files that were already copied. Then cancel persistence operations on Data objects, and eventually stop the host thread.
- Parameters:
initial_files – the set of files before import was started
n_files0 – the initial number of files
project – the current Project
processes – import processes that are running and should be cancelled
- source_list_is_not_empty() None
Checks the source list is not empty, enables OK button if not
- static sub_directory_name_validator() QRegularExpressionValidator
Name validator to filter invalid character in directory name
- Returns:
the validator
- class pydetecdiv.app.gui.ActionsData.ImportData(parent: QWidget)
Bases:
QAction
Action to import raw data images into a project
- class pydetecdiv.app.gui.ActionsData.ImportMetaData(parent: QWidget)
Bases:
QAction
Action to import raw data images into a project
- class pydetecdiv.app.gui.ActionsData.AddPathDialog(parent_window: QWidget)
Bases:
QDialog
A dialog window to select a path pointing to files or directories to import
- accept() None
Accept the path input text and add it to the source list
- path_specification_changed() None
Checks the path input text actually exists and enables Apply and OK buttons accordingly
- class pydetecdiv.app.gui.ActionsData.CreateFOV(parent: QWidget)
Bases:
QAction
Action to import raw data images into a project
- enable(raw_data_count: int)
Enable or disable this action in the Data menu whether there are raw data or not.
- Parameters:
raw_data_count – the number of files in raw dataset
- class pydetecdiv.app.gui.ActionsData.ComputeDriftDialog(title: str = None)
Bases:
Dialog
A dialog window to run drift correction computations for a selection of FOVs
- update_fov_list(project_name: str) dict[str, FOV]
Return the list of FOVs in the project as a dictionary mapping actual FOV objects to their names
- Parameters:
project_name – the name of the project
- Returns:
a dictionary of FOVs in project
- accept() None
Launch the drift computation and the associated waiting dialog
- compute_drift(Z: int = 0, C: int = 0) None
Compute the drift for the given Z and C as references
- Parameters:
Z – the reference z-layer
C – the reference channel
- class pydetecdiv.app.gui.ActionsData.ComputeDrift(parent: QWidget)
Bases:
QAction
Action to compute drift correction
- enable(project_name: str) None
Enable or disable this action in the Data menu whether there are raw data or not.
- Parameters:
project_name – the name of the project
- open_dialog() None
Open the Compute-drift dialog window
pydetecdiv.app.gui.RawData2FOV
Dialog window handling the definition of patterns for FOV creation from raw data file names
- class pydetecdiv.app.gui.RawData2FOV.RawData2FOV
Bases:
QDialog
,Ui_RawData2FOV
A class extending the QDialog and the Ui_RawData2FOV classes. Ui_RawData2FOV was created using QTDesigner
- reset() None
Reset the form with default patterns and colours
- get_regex() dict[str, str]
Build the complete regular expression from the individual patterns
- Returns:
the regular expression string
- change_sample_style() None
Change the colours of file name samples showing the pattern matches.
- static find_matches(urls: list[str], regexes: dict[str, str]) dict[str, list[Match]]
Find a list of matches with the defined regular expressions
- Parameters:
urls
regexes – the list of regular expressions to match
- Returns:
a list of matches
- static get_match_spans(matches: dict[str, list[Match]], group: int) dict[str, list[tuple[int, int]]]
Get the list of group positions for matches
- Parameters:
matches – the list of matches
group – the group index to retrieve the spans for
- Returns:
a dictionary of spans for the patterns (FOV, C, T, Z)
- static get_match_span(match, group: int = 2) tuple[int, int] | None
Get the span of a given group in a match
- Parameters:
match – the match
group – the group index
- Returns:
the group match span
- colourize_matches(matches: dict[str, list[Match]]) None
Find matches in file name samples and colourize them accordingly. Non-matching pattern check boxes’ background is set to orange. Conflicting patterns (having overlapping matches) are shown in red.
- Parameters:
matches – the list of matches to colourize
- static overlap(start1: int | None, end1: int | None, start2: int | None, end2: int | None) bool
Checks whether positions overlap
- Parameters:
start1 – start of first span
end1 – end of first span
start2 – start of second span
end2 – end of second span
- Returns:
True if spans overlap, False otherwise
- colourize_labels(pattern: str, colour: QColor) None
Colourize the file name samples matching the pattern with the specified colour
- Parameters:
pattern – the pattern
colour – the colour
- clear_colours() None
Clear colours to avoid overlapping style sheets
- choose_colour(object_name: str) None
Choose colour for a given pattern specified by its object name
- Parameters:
object_name – the object name
- show_chosen_colours() None
Show the chosen colour in the little square box on the right and the border of the pattern.
- button_clicked(button: QPushButton)
React to clicked button
- Parameters:
button – the button that was clicked
- create_fov_annotate(regex: str) None
The actual FOV creation and data annotation method
- Parameters:
regex – the regular expression to use for data annotation