robbert-harms/MDT

Missing model names in get_optimization_inits

cprmellema opened this issue · 2 comments

MDT development team,

Hello, I am a graduate student using this toolbox for processing diffusion MRI. When updating to the latest version, the python api function:
'mdt.get_optimization_inits' is now only accepting some of the model_name arguments, and not others.

example below:

init = mdt.get_optimization_inits(model_name='NODDI_DTI', input_data, output_folder)

raises the following error:

Traceback (most recent call last):
File ".../CondaEnvironments/CooperdMRIPipeline2/lib/python3.6/site-packages/mdt/lib/components.py", line 334, in get_model
return component_library.get_component('composite_models', model_name)
File ".../CondaEnvironments/CooperdMRIPipeline2/lib/python3.6/site-packages/mdt/lib/components.py", line 100, in get_component
raise ValueError('Can not find a component of type "{}" with name "{}"'.format(component_type, name))
ValueError: Can not find a component of type "composite_models" with name "NODDI_DTI"
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File ".../CondaEnvironments/CooperdMRIPipeline2/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 3296, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 1, in
cInit = mdt.get_optimization_inits('NODDI_DTI', cInput, sSaveName)
File ".../CondaEnvironments/CooperdMRIPipeline2/lib/python3.6/site-packages/mdt/init.py", line 88, in get_optimization_inits
return get_optimization_inits(model_name, input_data, output_folder, cl_device_ind=cl_device_ind)
File ".../CondaEnvironments/CooperdMRIPipeline2/lib/python3.6/site-packages/mdt/lib/model_fitting.py", line 161, in get_optimization_inits
return get_init_data(model_name)
File ".../CondaEnvironments/CooperdMRIPipeline2/lib/python3.6/site-packages/mdt/lib/model_fitting.py", line 75, in get_init_data
free_parameters = get_model(model_name)().get_free_param_names()
File ".../CondaEnvironments/CooperdMRIPipeline2/lib/python3.6/site-packages/mdt/lib/components.py", line 336, in get_model
raise ValueError('The model with the name "{}" could not be found.'.format(model_name))
ValueError: The model with the name "NODDI_DTI" could not be found.

The following model types I have tried raise the same error:
model_name='NODDI', 'BinghamNODDI', or 'NODDI-DTI'

These models run normally:
model_name= 'NODDIDA'

Any help you could give would be greatly appreciated! Thank you,

-Cooper Mellema

Hi Cooper,

The issue is probably two-fold.

The first issue might be that your models are not yet updated. After any update of MDT it is advised to run the bash shell script mdt-init-user-settings or call the relevant Python function mdt.init_user_settings() to initialize the models. This might explain why some of the models could not be listed. You can check which models are available using the Python command print(mdt.get_models_list()). The model NODDI should be in there.

The second issue is one of naming. For some models, like CHARMED, Ball&Stick and BinghamNODDI, there are variations with one or more restricted compartments. These variations are denoted with the suffix "_r[1,2,3]", i.e. CHARMED_r1 and BinghamNODDI_r1. The default BinghamNODDI model is the r1 variant, so, you would want to use the "BinghamNODDI_r1" model.

Extending on this issue, NODDI-DTI is not an actual model, rather, it is an post-processing function of the Tensor model. See [1] for a reference. If you want to use NODDI-DTI, you can simply use the Tensor model and look for the relevant NODDI-like output maps.

I hope this helps you out, let me know.

Best,

Robbert

References:

  1. Edwards LJ, Pine KJ, Ellerbrock I, Weiskopf N, Mohammadi S. NODDI-DTI: Estimating neurite orientation and dispersion parameters from a diffusion tensor in healthy white matter. Front Neurosci. 2017;11(DEC):1-15. doi:10.3389/fnins.2017.00720

Running the initialization function has fixed the problem. I will also make sure to use the correct model name. Thank you!