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.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

add_tag()[source]

Adds a tag to visualize in the count table

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_headers()[source]

Fills the headers of the table depending on the selected tags

fill_last_tag()[source]

Fills the cells corresponding to the last selected tag

fill_values(idx)[source]

Fill values_list depending on the visualized tags

Parameters:

idx – index of the select tag

static prepare_filter(couples)[source]

Prepares the filter in order to fill the count table

Parameters:

couples – (tag, value) couples

Returns:

Str query of the corresponding filter

refresh_layout()[source]

Updates the layout of the widget

remove_tag()[source]

Removes a tag to visualize in the count table

select_tag(idx)[source]

Opens a pop-up to select which tag to visualize in the count table

Parameters:

idx – the index of the selected push button

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

add_tag_pop_up()[source]

Display the add tag pop-up.

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

clone_tag_pop_up()[source]

Display the clone tag pop-up.

connect_actions()[source]

Connect methods to actions.

connect_mini_viewer()[source]

Display the selected documents in the viewer.

connect_toolbar()[source]

Connect methods to toolbar.

count_table_pop_up()[source]

Open the count table pop-up.

create_layout()[source]

Create the layouts of the tab.

create_toolbar_view()[source]

Create the toolbar menu at the top of the tab

move_splitter()[source]

Check if the viewer’s splitter is at its lowest position.

open_filter()[source]

Open a project filter that has already been saved.

open_filter_infos()[source]

Apply the current filter.

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

remove_tag_pop_up()[source]

Display the pop-up to remove user tags.

Reset the rapid search bar.

Launch the advanced search.

search_str(str_search)[source]

Search a string in the table and updates the visualized documents.

Parameters:

str_search – string to search

send_documents_to_pipeline()[source]

Send the current list of scans to the Pipeline Manager.

update_database(database)[source]

Update the database in the software. Called when switching project (new, open, and save as).

Parameters:

database – New instance of Database

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.

__init__(parent=None)[source]
createEditor(parent, option, index)[source]

Override of the createEditor method, called to generate the widget.

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.

__init__(parent=None)[source]
createEditor(parent, option, index)[source]

Override of the createEditor method, called to generate the widget.

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.

__init__(parent=None)[source]
createEditor(parent, option, index)[source]

Override of the createEditor method, called to generate the widget.

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_columns()[source]

Add columns.

add_path()[source]

Call a pop-up to add any document to the project.

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

clear_cell()[source]

Clear the selected cells.

context_menu_table(position)[source]

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

display_file()[source]

Tries to display a file in the user’s preferred application.

display_unreset_values()[source]

Display an error message when trying to reset user tags.

edit_table_data_values()[source]

Change values in DataBrowser

fill_cells_update_table()[source]

Initialize and fill the cells of the table.

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

mouseReleaseEvent(event)[source]

Update table after mouse release.

Parameters:

event – event

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”

multiple_sort_pop_up()[source]

Display the multiple sort pop-up.

remove_scan()[source]

Remove documents from table and project.

reset_cell()[source]

Reset the selected cells to their original values.

reset_column()[source]

Reset the selected columns to their original values.

reset_row()[source]

Reset the selected rows to their original values.

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

select_all_columns()[source]

Select one or several column(s). Called from the context menu.

selection_changed()[source]

Update the tab view when the selection changes.

show_brick_history(scan)[source]

Show brick history pop-up.

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_colors()[source]

Update the background of all the cells.

update_selection()[source]

Update the selection after a search.

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

update_visualized_rows(old_scans)[source]

Update the list of documents (scans) in the table.

Parameters:

old_scans – old list of scans

visualized_tags_pop_up()[source]

Display the visualized tags pop-up.

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.

__init__(parent=None)[source]

Initialization of the class

Parameters:

parent – QWidget parent

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.

clear()[source]

Remove the Nibabel images to be able to remove it in the unit tests

clearLayouts()[source]

Clear the final layout

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

createLayouts()[source]

Create the layouts.

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

enableSliders(idx)[source]

Enable all the horizontal slider.

Parameters:

idx – the slider’s 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

mem_release()[source]

Reset all object lists to zero in order to preserve memory

navigImage(idx)[source]

Display the 2D image for the selected index.

Parameters:

idx – the selected index

openTagsPopUp()[source]

Open a pop-up to select the legend of the thumbnails.

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.

update_visualization_method()[source]

Update the config file and the thumbnails.

Called when the state of the checkbox to show all slices changes.

verify_slices(file_paths)[source]

Make ‘Show all slices’ checkbox unclickable if len(file_paths) > 1.

Parameters:

file_paths – the selected documents

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.

__init__(project, value, types, scans, tags)[source]

Initialization of the ModifyTable class

Parameters:
  • project – Instance of project

  • value – List of values of the cell

  • types – Value types

  • scans – Scans of the rows

  • tags – Tags of the columns

add_item()[source]

Add one more element to self.value

fill_table()[source]

Fill the table.

rem_last_item()[source]

Remove last element of self.value

update_table_values(test=False)[source]

Update the table in the database when the ‘OK’ button is clicked.