Dental X-ray Analysis
DICOM in, pathology boxes and a structured radiology-style report out: CV detection wired to LLM reasoning.

What it is
What it does
A two-container pipeline for dental radiographs: upload DICOM, normalise pixels to PNG, detect pathologies with a hosted vision model, draw annotated bounding boxes, then have GPT turn the raw detections into a clinician-readable report with per-finding confidence and advice, all validated as JSON before it reaches the UI.
Why it exists
Two dentists can read the same X-ray and disagree. I wouldn't trust a black box either. I split the job: let the vision model find the boxes, let the LLM write the report, and make both stages inspectable on the image itself.
Repo Amit-kr26/dental-xrayStack FastAPI · React · Pydicom · Roboflow · OpenAI GPT-4.1 · Docker
How it is built
DICOM handling
pydicom reads ds.pixel_array, applies min-max normalisation to uint8 and saves PNG; JPEG-compressed DICOM decodes thanks to pylibjpeg, and InvalidDicomError maps to HTTP 400.
Detection call
routers/process.py posts to Roboflow model adr/6 with confidence 0.30 and 0.50 NMS overlap, receiving centre-format boxes.
Annotation drawing
PIL converts centre coordinates to corners and draws red rectangles with '{class} {confidence:.2f}' labels above each finding.
Schema-bound reporting
GPT-4.1 plays dental radiologist over the annotations JSON and must return {detected_pathologies, details[{pathology, location, confidence}], clinical_advice}. Class names like cavity_upper_left_molar are split into finding + location, fences stripped before json.loads.
Graceful degradation
Missing OPENAI_API_KEY falls back to a dummy report instead of crashing the pipeline.
Tested + containerised
pytest mocks the exact Roboflow URL to assert both success and invalid-file paths; docker-compose runs uvicorn :8000 beside an nginx-served React build on :3000.
How the pieces connect
Drawing is wider than the frame. Drag to pan.
Also filed under ML / DL