populse_mia package

MIA is shorthand for “Multiparametric Image Analysis”. It is intended to be a complete image processing environment mainly targeted at the analysis and visualization of large amounts of MRI data.

MRI data analysis often requires a complex succession of data processing pipelines applied to a set of data acquired in an MRI exam or over several MRI exams. This analysis may need to be repeated a large number of times in studies involving a large number of acquisition sessions. Such that manual execution of the processing modules or simple ad-hoc scripting of the process may become error-prone, cumbersome and difficult to reproduce. Data processing pipelines exist in separate heterogeneous toolboxes, developed in-house or by other researchers in the field. This heterogeneity adds to the complexity of the modules are to be invoked manually.

MIA (populse_mia) aims to provide easy tools to perform complex data processing based on a definition of the inputs and outputs of the individual pipelines on a conceptual level, and implies identifying data with respect to their role in an analysis project: “the scan type”, “the subject being scanned”, “the group of this subject is part of”, etc.

Contains:
Packages:
  • data_manager: handles the projects and their database

  • sources_images: a collection of images used in Mia

  • user_interface: mainly intended for the graphic interface of Mia

  • utils: various utilities for the Mia operation

Modules:
  • info.py: define software version, description and requirements

  • main.py: the first module used at the runtime of mia

  • __main__.py: make populse_mia accessible as a module

  • software_properties.py: handles the configuration of the software

  • test.py: unitary tests

Subpackages

Submodules

populse_mia.info module

Define software version, description and requirements

Contains:
Function:
  • get_populse_mia_gitversion

populse_mia.info.get_populse_mia_gitversion()[source]

Mia version as reported by the last commit in git

Returns:

the version or None if nothing was found

populse_mia.main module

The first module used at the mia runtime.

Basically, this module is dedicated to the initialisation of the basic parameters and the various checks necessary for a successful launch of the mia’s GUI.

Contains:
Function:
  • main

populse_mia.main.main()[source]

Make basic configuration check, then actual launch of Mia.

Checks if Mia is called from the site/dist packages (user mode) or from a cloned git repository (developer mode).

~/.populse_mia/configuration_path.yml is mandatory, if it doesn’t exist or is corrupted, try to create one with a valid properties path.

  • If launched from a cloned git repository (developer mode):
    • the properties_path is the “properties_dev_path” parameter in ~/.populse_mia/configuration_path.yml

  • If launched from the site/dist packages (user mode):
    • the properties_path is the “properties_user_path” parameter in ~/.populse_mia/configuration_path.yml

Launches the verify_processes() function, then the launch_mia() function (Mia’s real launch).

populse_mia.software_properties module

Module that handle the configuration of the software

Load and save the parameters from the miniviewer and the MIA preferences pop-up in the config.yml file.

Contains:
Class:
  • Config

class populse_mia.software_properties.Config(properties_path=None)[source]

Bases: object

Object that handles the configuration of the software

