mia_processes.bricks.tools package

General bricks needed to build pipelines or to operate other bricks (input data manipulations, etc.).

Submodules

mia_processes.bricks.tools.tools module

The toolbox library of the mia_processes package.

Basically, this module is dedicated to the low-level processes needed to run other higher-level bricks.

Contains
Class
  • Concat_to_list

  • Concat_to_list_of_list

  • Delete_data

  • Files_To_List

  • Filter_Files_List

  • Find_In_List

  • Get_Conditions_From_csv

  • Get_Patient_Name

  • Import_Data

  • Input_Filter

  • List_Duplicate

  • List_To_File

  • Make_A_List

  • Make_CVR_reg_physio

class mia_processes.bricks.tools.tools.Concat_to_list[source]

Bases: populse_mia.user_interface.pipeline_manager.process_mia.ProcessMIA

Make an output list corresponding to the concatenation of list1 and list2

Ex. [‘a’, ‘b’, ‘c’] and [‘d’, ‘e’] gives

[‘a’, ‘b’, ‘c’, ‘d’, ‘e’]

Please, see the complete documentation for the Concat_to_list brick in the mia_processes website

Note

  • Type ‘Concat_to_list.help()’ for a full description of this process parameters.

  • Type ‘<Concat_to_list>.get_input_spec()’ for a full description of this process input trait types.

  • Type ‘<Concat_to_list>.get_output_spec()’ for a full description of this process output trait types.

__init__()[source]

Dedicated to the attributes initialisation/instantiation.

The input and output plugs are defined here. The special ‘self.requirement’ attribute (optional) is used to define the third-party products necessary for the running of the brick.

list_outputs(is_plugged=None)[source]

Dedicated to the initialisation step of the brick.

The main objective of this method is to produce the outputs of the bricks (self.outputs) and the associated tags (self.inheritance_dic), if defined here. In order not to include an output in the database, this output must be a value of the optional key ‘notInDb’ of the self.outputs dictionary. To work properly this method must return self.make_initResult() object.

Parameters

is_plugged – the state, linked or not, of the plugs.

Returns

a dictionary with requirement, outputs and inheritance_dict.

run_process_mia()[source]

Dedicated to the process launch step of the brick.

class mia_processes.bricks.tools.tools.Concat_to_list_of_list[source]

Bases: populse_mia.user_interface.pipeline_manager.process_mia.ProcessMIA

Iteration of input list1 with each element of input list2

