-
Notifications
You must be signed in to change notification settings - Fork 62
NODDI
Download the sample dataset from the NODDI official website:
After unzipping, your directory structure should look like this:
NODDI_example_dataset/
├── brain_mask.hdr
├── brain_mask.img
├── NODDI_DWI.hdr
├── NODDI_DWI.img
├── NODDI_protocol.bval
└── NODDI_protocol.bvec
Usually, DWI images need some preprocessing (e.g., eddy current correction, head movement correction, and skull stripping). You need to perform these pre-preprocessing steps before fitting the model. Assuming this pre-processing has already been done for this sample dataset, we skip those steps here.
Move into the NODDI_example_dataset
directory and run a Python interpreter:
cd NODDI_example_dataset
python
In the Python shell, import the AMICO
library and setup/initialize the framework:
import amico
amico.setup()
-> Precomputing rotation matrices:
[ DONE ]
Note
This step will precompute all the necessary rotation matrices and store them in ~/.dipy
. This initialization step is necessary only the first time you use AMICO
.
Now you can instantiate an Evaluation
object and start the analysis:
ae = amico.Evaluation()
You can generate the scheme file from the bvals/bvecs files of your acquisition with the fsl2scheme()
method:
amico.util.fsl2scheme('NODDI_protocol.bval', 'NODDI_protocol.bvec')
-> Writing scheme file to [ NODDI_protocol.scheme ]
'NODDI_protocol.scheme'
Load your data with the load_data()
method:
ae.load_data('NODDI_DWI.img', 'NODDI_protocol.scheme', mask_filename='brain_mask.img', b0_thr=0)
-> Loading data:
* DWI signal
- dim = 128 x 128 x 50 x 81
- pixdim = 1.875 x 1.875 x 2.500
* Acquisition scheme
- 81 samples, 2 shells
- 9 @ b=0 , 24 @ b=700.0 , 48 @ b=2000.0
* Binary mask
- dim = 128 x 128 x 50
- pixdim = 1.875 x 1.875 x 2.500
- voxels = 178924
[ 0.3 seconds ]
-> Preprocessing:
* Normalizing to b0... [ min=0.00, mean=2.78, max=2862.00 ]
* Keeping all b0 volume(s)
[ 8.2 seconds ]
Set the NODDI
model with the set_model()
method and generate the response functions with the generate_kernels()
method:
ae.set_model('NODDI')
ae.generate_kernels(regenerate=True)
-> Creating LUT for "NODDI" model:
[ 1.8 seconds ]
Important
- This example uses the default parameters for the
NODDI
model. You can change them with themodel.set()
method. Refer to the Model Configuration page for more information on model-specific parameters. - You need to compute the reponse functions only once per study; in fact, scheme files with same b-values but different number/distribution of samples on each shell will result in the same precomputed kernels (which are actually computed at higher angular resolution). The method
generate_kernels()
does not recompute the kernels if they already exist, unless the flagregenerate
is set, e.g.generate_kernels(regenerate=True)
.
Load the precomputed kernels (at higher resolution) and adapt them to the actual scheme (distribution of points on each shell) of the current subject with the load_kernels()
method:
ae.load_kernels()
-> Resampling LUT for subject ".":
[ 0.4 seconds ]
Fit the model to the data with the fit()
method:
ae.fit()
-> Estimating principal directions (OLS):
[ 00h 00m 01s ]
-> Fitting 'NODDI' model to 178924 voxels (using 32 threads):
[ 00h 00m 04s ]
Finally, save the results as NIfTI images with the save_results()
method:
ae.save_results()
-> Saving output to "AMICO/NODDI/*":
- configuration [OK]
- fit_dir.nii.gz [OK]
- fit_NDI.nii.gz [OK]
- fit_ODI.nii.gz [OK]
- fit_FWF.nii.gz [OK]
[ DONE ]
🎉Congratulations! You have successfully fitted the NODDI
model to your data.🎉 You will find the estimated parameters in the NODDI_example_dataset/AMICO/NODDI
directory:
NODDI_example_dataset/AMICO/NODDI/
├── config.pickle
├── fit_dir.nii.gz
├── fit_FWF.nii.gz
├── fit_NDI.nii.gz
└── fit_ODI.nii.gz
Open them with your favorite viewer.