Files
sciagent/be0/migrations/027_imagehub_dataset_label_map.sql
Thinh Lam 688fac73e9
CI/CD / backend (push) Failing after 2m8s
CI/CD / frontend (push) Failing after 1m40s
CI/CD / deploy (push) Has been skipped
sciagent code + Gitea Actions CI/CD
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-30 09:38:30 +07:00

13 lines
1.0 KiB
SQL

-- ImageHub: per-dataset value to name label map for multi-label segmentation masks. A multi-label
-- labelsTr/<case>.nii.gz encodes each organ or structure as an integer voxel value (1, 2, 3 …). Until
-- now the viewer named those values from a fixed TotalSegmentator-v2 117-class map, so a non
-- TotalSegmentator dataset (KiTS = 1 kidney / 2 tumor / 3 cyst, or any custom nnU-Net labels) showed
-- confidently-wrong organ names. label_map stores the dataset own value to name mapping (a JSON object
-- with string keys), so the organ panel labels each overlay correctly and a user can edit them. The
-- empty default keeps the TotalSegmentator fallback for datasets without a map. Idempotent.
-- Apply after 026 (no semicolons inside comments or string literals — the runner splitter is naive):
-- docker exec -i initiative-postgres psql -U initiative -d initiatives < be0/migrations/027_imagehub_dataset_label_map.sql
ALTER TABLE imagehub_datasets
ADD COLUMN IF NOT EXISTS label_map JSONB NOT NULL DEFAULT '{}'::jsonb;