"""3D CNN baseline: whole-brain volume classification via MONAI ResNet. Input volumes are (B, 1, D, H, W). MONAI's resnet18 with spatial_dims=3 is a clean, reproducible baseline for the value-of-volume question. """ from __future__ import annotations import torch import torch.nn as nn from monai.networks.nets import resnet18 class ResNet3D(nn.Module): def __init__(self, n_classes: int = 3, in_channels: int = 1): super().__init__() self.net = resnet18( spatial_dims=3, n_input_channels=in_channels, num_classes=n_classes, ) def forward(self, vol: torch.Tensor, tab: torch.Tensor | None = None) -> torch.Tensor: return self.net(vol)