Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions PanTS-Demo/src/routes/Homepage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ type FacetData = {
counts: Record<string, FacetRow[]>;
unknown: Record<string, number>;
total: number;
datasetCounts: Record<string, number>;
};

// Filter groups whose available values are discovered from /api/facets (not hardcoded).
Expand Down Expand Up @@ -287,6 +288,7 @@ export default function Homepage() {
counts: data.facets ?? {},
unknown: data.unknown_counts ?? {},
total: data.total ?? 0,
datasetCounts: data.dataset_counts ?? {},
});
} catch (e) {
console.error(e);
Expand Down Expand Up @@ -725,6 +727,7 @@ export default function Homepage() {
onClick={() => toggleMulti("dataset", opt.value)}
>
{opt.label}
{countBadge(facetData?.datasetCounts[opt.value] ?? null)}
</button>
))}
</div>
Expand Down
14 changes: 12 additions & 2 deletions PanTS-Demo/src/routes/VisualizationPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,10 @@
return;
}
const id = pantsCase ?? "1";
const p = getPanTSId(id);
const isCvCase = String(id).toUpperCase().startsWith("CV");
// getPanTSId produces a garbage value for CV ids, but it's only used in the HF
// fallback URLs which are never reached for CV (CT is always on the JHU server).
const p = isCvCase ? "" : getPanTSId(id);
const localCt = `${API_BASE}/api/get-main-nifti/${id}.nii.gz`;
const localSeg = `${API_BASE}/api/get-segmentations/${id}.nii.gz`;
const hfCt = `https://huggingface.co/datasets/BodyMaps/iPanTSMini/resolve/main/image_only/${p}/ct.nii.gz?download=true`;
Expand All @@ -354,7 +357,14 @@
// full res when ?hd=1. HuggingFace fallback is full res only.
const resParam = isHd ? "" : "?res=low";
setCtUrl(localOk ? `${localCt}${resParam}` : hfCt);
setSegUrl(localOk ? `${localSeg}${resParam}` : hfSeg);
// CancerVerse cases have no masks yet — /api/get-segmentations returns
// {"masks_available": false} (JSON, HTTP 200) which hangs the nifti loader.
// Skip the seg URL entirely so the viewer opens CT-only without hanging.
if (isCvCase) {
setSegUrl(null);
} else {
setSegUrl(localOk ? `${localSeg}${resParam}` : hfSeg);
}
};
resolveSources();
return () => { cancelled = true; };
Expand Down Expand Up @@ -1076,7 +1086,7 @@
};
// refs have stable identity, so they aren't real deps; the loads key off
// ctUrl/segUrl/labelColorMap.
}, [

Check warning on line 1089 in PanTS-Demo/src/routes/VisualizationPage.tsx

View workflow job for this annotation

GitHub Actions / Frontend (Node 20)

React Hook useEffect has a missing dependency: 'labelColorMap'. Either include it or remove the dependency array

Check warning on line 1089 in PanTS-Demo/src/routes/VisualizationPage.tsx

View workflow job for this annotation

GitHub Actions / Frontend (Node 22)

React Hook useEffect has a missing dependency: 'labelColorMap'. Either include it or remove the dependency array
ctUrl,
segUrl,
isDicom,
Expand Down Expand Up @@ -1119,7 +1129,7 @@
// }, [pantsCase]);

// Update VOI (window/level) settings
const handleWindowChange = (

Check warning on line 1132 in PanTS-Demo/src/routes/VisualizationPage.tsx

View workflow job for this annotation

GitHub Actions / Frontend (Node 20)

The 'handleWindowChange' function makes the dependencies of useMemo Hook (at line 1632) change on every render. To fix this, wrap the definition of 'handleWindowChange' in its own useCallback() Hook

Check warning on line 1132 in PanTS-Demo/src/routes/VisualizationPage.tsx

View workflow job for this annotation

GitHub Actions / Frontend (Node 22)

The 'handleWindowChange' function makes the dependencies of useMemo Hook (at line 1632) change on every render. To fix this, wrap the definition of 'handleWindowChange' in its own useCallback() Hook
newWidth: number | null,
newCenter: number | null
) => {
Expand Down
5 changes: 5 additions & 0 deletions flask-server/api/api_blueprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -1871,12 +1871,17 @@ def _minmax(series: pd.Series):
if len(yr):
year_min, year_max = int(yr.min()), int(yr.max())

dataset_counts = {
"PanTS": int(len(DF)),
"CancerVerse": int(len(DF_CV)) if DF_CV is not None else 0,
}
return jsonify({
"facets": facets,
"unknown_counts": unknown_counts,
"age_range": {"min": age_min, "max": age_max},
"year_range": {"min": year_min, "max": year_max},
"total": int(len(df_now)),
"dataset_counts": dataset_counts,
})
except Exception as e:
return jsonify({"error": str(e)}), 400
Expand Down
Loading