populse_mia.user_interface.data_browser.count_table¶
Medical Scan Completeness Verification Tool.
This module provides a sophisticated quality assurance tool for medical imaging projects, enabling systematic verification of scan completeness through interactive tag-based analysis. The tool helps identify missing scans, incomplete datasets, and data inconsistencies across multiple metadata dimensions.
The primary component is a dynamic table-based interface that visualizes all possible combinations of selected metadata tags (patient names, scan types, time points, etc.) and indicates which combinations have corresponding scan data available.
- Core Functionality:
Interactive tag selection with expandable interface (2 to n tags).
Real-time database querying and scan counting.
Matrix visualization of tag combinations vs. data availability.
- Visual indicators:
✓ (green checkmark) for present data,
✗ (red cross) for missing.
Detailed tooltips showing specific scan filenames.
Statistical summaries with total counts per category.
- Use Cases:
Quality assurance before data analysis.
Identifying incomplete patient visits or missing sequences.
Verifying protocol compliance across studies.
Dataset completeness reporting.
Pre-processing validation for longitudinal studies.
- Technical Features:
Efficient database integration with lazy loading.
Dynamic UI generation based on selected metadata.
Scalable to handle large datasets with multiple tag dimensions.
Qt-based interface with responsive table resizing.
Memory-efficient combination generation using odometer algorithms.
- Example Workflow:
Select relevant metadata tags (e.g., PatientName, TimePoint, SequenceName).
Generate combination matrix showing all expected data points.
Review visual indicators to identify missing scans.
Use tooltips to examine specific scan files.
Export or act on completeness findings.
Classes
|
A visual tool for verifying medical scan completeness through tag combination analysis. |
- class populse_mia.user_interface.data_browser.count_table.CountTable(project)[source]¶
Bases:
QDialogA visual tool for verifying medical scan completeness through tag combination analysis.
This dialog provides an interactive interface to analyze medical scan data by selecting multiple tags (metadata fields) and displaying their combinations in a matrix format. The tool helps identify missing scans by showing which combinations of tag values have corresponding data.
- The interface consists of:
Dynamic tag selection buttons (expandable from 2 to n tags).
Add/remove controls for tag management.
A results table showing all possible combinations.
Visual indicators (✓/✗) for data presence/absence.
- Table Structure:
Rows: All combinations of the first (n-1) selected tags.
Columns: First (n-1) tag names + values of the last tag.
Cells: Count of matching scans or absence indicator.
Footer: Total counts per column.
Example
With tags [PatientName, TimePoint, SequenceName] for 2 patients (P1, P2), 3 timepoints (T1, T2, T3), and sequences (RARE, MDEFT, FLASH):
PatientName
TimePoint
RARE
MDEFT
FLASH
P1
T1
✓(2)
✓(1)
✓(1)
P1
T2
✓(1)
✓(1)
✓(1)
P1
T3
✓(2)
✓(1)
✓(1)
P2
T1
✓(2)
✓(1)
✓(1)
P2
T2
✓(2)
✓(1)
✓(1)
P2
T3
✓(2)
✓(1)
✗
Total
11
6
5
Note
P1/T2 is missing one RARE acquisition.
P2/T3 is missing the FLASH acquisition.
- Key Features:
Dynamic tag addition/removal.
Real-time scan counting.
Visual missing data indicators.
Hover tooltips showing specific scan files.
Automatic table resizing.
Contains:
Methods:
_create_clickable_label: Create a clickable label with an image.
_create_push_button: Create and configure a push button for tag selection.
_setup_components: Initialize basic UI components.
_setup_labels: Set up the add/remove tag labels with icons.
_setup_layout: Set up the layout of the widget.
_setup_table: Set up the table and count button.
add_tag: Adds a tag to visualize in the count table.
count_scans: Counts the number of scans depending on the selected tags and displays the result in the table.
fill_first_tags: Fills the cells of the table corresponding to the (n-1) first selected tags.
fill_headers: Fills the headers of the table depending on the selected tags.
fill_last_tag: Fills the cells corresponding to the last selected tag.
fill_values: Fill values_list depending on the visualized tags.
prepare_filter: Prepares the filter in order to fill the count table.
refresh_layout: Updates the layout of the widget.
remove_tag: Removes a tag to visualize in the count table.
select_tag: Opens a pop-up to select which tag to visualize in the count table.
- __init__(project) None[source]¶
Initialize the CountTable with the given project.
- Parameters:
project – The current medical imaging project, which includes a scan database
- _create_clickable_label(image_name: str, click_handler: Callable) ClickableLabel[source]¶
Create a clickable label with an image.
- Parameters:
image_name – (str) The filename of the image to display on the label.
click_handler – (Callable) The function to be called when the label is clicked.
- Returns:
(ClickableLabel) A label displaying the specified image, which triggers the click handler when clicked.
- _create_push_button(text: str, idx: int) QPushButton[source]¶
Create and configure a tag selection button.
- Parameters:
text – (str) The text to display on the button.
idx – (int) The index associated with the button for tag selection.
- Returns:
(QPushButton) A configured QPushButton that triggers the tag selection when clicked.
- count_scans() None[source]¶
Generate and populate the scan count table.
Creates a matrix showing all combinations of selected tag values, with counts or indicators for each combination’s scan availability. Early returns if no tags are selected or if database access fails.
- fill_first_tags() None[source]¶
Populate table cells for the first (n-1) selected tags.
Generates all possible combinations of the first n-1 tag values and fills corresponding table cells. Also adds total counts in the bottom row.
- fill_headers() None[source]¶
Populate table headers with tag names and last tag values.
- Sets horizontal headers for:
First n-1 columns: tag names.
Remaining columns: values of the last selected tag.
Also adds a “Total” row header.
- fill_last_tag() None[source]¶
Populate cells for the last selected tag with scan counts or indicators.
- For each combination of first n-1 tags and each value of the last tag:
Queries database for matching scans.
Shows count with checkmark if scans exist.
Shows red X if no scans found.
Adds scan filenames as tooltip.
Updates column totals.
- fill_values(idx: int) None[source]¶
Populate values list for the tag at the specified index.
Extracts all unique values for the selected tag from the database and stores them for table generation.
- Parameters:
idx – (Int) Index of the select tag.