Spaces:
Sleeping
Sleeping
| title: Ct App | |
| emoji: π | |
| colorFrom: blue | |
| colorTo: indigo | |
| sdk: gradio | |
| sdk_version: 6.18.0 | |
| python_version: '3.13' | |
| app_file: app.py | |
| pinned: false | |
| license: apache-2.0 | |
| short_description: App that scans CT docs using TotalSegmentator model, flags o | |
| tags: | |
| - track:backyard | |
| - sponsor:modal | |
| - achievement:offgrid | |
| - achievement:offbrand | |
| - achievement:fieldnotes | |
| # π©» CT Report Generator | |
| > **An automated 3D volumetric reporting pipeline for CT scans, powered by TotalSegmentator (3D U-Net) (β‘ ~30 Million Total Parameters) β deployed serverlessly on Modal.** | |
| > πΊ **[Watch the full video demo and post on X (Twitter)!](https://x.com/AKIS23820044161/status/2066586748541657272)** | |
| > Special Bonus Targets : Tiny Titan (~30M parameters model) Β· Off-Brand Award | |
| --- | |
| ## π Overview | |
| CT report generator is a Gradio-based clinical dashboard that automates the extraction and quantification of anatomical structures from 3D CT scans. It processes raw `.nii` / `.nii.gz` volumetric data, calculates the exact volume of dozens of internal organs, and automatically flags any measurements that fall outside of expected healthy reference ranges (e.g., hepatomegaly, splenomegaly, or asymmetrical kidneys). | |
| --- | |
| ## π Features | |
| | Feature | Description | | |
| |---|---| | |
| | π§ **Total Body Segmentation** | Automatically identifies and segments major solid organs, thoracic structures, and GI/GU tracts. | | |
| | π **Clinical Volume Alerts** | Cross-references organ volumes with normal adult reference ranges and flags anomalies (e.g. Enlarged liver, asymmetric lungs). | | |
| | πΌοΈ **Cross-Section Preview** | Generates an immediate mid-axial visual slice of the uploaded 3D volume. | | |
| | π **PDF Report Generation** | Automatically compiles the findings into a clean, professional, downloadable PDF clinical report using WeasyPrint. | | |
| --- | |
| ## π€ AI Models Used | |
| ### 1. `TotalSegmentator` β 3D Anatomical Segmentation | |
| - **Architecture:** 3D U-Net (nnU-Net framework) | |
| - **Total Parameters:** ~30 Million (30M) | |
| - **Task:** 3D medical image segmentation. | |
| - **Used for:** Identifying and calculating the exact cubic centimeter (cmΒ³) volume of 100+ anatomical structures from raw CT scans. | |
| - **Inference:** Fast-mode enabled for rapid screening on Modal **A10G GPU**. | |
| --- | |
| ## ποΈ Architecture | |
| ``` | |
| GRADIO FRONTEND (app.py) | |
| βββ 3D Visualization β nibabel + PIL (Mid-axial slice rendering) | |
| βββ Validation β Checks for valid 3D shape and intensity spread | |
| βββ PDF Generation β WeasyPrint HTML-to-PDF conversion | |
| βββ Remote RPC β Connects to Modal backend via `modal.Cls` | |
| MODAL SERVERLESS BACKEND (backend.py) | |
| βββ Segmenter [A10G] β `TotalSegmentator` subprocess | |
| β JSON parsing & Reference Range Logic | |
| β Returns structured clinical findings | |
| ``` | |
| --- | |
| ## π₯οΈ GPU Resources (Modal) | |
| | Container | GPU | Model(s) | Purpose | | |
| |---|---|---|---| | |
| | `Segmenter` | A10G (24GB) | TotalSegmentator 3D U-Net | Heavy volumetric segmentation and pixel quantification | | |
| --- | |
| ## βοΈ Setup & Deployment | |
| ```bash | |
| # 1. Install dependencies | |
| python -m venv venv && source venv/bin/activate | |
| pip install -r requirements.txt | |
| # 2. Deploy Modal backend | |
| modal deploy backend.py | |
| # 3. Run the Gradio frontend | |
| python app.py | |
| ``` | |