Skip to content

giocoal/ADNI-brain-MRI-alzheimer-WGAN-generation-and-classification

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ADNI Brain T1-Weighted MRI Images Classification and WGAN Generation (Alzheimer's and Healthy patients) for the purpose of data augmentation. Implemented in TensorFlow, trained on ADNI dataset.

Contributors Forks Stargazers Issues MIT License LinkedIn

Table of contents

Abstract

This project focused on Alzheimer's disease through three main objectives. Firstly, a dataset of axial 2D slices was created from 3D T1-weighted MRI brain images, integrating clinical, genetic, and biological sample data. Secondly, a Custom Resnet-18 was trained to classify these images, distinguishing between healthy individuals and those with Alzheimer's. The ultimate goal was to predict diagnoses solely based on cognitive assessments and clinical data. Lastly, different techniques for managing class imbalance were evaluated to improve the classifier's performance and reduce bias. Finally, a generative model (Wasserstein GAN) was trained on Alzheimer's Disease and Healthy for data augmentation and class balancing. This approach overcame the limitations of traditional undersampling, avoiding data loss and replacing problematic geometric data augmentation in the medical imaging context. The Wasserstein GAN provided an effective method to generate new samples of the minority class, contributing to improved performance of the final classifier.

GenetationExample

Requirements

  • python==3.8
  • ipython
  • ipykernel
  • matplotlib
  • pandas
  • seaborn
  • tqdm==4.64.1
  • scikit-learn==1.2.0
  • glob2==0.7
  • keras==2.10.0
  • Keras-Preprocessing==1.1.2
  • tensorflow==2.10.1
  • numpy==1.24.2
  • opencv_python==4.7.0.68
  • pandas==1.5.3
  • Pillow==9.4.0
  • imageio==2.25.0

ADNI: Image Dataset Acquisition

  1. Request access to the Alzheimer's Disease Neuroimaging Initiative: https://adni.loni.usc.edu/data-samples/access-data/ (tipically 1 week to be accepted)
  2. Visit the following website: https://ida.loni.usc.edu/login.jsp?project=ADNI&page=HOME#
  3. Sign up if you haven't already.
  4. Click on the "SEARCH" button.
  5. Select "Advanced Image Search (beta)."
  6. In the "Search Options" menu, choose "Pre-processed" under the "IMAGE TYPES" sub-menu.
  7. In the "Search Criteria" menu, select "MRI" under the "IMAGE" sub-menu. Then, under the "IMAGING PROTOCOL" sub-menu, choose "T1" for the weighting (Do not select "AXIAL" under the "Aquisition Plane" option, as most of the original data are volumetric .nii files.).
  8. To download subjects with Alzheimer's Disease (AD), go to the "Search Options" menu, select "Subject" under the "Search Sections" sub-menu, and then choose "AD" under the "subject" sub-menu. The same process applies to Normal Control (NC) subjects.
  9. Download only the "MPR; GradWarp; B1 Correction; N3; Scaled" images from the downloaded data.
  10. For compatibility, store the downloaded images of AD subjects in a directory named 'ad' and the images of NC subjects in a directory named 'nor'.

Image Preprocessing

  1. Go in the scripts/1_preprocessing folder
  2. Run the 1_ttv_split.py script to randomly split the patients into training, validation, and test sets.
  3. Optionally, you can run the 2_subjects_lists.py script to log which subjects are assigned to each set.
  4. Run the 3_nii_to_png_all.py script to convert the volumetric .nii data to axial .png MRI images.
  5. Optionally, use the 4_check_shapes.ipynb notebook to determine the number of different slices and dimensions for each visit's corresponding images.
  6. Run the 5_select_sequences_ttv.py script to discard the images that are irrelevant for AD diagnosis, focusing only on the relevant parts of a subject's head.
  7. Finally, execute the 6_resize_images.py script to resize all the images to a consistent size of (192, 160).

Wasserstein GAN Training and Generation

  1. Go in the scripts/3_GAN/WGAN folder
  2. Execute wgan_bs_32_lat_128_eps_600.py to train the GAN
  3. Execute generate_imgs.py to generate the images

Random and Stratified Undersampling

  1. Go to the scripts/2_class_imbalance_management folder
  2. Execute the various notebooks in it to perform class balancing

Brain MRI Classification: Alzheimer's Disease (AD) and Cognitive Normal (CN) detection

Use the notebooks in scripts/3_Resnet18_first folder to train and evaluate classification models for the detection of Alzheimer's Disease and Absence of symptoms in Brain MRI. Some forms of data augmentation are tested, including generation by trained W-GAN.

Status

Project is: ##c5f015 Done

Contact

Giorgio Carbone - feel free to contact me!

License

  • You can check out the full license here

This project is licensed under the terms of the MIT license.

Contributing

  1. Fork it (https://github.com/giocoal/ADNI-brain-MRI-alzheimer-WGAN-generation-and-classification.git)
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -am 'Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request

Contributors

About

Brain T1-Weighted MRI Images Classification and WGAN Generation (Alzheimer's and Healthy patients) for the purpose of data augmentation. Implemented in TensorFlow, trained on ADNI dataset.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages