diff --git a/PanTS-Demo/src/components/ScanReadout/ScanReadout.tsx b/PanTS-Demo/src/components/ScanReadout/ScanReadout.tsx new file mode 100644 index 0000000..c8b4c26 --- /dev/null +++ b/PanTS-Demo/src/components/ScanReadout/ScanReadout.tsx @@ -0,0 +1,62 @@ +import { organDescriptions } from "../../helpers/organInfo"; + +const pretty = (s: string) => s.replaceAll("_", " "); +const fmtVolume = (cm3: number) => (cm3 >= 1000 ? `${(cm3 / 1000).toFixed(1)} L` : `${Math.round(cm3)} cm³`); + +type ReadoutStat = { organ_name: string; volume_cm3: number; mean_hu: number }; + +type Props = { + stats: ReadoutStat[] | null; + loading: boolean; + error: boolean; + onLoad: () => void; +}; + +export default function ScanReadout({ stats, loading, error, onLoad }: Props) { + return ( +
Reading the scan…
+ ) : error ? ( +Couldn't load measurements for this scan.
+ ) : !stats ? ( + <> ++ A plain-language summary of this scan: each structure's measured size and density, explained. For learning, not diagnosis. +
+ + > + ) : stats.length === 0 ? ( +No measurable structures found in this scan.
+ ) : ( + <> ++ Density is in Hounsfield Units (HU): water is 0, fat is negative, soft tissue is mildly positive, bone is high. Volumes are measured from the segmentation. For learning, not diagnosis. +
+ {stats.map((s) => ( ++ {organDescriptions[s.organ_name] ?? "A structure identified in this scan."} +
+