-
Notifications
You must be signed in to change notification settings - Fork 8
User_guide_create_module
A MP3 module is a .m matlab file that meets certain requirements.
In order to facilitate the conception of a new module, we wrote a template module.
This file, furnished on the MP3 source code (/MP3/MP3_pipeline/Modules_Furnished/Other/Module_Template.m
), can be is easily filled up / modified in order to compute any operation on the files in the MP3 database.
First, one need to define the parameters of the module. There are 3 types of parameters:
- the ones specific to the module operation
Those are the parameters to modify. Add a parameter to the cell array with the convention :
module_parameters(:,index) = {Name,Default_value};
The input or output files are not parameters and then should not be mentioned here. - the ones specific to the automatic generation of jobs (links between inputs) Those parameters affect the behavior of the inputs between themselves, which are particularly important in the Registration modules. If the module to create is independent of the timepoints or patients, as the majority of modules, you don't have to modify them.
- the ones related to the initialization of the module. As far, nobody might have to modify them.
In the pipeline manager, selecting a module displays information about the parameters, the behavior, and the inputs of the module. Those lines are defined in the module file.
Those line allow the user to modify a parameter.
To allow the user to modify another parameter, just add a new line to the cell array, with the convention : user_parameter(:,index) = {A,B,C,D,E,F,G};
with
- A: the name displayed in the MP3 window (that appears after selecting a module)
- B: The type of the parameter: Text/char/cell/numeric or an input specific to the database: 1Scan/XScan/1ROI/XROI/1ScanOr1ROI/XScanOrXROI/1Cluster/XCluster/1Scan1TPXTP/1ROI1TPXTP (details of all those types in the template file)
- C: The parameter default values (Only for cell-type parameters). If the parameter is not a cell, set this as empty ('').
- D: The name of the parameter (Exactly the same as defined in the first paragraph!)
- E: Degrees of freedom let to the user (Only for input specific to the database). If the parameter type is not en input specific to the database, set this as empty ('').
- F: If the input is mandatory or not (Only for input specific to the database). If empty, the input is considered as optional.
- G: A description of the parameter that will be displayed on the bottom right corner of the pipeline manager.
In MP3 the output files names are generated before any job execution. The next paragraph of the template file is dedicated to this name generation. The existing paragraph creates an output thanks to the name of the input file. If the behavior of the wanted module is more complex (One input --> several outputs, several inputs --> one output, several inputs --> several outputs), one need to adapt it (one clever way would surely be to copy paste this paragraph from a module that has the wanted behavior ....)
Then code the core of the module, the operation that create output file(s) from input file(s).
- Name the output files as defined at the beginning of the module.
- Create an associated json file for each output of type
Scan
. - Apply the function
KeepModuleHistory
to benefit of the history management. - Benefit from the already written modules by copying/pasting lines from same behavior modules.
- Comment your code (We do not always meet this points ... sorry!).
- Place your resulting .m file in the module repository folder of the MP3 source code.
- Name your resulting .m file with 'Module_', or it will not be recognized by the pipeline manager.