Predicting categorical and continuous Alzheimer's disease outcomes from a single MRI scan.
Paper
Loaded from Europe PMC by your browser, not stored by OSCR: doi.org · Europe PMC
The paper is loaded when this pane is shown.
The authors' code
Python · 201 lines · 6.4 KB · MIT
- '''
- Dataset for training
- Written by Whalechen
- '''
- import math
- import os
- import random
- import numpy as np
- from torch.utils.data import Dataset
- import nibabel
- from scipy import ndimage
- class BrainS18Dataset(Dataset):
- def __init__(self, root_dir, img_list, sets):
- with open(img_list, 'r') as f:
- self.img_list = [line.strip() for line in f]
- print("Processing {} datas".format(len(self.img_list)))
- self.root_dir = root_dir
- self.input_D = sets.input_D
- self.input_H = sets.input_H
- self.input_W = sets.input_W
- self.phase = sets.phase
- def __nii2tensorarray__(self, data):
- [z, y, x] = data.shape
- new_data = np.reshape(data, [1, z, y, x])
- new_data = new_data.astype("float32")
- return new_data
- def __len__(self):
- return len(self.img_list)
- def __getitem__(self, idx):
- if self.phase == "train":
- # read image and labels
- ith_info = self.img_list[idx].split(" ")
- img_name = os.path.join(self.root_dir, ith_info[0])
- label_name = os.path.join(self.root_dir, ith_info[1])
- assert os.path.isfile(img_name)
- assert os.path.isfile(label_name)
- img = nibabel.load(img_name) # We have transposed the data from WHD format to DHW
- assert img is not None
- mask = nibabel.load(label_name)
- assert mask is not None
- # data processing
- img_array, mask_array = self.__training_data_process__(img, mask)
- # 2 tensor array
- img_array = self.__nii2tensorarray__(img_array)
- mask_array = self.__nii2tensorarray__(mask_array)
- assert img_array.shape == mask_array.shape, "img shape:{} is not equal to mask shape:{}".format(img_array.shape, mask_array.shape)
- return img_array, mask_array
- elif self.phase == "test":
- # read image
- ith_info = self.img_list[idx].split(" ")
- img_name = os.path.join(self.root_dir, ith_info[0])
- print(img_name)
- assert os.path.isfile(img_name)
- img = nibabel.load(img_name)
- assert img is not None
- # data processing
- img_array = self.__testing_data_process__(img)
- # 2 tensor array
- img_array = self.__nii2tensorarray__(img_array)
- return img_array
- def __drop_invalid_range__(self, volume, label=None):
- """
- Cut off the invalid area
- """
- zero_value = volume[0, 0, 0]
- non_zeros_idx = np.where(volume != zero_value)
- [max_z, max_h, max_w] = np.max(np.array(non_zeros_idx), axis=1)
- [min_z, min_h, min_w] = np.min(np.array(non_zeros_idx), axis=1)
- if label is not None:
- return volume[min_z:max_z, min_h:max_h, min_w:max_w], label[min_z:max_z, min_h:max_h, min_w:max_w]
- else:
- return volume[min_z:max_z, min_h:max_h, min_w:max_w]
- def __random_center_crop__(self, data, label):
- from random import random
- """
- Random crop
- """
- target_indexs = np.where(label>0)
- [img_d, img_h, img_w] = data.shape
- [max_D, max_H, max_W] = np.max(np.array(target_indexs), axis=1)
- [min_D, min_H, min_W] = np.min(np.array(target_indexs), axis=1)
- [target_depth, target_height, target_width] = np.array([max_D, max_H, max_W]) - np.array([min_D, min_H, min_W])
- Z_min = int((min_D - target_depth*1.0/2) * random())
- Y_min = int((min_H - target_height*1.0/2) * random())
- X_min = int((min_W - target_width*1.0/2) * random())
- Z_max = int(img_d - ((img_d - (max_D + target_depth*1.0/2)) * random()))
- Y_max = int(img_h - ((img_h - (max_H + target_height*1.0/2)) * random()))
- X_max = int(img_w - ((img_w - (max_W + target_width*1.0/2)) * random()))
- Z_min = np.max([0, Z_min])
- Y_min = np.max([0, Y_min])
- X_min = np.max([0, X_min])
- Z_max = np.min([img_d, Z_max])
- Y_max = np.min([img_h, Y_max])
- X_max = np.min([img_w, X_max])
- Z_min = int(Z_min)
- Y_min = int(Y_min)
- X_min = int(X_min)
- Z_max = int(Z_max)
- Y_max = int(Y_max)
- X_max = int(X_max)
- return data[Z_min: Z_max, Y_min: Y_max, X_min: X_max], label[Z_min: Z_max, Y_min: Y_max, X_min: X_max]
- def __itensity_normalize_one_volume__(self, volume):
- """
- normalize the itensity of an nd volume based on the mean and std of nonzeor region
- inputs:
- volume: the input nd volume
- outputs:
- out: the normalized nd volume
- """
- pixels = volume[volume > 0]
- mean = pixels.mean()
- std = pixels.std()
- out = (volume - mean)/std
- out_random = np.random.normal(0, 1, size = volume.shape)
- out[volume == 0] = out_random[volume == 0]
- return out
- def __resize_data__(self, data):
- """
- Resize the data to the input size
- """
- [depth, height, width] = data.shape
- scale = [self.input_D*1.0/depth, self.input_H*1.0/height, self.input_W*1.0/width]
- data = ndimage.interpolation.zoom(data, scale, order=0)
- return data
- def __crop_data__(self, data, label):
- """
- Random crop with different methods:
- """
- # random center crop
- data, label = self.__random_center_crop__ (data, label)
- return data, label
- def __training_data_process__(self, data, label):
- # crop data according net input size
- data = data.get_data()
- label = label.get_data()
- # drop out the invalid range
- data, label = self.__drop_invalid_range__(data, label)
- # crop data
- data, label = self.__crop_data__(data, label)
- # resize data
- data = self.__resize_data__(data)
- label = self.__resize_data__(label)
- # normalization datas
- data = self.__itensity_normalize_one_volume__(data)
- return data, label
- def __testing_data_process__(self, data):
- # crop data according net input size
- data = data.get_data()
- # resize data
- data = self.__resize_data__(data)
- # normalization datas
- data = self.__itensity_normalize_one_volume__(data)
- return data
brains18.py at commit 20f76aa, under MIT · at the source
Overview
- Department of Radiology and Biomedical Imaging, University of California San Francisco,San Francisco, CA USA
- Data Institute, University of San Francisco,San Francsico, CA USA
- Bakar Computational Health Sciences Institute, University of California San Francisco,San Francisco, USA
Abstract
Deep learning (DL) has shown success in predicting Alzheimer’s disease (AD) diagnosis, yet continuous measures such as cognitive assessment remain critical for richer prognosis, trajectory tracking and clinical trial enrichment. Current neurocognitive batteries are time-consuming, and the few DL models predicting cognition require expensive multimodal neuroimaging and longitudinal data. Although magnetic resonance imaging (MRI) is the most clinically accessible modality, on its own it struggles to capture AD heterogeneity in modern DL frameworks. We propose a multitask DL strategy integrating domain knowledge with large pretrained models to predict cognitive scores using only baseline MRI and demographics. By customizing loss functions and leveraging tissue segmentation-tuned latent representations as regularization features, our approach bypasses the need for longitudinal, multimodal or specialized neuroimaging data. This knowledge-informed multitask framework produces accurate diagnosis, segmentation and both current and future cognitive scores from a single baseline scan, with broad implications for early diagnosis, prognosis and clinical trial design.
Reproduced under the paper's license (CC BY), from the paper cited above.
Repositories
Its files are read in the Code ↔ Paper reader above.
Tencent/MedicalNet
20f76aaab5cac8056eaf50b79ed97c09dbfbd3bd, 27 November 2025Availability: 1 check, the latest on 28 September 2026: the link answers
- 28 September 2026: the link answers
11 files
- datasets/
brains18.py , Python, 201 lines - model.py, Python, 131 lines
- models/
resnet.py , Python, 263 lines - setting.py, Python, 116 lines
- test.py, Python, 106 lines
- test_ci.py, Python, 2 lines
- train.py, Python, 151 lines
- utils/
file_process.py , Python, 18 lines - utils/
logger.py , Python, 12 lines - LICENSE, License, 24 lines
- README.md, Text, 317 lines
darenma/MultitaskCognition
a65cbf6f2cdb817c25dbe4de05da158ec87469d7, 18 March 2026Availability: 1 check, the latest on 28 September 2026: the link answers
- 28 September 2026: the link answers
1 file
- 01-datasets.ipynb, Jupyter, 134 lines
- repository limit reached (2,000 files or 30 MB): the rest is at the source (14 files)
Code availability
Code for the analyses are available via GitHub at https://
Reproduced under the paper's license (CC BY), from the paper cited above.
Tracing map
Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.
What the map holds:
- 2 repositories of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
- 10 scripts, each with its path and the digest of its content;
- no match between paragraphs and code yet;
- neither the text of the paper nor the code itself.
Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.
Data
Datasets cited
- humanconnectome.org/
study/ , at Human Connectome Project; found in “Data availability”hcp-young-adult - openneuro:ds004856, at OpenNeuro; found in the references
Data availability
The public datasets in this study are available from ADNI (https://
Reproduced under the paper's license (CC BY), from the paper cited above.
Versions
The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.
Version 2, 28 September 2026
- Publisher: n/a → Nature Portfolio
Version 1, 28 September 2026: the first record
Recorded: type, language, journal, volume, issue, pages, dates, 7 authors, 2 keywords, 11 MeSH terms, 1 funder, 75 references.
Cite
This paper
Ma, D., Pabalan, C., Rajagopal, A., Akanksha, A., Interian, Y., Yang, Y., & Raj, A. (2026). Predicting categorical and continuous Alzheimer's disease outcomes from a single MRI scan. Nature aging, 6(5), 1121-1137. https://
BibTeX
@article{ma2026predictin
author = {Ma, Daren and Pabalan, Christabelle and Rajagopal, Abhejit and Akanksha, Akanksha and Interian, Yannet and Yang, Yang and Raj, Ashish},
title = {{Predicting categorical and continuous Alzheimer's disease outcomes from a single MRI scan}},
journal = {Nature aging},
year = {2026},
month = may,
volume = {6},
number = {5},
pages = {1121--1137},
publisher = {Nature Portfolio},
issn = {2662-8465},
doi = {10.1038/
url = {https://
pmid = {42151377},
pmcid = {PMC13190282}
}
RIS
TY - JOUR
AU - Ma, Daren
AU - Pabalan, Christabelle
AU - Rajagopal, Abhejit
AU - Akanksha, Akanksha
AU - Interian, Yannet
AU - Yang, Yang
AU - Raj, Ashish
TI - Predicting categorical and continuous Alzheimer's disease outcomes from a single MRI scan
T2 - Nature aging
J2 - Nat Aging
PY - 2026
DA - 2026/
VL - 6
IS - 5
SP - 1121
EP - 1137
SN - 2662-8465
PB - Nature Portfolio
DO - 10.1038/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1038/
"type": "article-journal",
"title": "Predicting categorical and continuous Alzheimer's disease outcomes from a single MRI scan",
"container-title": "Nature aging",
"author": [
{
"family": "Ma",
"given": "Daren"
},
{
"family": "Pabalan",
"given": "Christabelle"
},
{
"family": "Rajagopal",
"given": "Abhejit"
},
{
"family": "Akanksha",
"given": "Akanksha"
},
{
"family": "Interian",
"given": "Yannet"
},
{
"family": "Yang",
"given": "Yang"
},
{
"family": "Raj",
"given": "Ashish"
}
],
"container-title-short":
"volume": "6",
"issue": "5",
"page": "1121-1137",
"DOI": "10.1038/
"PMID": "42151377",
"PMCID": "PMC13190282",
"ISSN": "2662-8465",
"publisher": "Nature Portfolio",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
5,
18
]
]
}
}
The tracing map gets a citation of its own once an author has validated it and it has a DOI.
Similar papers
The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.
- [1] doi:10.1038/s41586-026-10454-2 [code]
- White matter micro- and macrostructure brain charts for the human lifespan.Journal: NatureIn common: SciPy, NumPy, OpenNeuro ds004856, humanconnectome.org/study/hcp-young-adult, 1 reference
- [2] doi:10.1162/imag.a.1338 [code]
- Systematic fMRI signal differences across cohorts alter lifespan trajectories of functional brain networks.Journal: Imaging neuroscience (Cambridge, Mass.)In common: NumPy, OpenNeuro ds004856, humanconnectome.org/study/hcp-young-adult, 1 reference
- [3] doi:10.1038/s41398-026-04426-3 [code]
- Resting-state brain age is associated with cognitive and sensorimotor abnormalities in schizophrenia spectrum disorders: a validation &
amp; longitudinal study. Journal: Translational psychiatryIn common: NiBabel, NumPy, OpenNeuro ds004856, structural MRI / diffusion, 2 references - [4] doi:10.1002/dad2.70360 [code]
- Investigating the amyloid-tau-neurodegener
ation framework in Alzheimer's disease using semi-supervised multimodal imaging data fusion. Journal: Alzheimer's & dementia (Amsterdam, Netherlands)In common: NiBabel, PyTorch, SciPy, 1 other tool, Alzheimer's / dementia, 3 references - [5] doi:10.1186/s40708-026-00316-y [code]
- Generalizable and explainable deep learning for brain MRI: a multi-cohort evaluation of 3D architectures for age and sex prediction.Journal: Brain informaticsIn common: PyTorch, SciPy, NumPy, OpenNeuro ds004856, structural MRI / diffusion, 1 reference
- [6] doi:10.1002/nbm.70277 [code]
- Hierarchical Bayesian Modelling Improves Microstructural Parameter Mapping in Diffusion and Exchange MRI Data.Journal: NMR in biomedicineIn common: NiBabel, SciPy, NumPy, humanconnectome.org/study/hcp-young-adult, structural MRI / diffusion, 2 references
- [7] doi:10.1002/hbm.70483 [code]
- Untamed: Unconstrained Tensor Decomposition and Graph Node Embedding for Cortical Parcellation.Journal: Human brain mappingIn common: NiBabel, PyTorch, SciPy, 1 other tool, humanconnectome.org/study/hcp-young-adult, 1 reference
- [8] doi:10.21203/rs.3.rs-9326213/v1 [code]
- Multi-task fMRI outperforms resting-state fMRI for revealing task-invariant organization of the human brainJournal: Research Square (preprint)In common: NiBabel, PyTorch, SciPy, 1 other tool, humanconnectome.org/study/hcp-young-adult, 1 reference
- [9] doi:10.64898/2026.03.09.710558 [code]
- Multi-task fMRI outperforms resting-state fMRI for revealing task-invariant organization of the human brainJournal: bioRxiv (preprint)In common: NiBabel, PyTorch, SciPy, 1 other tool, humanconnectome.org/study/hcp-young-adult, 1 reference
- [10] doi:10.1016/j.isci.2026.116671 [code]
- A high-resolution functional network-organized atlas of human superficial white matter from ultra-high-field diffusion MRI.Journal: iScienceIn common: NiBabel, PyTorch, SciPy, 1 other tool, humanconnectome.org/study/hcp-young-adult, structural MRI / diffusion
Contribute
The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.
Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.
Claim this paper
Correct its record
Say what each link of this record is, remove the ones that are not the paper's, add the ones that are missing. The correction becomes a new version of the record, in its Versions section.
Validate its tracing map
You validate the map as this page shows it: 2 repositories of the authors' code, each at its verified commit and with its license, 10 scripts, and 0 matches between paragraphs and code (see the Code and Map sections). It then receives a DOI on Zenodo, with you (your ORCID iD) and OSCR as its creators; the code itself is not deposited.
The map's fingerprint: sha256:328d20e95d56a68e…
Add the badge to its README
The badge links the code to this page. Copy one of these into the README of the paper's code: only you decide where it goes, and nothing is changed for you.
Markdown
[, paste the snippet at the top, then “Commit changes…” and, to review it first, “Create a new branch and start a pull request”. You open the pull request; OSCR asks for no permission.
Request its removal
To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).
Discussion, reproductions, activity
Discussion: questions and error reports about this paper and its code, from signed-in readers and its authors. It opens with sign-in.
Reproductions: reports from readers who ran the authors' code: what they reproduced, with which environment, commit and data. It opens with sign-in.
Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.
