DEV Community

Eng. Nadeem Mohamed Badr (NBrain) for NBrain

Posted on Originally published at nadeembadr.com

Zero-Upload HIPAA DICOM PHI Scrubbing in Browser & Python + Float64 29-Landmark Orthodontic AI (MedCore CephTrace)

Hospital radiology departments and orthodontic clinics across Egypt, Saudi Arabia, and MENA cannot legally upload raw .dcm radiographs containing PatientName, PatientID, BirthDate, or InstitutionName to third-party web servers. To solve medical data sovereignty while delivering sub-5-second clinical AI diagnostics, Eng. Nadeem Mohamed Badr El-Din (nadeembadr.com · ORCID 0009-0005-5836-2631) and NBrain (nbra.in) released a 100% browser-side zero-upload HIPAA DICOM Anonymizer (nbra.in/tools/dicom-anonymizer) backed by the zero-dependency MIT Python package nbrain-dicom-scrub, powering our clinical pipelines Nabd Masr (94.99% VinDr-CXR AUROC, CERN DOI 10.5281/zenodo.24861741) and MedCore CephTrace (29-landmark orthodontic cephalometrics).


In-Place DICOM Part-10 HIPAA Safe Harbor Scrubbing

Rather than re-encoding pixel matrices (which risks altering Window Level/Width Hounsfield calibration), nbrain-dicom-scrub verifies the 128-byte preamble + DICM magic header, walks Explicit-VR Little-Endian elements, and overwrites 19 HIPAA Safe Harbor PHI tags in-place with exact byte-length padding—leaving PixelData (7FE0,0010) 100% bit-identical:

from nbrain_dicom_scrub import build_synthetic_dicom, inspect_dicom, scrub_dicom_bytes

raw = build_synthetic_dicom(
    patient_name="SAMPLE^PATIENT",
    patient_id="EG-994210",
    institution="Cairo Demo Hospital",
)
clean_bytes, audit = scrub_dicom_bytes(raw)
print(audit)  # scrubbed_phi_count >= 7, PixelData 100% byte-identical
Enter fullscreen mode Exit fullscreen mode

Float64 Trigonometric Precision for MedCore CephTrace (29 Landmarks)

In lateral cephalometric orthodontics, tiny vertex errors across long skeletal planes skew SNA, SNB, ANB, FMA, and IMPA clinical classifications. MedCore CephTrace (cv.nbra.in) predicts 29 anatomical landmark heatmaps and computes every Steiner, Tweed, and Downs angle strictly in IEEE-754 float64:

import math


def cephalometric_angle(a: tuple[float, float], vertex: tuple[float, float], c: tuple[float, float]) -> float:
    v1 = (a[0] - vertex[0], a[1] - vertex[1])
    v2 = (c[0] - vertex[0], c[1] - vertex[1])
    dot = v1[0] * v2[0] + v1[1] * v2[1]
    cos_val = max(-1.0, min(1.0, dot / (math.hypot(*v1) * math.hypot(*v2))))
    return math.degrees(math.acos(cos_val))
Enter fullscreen mode Exit fullscreen mode

Live Open-Source Tools, Handbook & Podcast by NBrain

Top comments (0)