mdt.cli_scripts package¶
Submodules¶
mdt.cli_scripts.MDT module¶
Launches the MDT GUI, similar to the mdt-gui command
-
class
mdt.cli_scripts.MDT.
GUI_Shortcut
[source]¶ Bases:
mdt.cli_scripts.mdt_gui.GUI
mdt.cli_scripts.mdt_apply_mask module¶
Mask the background using the given mask.
This function multiplies a given volume (or list of volumes) with a binary mask.
mdt.cli_scripts.mdt_batch_fit module¶
Fits a batch profile to a set of data.
This script can be used to fit multiple models to multiple datasets. It needs a batch profile with information about the subjects. If no batch profile is given, this routine will try to auto-detect a good batch profile.
The most general batch profile is the ‘DirPerSubject’ profile which assumes that every subject has its own subdirectory under the given data folder. For details, please look up the batch profiles in your home folder.
A few of the batch profile settings can be altered with arguments to this script. For example, use_gradient_deviations and models_to_fit override the values in the batch profile.
mdt.cli_scripts.mdt_create_bvec_bval module¶
Generate the bval and bvec file from a protocol file.
mdt.cli_scripts.mdt_create_mask module¶
Create a (brain) mask for the given DWI. This uses the median-otsu algorithm.
mdt.cli_scripts.mdt_create_protocol module¶
Create a protocol from a bvec and bval file.
MDT uses a protocol file (with extension .prtcl) to store all the acquisition related values. This is a column based file which can hold, next to the b-values and gradient directions, the big Delta, small delta, gradient amplitude G and more of these extra acquisition details.
-
mdt.cli_scripts.mdt_create_protocol.
add_column_to_protocol
(protocol, column, value, mult_factor)[source]¶
mdt.cli_scripts.mdt_create_roi_slice module¶
Create a single slice mask that only includes the voxels in the selected slice.
mdt.cli_scripts.mdt_estimate_noise_std module¶
Estimate the noise standard deviation of the Gaussian noise in the original complex image domain.
The result is a single floating point number with the noise std. for every voxel. It uses the estimation routines from the components folders for the estimation. The estimation is the same as the one used in mdt-model-fit, but since the noise std estimation depends on the mask used, it is better to call this function beforehand with a complete brain mask. Later, the mdt-model-fit routine can be called on smaller masks with as noise std the value from this function.
mdt.cli_scripts.mdt_get_example_data module¶
Get the MDT example data that is accompanying the installation.
This will write the MDT example data (b1k_b2k and b6k datasets) to the indicated directory. You can use this data for testing MDT on your computer. These example datasets are contained within the MDT package and as such are available on every machine with MDT installed.
mdt.cli_scripts.mdt_gui module¶
Launches the MDT Graphical User Interface.
mdt.cli_scripts.mdt_info_img module¶
Print some basic information about an image file.
mdt.cli_scripts.mdt_info_protocol module¶
Print some basic information about a protocol.
mdt.cli_scripts.mdt_init_user_settings module¶
This script is meant to update your home folder with the latest MDT models.
mdt.cli_scripts.mdt_list_devices module¶
This script prints information about the available devices on your computer.
mdt.cli_scripts.mdt_list_models module¶
This script prints a list of all the models MDT can find in your home directory.
mdt.cli_scripts.mdt_math_img module¶
Evaluate an expression on a set of images.
This is meant to quickly convert/combine one or two maps with a mathematical expression. The expression can be any valid python expression.
The input list of images are loaded as numpy arrays and stored in the array ‘input’ and ‘i’. Next, the expression is evaluated using the input images and the result is stored in the indicated file(s).
In the expression you can either use the arrays ‘input’ or ‘i’ with linear indices, or/and you can use alphabetic characters for each image. For example, if you have specified 2 input images you can address them as:
- input[0] or i[0] or a
- input[1] or i[1] or b
This linear alphabetic indexing works with every alphabetic character except for the ‘i’ since that one is reserved for the array.
The module numpy is available under ‘np’ and some functions of MDT under ‘mdt’. This allows expressions like:
np.mean(np.concatenate(i, axis=3), axis=3)
to get the mean value per voxel of all the input images.
It is possible to change the mode of evaluation from single expression to a more complex python statement using the switch –as-statement (the default is –as-expression). In a statement more complex python commands are allowed. In statement mode you must explicitly output the results using ‘return’. (Basically it wraps your command in a function, of which the output is used as expression value).
If no output file is specified and the output is of dimension 2 or lower we print the output directly to the console. If the output is a list or tuple instead of an ndarray we will write every element of that sequence as a separate file. This will use the indicated file as basename and append an numerical index to it.
mdt.cli_scripts.mdt_math_protocol module¶
Evaluate an expression on a protocol.
This is meant to quickly change a protocol using mathematical expressions. The expressions can be any valid python string separated if needed with the semicolon (;).
The columns of the input protocol are loaded and stored as arrays with as variable names the names of the columns. Next, the expression is evaluated on those columns and the result is stored in the indicated file.
Columns can easily be removed with the python ‘del’ command. New columns can easily be added by assignment. When adding a column, the value can either be a scalar or a vector.
Additionally, the numpy library is available with prefix ‘np.’.
mdt.cli_scripts.mdt_model_fit module¶
Fit one of the models to the given data.
This function can use two kinds of noise standard deviation, a global or a local (voxel wise). If the argument -n / –noise-std is not set, MDT uses a default automatic noise estimation which may be either global or local. To use a predefined global noise std please set the argument to a floating point value. To use a voxel wise noise std, please give it a filename with a map to use.
mdt.cli_scripts.mdt_view_maps module¶
Launches the MDT maps visualizer.
mdt.cli_scripts.mdt_volume_merge module¶
Merge a list of volume images on the 4th dimension. Writes the result to a single image.
Please note that by default this will sort the list of volume names based on a natural key sort. This is the most convenient option in the case of globbing files. You can disable this behaviour using the flag –no-sort.