organize-adni
Organize the entire ADNI dataset based on the group name (AD, MCI, CN) locally
Science Score: 44.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (11.0%) to scientific vocabulary
Keywords
Repository
Organize the entire ADNI dataset based on the group name (AD, MCI, CN) locally
Basic Info
- Host: GitHub
- Owner: FahimFBA
- License: apache-2.0
- Language: HTML
- Default Branch: main
- Homepage: https://fahimfba.github.io/organize-ADNI
- Size: 539 KB
Statistics
- Stars: 11
- Watchers: 1
- Forks: 1
- Open Issues: 0
- Releases: 2
Topics
Metadata Files
README.md

Alzheimer's Disease Neuroimaging Initiative (ADNI) dataset organization based on the group name (AD, MCI, CN)
Organize the entire ADNI dataset based on the group name (AD, MCI, CN) locally. Then, remove all the subdirectories of the individual subjects and keep only the data of the subjects based on the group name. Lastly, rewrite the .nii files' filenames to the subject's ID.
Therefore, I have created 3 separate scripts to perform these tasks. The first script will organize the entire ADNI dataset based on the group name (AD, MCI, CN) locally. The second script will remove all the subdirectories of the individual subjects and keep only the data of the subjects based on the group name. The third script will rewrite the .nii files' filenames to the subject's ID. The reason for creating three separate scripts is to make the process more modular and to make it easier to understand and maintain. One cruicial thing behind creating 3 separate scripts is that, it might be possible that the user may not want to perform all the tasks. Therefore, the user can choose to perform only the tasks that are required. However, the tasks should be performed sequentially. The order of the scripts and tasks are as follows:
script.py- Organize the entire ADNI dataset based on the group name (AD, MCI, CN) locally.remove_subdir_script.py- Remove all the subdirectories of the individual subjects and keep only the data of the subjects based on the group name.rename_file_script.py- Rewrite the.niifiles' filenames to the subject's ID.
⭐ the repository if you found it helpful. 😊
If you use this repository, please cite it as below.
markdown
@software{Amin_organize-ADNI_2024,
author = {Amin, Md. Fahim},
month = feb,
title = {organize-ADNI},
url = {https://github.com/FahimFBA/organize-ADNI},
version = {2.0.4},
year = {2024}
}
Table of Contents
🎁 The entire project is live at fahimfba.github.io/organize-ADNI
Introduction
The Alzheimer's Disease Neuroimaging Initiative (ADNI) dataset is a large dataset that contains the data of subjects with Alzheimer's disease (AD), Mild Cognitive Impairment (MCI), and Cognitively Normal (CN). The dataset is organized into different directories based on the subject's ID. This script will organize the entire ADNI dataset based on the group name (AD, MCI, CN) locally.
The first script (script.py) will create 3 directories: AD, MCI, and CN. Each directory will contain the subjects' data based on the group name. The script will read the csv file that contains the list of the subjects and organize the dataset based on the group name.
The second script (removesubdirscript.py) will remove all the subdirectories of the individual subjects and keep only the data of the subjects based on the group name.
The third script (renamefilescript.py) will rewrite the .nii files' filenames to the subject's ID. The script will rename the .nii files' filenames to the subject's ID. Suppose, a file name is ADNI_002_S_0619_MR_MPR-R__GradWarp__N3__Scaled_2_Br_20081001115218896_S15145_I118678.nii. It will be renamed to I118678.nii.
This script can be used to organize the entire ADNI dataset based on the group name (AD, MCI, CN) locally. This script works successfully on Windows, Linux, and macOS.
Screenshot
After running first script
script.py:
After running second script
remove_subdir_script.py:
After running third script
rename_file_script.py:
Lastly, I have analyzed the dataset and found that the dataset is organized successfully.
Here, you can check the After & Before files and folders count side by side (Left Side = After, Right Side = Before).

Prerequisites
- Python 3.9 or later
How to use
- Clone the repository to your local machine.
bash git clone https://github.com/FahimFBA/organize-ADNI.git - Copy the
script.py,remove_subdir_script.py, andrename_file_script.pyto the root directory of the ADNI dataset. - Copy the csv file that contains the list of the subjects to the root directory of the ADNI dataset.
- Change the csv file name in the
script.pyto the name of the csv file that contains the list of the subjects. - Create 3 empty directories in the root directory of the ADNI dataset and name them
AD,MCI, andCN. - Run the
script.pyusing the following command, if you want to organize the entire ADNI dataset based on the group name (AD, MCI, CN) locally:bash python script.pyor,bash python3 script.py - The script will organize the entire ADNI dataset based on the group name (AD, MCI, CN) locally.
- Run the
remove_subdir_script.pyusing the following command, if you want to remove all the subdirectories of the individual subjects and keep only the data of the subjects based on the group name:bash python remove_subdir_script.pyor,bash python3 remove_subdir_script.py - The script will remove all the subdirectories of the individual subjects and keep only the data of the subjects based on the group name.
- Run the
rename_file_script.pyusing the following command, if you want to rewrite the.niifiles' filenames to the subject's ID:bash python rename_file_script.pyor,bash python3 rename_file_script.py - The script will rewrite the
.niifiles' filenames to the subject's ID. Suppose, a file name isADNI_002_S_0619_MR_MPR-R__GradWarp__N3__Scaled_2_Br_20081001115218896_S15145_I118678.nii. It will be renamed toI118678.nii.
Note: Here the root directory implies that directory which contains all the subject folders.
Experiment
The script was tested on the ADNI dataset - ADNI1: Screening 1.5T having 1075 subjects. The dataset contains 3 groups of subjects: AD, MCI, and CN. The script was able to organize the dataset based on the group name. The dataset was organized into 3 directories: AD, MCI, and CN. Each directory contains the subjects' data based on the group name. The dataset was organized successfully. This script can be used to organize the entire ADNI dataset based on the group name (AD, MCI, CN) locally. Then, another script was used to remove all the subdirectories of the individual subjects and keep only the data of the subjects based on the group name. Lastly, another script was used to rewrite the .nii files' filenames to the subject's ID. The script was able to rewrite the .nii files' filenames to the subject's ID. The dataset was organized successfully.
License
This project is licensed under the Apache License - see the LICENSE file for details.
Additional
If you want to compress the .nii files to .gzip files, you can use the following command:
bash
gzip * -r
This command will compress all the .nii files to .gzip files. But make sure that you go to the root directory of the ADNI dataset before running the command. Also, keep in mind that it will replace the original .nii files with the .gzip files. Therefore, it is recommended to keep a backup of the original .nii files before running the command.
Also, if you are a Windows user, you can install the gzip using chocolatey. You can install gzip via chocolatey using the following command:
bash
choco install gzip
Then, you can use the gzip command to compress the .nii files to .gzip files.
If you haven't installed chocolatey yet, you can install chocolatey by following the instructions on the chocolatey website.
Owner
- Name: Md. Fahim Bin Amin
- Login: FahimFBA
- Kind: user
- Location: Dhaka, Bangladesh
- Website: www.fahimbinamin.com
- Twitter: Fahim_FBA
- Repositories: 20
- Profile: https://github.com/FahimFBA
@Microsoft Research Investigation Contributor to OSS || Author @freeCodeCamp || Actively helping the Bengali Localization Effort @freeCodeCamp
Citation (CITATION.cff)
cff-version: 1.2.0 message: "If you use this repository, please cite it as below." authors: - family-names: "Amin" given-names: "Md. Fahim" orcid: "https://orcid.org/0000-0001-7392-793X" title: "organize-ADNI" version: 2.0.4 date-released: 2024-06-20 url: "https://github.com/FahimFBA/organize-ADNI"
GitHub Events
Total
- Watch event: 6
Last Year
- Watch event: 6
Issues and Pull Requests
Last synced: 5 months ago
All Time
- Total issues: 5
- Total pull requests: 6
- Average time to close issues: 42 minutes
- Average time to close pull requests: less than a minute
- Total issue authors: 1
- Total pull request authors: 1
- Average comments per issue: 0.0
- Average comments per pull request: 0.0
- Merged pull requests: 6
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- FahimFBA (5)
Pull Request Authors
- FahimFBA (12)