Contains:
Methods:
  • get_admin_hash: get the value of the hash of the admin password

  • get_afni_path: returns the path of AFNI

  • get_ants_path: returns the path of ANTS

  • getBackgroundColor: get background color

  • get_capsul_config: get CAPSUL config dictionary

  • get_capsul_engine: get a global CapsulEngine object used for all operations in MIA application

  • getChainCursors: returns if the “chain cursors” checkbox of the mini viewer is activated

  • get_freesurfer_setup: get freesurfer path

  • get_fsl_config: returns the path of the FSL config file

  • get_mainwindow_maximized: get the maximized (full-screen) flag

  • get_mainwindow_size: get the main window size

  • get_matlab_command: returns Matlab command

  • get_matlab_path: returns the path of Matlab’s executable

  • get_matlab_standalone_path: returns the path of Matlab Compiler Runtime

  • get_max_projects: returns the maximum number of projects displayed in the “Saved projects” menu

  • get_max_thumbnails: get max thumbnails number at the data browser bottom

  • get_properties_path: returns the software’s properties path

  • get_mri_conv_path: returns the MRIManager.jar path

  • get_mrtrix_path: returns mrtrix path

  • getNbAllSlicesMax: returns the maximum number of slices to display in the mini viewer

  • get_opened_projects: returns the opened projects

  • getPathToProjectsFolder: returns the project’s path

  • get_projects_save_path: returns the folder where the projects are saved

  • get_referential: returns boolean to indicate DataViewer referential

  • get_resources_path: get the resources path

  • getShowAllSlices: returns if the “show all slices” checkbox of the mini viewer is activated

  • getSourceImageDir: get the source directory for project images

  • get_spm_path: returns the path of SPM12 (license version)

  • get_spm_standalone_path: returns the path of SPM12 (standalone version)

  • getTextColor: return the text color

  • getThumbnailTag: returns the tag that is displayed in the mini viewer

  • get_use_afni: returns the value of “use afni” checkbox in the preferences

  • get_use_ants: returns the value of “use ants” checkbox in the preferences

  • get_use_clinical: returns the value of “clinical mode” checkbox in the preferences

  • get_use_freesurfer: returns the value of “use freesurfer” checkbox in the preferences

  • get_use_fsl: returns the value of “use fsl” checkbox in the preferences

  • get_use_matlab: returns the value of “use matlab” checkbox in the preferences

  • get_use_matlab_standalone: returns the value of “use matlab standalone” checkbox in the preferences

  • get_use_mrtrix: retunrs the value of “use mrtrix” checkbox in the prefrence

  • get_user_level: get the user level in the Capsul config

  • get_user_mode: returns the value of “user mode” checkbox in the preferences

  • get_use_spm: returns the value of “use spm” checkbox in the preferences

  • get_use_spm_standalone: returns the value of “use spm standalone” checkbox in the preferences

  • getViewerConfig: returns the DataViewer configuration (neuro or radio), by default neuro

  • getViewerFramerate: returns the DataViewer framerate for automatic time running images

  • isAutoSave: checks if auto-save mode is activated

  • isControlV1: checks if the selected display of the controller is of V1 type

  • isRadioView: checks if miniviewer in radiological orientation (if not, then it is in neurological orientation)

  • loadConfig: reads the config in the config.yml file

  • saveConfig: saves the config to the config.yml file

  • set_admin_hash: set the password hash

  • set_afni_path: set the path of the AFNI

  • set_ants_path: set the path of the ANTS

  • set_mrtrix_path: set the path of mrtrix

  • setAutoSave: sets the auto-save mode

  • setBackgroundColor: sets the background color

  • set_capsul_config: set CAPSUL configuration dict into MIA config

  • setChainCursors: set the “chain cursors” checkbox of the mini viewer

  • set_clinical_mode: set the value of “clinical mode” in the preferences

  • setControlV1: Set controller display mode (True if V1)

  • set_freesurfer_setup: set freesurfer path

  • set_fsl_config: set the path of the FSL config file

  • set_mainwindow_maximized: set the maximized (fullscreen) flag

  • set_mainwindow_size: set main window size

  • set_matlab_path: set the path of Matlab’s executable

  • set_matlab_standalone_path: set the path of Matlab Compiler Runtime

  • set_max_projects: set the maximum number of projects displayed in the “Saved projects” menu

  • set_max_thumbnails: set max thumbnails number at the data browser bottom

  • set_mri_conv_path: set the MRIManager.jar path

  • setNbAllSlicesMax: set the maximum number of slices to display in the mini viewer

  • set_opened_projects: set the opened projects

  • set_projects_save_path: set the folder where the projects are saved

  • set_radioView: set the orientation in miniviewer (True for radiological, False for neurological orientation)

  • set_referential: set the DataViewer referential

  • set_resources_path: Set the resources path

  • setShowAllSlices: set the “show all slices” checkbox of the mini viewer

  • setSourceImageDir: set the source directory for project images

  • set_spm_path: set the path of SPM12 (license version)

  • set_spm_standalone_path: set the path of SPM12 (standalone version)

  • setTextColor: set the text color

  • setThumbnailTag: set the tag that is displayed in the mini viewer

  • set_use_afni: set the value of “use afni” checkbox in the preferences

  • set_use_ants: set the value of “use ants” checkbox in the preferences

  • set_use_freesurfer: set the value of “use freesurfer” checkbox

    in the preferences

  • set_use_fsl: set the value of “use fsl” checkbox in the preferences

  • set_use_matlab: set the value of “use matlab” checkbox in the preferences

  • set_use_matlab_standalone: set the value of “use matlab standalone” checkbox in the preferences

  • set_use_mrtrix: set the value of “use mrtrix” checkbox in the preferences

  • set_user_mode: set the value of “user mode” checkbox in the preferences

  • set_use_spm: set the value of “use spm” checkbox in the preferences

  • set_use_spm_standalone: set the value of “use spm standalone” checkbox in the preferences

  • setViewerConfig: set the Viewer configuration neuro or radio

  • setViewerFramerate: set the Viewer frame rate for automatic running time images

  • update_capsul_config: update a global CapsulEngine object used for all operations in MIA application

