populse_mia.user_interface.data_browser package¶
Handle the data browser tab. Visualize, modify and search data.
- Contains:
- Module:
advanced_search
count_table
data_browser
mini_viewer
modify_table
rapid_search
Submodules¶
populse_mia.user_interface.data_browser.advanced_search module¶
Module to define the advanced search.
- Contains:
- Class:
AdvancedSearch
- class populse_mia.user_interface.data_browser.advanced_search.AdvancedSearch(project, data_browser, scans_list=None, tags_list=None, from_pipeline=False)[source]¶
Bases:
QWidget
Class that manages the widget of the advanced search
The advanced search creates a complex query to the database and is a combination of several “query lines” which are linked with AND or OR and all composed of: - A negation or not - A tag name or all visible tags - A condition (==, !=, >, <, >=, <=, CONTAINS, IN, BETWEEN) - A value
- __init__(project, data_browser, scans_list=None, tags_list=None, from_pipeline=False)[source]¶
Initialization of the AdvancedSearch class
- Parameters:
project – current project in the software
data_browser – parent data browser widget
scans_list – current list of the documents
tags_list – list of the visualized tags
from_pipeline – True if the widget is called from the pipeline manager
- apply_filter(filter)[source]¶
Apply an opened filter to update the table.
- Parameters:
filter – Filter object opened to apply
- displayConditionRules(field, condition)[source]¶
Set the list of condition choices, depending on the tag type
- Parameters:
field – field
condition – condition
- displayValueRules(choice, value)[source]¶
Update the placeholder text. when the condition choice is changed.
- Parameters:
choice – choice
value – value
- get_filters(replace_all_by_fields)[source]¶
Get the filters in a list
- Parameters:
replace_all_by_fields – to replace All visualized tags by the list of visible fields
- Returns:
Lists of filters (fields, conditions, values, links, nots)
- static prepare_filters(links, fields, conditions, values, nots, scans)[source]¶
Prepare the str representation of the filter
- Parameters:
links – list of links (AND/OR)
fields – list of fields
conditions – list of conditions (==, !=, <, >, <=, >=, IN, BETWEEN, CONTAINS, HAS VALUE, HAS NO VALUE)
values – list of values
nots – list of negations (”” or NOT)
scans – list of scans to search in
- Returns:
str representation of the filter
populse_mia.user_interface.data_browser.count_table module¶
Module to define CountTable popup.
- Contains:
- Class:
CountTable
- class populse_mia.user_interface.data_browser.count_table.CountTable(project)[source]¶
Bases:
QDialog
Tool to precisely verify the scans of the project.
It is composed of push buttons on its top, each one corresponding to a tag selected by the user. When, the “Count scans” button is clicked, a table is created with all the combinations possible for the values of the first n-1 tags. Then, the m values that can take the last tag are displayed in the header of the m last columns of the table. The cells are then filled with a green plus or a red cross depending on if there is at least a scan that has all the tags values or not.
- Example:
Assume that the current project has scans for two patients (P1 and P2) and three time points (T1, T2 and T3). For each (patient, time point), several sequences have been made (two RARE, one MDEFT and one FLASH). Selecting [PatientName, TimePoint, SequenceName] as tags, the table will be:
PatientName
TimePoint
RARE
MDEFT
FLASH
P1
T1
v(2)
v(1)
v(1)
P1
T2
v(2)
v(1)
v(1)
P1
T3
v(2)
v(1)
v(1)
P2
T1
v(2)
v(1)
v(1)
P2
T2
v(2)
v(1)
v(1)
P2
T3
v(2)
v(1)
v(1)
with v(n) meaning that n scans corresponds of the selected values for (PatientName, TimePoint,SequenceName).
If no scans corresponds for a triplet value, a red cross will be displayed. For example, if the user forgets to import one RARE for P1 at T2 and one FLASH for P2 at T3. The table will be:
PatientName
TimePoint
RARE
MDEFT
FLASH
P1
T1
v(2)
v(1)
v(1)
P1
T2
v(1)
v(1)
v(1)
P1
T3
v(2)
v(1)
v(1)
P2
T1
v(2)
v(1)
v(1)
P2
T2
v(2)
v(1)
v(1)
P2
T3
v(2)
v(1)
x
Thus, thanks to the CountTable tool, he or she directly knows if some scans are missing.
- __init__(project)[source]¶
Initialization of the Count Table
- Parameters:
project – current project in the software
- count_scans()[source]¶
Counts the number of scans depending on the selected tags and displays the result in the table
- fill_first_tags()[source]¶
Fills the cells of the table corresponding to the (n-1) first selected tags
- fill_values(idx)[source]¶
Fill values_list depending on the visualized tags
- Parameters:
idx – index of the select tag
populse_mia.user_interface.data_browser.data_browser module¶
Module to define data browser tab appearance, settings and methods.
- Contains:
- Class:
DataBrowser
DateFormatDelegate
DateTimeFormatDelegate
NumberFormatDelegate
TableDataBrowser
TimeFormatDelegate
- class populse_mia.user_interface.data_browser.data_browser.DataBrowser(project, main_window)[source]¶
Bases:
QWidget
Widget that contains everything in the Data Browser tab.
- Parameters:
project – current project in the software
main_window – main window of the software
- __init__(project, main_window)[source]¶
Initialization of the data_browser class
- Parameters:
project – current project in the software
main_window – main window of the software
- add_tag_infos(new_tag_name, new_default_value, tag_type, new_tag_description, new_tag_unit)[source]¶
Add the tag after add tag pop-up.
- Parameters:
new_tag_name – New tag name
new_default_value – New default value
tag_type – New tag type
new_tag_description – New tag description
new_tag_unit – New tag unit
- clone_tag_infos(tag_to_clone, new_tag_name)[source]¶
Clone the tag after the clone tag pop-up.
- Parameters:
tag_to_clone – Tag to clone
new_tag_name – New tag name
- remove_tag_infos(tag_names_to_remove)[source]¶
Remove user tags after the pop-up.
- Parameters:
tag_names_to_remove – list of tags to remove
- class populse_mia.user_interface.data_browser.data_browser.DateFormatDelegate(parent=None)[source]¶
Bases:
QItemDelegate
Delegate that is used to handle dates in the TableDataBrowser.
- class populse_mia.user_interface.data_browser.data_browser.DateTimeFormatDelegate(parent=None)[source]¶
Bases:
QItemDelegate
Delegate that is used to handle date & time in the TableDataBrowser.
- class populse_mia.user_interface.data_browser.data_browser.NumberFormatDelegate(parent=None)[source]¶
Bases:
QItemDelegate
Delegate that is used to handle numbers in the TableDataBrowser.
- class populse_mia.user_interface.data_browser.data_browser.TableDataBrowser(project, data_browser, tags_to_display, update_values, activate_selection, link_viewer=True)[source]¶
Bases:
QTableWidget
Table widget that displays the documents contained in the database and their associated tags.
- __init__(project, data_browser, tags_to_display, update_values, activate_selection, link_viewer=True)[source]¶
Initialization of the class
- Parameters:
project – current project in the software
data_browser – parent data browser widget
tags_to_display – list of tags to display
update_values – boolean to specify if edition is enabled
activate_selection – dictionary containing information about the processes that has been run to generate documents
link_viewer – boolean to specify if the table is linked to a viewer
- add_column(column, tag)[source]¶
Add a column to the table
- Parameters:
column – index of the column to add
tag – tag name to add
- add_rows(rows)[source]¶
Insert rows if they are not already in the table.
- Parameters:
rows – list of all scans
- change_cell_color(item_origin)[source]¶
Change the background color and the value of cells when edited by the user. Handle the multi-selection case.
- Parameters:
item_origin – item from where the call comes from
Create the context menu of the table.
- Parameters:
position – position of the mouse cursor
- delete_from_brick(name)[source]¶
Delete a document from its brick id.
This method is used to clean the database when the user initializes a pipeline (multiple bricks) but doesn’t run it before initializing another one or closing the software.
- Parameters:
name – string of the brick id
- fill_headers(take_tags_to_update=False)[source]¶
Initialize and fill the headers of the table.
- Parameters:
take_tags_to_update – boolean to hide or show tags
- get_current_filter()[source]¶
Get the current data browser selection (list of paths).
If there is a current selection, the list of selected scans is returned otherwise the list of the visible paths in the data browser is returned.
- Returns:
the list of scans corresponding to the current selection in the data browser
- get_index_insertion(to_insert)[source]¶
Get index insertion of a new column, since it’s already sorted in alphabetical order.
- Parameters:
to_insert – tag to insert
- get_scan_row(scan)[source]¶
Return the row index of the scan.
- Parameters:
scan – scan filename
- Returns:
index of the row of the scan
- get_tag_column(tag)[source]¶
Return the column index of the tag.
- Parameters:
tag – tag name
- Returns:
index of the column of the tag
- multiple_sort_infos(list_tags, order)[source]¶
Sort the table according to the tags specify in list_tags.
- Parameters:
list_tags – list of the tags on which to sort the documents
order – “Ascending” or “Descending”
- section_moved(logical_index, old_index, new_index)[source]¶
Update the visual index and forbid to move the first column when the user try to move columns.
- Parameters:
logical_index – int of the column logical index
old_index – int of the column old visual index
new_index – int of the column new visual index
- select_all_column(col)[source]¶
Select all column when the header is double clicked
- Parameters:
col – column to select
- sort_column(order)[source]¶
Sort the current column.
- Parameters:
order – order of sort (0 for ascending, 1 for descending)
- sort_updated(column, order)[source]¶
Update project and tab parameters after a sort.
- Parameters:
column – index of that was sorted
order – boolean of the new order
- update_table(take_tags_to_update=False)[source]¶
Fill the table with the project’s data.
Only called when switching project to completely reset the table.
- Parameters:
take_tags_to_update – boolean
- update_visualized_columns(old_tags, showed)[source]¶
Update the tags shown in the table.
- Parameters:
old_tags – old list of visualized tags
showed – list of tags to display
- class populse_mia.user_interface.data_browser.data_browser.TimeFormatDelegate(parent=None)[source]¶
Bases:
QItemDelegate
Delegate that is used to handle times in the TableDataBrowser.
- createEditor(parent, option, index)[source]¶
Override of the createEditor method, called to generate the widget.
- Parameters:
parent – QWidget parent
option – Only used to overload the QItemDelegate class
index – Only used to overload the QItemDelegate class
- Returns:
The QWidget with a specified format
populse_mia.user_interface.data_browser.mini_viewer module¶
Module to define the mini viewer.
- Contains:
- Class:
MiniViewer
- class populse_mia.user_interface.data_browser.mini_viewer.MiniViewer(project)[source]¶
Bases:
QWidget
MiniViewer that allows to rapidly visualize scans either with a single image per scan with cursors to move in five dimensions or with all images of the greater dimension of the scan.
When the latter is selected, the displayed images depends on their dimension:
3D: display all the slices.
- 4D: display the middle slice of the third dimension for each time
of the fourth dimension.
- 5D: display the middle slice of the third dimension for the first
time of the fourth dimension for each time of the fifth dimension.
- Note:
idx corresponds to the index of the displayed image
idx in [0, self.max_scans]
- most of the class’s attributes are lists of 0 to self.max_scans
elements
- __init__(project)[source]¶
Initialise the MiniViewer object
- Parameters:
project – current project in the software
- boxSlider(idx)[source]¶
Define horizontal sliders connections and thumbnail labels.
- Parameters:
idx – the selected index
- changePosValue(idx, cursor_to_change)[source]¶
Change the value of a cursor for the selected index.
- Parameters:
idx – the selected index
cursor_to_change – the cursor to change (1, 2 or 3)
- check_box_cursors_state_changed()[source]¶
Update the config file.
Called when the state of the checkbox to chain the cursors changes.
- createDimensionLabels(idx)[source]¶
Create the dimension labels for the selected index.
- Parameters:
idx – the selected index
- createFieldValue()[source]¶
Create a field where will be displayed the position of a cursor.
- Returns:
the corresponding field
- create_slider(maxm=0, minm=0, pos=0)[source]¶
Generate an horizontal slider.
- Parameters:
maxm – slider’s maximum
minm – slider’s minimum
pos – slider’s initial value
- Returns:
the slider object
- displayPosValue(idx)[source]¶
Display the position of each cursor for the selected index.
- Parameters:
idx – the selected index
- image2DModifications(idx, im2D=None)[source]¶
Apply modifications to display the image correctly.
- Parameters:
idx – the selected index
im2D – image to modify
- image_to_pixmap(im, i)[source]¶
Create a 2D pixmap from a N-D Nifti image.
- Parameters:
im – Nifti image
i – index of the slide
- Returns:
the corresponding pixmap
- indexImage(idx)[source]¶
Update all slider values according to the size of the current image.
- Parameters:
idx – the selected index
Display the 2D image for the selected index.
- Parameters:
idx – the selected index
- setThumbnail(file_path_base_name, idx)[source]¶
Set the thumbnail tag value under the image frame.
- Parameters:
file_path_base_name – basename of the selected path
idx – index of the image
- show_slices(file_paths)[source]¶
Creates the thumbnails from the selected file paths.
- Parameters:
file_paths – the selected file paths
- update_nb_slices()[source]¶
Update the config file and the thumbnails.
Called when the number of slices to visualize changes.
populse_mia.user_interface.data_browser.modify_table module¶
Module to handle updates of the databrowser table after modifications.
- Contains:
- Class:
ModifyTable
- class populse_mia.user_interface.data_browser.modify_table.ModifyTable(project, value, types, scans, tags)[source]¶
Bases:
QDialog
Used to modify the contents of cells which contains lists.
When the user wishes to modify a cell which contains a list in the databrowser tab, a popup will appear to help the user to change the content of the cell.
populse_mia.user_interface.data_browser.rapid_search module¶
Module to define the rapid search.
- Contains:
- Class:
RapidSearch
- class populse_mia.user_interface.data_browser.rapid_search.RapidSearch(databrowser)[source]¶
Bases:
QLineEdit
- Widget used to search for a pattern in the table (for all the visualized
tags).
Enter % to replace any string, _ to replace any character , Not Defined for the scans with missing value(s). Dates are in the following format: yyyy-mm-dd hh:mm:ss.fff”
- Parameters:
databrowser – parent data browser widget
- __init__(databrowser)[source]¶
Initialization of RapidSearch class.
- Parameters:
databrowser – parent data browser widget