This pipeline was used to perform age predictions from rat MRI images as presented in the preprint:
Brusini et al. (2021)
- nibabel==3.2.0
- scikit-learn==0.23.2
- xlrd==1.2.0
Structural MRI data must be preprocessed in order to generate modulated tissue probability maps (TPMs) to be fed into the model, as described in Brusini et al. (2021). The reference template used in the study is available at DOI 10.17605/OSF.IO/U4GTW (MacNicol et. al, 2021).
Pre-trained models and related training data resources are available in the folder 'pretrained' (size: 2.9 GB), downloadable from DOI: 10.17605/OSF.IO/6WD7T. These data were generated by training the proposed model on 89 untreated rats between 3 and 17 months of age. They can be used to directly test the model on new image samples. However, re-training the model on additional data may be necessary / recommended for better performance.
To generate the model inputs from the processed TPMs, run:
python3 create_input_data.py ./config_files/config_file_RAGE_dataset.json
In the configuration file, it is possible to specify:
- "Metadata Path": path to the .xslx file containing information about the dataset (IDs, ages).
- "Input Nifti Folder": path of the folder which contains the TPMs nifti files.
- "Output Folder": path of the folder where the generated files will be saved.
- "Output Feature File": the name of the .npy file where to store the input features.
- "Output Age File": the name of the .npy file where to store the column-vector containing the ages (in weeks).
- "Output IDs File": the name of the .npy file where to store the list containing the subjects IDs.
- "Tissues Used": provide a string from the following to specify which tissue to use: 'gm' ; 'wm' ; 'both' (referring to both gm and wm) ; 'all' (gm+wm+csf).
- "All Templates": true / false. Specify whether TPMs from all available templates have to be concatenated together.
To train the model, run:
python3 RAGE_train.py ./config_files/config_file_RAGE_train.json
In the configuration file, it is possible to specify:
- "Input Feature Path Training": path of the file which contains the features of the training set.
- "Input Age Path Training": path of the file which contains the chronological ages of the training set.
- "Output Folder": path of the folder where the trained models are stored.
- "Add LR classifier": true / false. Specify whether you want to use the ensemble of GPR and LR, rather than simply GPR.
To test the model, run:
python3 RAGE_predict.py ./config_files/config_file_RAGE_test.json
In the configuration file, it is possible to specify:
- "Input Feature Path Testing": path of the file which contains the features of the test set.
- "Input Age Path Testing": path of the file which contains the chronological ages of the test set.
- "Input Subject IDs Path Testing": path of the file which contains the IDs of the subjects in the test set.
- "Output Folder": path of the folder where the age predictions will be saved.
- "Pretrained Folder": path of the folder where the trained models are stored.
- "Add LR predictions": true / false. Specify whether you want to use the ensemble of GPR and LR, rather than simply GPR, to perform the age predictions.