__init__(properties_path=None)[source]

Initialization of the Config class

Parameters:
  • config_path:

    str (optional). If provided, the configuration file will be loaded/saved from the given directory. Otherwise, the regular heuristics will be used to determine the config path. This option allows to use an alternative config directory (for tests for instance).

capsul_engine = None
getBackgroundColor()[source]

Get background color.

Returns:

string of the background color

getChainCursors()[source]

Get the value of the checkbox ‘chain cursor’ in miniviewer.

Returns:

boolean

getNbAllSlicesMax()[source]

Get number the maximum number of slices to display in the miniviewer.

Returns:

Integer

getPathToProjectsFolder()[source]

Get the project’s path.

Returns:

string of the path

getShowAllSlices()[source]

Get whether the show_all_slices parameters was enabled or not in the miniviewer.

Returns:

boolean

getSourceImageDir()[source]

Get the source directory for project images.

Returns:

string of the path

getTextColor()[source]

Get the text color.

Returns:

string

getThumbnailTag()[source]

Get the tag of the thumbnail displayed in the miniviewer.

Returns:

string

getViewerConfig()[source]

Get the viewer config neuro or radio, neuro by default

Returns:

String

getViewerFramerate()[source]

Get the Viewer framerate

Returns:

integer

get_admin_hash()[source]

Get the value of the hash of the admin password.

Returns:

string

get_afni_path()[source]

Get the AFNI path

Returns:

string of path to AFNI

get_ants_path()[source]

Get the ANTS path

Returns:

string of path to ANTS

get_capsul_config(sync_from_engine=True)[source]

Get CAPSUL config dictionary.

Parameters:

sync_from_engine – if True, perform a synchronisation with CAPSUL engine (Bool)

Returns:

capsul_config: the CAPSUL configuration saved into Mia config (Dict)

static get_capsul_engine()[source]

Get a global CapsulEngine object used for all operations in MIA application. The engine is created once when needed.

Returns:

Config.capsul_engine: capsul.engine.CapsulEngine object

get_freesurfer_setup()[source]

Get the freesurfer path

Returns:

string of path to freesurfer

get_fsl_config()[source]

Get the FSL config file path

Returns:

string of path to the fsl/etc/fslconf/fsl.sh file

get_mainwindow_maximized()[source]

Get the maximized (fullscreen) flag

Returns:

boolean

get_mainwindow_size()[source]

Get the main window size

Returns:

list or None

get_matlab_command()[source]

Get Matlab command.

Returns:

matlab executable path or nothing if matlab path not specified

get_matlab_path()[source]

Get the path to the matlab executable.

Returns:

String of path

get_matlab_standalone_path()[source]

Get the path to matlab compiler runtime.

Returns:

string of path

get_max_projects()[source]

Get the maximum number of projects displayed in the “Saved projects” menu.

Returns:

Integer

get_max_thumbnails()[source]

Get the max thumbnails number at the data browser bottom.

Returns:

Integer

get_mri_conv_path()[source]

Get the MRIManager.jar path.

Returns:

string of the path to the MRIManager.jar

get_mrtrix_path()[source]

Get the mrtrix path

Returns:

string of path to mrtrix

get_opened_projects()[source]

Get opened projects.

Returns:

list of opened projects

get_projects_save_path()[source]

Get the path where projects are saved.

Returns:

string of path

get_properties_path()[source]

Get the path to the folder containing the processes and properties folders of mia (properties_path).

The properties_path is defined and stored in the configuration_path.yml file, located in the ~/.populse_mia folder.

If Mia is launched in user mode, properties path must compulsorily be returned from the “properties_user_path” parameter of the configuration_path.yml file.

If mia is launched in developer mode, mia path must compulsorily be returned from the “properties_dev_path” parameter of the configuration_path.yml file.

Returns:

