ct-app / README.md
AKIS-4's picture
Update README.md
b442632 verified
|
Raw
History Blame Contribute Delete
3.36 kB
---
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
```