How lab-smile/grace-cli works
Project type and purpose
• This is a command-line tool (CLI) written in Python that wraps the GRACE model for batch processing of NIfTI medical images.
• It’s not a web or microservice system but a local‐execution pipeline: take .nii/.nii.gz files, run inference with a pre-trained GRACE model, and write output files.
File structure
Top-level files:
• run.sh – Shell entry point; orchestrates virtual‐environment setup, dependency installation, and invokes the Python script.
• grace.py – Core Python program: parses arguments, loads the GRACE model, runs inference via nibabel or similar, writes output.
• requirements.txt – Python dependencies.
• GRACE.pth – (Not committed; downloaded at install) pre-trained model weights.
• inputs – User-provided .nii/.nii.gz files or directory (not in repo but part of runtime).
• outputs – Generated by the CLI; holds *_pred_GRACE.nii(.gz) files.
README for additional insights
• Steps: clone → chmod +x run.sh → download GRACE.pth → ./run.sh <input>
• run.sh:
1. create fresh venv
2. pip install -r requirements.txt
3. python grace.py <input>
4. outputs go into ./outputs
• Error handling for missing/invalid inputs, GPU optional if CUDA is available.