How victorbutoi/flexray works
FleXray is a Python package and CLI for X-ray anatomy segmentation, with additional tools for training, preparing and harmonizing datasets, rendering CT-derived DRRs, and MCP-based access. The main user workflow preprocesses an image, runs a pretrained model, and saves masks, probabilities, and logits. README capabilities guide the broader map; only some internal behavior was sampled, so uncertain implementation links are omitted.
Main entry points: runner.py Inference runner · train.py Training lifecycle · launch/cli.py Training launcher · datasets/cli.py Dataset CLI
Components 30
Inference
- Inference CLI
src/fxr/inference/cli.py - Inference runner
src/fxr/inference/runner.py - Image preprocessing
src/fxr/inference/preprocessing.py - Model segmenter
src/fxr/inference/segmenter.py - Test-time augmentation
src/fxr/inference/tta.py - Prediction processing
src/fxr/inference/postprocessing.py - Prediction artifacts
src/fxr/inference/artifacts.py
Training
- Training launcher
src/fxr/launch/cli.py - Run validation
src/fxr/launch/readiness.py - Training lifecycle
src/fxr/experiment/train.py - Segmentation model
src/fxr/models/unet.py - Training augmentation
src/fxr/augmentation/pipeline.py - Segmentation losses
src/fxr/losses/segmentation.py
Data and protocols
- Dataset CLI
src/fxr/datasets/cli.py - Dataset preparation
src/fxr/datasets/builders.py - Dataset packaging
src/fxr/datasets/packaging.py - Dataset runtime
src/fxr/datasets/runtime.py - ThunderDB packages
- Protocol CLI
src/fxr/protocols/cli.py - Protocol definitions
src/fxr/protocols/io.py
DRR rendering
- DRR CLI
src/fxr/launch/render_cli.py - DRR rendering
src/fxr/drr/rendering.py - CT subjects
src/fxr/drr/subjects.py
External access
- MCP server
src/fxr/mcp/server.py - Inference tools
src/fxr/mcp/inference_tools.py - Protocol tools
src/fxr/mcp/protocol_tools.py
Other components
- User
- Hugging Face
- AI client
- NumPy outputs
Connections 30
- User → Inference CLI: runs prediction
- Inference CLI → Inference runner: starts inference
- Inference runner → Image preprocessing: prepares image
- Inference runner → Model segmenter: runs model
- Inference runner → Test-time augmentation: applies TTA
- Inference runner → Prediction processing: processes prediction
- Inference runner → Prediction artifacts: writes results
- Model segmenter → Hugging Face: loads model bundle
- Prediction artifacts → NumPy outputs: saves arrays
- User → Training launcher: starts training
- Training launcher → Run validation: validates config
- Training launcher → Training lifecycle: runs experiment
- Training lifecycle → Segmentation model: trains model
- Training lifecycle → Training augmentation: augments batches
- Training lifecycle → Segmentation losses: computes loss
- User → Dataset CLI: prepares datasets
- Dataset CLI → Dataset preparation: builds dataset
- Dataset CLI → Dataset packaging: packages data
- Dataset packaging → ThunderDB packages: writes package
- Dataset runtime → ThunderDB packages: reads package
- User → Protocol CLI: manages protocols
- Protocol CLI → Protocol definitions: loads definitions
- User → DRR CLI: renders CT data
- DRR CLI → DRR rendering: starts rendering
- DRR rendering → CT subjects: uses subjects
- AI client → MCP server: sends tool requests
- MCP server → Inference tools: registers tools
- MCP server → Protocol tools: registers tools
- Inference tools → Model segmenter: runs segmentation
- Protocol tools → Protocol definitions: inspects definitions