brain-structure / README.md
jesse-radiata's picture
Add files using upload-large-folder tool
e948260 verified
|
raw
history blame
9.17 kB
# Description
3794 3D structural MRI brain scans (T1-weighted MPRAGE NIfTI files) from 2607 individuals included in five publicly available datasets: [IXI](https://brain-development.org/ixi-dataset/), [DLBS](https://fcon_1000.projects.nitrc.org/indi/retro/dlbs.html), [NKI-RS](https://fcon_1000.projects.nitrc.org/indi/enhanced/sharing_neuro.html), [OASIS-1](https://sites.wustl.edu/oasisbrains/home/oasis-1/), and [OASIS-2](https://sites.wustl.edu/oasisbrains/home/oasis-2/). Subjects have a mean age of 45 Β± 24. 3773 scans come from cognitively normal individuals and 261 scans from individuals with an Alzheimer's disease clinical diagnosis. Scans dimensions are 113x137x113, 1.5mm^3 resolution, aligned to MNI152 space (see methods).
Scans are processed and no protected health information (PHI) is included - only the skull-stripped scan, integer age, biological sex, and clinical diagnosis. [Radiata](https://radiata.ai/) compiles and processes publicly available neuroimaging datasets to create an open, unified, and harmonized dataset. This can be used for purposes including developing models for brain age prediction and disease classification. For more information see https://radiata.ai/public-studies.
# License
The use of the dataset as a whole is licensed under the ODC-By v1.0 license. Individual scans are licensed under study-specific data use agreements:
IXI - [CC BY-SA 3.0](https://brain-development.org/ixi-dataset/)
DLBS - [CC BY-NC 4.0](https://fcon_1000.projects.nitrc.org/indi/retro/dlbs.html)
NKI-RS - [Custom DUA](https://fcon_1000.projects.nitrc.org/indi/enhanced/sharing.html)
OASIS-1 - [Custom DUA](https://sites.wustl.edu/oasisbrains/)
OASIS-2 - [Custom DUA](https://sites.wustl.edu/oasisbrains/)
The metadata provide the license for each object.
# Sample images
<table>
<tr>
<td align="center">
<img src="18_F_CN_2966.png" alt="18_F_CN_2966" width="150">
<br>Age 18 F
<br>Cognitively normal
</td>
<td align="center">
<img src="71_M_AD_3585.png" alt="71_M_AD_3585" width="150">
<br>Age 71 M
<br>Alzheimer's disease
</td>
<td align="center">
<img src="46_F_CN_436.png" alt="46_F_CN_436" width="150">
<br>Age 46 F
<br>Cognitively normal
</td>
<td align="center">
<img src="86_M_CN_3765.png" alt="86_M_CN_3765" width="150">
<br>Age 86 M
<br>Cognitively normal
</td>
</tr>
</table>
# Subject characteristics table
| Split | n (scans) | n (subjects) | age_mean | age_std | age_range | sex_counts | diagnosis_counts | study_counts |
|-------|-----------|--------------|-----------|-----------|-------------|--------------------------------|--------------------------|----------------------------------------------------------------------------|
| train | 3066 | 2085 | 45.1 | 24.5 | (6, 98) | {'female': 1827, 'male': 1239} | {'CN': 2847, 'AD': 219} | {'NKI-RS': 1854, 'OASIS-1': 340, 'IXI': 326, 'OASIS-2': 296, 'DLBS': 250} |
| validation | 364 | 261 | 46.4 | 24.5 | (6, 90) | {'female': 225, 'male': 139} | {'CN': 339, 'AD': 25} | {'NKI-RS': 213, 'IXI': 43, 'OASIS-1': 38, 'OASIS-2': 38, 'DLBS': 32} |
| test | 364 | 261 | 45.7 | 24.6 | (6, 93) | {'female': 210, 'male': 154} | {'CN': 343, 'AD': 21} | {'NKI-RS': 216, 'IXI': 40, 'OASIS-2': 39, 'OASIS-1': 36, 'DLBS': 33} |
# Folder organization
```bash
brains-structure/
β”œβ”€ brains-structure.py
β”œβ”€ metadata.csv
β”œβ”€ IXI/
β”‚ β”œβ”€ sub-002/
β”‚ β”‚ └─ ses-01/
β”‚ β”‚ └─ anat/
β”‚ β”‚ β”œβ”€ sub-002_ses-01_T1w_brain_affine_mni.nii.gz
β”‚ β”‚ └─ sub-017_ses-01_scandata.json
β”‚ └─ ...
β”œβ”€ DLBS/
β”‚ └─ ...
└─ ...
```
# Example usage:
```
# install Hugging Face Datasets library
pip install datasets
```
```
# load datasets
from datasets import load_dataset
ds_train = load_dataset("radiata-ai/brains-structure", name="all", split="train", trust_remote_code=True)
ds_val = load_dataset("radiata-ai/brains-structure", name="all", split="validation", trust_remote_code=True)
ds_test = load_dataset("radiata-ai/brains-structure", name="all", split="test", trust_remote_code=True)
```
```
# example PyTorch processing of images
import torch
import torch.nn.functional as F
from torch.utils.data import Dataset
import nibabel as nib
class NiiDataset(Dataset):
"""
A PyTorch Dataset that wraps a Hugging Face Dataset containing
MRI .nii.gz file paths, and loads/normalizes/resamples each volume.
"""
def __init__(self, hf_dataset):
"""
hf_dataset: a Hugging Face Dataset object, e.g. ds_train
(each example should have a 'nii_filepath')
"""
self.hf_dataset = hf_dataset
def __len__(self):
return len(self.hf_dataset)
def __getitem__(self, idx):
# Load the dataset example
example = self.hf_dataset[idx]
nii_path = example["nii_filepath"] # e.g., "IXI/sub-017/ses-01/anat/sub-017_ses-01_T1w.nii.gz"
# Load the .nii.gz file with nibabel
cur_t1_file = nib.load(nii_path)
t1_data = cur_t1_file.get_fdata()
# Preprocess: example sub-volume
# (7:105, 8:132, :108) => shape: (98, 124, 108)
t1_data = t1_data[7:105, 8:132, :108]
# Normalize intensities
t1_data = t1_data / t1_data.max()
# Convert to PyTorch tensor, add two channel dims for volumetric interpolation
# shape => (1, 1, 98, 124, 108)
t1_tensor = torch.from_numpy(t1_data).float().unsqueeze(0).unsqueeze(0)
# Downsample/resample to e.g. (96, 96, 96)
img_downsample = F.interpolate(
t1_tensor,
size=(96, 96, 96),
mode="trilinear",
align_corners=False
)
# shape => (1, 96, 96, 96)
# Squeeze out the channel dim if needed: shape => (96, 96, 96)
img_downsample = img_downsample.squeeze(0)
sample = {"img": img_downsample}
return sample
```
# Study descriptions
- IXI: A dataset of nearly 600 MR images from normal, healthy subjects, including T1, T2, PD-weighted, MRA, and diffusion-weighted images collected at three different hospitals in London.
Citation: IXI data was obtained from https://brain-development.org/ixi-dataset/
- DLBS: A dataset from the Dallas Lifespan Brain Study (DLBS) comprising structural MRI, DTI, functional MRI, resting-state fMRI, and amyloid PET scans from 350 healthy adults aged 20-89, including extensive cognitive testing and demographic information.
Citation: DLBS data was obtained from the International Neuroimaging Data-sharing Initiative (INDI) database.
- NKI-RS: A large-scale ongoing neuroimaging dataset (N > 1000) across the lifespan from a community sample, including structural and functional MRI scans such as MPRAGE, DTI, resting-state fMRI, and task-based fMRI.
Citation: NKI-RS data was obtained from Rockland Sample Neuroimaging Data Release.
- OASIS-1: Cross-sectional T1-weighted MRI data from 416 right-handed subjects aged 18 to 96, including 100 over 60 with very mild to moderate Alzheimer’s disease, each with 3 or 4 scans.
Citation: OASIS-1: Cross-Sectional: https://doi.org/10.1162/jocn.2007.19.9.1498
- OASIS-2: A longitudinal MRI dataset of 150 right-handed individuals aged 60-96, with 373 imaging sessions including T1-weighted MRIs, featuring nondemented and demented older adults, including patients with Alzheimer’s disease.
Citation: OASIS-2: Longitudinal: https://doi.org/10.1162/jocn.2009.21407
# Methods
## Image processing
T1-weighted structural MRI scans were processed with [CAT12](https://neuro-jena.github.io/cat12-help/) ([Gaser et al, 2024](https://academic.oup.com/gigascience/article/doi/10.1093/gigascience/giae049/7727520)). Voxel-based processing created tissue probability maps for gray matter/white matter/CSF. Scans were masked to brain-only and subsequently registered to ICBM 2009c Nonlinear Asymmetric space (MNI152NLin2009cAsym 1.5mm^3) using linear affine registration with 12 degrees of freedom in [FSL FLIRT](https://fsl.fmrib.ox.ac.uk/fsl/docs/#/registration/flirt/index). The goal was to linearly align scans to standard space while preserving individual anatomy.
Metadata includes the total intracranial volume (TIV), image quality rating (IQR), MRI scanner manufacturer/model, and field strength.
## Train/validation/test partitioning
Scans were partitioned into train/validation/test datasets with a 80/10/10 split. Splits were balanced for age, sex, clinical diagnosis, and study. Subjects with multiple scans only appear in one split.
# Citation
@dataset{Radiata-Brains-structure,
author = {Jesse Brown and Clayton Young},
title = {Brains-Structure: A Collection of Processed Structural MRI Scans},
year = {2025},
url = { https://huggingface.co/datasets/radiata-ai/brains-structure },
note = {Version 1.0},
publisher = { Hugging Face }
}