string of path to properties folder

get_referential()[source]

Checks in anatomist_2 data viewer which referential has been chosen

Returns:

0 for World Coordinates, 1 for Image ref

get_resources_path()[source]

Get the resources path.

Returns:

string of the path to the resources folder

get_spm_path()[source]

Get the path of SPM12.

Returns:

string of path

get_spm_standalone_path()[source]

Get the path to the SPM12 (standalone version).

Returns:

String of path

get_use_afni()[source]

Get the value of “use afni” checkbox in the preferences.

Returns:

boolean

get_use_ants()[source]

Get the value of “use ants” checkbox in the preferences.

Returns:

boolean

get_use_clinical()[source]

Get the clinical mode in the preferences.

Returns:

boolean

get_use_freesurfer()[source]

Get the value of “use freesurfer” checkbox in the preferences.

Returns:

boolean

get_use_fsl()[source]

Get the value of “use fsl” checkbox in the preferences.

Returns:

boolean

get_use_matlab()[source]

Get the value of “use matlab” checkbox in the preferences.

Returns:

boolean

get_use_matlab_standalone()[source]

Get the value of “use matlab standalone” checkbox in the preferences.

Returns:

boolean

get_use_mrtrix()[source]

Get the value of “use mrtrix” checkbox in the preferences.

Returns:

boolean

get_use_spm()[source]

Get the value of “use spm” checkbox in the preferences.

Returns:

boolean

get_use_spm_standalone()[source]

Get the value of “use spm standalone” checkbox in the preferences.

Returns:

boolean

get_user_level()[source]

Get the user level in the Capsul config

Returns:

integer

get_user_mode()[source]

Get if user mode is disabled or enabled in the preferences.

Returns:

boolean

isAutoSave()[source]

Get if the auto-save mode is enabled or not.

Returns:

boolean

isControlV1()[source]

Get if the display of the controller is of V1 type.

Returns:

boolean

isRadioView()[source]

Get if the display in miniviewer is in radiological orientation.

  • True for radiological

  • False for neurological

Returns:

boolean

loadConfig()[source]

Read the config in the config.yml file.

Returns:

Returns a dictionary of the contents of config.yml

saveConfig()[source]

Save the current parameters in the config.yml file.

setAutoSave(save)[source]

Set auto-save mode.

Parameters:

save – boolean

setBackgroundColor(color)[source]

Set background color and save configuration.

Parameters:

color – Color string (‘Black’, ‘Blue’, ‘Green’, ‘Grey’, ‘Orange’, ‘Red’, ‘Yellow’, ‘White’)

setChainCursors(chain_cursors)[source]

Set the value of the checkbox ‘chain cursor’ in the mini viewer.

Parameters:

chain_cursors – Boolean

setControlV1(controlV1)[source]

Set controller display mode (True if V1).

Parameters:

controlV1 – boolean

setNbAllSlicesMax(nb_slices_max)[source]

Set the number of slices to display in the mini viewer.

Parameters:

nb_slices_max – maximum number of slices to display (Int)

setShowAllSlices(show_all_slices)[source]

Set the show_all_slides setting in miniviewer.

Parameters:

show_all_slices – Boolean

setSourceImageDir(source_image_dir)[source]

Set the source directory for project images.

Parameters:

source_image_dir – String of path

setTextColor(color)[source]

Set text color and save configuration.

Parameters:

color – Color string (‘Black’, ‘Blue’, ‘Green’, ‘Grey’, ‘Orange’, ‘Red’, ‘Yellow’, ‘White’)

setThumbnailTag(thumbnail_tag)[source]

Set the tag that is displayed in the mini viewer.

Parameters:

thumbnail_tag – string

setViewerConfig(config_NeuRad)[source]

sets user’s configuration neuro or radio for data_viewer

  • neuro: neurological

  • radio: radiological

Parameters:

config_NeuRad – string

setViewerFramerate(im_sec)[source]

sets user’s framerate for data_viewer

Parameters:

im_sec – int

set_admin_hash(admin_hash)[source]

Set the password hash.

Parameters:

admin_hash – string of hash

set_afni_path(path)[source]

Set the AFNI path

Parameters:

path – string of AFNI path

set_ants_path(path)[source]

Set the ANTS path

Parameters:

path – string of ANTS path

