Progression-guided spatiotemporal memory transformers for accurate and consistent longitudinal brain tumor segmentation.
The 3 matches · 1 of them tie a paragraph to a whole file, not to given lines: a weak match, whose lines are not tinted
- [1] § Experimental results and discussion › Experimental setup ↔ PGSMT.ipynb, lines 186–190 · score 0.59 · weight decay, AdamW, setup, optimizer, model
- [2] § Experimental results and discussion › Experimental setup ↔ Configuration_Setup.ipynb, the whole file · a weak match · score 0.53 · weight decay, batch, patches, setup
- [3] § Experimental results and discussion › Experimental setup ↔ PGSMT.ipynb, lines 186–190 · score 0.52 · weight decay, AdamW, setup, optimization, model
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
Jupyter notebook · 205 lines · 5.6 KB · no license · 2 matches
- # %%
- import torch
- import torch.nn as nn
- import torch.nn.functional as F
- # -----------------------------------
- # 1. Spatial Encoder
- # -----------------------------------
- class Encoder(nn.Module):
- def __init__(self, in_channels=4, base_channels=32):
- super().__init__()
- self.conv1 = nn.Conv3d(in_channels, base_channels, 3, padding=1)
- self.conv2 = nn.Conv3d(base_channels, base_channels*2, 3, padding=1)
- self.pool = nn.MaxPool3d(2)
- def forward(self, x):
- x = F.relu(self.conv1(x))
- x = self.pool(x)
- x = F.relu(self.conv2(x))
- return x
- # -----------------------------------
- # 2. Progression-Aware Temporal Memory
- # -----------------------------------
- class PATM(nn.Module):
- def __init__(self, dim, memory_slots=16):
- super().__init__()
- self.memory = nn.Parameter(torch.randn(memory_slots, dim))
- self.linear_q = nn.Linear(dim, dim)
- self.linear_k = nn.Linear(dim, dim)
- self.linear_v = nn.Linear(dim, dim)
- def forward(self, Ft, prev_memory):
- B, C, H, W, D = Ft.shape
- Ft_flat = Ft.view(B, C, -1).permute(0, 2, 1) # [B, N, C]
- Q = self.linear_q(Ft_flat)
- K = self.linear_k(prev_memory)
- V = self.linear_v(prev_memory)
- attn = torch.softmax(Q @ K.transpose(-1, -2) / (C**0.5), dim=-1)
- memory_update = attn @ V
- return memory_update
- # -----------------------------------
- # 3. Cross-Time Structural Alignment
- # -----------------------------------
- class CTSAM(nn.Module):
- def __init__(self, channels):
- super().__init__()
- self.offset_conv = nn.Conv3d(channels, 2, 3, padding=1)
- def forward(self, Ft, Ft_prev):
- offset = self.offset_conv(Ft)
- # simplified alignment (no grid_sample for brevity)
- aligned_prev = Ft_prev + offset.mean()
- loss_align = torch.mean((Ft - aligned_prev) ** 2)
- return aligned_prev, loss_align
- # -----------------------------------
- # 4. Boundary-Enhanced Transformer
- # -----------------------------------
- class BETE(nn.Module):
- def __init__(self, dim):
- super().__init__()
- self.q = nn.Linear(dim, dim)
- self.k = nn.Linear(dim, dim)
- self.v = nn.Linear(dim, dim)
- def forward(self, x):
- B, C, H, W, D = x.shape
- x_flat = x.view(B, C, -1).permute(0, 2, 1)
- Q = self.q(x_flat)
- K = self.k(x_flat)
- V = self.v(x_flat)
- attn = torch.softmax(Q @ K.transpose(-1, -2) / (C**0.5), dim=-1)
- out = attn @ V
- out = out.permute(0, 2, 1).view(B, C, H, W, D)
- return out
- # -----------------------------------
- # 5. Decoder
- # -----------------------------------
- class Decoder(nn.Module):
- def __init__(self, in_channels, num_classes=4):
- super().__init__()
- self.conv = nn.Conv3d(in_channels, num_classes, 1)
- def forward(self, x):
- return self.conv(x) # logits
- # -----------------------------------
- # 6. PGSMT Model
- # -----------------------------------
- class PGSMT(nn.Module):
- def __init__(self):
- super().__init__()
- self.encoder = Encoder()
- self.memory_module = PATM(dim=64)
- self.align = CTSAM(64)
- self.transformer = BETE(64)
- self.decoder = Decoder(64, num_classes=4)
- def forward(self, X_seq):
- memory = None
- outputs = []
- total_align_loss = 0
- for t in range(len(X_seq)):
- Ft = self.encoder(X_seq[t])
- if t == 0:
- memory = torch.zeros(1, 16, 64).to(Ft.device)
- aligned_prev = Ft
- else:
- aligned_prev, loss_align = self.align(Ft, prev_Ft)
- total_align_loss += loss_align
- memory = self.memory_module(Ft, memory)
- Zt = self.transformer(Ft)
- Yt = self.decoder(Zt)
- outputs.append(Yt)
- prev_Ft = Ft
- return outputs, total_align_loss
- # -----------------------------------
- # 7. Dice Loss
- # -----------------------------------
- def dice_loss(pred, target):
- pred = torch.softmax(pred, dim=1)
- intersection = (pred * target).sum()
- return 1 - (2. * intersection + 1e-5) / (pred.sum() + target.sum() + 1e-5)
- # -----------------------------------
- # 8. Total Loss
- # -----------------------------------
- def total_loss(outputs, targets, align_loss, lambda1=0.5, lambda2=0.3):
- loss = 0
- for t in range(len(outputs)):
- loss += dice_loss(outputs[t], targets[t])
- if t > 0:
- temp_loss = torch.mean(torch.abs(outputs[t] - outputs[t-1]))
- loss += lambda2 * temp_loss
- loss += lambda1 * align_loss
- return loss
- # -----------------------------------
- # 9. Training Step
- # -----------------------------------
- def train_step(model, data, optimizer):
- X_seq, Y_seq = data
- optimizer.zero_grad()
- outputs, align_loss = model(X_seq)
- loss = total_loss(outputs, Y_seq, align_loss)
- loss.backward()
- optimizer.step()
- return loss.item()
- # -----------------------------------
- # 10. Optimizer Setup
- # -----------------------------------
- def get_optimizer(model):
- return torch.optim.AdamW(model.parameters(), lr=1e-4, weight_decay=1e-5)
- # -----------------------------------
- # 11. Example Run
- # -----------------------------------
- if __name__ == "__main__":
- model = PGSMT().cuda()
- optimizer = get_optimizer(model)
- # dummy data: sequence of 3 time points
- X_seq = [torch.randn(1, 4, 64, 64, 64).cuda() for _ in range(3)]
- Y_seq = [torch.randn(1, 4, 64, 64, 64).cuda() for _ in range(3)]
- loss = train_step(model, (X_seq, Y_seq), optimizer)
- print("Loss:", loss)
PGSMT.ipynb at commit f6c67ff, no license · at the source
Overview
- School of Computing Science and Engineering, Galgotias University, Greater Noida, Uttar Pradesh 203201 India
- Department of Communication Technology and Network, Faculty of Computer Science and Information Technology, Universiti Putra Malaysia (UPM), Serdang, Selangor 43400 Malaysia
- Department of Mathematics, Faculty of Mathematics and Natural Sciences, University of Jember, Jember, Indonesia
- Manipal Institute of Technology Bengaluru, Manipal Academy of Higher Education, Manipal, India
- Department of Computer Science and Engineering, KG Reddy College of Engineering and Technology, Hyderabad, Telangana 501504 India
Abstract
For monitoring the progression of the disease and the efficacy of treatment, it is essential to segment the brain tumor. The majority of the available deep learning models in use today are based on discrete time points without considering the continuity of the process, which causes irregular shapes of the tumors in the subsequent images. In this study, a model called Progression-Guided Spatiotemporal Memory Transformer (PGSMT) has been proposed, which has a unique design to overcome the constraints. A progression-aware temporal memory module, where the latent tumor representation is built up across successive MRI scans, a cross-time structural alignment mechanism, where the consistency of tumor morphology is preserved with the ability to accommodate pathological changes, and a boundary-enhanced transformer encoder, where the spatial dependencies are captured and stored for precise boundary delineation, are the three major components of the proposed framework. PGSMT learns the temporal weighting, making it possible for the network to distinguish between noise and actual progression, unlike other temporal fusion methods. When compared with the Convolutional Neural Network (CNN), hybrid CNN-Transformer, and Transformer models, the proposed PGSMT outperforms these models in the BraTS longitudinal benchmark dataset. PGSMT shows statistically significant improvements (p < 0.05), with 88.1% Dice for the enhancing tumor, 90.2% Dice for the tumor core, and 93.0% Dice for the total tumor. while reducing inter-scan volumetric inconsistencies significantly. The relevant therapeutic interest in the dynamics of changing tumor volumes is substantiated by attention analysis. With respect to the empirical evaluation on the BraTS longitudinal data set, the results achieve 88.1% Dice for the enhancing tumor, 90.2% Dice for the tumor core, and 93.0% Dice for the total tumor, demonstrating statistically significant improvements (p < 0.05) compared to traditional methods, while the results indicate increased stability in terms of temporal variance.
Reproduced under the paper's license (CC BY), from the paper cited above.
Repository
Its files are read in the Code ↔ Paper reader above, with 3 matches between paragraphs and lines of code.
skbsangeetha/Progression-Guided-Spatiotemporal-Memory-Transformers-for-Brain-Tumor-Segmentation
f6c67ffeaff7fb038bad74c6563eeba1060906b8, 25 April 2026Availability: 1 check, the latest on 28 September 2026: the link answers
- 28 September 2026: the link answers
15 files
- Alignment_Module.ipynb, Jupyter, 11 lines
- Configuration_Setup.ipyn
b , Jupyter, 15 lines, 1 match - Dataset_Loader.ipynb, Jupyter, 14 lines
- Decoder.ipynb, Jupyter, 8 lines
- Dice_Loss.ipynb, Jupyter, 7 lines
- Encoder.ipynb, Jupyter, 15 lines
- Full_Run_Script.ipynb, Jupyter, 12 lines
- Model.ipynb, Jupyter, 30 lines
- PGSMT.ipynb, Jupyter, 205 lines, 2 matches
- Seed_Initialization.ipyn
b , Jupyter, 10 lines - Temporal_Loss.ipynb, Jupyter, 6 lines
- Temporal_Memory_Module.i
pynb , Jupyter, 18 lines - Total_Loss.ipynb, Jupyter, 9 lines
- Training_Loop.ipynb, Jupyter, 20 lines
- Transformer_Block.ipynb, Jupyter, 17 lines
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:
- 1 repository of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
- 15 scripts, each with its path and the digest of its content;
- 3 matches between paragraphs of the paper and lines of the code (method lexical-v1);
- 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
- kaggle.com/
datasets/ , at Kaggle; found in the text, “Dataset description”awsaf49 - kaggle.com/
datasets/ , at Kaggle; found in the text, “Dataset description”talhaumar
Data availability
The datasets used during the current study are available from the corresponding author on reasonable request.
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 1, 28 September 2026: the first record
Recorded: type, language, journal, volume, issue, pages, dates, 6 authors, 14 keywords, 8 MeSH terms, 1 funder, 11 references.
Cite
This paper
Mathivanan, S. K., Subramaniam, S. K., Dafik, R, S., SKB, S., & S, S. S. (2026). Progression-guided spatiotemporal memory transformers for accurate and consistent longitudinal brain tumor segmentation. Scientific reports, 16(1), 23919. https://
BibTeX
@article{mathivanan2026p
author = {Mathivanan, Sandeep Kumar and Subramaniam, Shamala K and Dafik and R, Sunder and SKB, Sangeetha and S, Siva Shankar},
title = {{Progression-guided spatiotemporal memory transformers for accurate and consistent longitudinal brain tumor segmentation}},
journal = {Scientific reports},
year = {2026},
month = may,
volume = {16},
number = {1},
pages = {23919},
publisher = {Nature Publishing Group},
issn = {2045-2322},
doi = {10.1038/
url = {https://
pmid = {42185460},
pmcid = {PMC13434621}
}
RIS
TY - JOUR
AU - Mathivanan, Sandeep Kumar
AU - Subramaniam, Shamala K
AU - Dafik
AU - R, Sunder
AU - SKB, Sangeetha
AU - S, Siva Shankar
TI - Progression-guided spatiotemporal memory transformers for accurate and consistent longitudinal brain tumor segmentation
T2 - Scientific reports
J2 - Sci Rep
PY - 2026
DA - 2026/
VL - 16
IS - 1
SP - 23919
SN - 2045-2322
PB - Nature Publishing Group
DO - 10.1038/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1038/
"type": "article-journal",
"title": "Progression-guided spatiotemporal memory transformers for accurate and consistent longitudinal brain tumor segmentation",
"container-title": "Scientific reports",
"author": [
{
"family": "Mathivanan",
"given": "Sandeep Kumar"
},
{
"family": "Subramaniam",
"given": "Shamala K"
},
{
"family": "Dafik"
},
{
"family": "R",
"given": "Sunder"
},
{
"family": "SKB",
"given": "Sangeetha"
},
{
"family": "S",
"given": "Siva Shankar"
}
],
"container-title-short":
"volume": "16",
"issue": "1",
"page": "23919",
"DOI": "10.1038/
"PMID": "42185460",
"PMCID": "PMC13434621",
"ISSN": "2045-2322",
"publisher": "Nature Publishing Group",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
5,
25
]
]
}
}
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.3389/frai.2026.1807248 [code]
- Federated learning framework for medical image analysis with perspective-aware contrastive and mixture of experts.Journal: Frontiers in artificial intelligenceIn common: PyTorch, NumPy, kaggle.com/datasets/awsaf49, methods / tools, 1 reference
- [2] doi:10.1038/s41467-026-71267-5 [code]
- Human-like cognitive generalization for large models via mental representation-guided supervision.Journal: Nature communicationsIn common: PyTorch, NumPy, kaggle.com/datasets/awsaf49
- [3] doi:10.3389/fradi.2026.1847193
- Image-conditioned latent rectified flow models for 3D medical anomaly localisation.Journal: Frontiers in radiologyIn common: kaggle.com/datasets/awsaf49, methods / tools, 1 reference
- [4] doi:10.1371/journal.pone.0351667
- MamNet-PT: A Mamba-enhanced hybrid architecture with selective state-space modeling for uncertainty-aware brain tumor segmentation.Journal: PloS oneIn common: kaggle.com/datasets/awsaf49, methods / tools, structural MRI / diffusion, other condition
- [5] doi:10.1038/s41598-026-50240-8
- High-precision brain tumor segmentation with switchable normalization in faster R-CNN architecture.Journal: Scientific reportsIn common: kaggle.com/datasets/awsaf49, methods / tools, structural MRI / diffusion, other condition
- [6] doi:10.3390/jimaging12060251
- 3D Deep Learning for Brain Tumor Segmentation and Survival Prediction: A Comprehensive Multi-Modal Analysis Using the BraTS2020 Dataset.Journal: Journal of imagingIn common: kaggle.com/datasets/awsaf49, other condition, 1 reference
- [7] doi:10.1038/s41598-026-45697-6
- Real-time medical images enhancement technique using Adaptive Histogram Equalization model.Journal: Scientific reportsIn common: kaggle.com/datasets/awsaf49, methods / tools, structural MRI / diffusion, other condition
- [8] doi:10.3389/frai.2026.1812932
- Bridging global context and local precision using a disagreement-based region specific ensemble of Swin UNETR and SegResNet for 3D glioma segmentation.Journal: Frontiers in artificial intelligenceIn common: kaggle.com/datasets/awsaf49, methods / tools, other condition
- [9] doi:10.1186/s12911-026-03551-9
- A multi-sequence MRI integration framework using SwinUNETR-v2 for multiple sclerosis lesion segmentation.Journal: BMC medical informatics and decision makingIn common: kaggle.com/datasets/awsaf49, structural MRI / diffusion
- [10] doi:10.1371/journal.pone.0351405 [code]
- Unimodal vs. multimodal deep learning for non-invasive MGMT promoter methylation prediction in glioblastoma: A systematic evaluation on the BraTS 2021 dataset.Journal: PloS oneIn common: PyTorch, NumPy, methods / tools, structural MRI / diffusion, other condition, 1 reference
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: 1 repository of the authors' code, each at its verified commit and with its license, 15 scripts, and 3 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:6080c0750e93d1bb…
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.
