How amirrezahakam/swinunet-gan-pet-denoising works
SwinPix is a brain-PET denoising framework: raw DICOM volumes are prepared into paired low-dose/full-dose data, then a supervised Swin-UNet is pretrained and refined with conditional PatchGAN; checkpoints feed quantitative, edge-aware, and single-volume inference workflows. The graph also preserves preprocessing stages and baseline comparison. Training and model relationships are supported by excerpts and the SOURCE INDEX; README statements support the documented pipeline and user-facing capabilities. Some preprocessing-stage wiring and CLI internals were not sampled, so those documented links cite the README.
Main entry points: gan_trainer.py Phase 3 GAN trainer · trainer.py Phase 2 trainer · swin_unet.py Swin-UNet generator · dataset.py Paired PET dataset
Components 29
Data preparation
- DICOM conversion
src/preprocessing/stage01_dicom_converter.py - Resampling
src/preprocessing/stage02_resampling.py - Spatial normalization
src/preprocessing/stage03_spatial_normalization.py - Skull stripping
src/preprocessing/stage04_skull_stripping.py - Intensity normalization
src/preprocessing/stage05_intensity_normalization.py - Noise simulation
src/preprocessing/stage06_noise_simulation.py - Dataset splitting
src/preprocessing/stage07_data_splitting.py - Slice extraction
src/preprocessing/stage08_slice_extraction.py - Preprocessing loader
src/preprocessing/stage09_dataloader.py - Phase 1 runner
src/preprocessing/orchestrator.py
Denoising models
- Swin-UNet generator
src/models/swin_unet.py - PatchGAN discriminator
src/models/discriminator.py
Training
- Phase 2 trainer
src/training/trainer.py - Phase 3 GAN trainer
src/training/gan_trainer.py - Hybrid image loss
src/losses/losses.py - Charbonnier loss
src/losses/charbonnier_loss.py - VGG perceptual loss
src/losses/perceptual_loss.py - Phase 2 CLI
scripts/train.py - Phase 3 CLI
scripts/train_gan.py
Evaluation
- Image quality metrics
src/metrics/image_quality.py - Test evaluation
src/analysis/final_evaluation.py - Baseline comparison
src/analysis/baseline_comparison.py - Evaluation CLI
scripts/evaluate.py - Edge evaluation CLI
scripts/edge_aware_eval.py - Inference CLI
scripts/infer.py - Denoised PET result
Data and utilities
- Paired PET dataset
src/data/dataset.py - Training data loader
src/data/dataloader.py
Other components
- PET researcher
Connections 33
- PET researcher → Phase 1 runner: runs preprocessing
README.md - Phase 1 runner → DICOM conversion: runs stage
src/preprocessing/orchestrator.py - DICOM conversion → Resampling: prepares volumes
README.md - Resampling → Spatial normalization: prepares volumes
README.md - Spatial normalization → Skull stripping: prepares volumes
README.md - Skull stripping → Intensity normalization: prepares volumes
README.md - Intensity normalization → Noise simulation: simulates dose
README.md - Noise simulation → Dataset splitting: forms pairs
README.md - Dataset splitting → Slice extraction: provides splits
README.md - Slice extraction → Preprocessing loader: prepares inputs
README.md - PET researcher → Phase 2 CLI: starts training
README.md - Phase 2 CLI → Phase 2 trainer: invokes
README.md - Phase 2 trainer → Paired PET dataset: loads samples
src/training/trainer.py - Phase 2 trainer → Swin-UNet generator: trains generator
src/training/trainer.py - Phase 2 trainer → Hybrid image loss: optimizes with
src/training/trainer.py - Hybrid image loss → Charbonnier loss: uses
- PET researcher → Phase 3 CLI: starts refinement
README.md - Phase 3 CLI → Phase 3 GAN trainer: invokes
README.md - Phase 3 GAN trainer → Paired PET dataset: loads samples
src/training/gan_trainer.py - Phase 3 GAN trainer → Swin-UNet generator: refines generator
src/training/gan_trainer.py - Phase 3 GAN trainer → PatchGAN discriminator: trains discriminator
src/training/gan_trainer.py - Phase 3 GAN trainer → VGG perceptual loss: uses perceptual loss
src/training/gan_trainer.py - PET researcher → Evaluation CLI: requests evaluation
README.md - Evaluation CLI → Test evaluation: runs evaluator
src/analysis/final_evaluation.py - Test evaluation → Paired PET dataset: loads test pairs
src/analysis/final_evaluation.py - Test evaluation → Swin-UNet generator: predicts with
src/analysis/final_evaluation.py - PET researcher → Edge evaluation CLI: requests edge metrics
README.md - Edge evaluation CLI → Image quality metrics: calculates metrics
scripts/edge_aware_eval.py - PET researcher → Inference CLI: requests denoising
README.md - Inference CLI → Swin-UNet generator: runs model
scripts/infer.py - Inference CLI → Denoised PET result: writes result
README.md - PET researcher → Baseline comparison: compares methods
README.md - Baseline comparison → Paired PET dataset: evaluates pairs
src/analysis/baseline_comparison.py