set_capsul_config(capsul_config_dict)[source]

Set CAPSUL configuration dict into MIA config.

This method is used just (and only) after editing capsul config (in File > Mia preferences, Pipeline tab, Edit CAPSUL config button), in order to synchronise the new Capsul config with the Mia preferences.

Parameters:

capsul_config_dict – a dict; {‘engine’: {…}, ‘engine_modules’: […]}

set_clinical_mode(clinical_mode)[source]

Enable of disable clinical mode.

Parameters:

clinical_mode – boolean

set_freesurfer_setup(path)[source]

Set the freesurfer config file

Parameters:

path – string of path to freesurfer/FreeSurferEnv.sh

set_fsl_config(path)[source]

Set the FSL config file

Parameters:

path – string of path to fsl/etc/fslconf/fsl.sh

set_mainwindow_maximized(enabled)[source]

Set the maximized (full-screen) flag

Parameters:

enabled – boolean

set_mainwindow_size(size)[source]

Set main window size

Parameters:

size – list

set_matlab_path(path)[source]

Set the path of Matlab’s executable.

Parameters:

path – string of path

set_matlab_standalone_path(path)[source]

Set the path of Matlab Compiler Runtime.

Parameters:

path – string of path

set_max_projects(nb_max_projects)[source]

Set the maximum number of projects displayed in the “Saved projects” menu.

Parameters:

nb_max_projects – Integer

set_max_thumbnails(nb_max_thumbnails)[source]

Set max thumbnails number at the data browser bottom.

Parameters:

nb_max_thumbnails – Integer

set_mri_conv_path(path)[source]

Set the MRIManager.jar path.

Parameters:

path – string of the path

set_mrtrix_path(path)[source]

Set the mrtrix path

Parameters:

path – string of mrtrix path

set_opened_projects(new_projects)[source]

Set the list of opened projects and saves the modification.

Parameters:

new_projects – list of path

set_projects_save_path(path)[source]

Set the folder where the projects are saved.

Parameters:

path – string of path

set_radioView(radio_view)[source]

Set the radiological/neurological orientation in mini viewer.

  • True for radiological

  • False for neurological

Parameters:

radio_view – boolean

set_referential(ref)[source]

Set the referential to image ref or world coordinates in anatomist_2 data viewer.

Parameters:

ref – str; 0 for World Coordinates, 1 for Image ref

set_resources_path(path)[source]

Set the resources path.

Parameters:

path – string of the path

set_spm_path(path)[source]

Set the path of SPM (license version).

Parameters:

path – string of path

set_spm_standalone_path(path)[source]

Set the path of SPM (standalone version).

Parameters:

path – string of path

set_use_afni(use_afni)[source]

Set the value of “use_afni” checkbox in the preferences.

Parameters:

use_afni – boolean

set_use_ants(use_ants)[source]

Set the value of “use_ants” checkbox in the preferences.

Parameters:

use_ants – boolean

set_use_freesurfer(use_freesurfer)[source]

Set the value of “use_freesurfer” checkbox in the preferences.

Parameters:

use_freesurfer – boolean

set_use_fsl(use_fsl)[source]

Set the value of “use_fsl” checkbox in the preferences.

Parameters:

use_fsl – boolean

set_use_matlab(use_matlab)[source]

Set the value of “use matlab” checkbox in the preferences.

Parameters:

use_matlab – boolean

set_use_matlab_standalone(use_matlab_standalone)[source]

Set the value of “use_matlab_standalone” checkbox in the preferences.

Parameters:

use_matlab – boolean

set_use_mrtrix(use_mrtrix)[source]

Set the value of “use_mrtrix” checkbox in the preferences.

Parameters:

use_mrtrix – boolean

set_use_spm(use_spm)[source]

Set the value of “use spm” checkbox in the preferences.

Parameters:

use_spm – boolean

set_use_spm_standalone(use_spm_standalone)[source]

Set the value of “use spm standalone” checkbox in the preferences.

Parameters:

use_spm_standalone – boolean

set_user_mode(user_mode)[source]

Enable of disable user mode.

Parameters:

user_mode – boolean

update_capsul_config()[source]

Update a global CapsulEngine object used for all operations in MIA application. The engine is created once when needed, and updated each time the config is saved.

Returns:

capsul.engine.CapsulEngine object

populse_mia.test module