The ADvanceMCI project aims to classify participants with Progressive Mild Cognitive Impairment (MCI) from those with Stable MCI using neuroimaging data. The project involves various stages of preprocessing, brain segmentation, quality control, and data transformation to prepare the dataset for machine learning analysis.
This README provides a guide to the project structure, pre-processing steps, and necessary commands to replicate the analysis pipeline.
Before running the pipeline, ensure you have the following software and dependencies installed:
-
FastSurfer: A deep learning-based MRI preprocessing and segmentation tool.
- Follow the installation guide here: FastSurfer Installation
-
Python: Required for some preprocessing scripts, such as GMWM extraction, outlier detection, etc.
-
MRIQC: To assess the quality of MRI images.
-
FSL/FreeSurfer: Used for brain image processing tasks.
Additionally, you will need the following Python packages:
pip install nibabel numpy scikit-learnClone the project repository to your local machine:
git clone https://github.com/your-username/ADvanceMCI.git
cd ADvanceMCIWe use FastSurfer for preprocessing and segmentation of MRI scans using deep learning techniques. FastSurfer is fast and provides high-quality segmentation results. Below are the commands to preprocess the data.
- Download the dataset for OASIS and ADNI.
- For each participant in the dataset, run FastSurfer to preprocess the T1-weighted images and perform segmentation.
for dataset in oasis ADNI; do
for sub in ${dataset}/*; do
base_name=$(basename $sub)
SUBJECTS_DIR=${sub}
fastsurfer --t1 "${sub}/${base_name}.nii.gz" --sd "${dataset}" --sid "${base_name}" --fs_license "license.txt" --no_cereb --no_hypothal --parallel --threads 20 --qc_snap --seg_only
done
doneTo extract the Gray Matter (GM) and White Matter (WM) masks, we use the following Python and shell scripts. These masks are important for subsequent analyses, such as feature extraction.
Run the script to extract the GM and WM masks for both OASIS and ADNI datasets:
./GMWM_extraction.sh oasis
./GMWM_extraction.sh ADNIWe use MRIQC to evaluate the quality of the MRI images. The quality control steps help identify and remove outlier images that may affect model training.
- Run MRIQC on the datasets:
./mriqc.sh oasis
./mriqc.sh ADNI- Use the
outliers.shscript to remove any images flagged as outliers based on MRIQC results.
./outliers.sh oasis
./outliers.sh ADNINormalizing the data is an essential step to ensure that all features are on the same scale. Min-Max normalization rescales the pixel values of the MRI images to a range between 0 and 1.
You can implement the normalization as per your requirements.
Resizing the T1-weighted images to a standard resolution of 64x64 pixels may be required for certain machine learning models. This step ensures consistency across all images in the dataset.
Resizing commands can be added here as needed based on your model requirements.
Finally, convert the NIfTI format images to NPZ format for easy use with machine learning models. This conversion allows for faster loading and more efficient processing during model training.
python ./convert_nii2npz.pyOnce the preprocessing steps are complete, you can begin with model training and evaluation. Make sure the dataset is correctly prepared by checking the processed files and logs for any errors.
To run the preprocessing pipeline for the OASIS dataset:
bash preprocess_oasis.shTo run the preprocessing pipeline for the ADNI dataset:
bash preprocess_adni.shEach script will process the data and output results to the corresponding directories.
- FastSurfer: FastSurfer GitHub
- MRIQC: MRIQC GitHub
This project is licensed under the MIT License - see the LICENSE file for details.