tabs#
GUI tabs for ClearMap.
All the classes in this module are subclasses (direct or indirect) of the
ExperimentTab and GroupTab classes which derive from GenericTab
and provide the basic structure and methods that are common to all tabs.
Presentation#
Each tab manages a specific part of the processing pipeline and has its own UI elements. It is composed of:
ui: QWidget constructed from a .ui file that defines the layout and the widgets.
sample_manager: handles the sample metadata and workspace.
sample_params: experiment-level object that links the UI to the sample configuration file.
params: tab specific parameter link object (UI - config). (For the SampleInfoTab, this is the SampleParameters object.)
name: used to identify the tab in the GUI.
processing_type: identifies the type of tab, one of (None, ‘pre’, ‘post’, ‘batch’).
Abstract tabs hierarchy#
GenericTab: base class for all tabs, handles the UI and channel pages.
ExperimentTab: base for tabs tied to a single experiment (SampleInfo, Stitching, Registration, CellMap, TractMap, Colocalization).
PipelineTab: base for Pre/Post-processing tabs.
PreProcessingTab / PostProcessingTab: specialisation of PipelineTab that form the basis for concrete tabs.
GroupTab: base for group/multi-experiment tabs.
BatchTab: abstract tab for batch/group workflows (e.g. batch processing, group analysis).
Optionally, for Pipeline tabs (PreProcessingTab and
PostProcessingTab), a worker object is used to handle the
processing steps and computation.
Tab setup flow#
Setup order#
Typical calling sequence is:
tab.setuptab.set_paramssets
sample_paramsif notSampleInfoTabcalls
tab._set_paramscalls
tab._setup_workers(for pipeline tabs)calls
tab._create_channels(if the tab has channel pages)calls
tab._load_config_to_gui(via params)calls
tab._bind_params_signals(for tab-specific signals)
Tabs with channels#
Some tabs can have channel pages. Channel pages are created by
add_channel_tab() (invoked from set_params() and, for tabs that
allow it, the (+) button). To control the behaviour of this method,
the following methods can be implemented in the concrete tab classes:
_setup_channel(page_widget, channel)(optional): additional setup for the UI (before binding)._bind_channel(required): wire channel-page-specific actions which are not automatically set through the params object attribute.
PipelineTab additional setup methods#
_setup_workers: sets up the worker (Processor) which handles the computations associated with this tab. Called inset_paramsand also when the sample config is applied.
Processing steps#
Pre/Post processing tabs expose worker orchestration methods. UI widgets are wired via ParamLinks (and bus events), while buttons typically call small wrappers that run steps in threads and update progress dialogs.
- class BatchProcessingTab(main_window, tab_idx: int, *, group_controller: AnalysisGroupController | None = None)[source]#
Bases:
BatchTab
- class CellCounterTab(main_window, tab_idx: int, sample_manager=None)[source]#
Bases:
PostProcessingTab[CellDetector]The tab responsible for the cell detection and cell coordinates alignment
- handle_tool_tab_changed(tab_idx: int) None[source]#
Triggered when a new sub tab (tooltab) of the cell detection tab is selected. It will either plot the cell parameter distributions or update the cell count display.
- Parameters:
tab_idx (int)
- plot_cell_filter_results(channel: str) None[source]#
Plot the cells as colored dots on top of the raw image fraction used for tests
- plot_debug_cropping_interface(channel: str) None[source]#
Plot the orthoslicer to select a subset of the sample for cell detection tests
- plot_detection_results(channel: str) None[source]#
Display the different steps of the cell detection in a grid to evaluate the filters
- plot_labeled_cells_scatter(channel: str, raw: bool = False) None[source]#
Plot the cells as colored symbols on top of either the raw stitched (not aligned) image or the resampled (aligned) image
- run_tuning_cell_detection(channel: str) None[source]#
Run the cell detection on a subset of the sample which was previously selected
- setup_cell_param_histogram(cells: DataFrame, plot_item: PlotWidget | None, key: str = 'size', x_log: bool = False) PlotWidget[source]#
Plots the histogram of the cell parameter defined by key.
- Parameters:
cells (pd.DataFrame) – The Cells dataframe containing one row per detected cell
plot_item (pg.PlotWidget | None) – Existing widget to reuse; creates a new one if None.
key (str) –
- The key (cell attribute) in the dataframe to plot.
One of ‘size’ or ‘source’
x_log (bool) – X axis is logarithmic
- update_cell_number(channel: str) None[source]#
Update the cell count number displayed based on the detected/filtered cell files
- channels_ui_name = 'cell_map_params'#
- pipeline_name = 'cell_map'#
- workers_are_global = False#
- class ColocalizationTab(main_window, tab_idx: int, sample_manager)[source]#
Bases:
PostProcessingTab[ColocalizationProcessor]- sort_channels(channel_a: str, channel_b: str) tuple[str, str][source]#
Return the channels ordered based on the state of the First channel radio buttons
- Parameters:
channel_a (str) – The name of the first channel
channel_b (str) – The name of the second channel
Returns
- tuple[str, str]
(first_channel, second_channel) as chosen by the user
- channels_ui_name = 'colocalization_params'#
- pipeline_name = 'colocalization'#
- workers_are_global = False#
- class GroupAnalysisTab(main_window, tab_idx: int, *, group_controller: AnalysisGroupController)[source]#
Bases:
BatchTab- get_analysable_channels() list[str][source]#
List the channels that have density maps available for analysis.
Warning
Assumes all samples have the same channels.
Returns
- list of str
The list of channels that have density maps available
- handle_groups_changed(event: UiBatchGroupsChanged) None[source]#
- advanced_controls_names: list[str]#
- property processor#
- class RegistrationTab(main_window, tab_idx: int, sample_manager=None)[source]#
Bases:
PreProcessingTab[RegistrationProcessor]- handle_align_with_changed(event: UiAlignWithChanged) None[source]#
- plot_registration_results() None[source]#
Plot the result of the registration between 2 channels. Either side by side or as a composite
If the composite checkbox is checked, the two images are overlayed. Otherwise, they are displayed side by side
- run_registration() None[source]#
Run the actual registration between the sample and the reference atlas.
- setup_atlas() None[source]#
Setup the atlas that corresponds to the orientation and cropping of the sample
- write_registration_landmark_coords(channel: str) None[source]#
Write the corresponding landmarks to file for use in landmark optimised registration
- advanced_controls_names: list[str]#
- channels_ui_name = 'registration_params'#
- landmark_selector: LandmarksSelectorDialog | None#
- pipeline_name = 'registration'#
- class SampleInfoTab(main_window, tab_idx: int, sample_manager=None)[source]#
Bases:
ExperimentTabThe tab manager to define the parameters of the sample. This refers to values that are intrinsic to the sample and the acquisition like resolution, orientation …
- display_atlas(event: UiRequestPlotAtlas) None[source]#
Plot the atlas as a grayscale image in the viewer
- edit_workspace_folders() None[source]#
Open a dialog to edit workspace.resource_type_to_folder and propagate changes via SampleManager.set_resource_type_to_folder().
- launch_pattern_wizard() None[source]#
Start the pattern selection wizard. This wizard helps create the pattern strings for the individual tiles, with specific characters representing the digits for the different axes.
- plot_mini_brain(event: UiRequestPlotMiniBrain) None[source]#
Plot the brain icon which represents the acquisition sample orientation graphically to help users pick the right orientation.
- prepare_channel_raw_data(event: UiPrepareRawDataForClearMap) None[source]#
Per-channel ‘stitched’ asset creation from button.
- prompt_prepare_all_channels_raw_data(force: bool = False) None[source]#
GUI wrapper for bulk raw-data preparation with user confirmation.
Checks which pipeline-ready channels still need their working asset (npy tiles for tiled channels, stitched volume in npy for non-tiled) and presents a confirmation dialog before proceeding.
Prompts automatically once per session on first call. Subsequent automatic calls are no-ops; the manual button bypasses this guard via force=True.
- Parameters:
force (bool) – If True, include already-prepared channels and bypass the once-per-session guard. Intended for the manual re-import button.
- detached: bool#
- property src_folder: Path#
- class StitchingTab(main_window, tab_idx: int, sample_manager=None)[source]#
Bases:
PreProcessingTab[StitchingProcessor]The tab responsible for all the alignments, including the stitching and aligning to the atlas.
- preview_stitching_dumb(channel: str, color: bool) None[source]#
Preview the stitching based only on a dumb overlay of the tiles i.e. only using the fixed guess overlap
- Parameters:
channel (str) – The channel to preview
color (bool) – Whether to stitch in chessboard or continuous grayscale
- preview_stitching_smart(channel: str, asset_sub_type: str = 'aligned_axis') None[source]#
Preview the stitching based on the actual stitching variable, rigid by default.
- Parameters:
channel (str) – The channel to preview
asset_sub_type (str) – One of (‘aligned_axis’, ‘aligned’, ‘placed’)
- prompt_conversion(channel: str) str | None[source]#
Prompt the user to convert the tiles to npy for efficiency
- Parameters:
channel (str) – The channel to convert
- run_stitching() None[source]#
Run the actual stitching steps based on the values in the config file (set from the UI).
- set_run_channel(_, state: bool, channel: str) None[source]#
Set the channels to run the stitching on
- Parameters:
state (bool) – Whether the channel is checked
channel (str) – The name of the channel
- advanced_controls_names: list[str]#
- channels_ui_name = 'stitching_params'#
- pipeline_name = 'stitching'#
- class TractMapTab(main_window, tab_idx: int, sample_manager=None)[source]#
Bases:
PostProcessingTab[TractMapProcessor]The tab responsible for the tract map processing and visualization.
- create_tuning_sample(channel: str) None[source]#
Create an array from a subset of the sample to perform tests on
- plot_debug_cropping_interface(channel: str) None[source]#
Plot the ortho-slicer to select a subset for tracts detection tests
- advanced_controls_names: list[str]#
- channels_ui_name = 'tract_map_params'#
- pipeline_name = 'tract_map'#
- workers_are_global = False#
- class VasculatureTab(main_window, tab_idx: int, sample_manager=None)[source]#
Bases:
PostProcessingTab[BinaryVesselProcessor]Tab for vasculature binarization, graph extraction and analysis.
- Two distinct workers are accessed via substep:
substep=’binary’ → BinaryVesselProcessor
substep=’graph’ → VesselGraphOrchestrator
- ..note::
get_worker() is @overloaded so call sites resolve to the correct type automatically.
- binarize_and_postprocess_channel(channel: str, stop_on_error: bool = False) None[source]#
Run the enabled binarization steps for channel in pipeline order.
- Parameters:
channel (str) – Channel name to process.
stop_on_error (bool) – Whether to stop the process if an error occurs.
- display_graph_chunk(graph_step: str) None[source]#
Display a chunk of the graph selected with the slicer
- Parameters:
graph_step (str) – The name of the step to display (from ‘raw’, ‘cleaned’, ‘reduced’, ‘annotated’)
- plot_binarization_results(plot_side_by_side: bool = True) None[source]#
Plot the thresholded images resulting from the binarization at the steps specified by the comboboxes in the UI.
- Parameters:
plot_side_by_side (bool) – Whether to plot the images side by side (True) or overlay them (False).
- plot_graph_structure() None[source]#
Plot a subregion of the vasculature graph corresponding to a brain structure
- plot_graph_type_processing_chunk_slicer() None[source]#
Plot the ortho-slicer to pick a sub part of the graph to display.
Warning
Depending on the display options, the whole graph may not fit in memory
- post_process_graph() None[source]#
Post process the graph by filtering, tracing and removing capillaries
- unload_temporary_graphs() None[source]#
Unload the temporary vasculature graph objects to free up RAM
- update_file_suffix(event: UiVesselGraphFiltersChanged) None[source]#
Update the file suffix for the filtered graph
- advanced_controls_names: list[str]#
- channels_ui_name = 'vasculature_params'#
- pipeline_name = 'vasculature'#
- workers_are_global = True#