Ex. [‘a’, ‘b’, ‘c’] and [‘1’, ‘2’] gives
[[‘a’, ‘1’], [‘a’, ‘2’],

[‘b’, ‘1’], [‘b’, ‘2’], [‘c’, ‘1’], [‘c’, ‘2’]

Please, see the complete documentation for the Concat_to_list_of_list brick in the mia_processes website

Note

  • Type ‘Concat_to_list_of_list.help()’ for a full description of this process parameters.

  • Type ‘<Concat_to_list_of_list>.get_input_spec()’ for a full description of this process input trait types.

  • Type ‘<Concat_to_list_of_list>.get_output_spec()’ for a full description of this process output trait types.

__init__()[source]

Dedicated to the attributes initialisation/instantiation.

The input and output plugs are defined here. The special ‘self.requirement’ attribute (optional) is used to define the third-party products necessary for the running of the brick.

list_outputs(is_plugged=None)[source]

Dedicated to the initialisation step of the brick.

The main objective of this method is to produce the outputs of the bricks (self.outputs) and the associated tags (self.inheritance_dic), if defined here. In order not to include an output in the database, this output must be a value of the optional key ‘notInDb’ of the self.outputs dictionary. To work properly this method must return self.make_initResult() object.

Parameters

is_plugged – the state, linked or not, of the plugs.

Returns

a dictionary with requirement, outputs and inheritance_dict.

run_process_mia()[source]

Dedicated to the process launch step of the brick.

class mia_processes.bricks.tools.tools.Delete_data[source]

Bases: populse_mia.user_interface.pipeline_manager.process_mia.ProcessMIA

Delete from database data

Please, see the complete documentation for the Delete_data brick in the mia_processes website

Note

  • Type ‘Delete_data.help()’ for a full description of this process parameters.

  • Type ‘<Delete_data>.get_input_spec()’ for a full description of this process input trait types.

  • Type ‘<Delete_data>.get_output_spec()’ for a full description of this process output trait types.

__init__()[source]

Dedicated to the attributes initialisation / instantiation.

The input and output plugs are defined here. The special ‘self.requirement’ attribute (optional) is used to define the third-party products necessary for the running of the brick.

list_outputs(is_plugged=None)[source]

Dedicated to the initialisation step of the brick. The main objective of this method is to produce the outputs of the bricks (self.outputs) and the associated tags (self.inheritance_dic), if defined here. In order not to include an output in the database, this output must be a value of the optional key ‘notInDb’ of the self.outputs dictionary. To work properly this method must return self.make_initResult() object. :param is_plugged: the state, linked or not, of the plugs. :returns: a dictionary with requirement, outputs and inheritance_dict.

run_process_mia()[source]

Dedicated to the process launch step of the brick.

class mia_processes.bricks.tools.tools.Files_To_List[source]

Bases: populse_mia.user_interface.pipeline_manager.process_mia.ProcessMIA

From 3 file names, generating a list containing all these file names

Please, see the complete documentation for the Files_To_List brick in the mia_processes website

Note

  • Type ‘Files_To_List.help()’ for a full description of this process parameters.

  • Type ‘<Files_To_List>.get_input_spec()’ for a full description of this process input trait types.

  • Type ‘<Files_To_List>.get_output_spec()’ for a full description of this process output trait types.

__init__()[source]

Dedicated to the attributes initialisation/instantiation.

The input and output plugs are defined here. The special ‘self.requirement’ attribute (optional) is used to define the third-party products necessary for the running of the brick.

list_outputs(is_plugged=None)[source]

Dedicated to the initialisation step of the brick.

The main objective of this method is to produce the outputs of the bricks (self.outputs) and the associated tags (self.inheritance_dic), if defined here. In order not to include an output in the database, this output must be a value of the optional key ‘notInDb’ of the self.outputs dictionary. To work properly this method must return self.make_initResult() object.

Parameters

is_plugged – the state, linked or not, of the plugs.

Returns

a dictionary with requirement, outputs and inheritance_dict.

run_process_mia()[source]

Dedicated to the process launch step of the brick.

class mia_processes.bricks.tools.tools.Filter_Files_List[source]

Bases: populse_mia.user_interface.pipeline_manager.process_mia.ProcessMIA

Selects one or more (slicing) element(s) from a list

Please, see the complete documentation for the Filter_Files_List brick in the mia_processes website

Note

  • Type ‘Filter_Files_List.help()’ for a full description of this process parameters.

  • Type ‘<Filter_Files_List>.get_input_spec()’ for a full description of this process input trait types.

  • Type ‘<Filter_Files_List>.get_output_spec()’ for a full description of this process output trait types.

__init__()[source]

Dedicated to the attributes initialisation/instantiation.

The input and output plugs are defined here. The special ‘self.requirement’ attribute (optional) is used to define the third-party products necessary for the running of the brick.

list_outputs(is_plugged=None)[source]

Dedicated to the initialisation step of the brick.

The main objective of this method is to produce the outputs of the bricks (self.outputs) and the associated tags (self.inheritance_dic), if defined here. In order not to include an output in the database, this output must be a value of the optional key ‘notInDb’ of the self.outputs dictionary. To work properly this method must return self.make_initResult() object.

Parameters

is_plugged – the state, linked or not, of the plugs.

Returns

a dictionary with requirement, outputs and inheritance_dict.

run_process_mia()[source]

Dedicated to the process launch step of the brick.

class mia_processes.bricks.tools.tools.Find_In_List[source]

Bases: populse_mia.user_interface.pipeline_manager.process_mia.ProcessMIA

From a list of files, select the 1rst element that contains a pattern

Please, see the complete documentation for the Find_In_List brick in the mia_processes website

Note

  • Type ‘Find_In_List.help()’ for a full description of this process parameters.

  • Type ‘<Find_In_List>.get_input_spec()’ for a full description of this process input trait types.

  • Type ‘<Find_In_List>.get_output_spec()’ for a full description of this process output trait types.

__init__()[source]

Dedicated to the attributes initialisation/instantiation.

The input and output plugs are defined here. The special ‘self.requirement’ attribute (optional) is used to define the third-party products necessary for the running of the brick.

list_outputs(is_plugged=None)[source]

Dedicated to the initialisation step of the brick.

The main objective of this method is to produce the outputs of the bricks (self.outputs) and the associated tags (self.inheritance_dic), if defined here. In order not to include an output in the database, this output must be a value of the optional key ‘notInDb’ of the self.outputs dictionary. To work properly this method must return self.make_initResult() object.

Parameters

is_plugged – the state, linked or not, of the plugs.

Returns

a dictionary with requirement, outputs and inheritance_dict.

run_process_mia()[source]

Dedicated to the process launch step of the brick.

class mia_processes.bricks.tools.tools.Get_Conditions_From_csv[source]

Bases: populse_mia.user_interface.pipeline_manager.process_mia.ProcessMIA

Get conditions information (conditions names, onsets and durations) for Level1Design brick using csv files.

Please, see the complete documentation for the Get_Conditions_From_csv brick in the mia_processes website

Note

  • Type ‘Get_Conditions_From_csv.help()’ for a full description of this process parameters.

  • Type ‘<Get_Conditions_From_csv>.get_input_spec()’ for a full description of this process input trait types.

  • Type ‘<Get_Conditions_From_csv>.get_output_spec()’ for a full description of this process output trait types.

__init__()[source]

Dedicated to the attributes initialisation/instantiation.

The input and output plugs are defined here. The special ‘self.requirement’ attribute (optional) is used to define the third-party products necessary for the running of the brick.

list_outputs(is_plugged=None)[source]

Dedicated to the initialisation step of the brick.

The main objective of this method is to produce the outputs of the bricks (self.outputs) and the associated tags (self.inheritance_dic), if defined here. In order not to include an output in the database, this output must be a value of the optional key ‘notInDb’ of the self.outputs dictionary. To work properly this method must return self.make_initResult() object.

Parameters

is_plugged – the state, linked or not, of the plugs.

Returns

a dictionary with requirement, outputs and inheritance_dict.

run_process_mia()[source]

Dedicated to the process launch step of the brick.

class mia_processes.bricks.tools.tools.Get_Patient_Name[source]

Bases: populse_mia.user_interface.pipeline_manager.process_mia.ProcessMIA

Get patient name from a file

Please, see the complete documentation for the Get_Patient_Name brick in the mia_processes website

Note

  • Type ‘Get_Patient_Name.help()’ for a full description of this process parameters.

  • Type ‘<Get_Patient_Name>.get_input_spec()’ for a full description of this process input trait types.

  • Type ‘<Get_Patient_Name>.get_output_spec()’ for a full description of this process output trait types.

__init__()[source]

Dedicated to the attributes initialisation/instantiation.

The input and output plugs are defined here. The special ‘self.requirement’ attribute (optional) is used to define the third-party products necessary for the running of the brick.

list_outputs(is_plugged=None)[source]

Dedicated to the initialisation step of the brick.

The main objective of this method is to produce the outputs of the bricks (self.outputs) and the associated tags (self.inheritance_dic), if defined here. In order not to include an output in the database, this output must be a value of the optional key ‘notInDb’ of the self.outputs dictionary. To work properly this method must return self.make_initResult() object.

Parameters

is_plugged – the state, linked or not, of the plugs.

Returns

a dictionary with requirement, outputs and inheritance_dict.

run_process_mia()[source]

Dedicated to the process launch step of the brick.

class mia_processes.bricks.tools.tools.Import_Data[source]

Bases: populse_mia.user_interface.pipeline_manager.process_mia.ProcessMIA

Import reference data into the current pipeline

  • This brick was originally written to select regions of interest. The rois_list parameter is used to filter the data to be imported from a library defined by lib_dir. If roi_list is a list, each element of it will be a filename filter applied for retrieval. If roi_list is a list of lists, the filters will result from concatenating the elements of each internal list (e.g. [[“foo”, “1”], [“faa”, “2”]] gives two filters, “foo_1” and “faa_2”.

  • If lib_dir is not set, use the miaresources/ROIs/ file.

  • The file_in_db file is used only to retrieve the value of the associated PatientName tag.

  • The reference data is imported into the output_directory/PatientName_data/ROI_data/raw_data directory.

Note

  • Type ‘Import_Data.help()’ for a full description of this process parameters.

  • Type ‘<Import_Data>.get_input_spec()’ for a full description of this process input trait types.

  • Type ‘<Import_Data>.get_output_spec()’ for a full description of this process output trait types.

__init__()[source]

Dedicated to the attributes initialisation/instantiation.

The input and output plugs are defined here. The special ‘self.requirement’ attribute (optional) is used to define the third-party products necessary for the running of the brick.

list_outputs(is_plugged=None)[source]

Dedicated to the initialisation step of the brick.

The main objective of this method is to produce the outputs of the bricks (self.outputs) and the associated tags (self.inheritance_dic), if defined here. In order not to include an output in the database, this output must be a value of the optional key ‘notInDb’ of the self.outputs dictionary. To work properly this method must return self.make_initResult() object.

Parameters

is_plugged – the state, linked or not, of the plugs.

Returns

a dictionary with requirement, outputs and inheritance_dict.

run_process_mia()[source]

Dedicated to the process launch step of the brick.

class mia_processes.bricks.tools.tools.Input_Filter[source]

Bases: populse_mia.user_interface.pipeline_manager.process_mia.ProcessMIA

To filter the Data Browser tab or the output data of another brick

Please, see the complete documentation for the Input_Filter in the mia_processes website

Note

  • Type ‘Input_Filter.help()’ for a full description of this process parameters.

  • Type ‘<Input_Filter>.get_input_spec()’ for a full description of this process input trait types.

  • Type ‘<Input_Filter>.get_output_spec()’ for a full description of this process output trait types.

__init__()[source]

Dedicated to the attributes initialisation/instantiation.

The input and output plugs are defined here. The special ‘self.requirement’ attribute (optional) is used to define the third-party products necessary for the running of the brick.

list_outputs(is_plugged=None)[source]

Dedicated to the initialisation step of the brick.

The main objective of this method is to produce the outputs of the bricks (self.outputs) and the associated tags (self.inheritance_dic), if defined here. In order not to include an output in the database, this output must be a value of the optional key ‘notInDb’ of the self.outputs dictionary. To work properly this method must return self.make_initResult() object.

Parameters

is_plugged – the state, linked or not, of the plugs.

Returns

a dictionary with requirement, outputs and inheritance_dict.

run_process_mia()[source]

Dedicated to the process launch step of the brick.

class mia_processes.bricks.tools.tools.List_Duplicate[source]

Bases: populse_mia.user_interface.pipeline_manager.process_mia.ProcessMIA

From a file name, generate a list containing that file name and the file name itself

Please, see the complete documentation for the List_Duplicate in the mia_processes website

Note

  • Type ‘List_Duplicate.help()’ for a full description of this process parameters.

  • Type ‘<List_Duplicate>.get_input_spec()’ for a full description of this process input trait types.

  • Type ‘<List_Duplicate>.get_output_spec()’ for a full description of this process output trait types.

__init__()[source]

Dedicated to the attributes initialisation / instantiation.

The input and output plugs are defined here. The special ‘self.requirement’ attribute (optional) is used to define the third-party products necessary for the running of the brick.

list_outputs(is_plugged=None)[source]

Dedicated to the initialisation step of the brick.

The main objective of this method is to produce the outputs of the bricks (self.outputs) and the associated tags (self.inheritance_dic), if defined here. In order not to include an output in the database, this output must be a value of the optional key ‘notInDb’ of the self.outputs dictionary. To work properly this method must return self.make_initResult() object.

Parameters

is_plugged – the state, linked or not, of the plugs.

Returns

a dictionary with requirement, outputs and inheritance_dict.

run_process_mia()[source]

Dedicated to the process launch step of the brick.

class mia_processes.bricks.tools.tools.List_To_File[source]

Bases: populse_mia.user_interface.pipeline_manager.process_mia.ProcessMIA

From several filenames, selects and generates a file

Please, see the complete documentation for the List_To_File in the mia_processes website

Note

  • Type ‘List_To_File.help()’ for a full description of this process parameters.

  • Type ‘<List_To_File>.get_input_spec()’ for a full description of this process input trait types.

  • Type ‘<List_To_File>.get_output_spec()’ for a full description of this process output trait types.

__init__()[source]

Dedicated to the attributes initialisation / instantiation.

The input and output plugs are defined here. The special ‘self.requirement’ attribute (optional) is used to define the third-party products necessary for the running of the brick.

list_outputs(is_plugged=None)[source]

Dedicated to the initialisation step of the brick.

The main objective of this method is to produce the outputs of the bricks (self.outputs) and the associated tags (self.inheritance_dic), if defined here. In order not to include an output in the database, this output must be a value of the optional key ‘notInDb’ of the self.outputs dictionary. To work properly this method must return self.make_initResult() object.

Parameters

is_plugged – the state, linked or not, of the plugs.

Returns

a dictionary with requirement, outputs and inheritance_dict.

run_process_mia()[source]

Dedicated to the process launch step of the brick.

class mia_processes.bricks.tools.tools.Make_A_List[source]

Bases: populse_mia.user_interface.pipeline_manager.process_mia.ProcessMIA

From 2 objects, generating a list containing all these objects

Please, see the complete documentation for the Make_A_List in the mia_processes website

Note

  • Type ‘Make_A_List.help()’ for a full description of this process parameters.

  • Type ‘<Make_A_List>.get_input_spec()’ for a full description of this process input trait types.

  • Type ‘<Make_A_List>.get_output_spec()’ for a full description of this process output trait types.

__init__()[source]

Dedicated to the attributes initialisation / instantiation.

The input and output plugs are defined here. The special ‘self.requirement’ attribute (optional) is used to define the third-party products necessary for the running of the brick.

list_outputs(is_plugged=None)[source]

Dedicated to the initialisation step of the brick. The main objective of this method is to produce the outputs of the bricks (self.outputs) and the associated tags (self.inheritance_dic), if defined here. In order not to include an output in the database, this output must be a value of the optional key ‘notInDb’ of the self.outputs dictionary. To work properly this method must return self.make_initResult() object. :param is_plugged: the state, linked or not, of the plugs. :returns: a dictionary with requirement, outputs and inheritance_dict.

run_process_mia()[source]

Dedicated to the process launch step of the brick.

class mia_processes.bricks.tools.tools.Make_CVR_reg_physio[source]

Bases: populse_mia.user_interface.pipeline_manager.process_mia.ProcessMIA

Generate the physiological regressor for CVR

Please, see the complete documentation for the Make_CVR_reg_physio in the mia_processes website

Note

  • Type ‘Make_CVR_reg_physio.help()’ for a full description of this process parameters.

  • Type ‘<Make_CVR_reg_physio>.get_input_spec()’ for a full description of this process input trait types.

  • Type ‘<Make_CVR_reg_physio>.get_output_spec()’ for a full description of this process output trait types.

__init__()[source]

Dedicated to the attributes initialisation / instantiation.

The input and output plugs are defined here. The special ‘self.requirement’ attribute (optional) is used to define the third-party products necessary for the running of the brick.

gaussfir(bt, nt=3, of=2)[source]

Generate a Gaussian FIR filter

with a specified bandwidth-time product (bt), number of taps (nt), and oversampling factor (of)

gfb_conv(a, b, shape='full')[source]

Return a subsection of the convolution, as specified by the shape parameter.

Parameters
  • a – a vector (a ndarray numpy object)

  • b – a vector (a ndarray numpy object)

  • shape – sub-section of the convolution (a string in [‘full’, ‘same’, ‘valid’])

list_outputs(is_plugged=None)[source]

Dedicated to the initialisation step of the brick. The main objective of this method is to produce the outputs of the bricks (self.outputs) and the associated tags (self.inheritance_dic), if defined here. In order not to include an output in the database, this output must be a value of the optional key ‘notInDb’ of the self.outputs dictionary. To work properly this method must return self.make_initResult() object. :param is_plugged: the state, linked or not, of the plugs. :returns: a dictionary with requirement, outputs and inheritance_dict.

run_process_mia()[source]

Dedicated to the process launch step of the brick.

spm_hrf(rt, p=[6, 16, 1, 1, 6, 0, 32], t=16)[source]

Hemodynamic response function.

Parameters: - rt: scan repeat time - p: parameters of the response function (two Gamma functions) (Default: [6, 16, 1, 1, 6, 0, 32]) - t: microtime resolution (Default: 16)

Returns: - hrf: hemodynamic response function - p: parameters of the response function

Note: Adapted from SPM12 matlab code (spm_hrf.m)