Views
No views yet
License note: thelicensefield above is set tootheras a placeholder. Set it to whatever license you intend to release your code and model weights under before making the repo public.
models/ has been stripped to the tensors needed for inference (network_weights, trainer_name, init_args, inference_allowed_mirroring_axes). Optimizer state, the duplicate checkpoint_latest.pth, and training artifacts (logs, progress.png, debug.json) were removed. This reduces the model from ~478 MB to ~125 MB with no change to inference output. It is not suitable for resuming training.1# Requires git-lfs (https://git-lfs.com) for the .pth weights
2git lfs install
3git clone https://huggingface.co/<your-username>/<your-repo-name>
4cd <your-repo-name>1from huggingface_hub import snapshot_download
2snapshot_download(repo_id="<your-username>/<your-repo-name>", local_dir="mouse_brain_pipeline")1conda env create -f environment.yaml
2conda activate mouse-mrimodels/
Dataset001_MouseBrain/
nnUNetTrainer__nnUNetPlans__3d_fullres/
dataset.json
plans.json
fold_0/
checkpoint_best.pth # slim, inference-onlypipeline_config.json already points nnunet.model_path at models, so no change is needed.example_atlas/NeAt_in_vivo/, and pipeline_config.json
already points atlas_parent at it — so registration works out of the box with no extra download.example_atlas/NeAt_in_vivo/README.md for provenance, license, and citation.atlas_parent at a folder containing template/ (skull-stripped) and
label/ subdirectories:NeAt/in_vivo)"atlas_parent": "/path/to/mouse-brain-atlas/NeAt/in_vivo"python mouse_brain_pipeline.py <input_path> --config pipeline_config.json [OPTIONS]<input_path> — a single NIfTI file (.nii/.nii.gz) or a directory of them--config — path to pipeline_config.json1# Single image
2python mouse_brain_pipeline.py /path/to/subject_01.nii --config pipeline_config.json
3
4# Batch (directory)
5python mouse_brain_pipeline.py /path/to/images/ --config pipeline_config.json
6
7# Custom output location, more registration runs / workers
8python mouse_brain_pipeline.py /path/to/images/ --config pipeline_config.json \
9 --output-root /path/to/results/ --runs 20 --workers 8| Argument | Description | Default |
|---|---|---|
input | Input image file or directory | Required |
--config | Path to pipeline configuration JSON | Required |
--skip-skull-stripping | Skip skull stripping (expects pre-stripped images) | False |
--output-root | Override output_root from config | From config |
--runs | Registration runs for consensus | 10 |
--workers | Parallel registration workers | CPU cores − 2 |
--interactive | Prompt on a resolution/spacing mismatch (single-image mode). Off by default: mismatched images are auto-resampled to the expected resolution. | False |
--debug | Debug logging + keep intermediate files | False |
--interactive to be prompted (exit / resample / custom spacing) instead.<output_root>/
├── skull_stripped/<subject_id>/ # skull_stripped.nii, brain_mask.nii
├── registration/<subject_id>/ # reference_transformed.nii, registered_labels_consensus.nii,
│ # registration_confidence.nii, consensus_verification.png
├── volumes/<subject_id>/ # brain_volumes.csv
├── tmp/<subject_id>/ # temporary files (auto-deleted unless --debug)
└── processing_log_YYYYMMDD_HHMMSS.jsonLabel, Region_Name, Hemisphere, Voxel_Count, Volume_mm3, Mean_Intensity..nii and .nii.gz.conda activate mouse-mri then pip install nnunetv2==2.5.1.models/Dataset001_MouseBrain/nnUNetTrainer__nnUNetPlans__3d_fullres/fold_0/.atlas_parent points at the folder containing template/ and label/."device": "cuda" in the config for GPU. Tune --workers for registration.license field in the header above.example_atlas/NeAt_in_vivo/) is a derivative of the NeAt atlas and is distributed under the GNU GPL v3, with its own LICENSE and provenance/citation in that folder. It is a separate work aggregated alongside the pipeline; it does not impose GPLv3 on your own code.