widgets#
A set of custom widgets for the ClearMap GUI
- class DataFrameWidget(df, n_digits=2, parent=None)[source]#
Bases:
QWidget
A simple widget to display a pandas DataFrame
- class LandmarksSelectorDialog(app=None)[source]#
Bases:
WizardDialog
A dialog to select landmarks in 3D space for registration The dialog allows to select landmarks in two views (fixed and moving) The landmarks are displayed in two 3D viewers with matching colors
- connect_buttons()[source]#
Connect the buttons to their slots. This method is called automatically in the constructor
- setup()[source]#
Setup the dialog after creation from the ui file. This method is called automatically in the constructor
- property colors#
Get the ordered list of colors of the markers
Returns
- list(str)
The markers colors
- property current_color#
Get the color of the currently selected marker
Returns
- str
The color of the currently selected marker
- property current_marker#
Get the index of the currently selected marker .. rubric:: Returns
int : the index of the currently selected marker
- property fixed_coords#
- property moving_coords#
- class OrthoViewer(img=None, parent=None)[source]#
Bases:
object
Orthogonal viewer for 3D images
This is a class that allows to visualize 3D images in 3 orthogonal views.
- plot_orthogonal_views(img=None, parent=None)[source]#
Plot the orthogonal views of the image
- Parameters:
img (np.ndarray) – The image to plot. If None, the image set at initialization will be used
parent (QWidget) – The parent widget to plot into. If None, the parent set at initialization will be used
Returns
list(DataViewer)
- setup(img, params, parent=None)[source]#
Initialize the viewer after the object has been created
- Parameters:
img (np.ndarray) – The 3D image to visualize
params (UiParameter) – The parameters object
parent (QWidget) – The parent widget
Returns
- update_ranges(ranges)[source]#
Update the ranges (min, max) for each axis of the viewer
- Parameters:
ranges (list(tuple(float, float)))
- property depth#
Get the depth of the image
Returns
int
- property height#
Get the height of the image
Returns
int
- property shape#
Get the shape of the image
Returns
tuple(int, int, int)
- property width#
Get the width of the image
Returns
int
- class PatternDialog(src_folder, params, app=None, min_file_number=10, tile_extension='.ome.tif')[source]#
Bases:
WizardDialog
A wizard dialog to help the user define file patterns for a set of image file paths The dialog scans the source folder to find patterns in the file names and suggests them to the user there must be at least min_file_number files in the folder with the extension tile_extension to trigger the pattern search
- add_group()[source]#
Add a new group of widgets to the dialog This is a group of widgets to define a pattern for a set of image files (typically a channel)
- connect_buttons()[source]#
Connect the buttons to their slots. This method is called automatically in the constructor
- get_patterns()[source]#
Scan the current source folder to get the pattern finders for the image files
Returns
- list(PatternFinder)
The pattern finders for the source folder
- get_widgets(image_group_id, axis)[source]#
Get the widgets (label, pattern and combo) for a given image group and axis
- Parameters:
image_group_id (int) – The index of the image group
axis (int) – The index of the axis
Returns
- tuple(QLabel, QLabel, QComboBox)
The label of the axis, pattern for the axis pattern and combobox containing the axis name (as a letter)
- save_results()[source]#
Save the file patterns to the sample configuration file and close the dialog
- class PerfMonitor(parent, fast_period, slow_period, *args, **kwargs)[source]#
Bases:
QWidget
- cpu_vals_changed#
- gpu_vals_changed#
- percent_thread#
The percentage of the CPU used by the most active process of ClearMap
- class ProgressWatcher(max_progress=100, main_max_progress=1, parent=None)[source]#
Bases:
QWidget
A QWidget that watches the progress of a process. It uses signals to update the progress bar and the text The main setup methods are setup and prepare_for_substep It is meant to be used in conjunction with a ProgressWatcherDialog to which it is connected through its signals
- count_dones()[source]#
Parse the logs to extract the number of done operations (based on self.pattern) For each done operation, the progress is incremented by 1 For efficiency, the logs are read from the last read position
Returns
- int
The number of done operations found
- increment(increment)[source]#
Increment the progress value of the current main or sub step
- Parameters:
increment (int or float) – The increment value. If float, it is considered as a percentage of the maximum progress value
- increment_main_progress(increment=1)[source]#
Integer increment of the main progress
- Parameters:
increment (int) – The increment value (default is 1)
- prepare_for_substep(step_length, pattern, step_name)[source]#
Setup the watcher for a new substep
- Parameters:
step_name – str
step_length – int The number of steps in the operation
pattern – str or re.Pattern or (str, re.Pattern) the text to look for in the logs to check for progress
- set_main_progress(value)[source]#
Set the progress value for the main step
- Parameters:
value (int) – The progress value
- set_progress(value)[source]#
Set the progress value of the current main or sub step
- Parameters:
value (int) – The progress value
- setup(main_step_name, main_step_length, sub_step_length=0, pattern=None)[source]#
Post initialisation of the
- Parameters:
main_step_name
main_step_length
sub_step_length
pattern
Returns
- aborted#
- finished#
- main_max_changed#
- property main_max_progress#
- main_progress_changed#
- property main_step_name#
- main_step_name_changed#
- max_changed#
- property max_progress#
- progress_changed#
- property sub_step_name#
- sub_step_name_changed#
- class SamplePickerDialog(src_folder, params, app=None)[source]#
Bases:
WizardDialog
A dialog to help the user pick the sample folders from a source folder. The dialog scans the source folder to find the sample folders based on the presence of a sample_params.cfg file The results are displayed in two lists. The user can move the sample folders from the left (available items) list to the right (selected items) list. The samples can be split into groups to allow for different processing of the groups.
- connect_buttons()[source]#
Connect the buttons to their slots. This method is called automatically in the constructor
- class StructurePickerWidget(parent=None)[source]#
Bases:
QTreeWidget
- DARK_COLOR = '#2E3436'#
- LIGHT_COLOR = 'white'#
- class StructureSelector(app=None)[source]#
Bases:
WizardDialog
- connect_buttons()[source]#
Connect the buttons to their slots. This method is called automatically in the constructor but should be implemented in the subclass
- class TwoListSelection(parent=None)[source]#
Bases:
QWidget
A widget that allows to select items from a list and move them to another list This is useful for selecting items from a list of available items and moving them to a list of selected items
- addAvailableItems(items)[source]#
Add the list of available items to the left list
- Parameters:
items (list(str)) – The list of items to add
- get_left_elements()[source]#
Get the list of items in the left list (available items)
Returns
list(str)
- get_right_elements()[source]#
Get the list of items in the right list (selected items)
Returns
list(str)
- class WizardDialog(ui_name, ui_title, src_folder='', params=None, app=None, size=None)[source]#
Bases:
object
A base class for a complex dialogs designed with QT creator and exported as ui files. It is meant to be subclassed. The subclass should implement the setup and connect_buttons methods This class needs a src_folder, a ui_name, a ui_title. The ui names and titles are used to build a dialog from the ui file of the same name and parametrise the dialog
- connect_buttons()[source]#
Connect the buttons to their slots. This method is called automatically in the constructor but should be implemented in the subclass
- static enable_widgets(widgets)[source]#
Helper method to enable a list of widgets
- Parameters:
widgets (list(QWidget)) – The list of widgets to enable