How segevmunitz/astrocytes_morphology_detection works
AstroSeg builds complete GFAP-positive astrocyte instances from microscopy, linking each predicted cell’s nucleus, soma, and processes. The principal path prepares manifest-backed images and annotations, trains a multi-head model, predicts image patches, then reconstructs individual cells and measurements/QC. Separate branches support human mask import/review, pseudo-labeling, the older semantic/binary pipeline, and Cellpose refinement. Edges are limited to README statements and shown source references/calls; unsampled implementation details are not inferred.
Main entry points: predict_instances.py Patch inference · instance_trainer.py Instance trainer · instance_dataset.py Instance patches · workflow.py Mask import
Components 26
Data preparation
- Manifest schema
src/astroseg/io/manifest.py - Microscopy I/O
src/astroseg/io/ome_tiff.py - Channel selection
src/astroseg/preprocessing/channels.py - Instance patches
src/astroseg/datasets/instance_dataset.py - Instance targets
src/astroseg/preprocessing/instance_targets.py - Semantic patches
src/astroseg/datasets/astrocyte_dataset.py
Model training
- Instance trainer
src/astroseg/training/instance_trainer.py - Multichannel U-Net
src/astroseg/models/multichannel_unet.py - Training losses
src/astroseg/training/losses.py - Checkpoints
src/astroseg/training/checkpoints.py
Instance prediction
- Patch inference
src/astroseg/inference/predict_instances.py - Cell reconstruction
src/astroseg/postprocessing/astrocyte_instances.py - Nucleus detection
src/astroseg/preprocessing/nucleus_detection.py - Cell morphology
src/astroseg/postprocessing/skeleton.py - Image measurements
src/astroseg/analysis/morphology.py - QC overlays
src/astroseg/visualization/overlays.py
Annotation workflows
- Mask import
src/astroseg/annotations/workflow.py - Instance annotation workflow
src/astroseg/annotations/instance_workflow.py - Mask review GUI
src/astroseg/gui/mask_review.py - Pseudo-labeling
src/astroseg/annotations/pseudo_labels.py
Other model paths
- Binary U-Net
src/astroseg/models/unet.py - Cellpose transfer
src/astroseg/cellpose/transfer.py - Cellpose model
src/astroseg/models/cellpose_transfer.py
Other components
- Microscopy user
- Dataset artifacts
- Instance results
Connections 32
- Microscopy user → Manifest schema: defines dataset
README.md - Manifest schema → Instance patches: indexes samples
src/astroseg/datasets/instance_dataset.py - Instance patches → Microscopy I/O: loads images
src/astroseg/datasets/instance_dataset.py - Instance patches → Instance targets: builds targets
src/astroseg/datasets/instance_dataset.py - Instance patches → Channel selection: prepares channels
- Microscopy user → Instance trainer: trains model
README.md - Instance trainer → Multichannel U-Net: optimizes
src/astroseg/training/instance_trainer.py - Instance trainer → Training losses: computes loss
src/astroseg/training/instance_trainer.py - Instance trainer → Checkpoints: saves weights
src/astroseg/training/instance_trainer.py - Instance trainer → Instance patches: consumes batches
- Multichannel U-Net → Patch inference: predicts heads
- Patch inference → Nucleus detection: uses nuclei
- Patch inference → Cell reconstruction: reconstructs cells
- Microscopy user → Patch inference: predicts images
README.md - Patch inference → Checkpoints: loads weights
- Patch inference → Instance results: writes predictions
README.md - Cell reconstruction → Instance results: labels instances
README.md - Cell reconstruction → Cell morphology: derives morphology
- Image measurements → Cell morphology: uses skeleton
src/astroseg/analysis/morphology.py - Microscopy user → Mask import: imports masks
README.md - Mask import → Microscopy I/O: loads microscopy
src/astroseg/annotations/workflow.py - Mask import → QC overlays: creates QC overlay
src/astroseg/annotations/workflow.py - Microscopy user → Mask review GUI: reviews masks
README.md - Instance annotation workflow → Mask import: uses import workflow
src/astroseg/annotations/instance_workflow.py - Microscopy user → Pseudo-labeling: creates pseudo-labels
README.md - Microscopy user → Binary U-Net: runs baseline
README.md - Microscopy user → Cellpose transfer: refines Cellpose
README.md - Cellpose transfer → Cellpose model: transfers weights
- Semantic patches → Microscopy I/O: loads images
src/astroseg/datasets/astrocyte_dataset.py - Semantic patches → Channel selection: prepares inputs
src/astroseg/datasets/astrocyte_dataset.py - Microscopy user → Dataset artifacts: stores artifacts
README.md - Instance results → Dataset artifacts: persists outputs
README.md