Pig Brain SegResNet β€” brain extraction for porcine T2/CISS MRI

⚠️ License is a placeholder (cc-by-nc-4.0). Confirm the final license before making this repo public / before publication.

3D SegResNet (MONAI) for binary brain extraction (brain vs. background) on sub-millimeter porcine T2-weighted / 3D-CISS MRI. This is the deep-learning component of the pipeline described in "Automated Brain Extraction Using Deep Learning and Atlas-Guided Refinement."

The released pipeline pairs this model with ANTs SyN template refinement; the model alone provides a fast, template-free brain mask and the initial mask that anchors the iterative curation workflow.

Files

  • pig_brain_segresnet.pth β€” model state_dict (load into the architecture below).
  • config.yaml β€” full training/inference config (architecture + post-processing).

Architecture

field value
init_filters 32
blocks_down (1, 2, 2, 4)
blocks_up (1, 1, 1)
in / out channels 1 / 2
spatial_dims 3
params ~18.8 M

Preprocessing

LPS orientation β†’ 1 mm isotropic resampling (bilinear) β†’ foreground crop β†’ spatial pad to 128Β³ β†’ per-channel non-zero z-score normalization.

Inference

Gaussian-weighted sliding window (ROI 128Β³, overlap 0.75) with flip TTA, then: softmax β†’ Gaussian smooth β†’ threshold 0.6 β†’ remove small objects (min 500) β†’ keep largest connected component β†’ fill holes. Spatial preprocessing is inverted to return the mask to native resolution.

Usage

import torch
from omegaconf import OmegaConf
from huggingface_hub import hf_hub_download
from monai.networks.nets import SegResNet

repo = "madhavappaneni9/pig-brain-segresnet"
cfg = OmegaConf.load(hf_hub_download(repo, "config.yaml"))
weights = hf_hub_download(repo, "pig_brain_segresnet.pth")

model = SegResNet(
    spatial_dims=cfg.model.spatial_dims,
    init_filters=cfg.model.init_filters,
    in_channels=cfg.model.in_channels,
    out_channels=cfg.model.out_channels,
    blocks_down=tuple(cfg.model.blocks_down),
    blocks_up=tuple(cfg.model.blocks_up),
    dropout_prob=0.0,
)
model.load_state_dict(torch.load(weights, map_location="cpu", weights_only=False))
model.eval()

A full preprocessing + sliding-window + post-processing example is in the demo Space.

Intended use & limitations

  • Intended: research brain extraction for porcine T2/CISS MRI; baseline for future porcine brain MRI studies.
  • Not for clinical/diagnostic use.
  • Trained on a small cohort; defaults calibrated to ~1-month Yorkshire piglets. Out-of-distribution scans (other ages/cohorts/contrasts) may segment poorly and benefit from transfer-learning the checkpoint on a small new-cohort sample.

Citation

Citation to be added on publication.

Downloads last month
14
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support