diff --git a/idc-migration-todo.md b/idc-migration-todo.md index fbe5cb545d7..4094683b3e1 100644 --- a/idc-migration-todo.md +++ b/idc-migration-todo.md @@ -1,20 +1,232 @@ -# IDC Migration TODO: OHIF v3.12.14 → v3.13.10+ +# IDC Migration: OHIF v3.12.14 → v3.13.12 -This document tracks the migration status from IDC's OHIF v3.12.14 fork to v3.13.10+ (PR #140). +This document tracks the migration status and documents all IDC-specific changes on top of OHIF upstream. + +--- ## Migration Status Summary | Category | Status | |----------|--------| | IDC Extension | ✅ Migrated | -| SRPointTool | ✅ Preserved | -| Mode Selector | ✅ Preserved | +| SRPointTool | ✅ Preserved + PR opened | +| Mode Selector | ✅ Preserved + PR open | +| MergeDataSource | ✅ Enhanced + PR open | | Instance Annotations | ✅ Preserved | | Deploy Scripts | ✅ Updated | -| Adapters Patch | ✅ Renamed | +| Patches | ✅ Updated for CS3D 5.6.8 | | Config Format | ✅ Migrated | -| GCP Extension | ✅ Updated for OHIF 3.13 compatibility | -| GCP Mode | ✅ Updated for OHIF 3.13 compatibility | +| GCP Extension | ✅ Updated for OHIF 3.13 | +| GCP Mode | ✅ Updated for OHIF 3.13 | +| SEG Loading | ✅ Buffer-based fallback added | + +--- + +## Upstream PRs Opened During Migration + +### OHIF Viewers PRs + +| PR | Title | Status | Description | +|----|-------|--------|-------------| +| [#5987](https://github.com/OHIF/Viewers/pull/5987) | feat(Mode): Add mode selector | 🟡 OPEN | ToolbarModeSelector component for switching modes | +| [#6331](https://github.com/OHIF/Viewers/pull/6331) | fix(MergeDataSource): improve series-to-datasource routing | 🟡 OPEN | seriesSourceMap + retrieve.series.metadata tagging | +| [#6335](https://github.com/OHIF/Viewers/pull/6335) | feat(cornerstone-dicom-sr): add SRPoint tool | 🟡 OPEN | SRPointTool for DICOM SR point annotations | + +### Cornerstone3D PRs + +| PR | Title | Status | Description | +|----|-------|--------|-------------| +| [#2856](https://github.com/cornerstonejs/cornerstone3D/pull/2856) | feat(voi): VOI LUT Function and VOI LUT Sequence support | 🟡 OPEN | VOI LUT validation - IDC has patch | +| [#2882](https://github.com/cornerstonejs/cornerstone3D/pull/2882) | fix(adapters): Index segments by SegmentNumber | Referenced | LABELMAP support - IDC has patch | +| [#2963](https://github.com/cornerstonejs/cornerstone3D/pull/2963) | fix(adapters): add null checks for PerFrameFunctionalGroupsSequence | 🔴 CLOSED | Replaced by buffer-based loader approach | + +--- + +## IDC Patches (Cornerstone3D) + +Located in `patches/` directory: + +### `@cornerstonejs__core.patch` +- **Purpose:** VOI LUT function validation +- **Upstream PR:** [CS3D #2856](https://github.com/cornerstonejs/cornerstone3D/pull/2856) +- **What it does:** Validates VOI LUT function values and falls back to LINEAR for invalid/undefined values +- **Remove when:** PR #2856 is merged and CS3D version is updated + +### `@cornerstonejs__adapters.patch` +- **Purpose:** Index segments by SegmentNumber for LABELMAP support +- **Upstream PR:** [CS3D #2882](https://github.com/cornerstonejs/cornerstone3D/pull/2882) +- **What it does:** Fixes segment color mapping for LABELMAP segmentations where SegmentNumber may start at 0 or have gaps +- **Remove when:** PR #2882 is merged and CS3D version is updated + +### checkOrientation Fix (Not a Patch) +- **Location:** `extensions/cornerstone-dicom-seg/src/getSopClassHandlerModule.ts` +- **Purpose:** Handle SEG files where PerFrameFunctionalGroupsSequence is missing from metadata +- **What it does:** Detects missing PerFrameFunctionalGroupsSequence and falls back to `createFromDICOMSegBuffer` (fetches full DICOM file) +- **Why not a patch:** Implemented in OHIF code, not Cornerstone3D + +--- + +## Complete IDC Fork Delta (vs Upstream) + +### 1. IDC Extension (`extensions/idc/`) +**Status:** IDC-specific, keep in fork + +| File | Purpose | +|------|---------| +| `src/index.tsx` | Extension entry point | +| `src/DownloadStudySeriesDialog.tsx` | idc-index download dialog | +| `src/instanceAnnotations/InstanceAnnotationsOverlay.tsx` | Qualitative SR annotations overlay | +| `src/instanceAnnotations/extractInstanceAnnotations.ts` | TID 1500/1501 annotation extraction | +| `src/instanceAnnotations/instanceAnnotationStore.ts` | Annotation state management | +| `src/instanceAnnotations/registerInstanceAnnotations.tsx` | Registration with OHIF | +| `src/instanceAnnotations/constants.ts` | Annotation constants | + +### 2. ToolbarModeSelector (`extensions/default/`) +**Status:** PR [#5987](https://github.com/OHIF/Viewers/pull/5987) open + +| File | Purpose | +|------|---------| +| `src/Toolbar/ToolbarModeSelector.tsx` | Mode switching UI component | +| `src/utils/modeSelectorUtils.ts` | Mode validation and navigation utilities | +| `src/utils/modeSelectorUtils.test.ts` | Tests | +| `src/customizations/modeSelectorCustomization.ts` | Customization config | +| `src/customizations/modeSelectorCustomization.types.ts` | TypeScript types | +| `src/getToolbarModule.tsx` | Toolbar registration (modified) | +| `src/getHangingProtocolModule.js` | HP module (modified) | + +### 3. SRPointTool (`extensions/cornerstone-dicom-sr/`) +**Status:** PR [#6335](https://github.com/OHIF/Viewers/pull/6335) open + +| File | Purpose | +|------|---------| +| `src/tools/SRPointTool.ts` | Cross marker rendering for SR points | +| `src/tools/toolNames.ts` | Added SRPoint (modified) | +| `src/utils/srToolGetTextLines.ts` | SR-specific text line generation | +| `src/utils/getLabelForSRMeasurement.js` | Label extraction from SR measurements | +| `src/utils/getLabelFromDCMJSImportedToolData.js` | Label extraction fix (modified) | +| `src/utils/addSRAnnotation.ts` | Uses getLabelForSRMeasurement (modified) | +| `src/init.ts` | Tool registration (modified) | +| `src/tools/DICOMSRDisplayTool.ts` | Cross rendering for points (modified) | +| `src/getSopClassHandlerModule.ts` | SR finding extraction (modified) | + +### 4. MergeDataSource Enhancements (`extensions/default/`) +**Status:** PR [#6331](https://github.com/OHIF/Viewers/pull/6331) open + +| File | Purpose | +|------|---------| +| `src/MergeDataSource/index.ts` | seriesSourceMap + retrieve.series.metadata handler | +| `src/DicomWebDataSource/index.ts` | Minor modification | +| `src/DicomWebDataSource/qido.js` | Minor modification | + +### 5. Measurement Service Mappings (`extensions/cornerstone/`) +**Status:** Part of SRPointTool PR + +| File | Purpose | +|------|---------| +| `src/initMeasurementService.ts` | SRPoint/SRRectangleROI mappings | +| `src/utils/measurementServiceMappings/constants/supportedTools.js` | Added SRPoint, SRRectangleROI | +| `src/utils/measurementServiceMappings/measurementServiceMappingsFactory.ts` | Type mappings | + +### 6. SEG Loading Fallback (`extensions/cornerstone-dicom-seg/`) +**Status:** IDC-specific (handles IDC's static WADO servers) + +| File | Purpose | +|------|---------| +| `src/getSopClassHandlerModule.ts` | PerFrameFunctionalGroupsSequence detection + buffer-based loader fallback | + +### 7. Platform Core Changes (`platform/core/`) +**Status:** May need review for upstreaming + +| File | Purpose | +|------|---------| +| `src/services/HangingProtocolService/HangingProtocolService.ts` | HP customization additions | +| `src/services/ToolBarService/ToolbarService.ts` | Minor change | +| `src/types/HangingProtocol.ts` | Type additions | + +### 8. Internationalization (`platform/i18n/`) +**Status:** Part of ToolbarModeSelector PR + +| File | Purpose | +|------|---------| +| `src/locales/en-US/ToolbarModeSelector.json` | English translations | +| `src/locales/en-US/EncapsulatedDocument.json` | Document translations | +| `src/locales/fr/ToolbarModeSelector.json` | French translations | +| `src/locales/nl/ToolbarModeSelector.json` | Dutch translations | +| `src/locales/zh/ToolbarModeSelector.json` | Chinese translations | +| `src/locales/test-LNG/ToolbarModeSelector.json` | Test translations | + +### 9. IDC Assets & Branding (`idc-assets/`) +**Status:** IDC-specific, keep in fork + +| File | Purpose | +|------|---------| +| `IDC-Logo-WHITE.svg` | IDC logo | +| `app-config-template.js` | Config template for deployment | +| `favicon-nci-16x16.png` | NCI favicon | +| `favicon-nci-32x32.png` | NCI favicon | +| `favicon-nci.ico` | NCI favicon | +| `viewer_deployment_config.txt` | Deployment config | + +### 10. IDC Deployment Scripts (`idc-deploy-shell/`) +**Status:** IDC-specific, keep in fork + +| File | Purpose | +|------|---------| +| `buildViewer.sh` | Build script (pnpm, rspack) | +| `buildLoadBalancer.sh` | Load balancer setup | +| `cloudCopy.sh` | GCP cloud copy | +| `gcloud_authenticate.sh` | GCP authentication | +| `install-deps.sh` | Dependency installation (Node 24, pnpm) | +| `prepare_config.sh` | Config preparation | +| `pull_config.sh` | Config pulling | +| `killPing.sh` | Utility script | +| `pingJob.sh` | Utility script | + +### 11. IDC Configurations (`platform/app/`) +**Status:** IDC-specific, keep in fork + +| File | Purpose | +|------|---------| +| `public/config/idc.js` | Main IDC configuration | +| `public/config/default.js` | Modified default config | +| `public/config/dev.js` | Modified dev config | +| `public/assets/idc.svg` | IDC logo in app | +| `pluginConfig.json` | Includes IDC extension + GCP packages | +| `package.json` | GCP package dependencies | + +### 12. CI/CD Changes (`.circleci/`, `.github/`) +**Status:** IDC-specific, keep in fork + +| File | Purpose | +|------|---------| +| `.circleci/config.yml` | IDC CircleCI deployment to GCP | +| `.github/workflows/github-release.yml` | GitHub release workflow | +| `.github/workflows/playwright.yml` | Fork-safe Playwright config | +| `.github/.dependabot.yaml` | Dependabot config | + +### 13. Build Configuration +**Status:** IDC-specific, keep in fork + +| File | Purpose | +|------|---------| +| `pnpm-workspace.yaml` | GCP package refs + patches | +| `.npmrc` | npm configuration | +| `.webpack/resolveConfig.js` | Resolve config | +| `.webpack/rules/transpileJavaScript.js` | GCP packages transpilation | +| `.webpack/webpack.base.js` | Webpack base config | +| `Dockerfile` | Container config | + +### 14. Mode Customizations +**Status:** IDC-specific toolbar changes + +| File | Purpose | +|------|---------| +| `modes/basic/src/initToolGroups.ts` | Tool group customization | +| `modes/basic-dev-mode/src/index.ts` | Dev mode config | +| `modes/basic-dev-mode/src/toolbarButtons.ts` | Toolbar buttons | +| `modes/basic-test-mode/src/initToolGroups.ts` | Test mode tool groups | +| `modes/usAnnotation/src/initToolGroups.js` | US annotation tool groups | +| `modes/usAnnotation/src/index.ts` | US annotation mode | --- @@ -22,37 +234,31 @@ This document tracks the migration status from IDC's OHIF v3.12.14 fork to v3.13 ### Critical (Must Test Before Merge) +- [ ] **Segmentation Loading** + - Test SEG files load correctly (especially from IDC static WADO) + - Verify PerFrameFunctionalGroupsSequence fallback works + - Verify LABELMAP segment color mapping works (adapters patch) + - Test overlapping segmentations in MPR layout + - [ ] **SRPoint/SRRectangleROI Rendering** - Test with IDC SR annotation studies - - Verify semantic labels display correctly (e.g., "Lesion" instead of intensity values) - - See [Potential Regression](#potential-regression-srpointsrrectangleroi-conversion) below + - Verify semantic labels display correctly (e.g., "Lesion") + - Verify cross marker rendering for points - [ ] **Instance Annotations (TID 1500/1501)** - Verify qualitative annotations render on viewport overlays - Check color mapping is correct per annotation value - - Test maxLabels configuration (default: 10) - -- [ ] **Segmentation Loading** - - Test SEG files load correctly with new backend architecture - - Verify LABELMAP segment color mapping works (adapters patch) - - Test overlapping segmentations in MPR layout ### Standard Verification - [ ] **GCP Data Source Merge** - Verify Google OAuth login works - - Test query param approach: `?StudyInstanceUIDs=...&gcp=projects/.../dicomStores/...` - - Test GCP routing: `/projects/.../locations/.../datasets/.../dicomStores/.../study/...` + - Test `?gcp=projects/.../dicomStores/...` query param - Confirm both IDC and GCP series appear in merged view - - Verify mode selector navigation works between modes + - Verify mode selector navigation works - [ ] **Download Dialog** - Verify idc-index download commands display correctly - - Test StudyInstanceUID/SeriesInstanceUID substitution - -- [ ] **Microscopy Mode** - - Test whole slide imaging display - - Verify dicom-microscopy extension loads - [ ] **Build & Deploy** - CI/CD pipeline runs successfully @@ -61,164 +267,42 @@ This document tracks the migration status from IDC's OHIF v3.12.14 fork to v3.13 --- -## Potential Regression: SRPoint/SRRectangleROI Conversion - -### Issue - -In `extensions/cornerstone-dicom-sr/src/utils/hydrateStructuredReport.ts`, the conversion logic was removed: - -**Before (v3.12.14):** -```javascript -const srAnnotationType = - annotationType === 'Probe' ? 'SRPoint' : - annotationType === 'RectangleROI' ? 'SRRectangleROI' : - annotationType; - -annotation.metadata.toolName = srAnnotationType; -``` - -**After (v3.13.10+):** -```javascript -annotation.metadata.toolName = annotationType; // Uses Probe/RectangleROI directly -``` - -### Impact - -SR point annotations from DICOM SR files may display as regular `Probe` tools (showing intensity values) instead of `SRPoint` tools (showing semantic labels like "Lesion"). - -### Fix Required If Regression Confirmed - -Restore the conversion logic in `hydrateStructuredReport.ts`: - -```javascript -/** Use SR subtypes for Probe and RectangleROI - they show label instead of intensity/stats */ -const srAnnotationType = - annotationType === 'Probe' ? 'SRPoint' : - annotationType === 'RectangleROI' ? 'SRRectangleROI' : - annotationType; - -const annotation = { - annotationUID: toolData.annotation.annotationUID, - data: toolData.annotation.data, - predecessorImageId: toolData.predecessorImageId, - metadata: { - ...referenceData, - toolName: srAnnotationType, // Use SR subtype - }, -}; -``` - ---- - -## Behavioral Change: Annotation Locking +## Files Removed/Cleaned -### What Changed - -- **Before:** Annotations always locked after SR hydration -- **After:** Annotations locked only if `disableEditing` customization is set - -### IDC Status - -IDC config sets `panelMeasurement.disableEditing: true`, so this should work correctly. No action needed unless issues observed. +| File | Reason | +|------|--------| +| `lerna-debug.log` | Debug file, should not be committed | +| `testdata` (submodule) | Removed submodule | +| `runtime.txt` | Removed Python runtime file | --- -## QIDO Enhancements (New Features) - -New fields added to study queries: +## Post-Merge Actions -| Field | Tag | Description | -|-------|-----|-------------| -| ModalitiesInStudy | 00080061 | All modalities in study | -| ReferringPhysicianName | 00080090 | Referring physician | -| PatientBirthDate | 00100030 | Patient DOB | +### When Upstream PRs Merge -These are improvements, not regressions. +1. **When #5987 (ToolbarModeSelector) merges:** + - Sync fork with upstream + - Remove IDC-specific ToolbarModeSelector files + - Keep only i18n customizations if any ---- - -## IDC-Specific Files Inventory - -### Preserved Without Changes -- `extensions/cornerstone-dicom-sr/src/tools/SRPointTool.ts` -- `extensions/cornerstone-dicom-sr/src/utils/getLabelForSRMeasurement.js` -- `extensions/cornerstone-dicom-sr/src/utils/srToolGetTextLines.ts` -- `extensions/default/src/Toolbar/ToolbarModeSelector.tsx` -- `extensions/default/src/utils/modeSelectorUtils.ts` -- `extensions/idc/src/*` (all instance annotation code) -- `idc-assets/IDC-Logo-WHITE.svg` -- `idc-assets/favicon-nci.ico` -- `platform/app/public/assets/idc.svg` -- `platform/i18n/src/locales/*/ToolbarModeSelector.json` - -### Updated for v3.13 Compatibility -- `extensions/idc/package.json` (peer deps, Node 24, pnpm) -- `idc-assets/app-config-template.js` (customizationService format) -- `idc-deploy-shell/buildViewer.sh` (pnpm, rspack) -- `idc-deploy-shell/install-deps.sh` (Node 24, pnpm) -- `patches/@cornerstonejs+adapters+5.6.8.patch` (renamed from 4.15.29) -- `platform/app/public/config/default.js` (IDC config, customizationService format) -- `platform/app/public/config/dev.js` (IDC dev config, customizationService format) -- `platform/app/pluginConfig.json` (includes @idc/gcp-extension and @idc/gcp-mode) - -### Mode Customizations (initToolGroups) -- `modes/basic/src/initToolGroups.ts` -- `modes/basic-test-mode/src/initToolGroups.ts` -- `modes/usAnnotation/src/initToolGroups.js` - ---- +2. **When #6331 (MergeDataSource) merges:** + - Sync fork with upstream + - Remove IDC-specific MergeDataSource changes -## GCP Extension/Mode Updates +3. **When #6335 (SRPointTool) merges:** + - Sync fork with upstream + - Remove IDC-specific SRPoint files -### OHIF 3.13 Compatibility Changes +4. **When CS3D #2856 (VOI LUT) merges:** + - Update Cornerstone3D version + - Remove `@cornerstonejs__core.patch` -The `@idc/gcp-extension` and `@idc/gcp-mode` packages have been updated for OHIF 3.13 compatibility: - -| Change | Before (v3.12) | After (v3.13) | -|--------|----------------|---------------| -| `useBulkDataURI` | `useBulkDataURI: false` | `bulkDataURI: { enabled: false }` | - -### How GCP Data Sources Work - -**GCP Extension** (`preRegistration`): -- Creates `gcp` data source with `onConfiguration` for `?gcp=` query param parsing -- Creates `gcp-extension-merge` merge data source when `?gcp=` param is present -- Provides mode selector customization for navigation - -**GCP Mode** (`onModeInit`): -- Creates `gcp-mode-dicomweb-data-source` for route-based GCP paths -- Creates `gcp-mode-merge` merge data source when `?gcp=` param is present -- Provides custom routing: `/projects/:project/locations/:location/datasets/:dataset/dicomStores/:dicomStore/study/:StudyInstanceUIDs` - -### What's Preserved (No Regressions) - -1. **GCP Mode custom routing:** `/projects/:project/locations/:location/datasets/:dataset/dicomStores/:dicomStore/study/:StudyInstanceUIDs` -2. **Query param support:** `?gcp=projects/PROJECT/locations/LOCATION/datasets/DATASET/dicomStores/STORE` -3. **Mode selector customization:** Proper navigation between GCP and standard modes -4. **Merge data source:** Combining IDC + GCP data at series level - ---- - -## Dependencies - -Companion PRs needed for the GCP packages with OHIF 3.13 compatibility: -- https://github.com/ImagingDataCommons/ohif-gcp-extension -- https://github.com/ImagingDataCommons/ohif-gcp-mode - ---- - -## Migration Commits - -| Commit | Description | -|--------|-------------| -| `0a56b26` | Update IDC config and extensions for OHIF 3.13.12 | -| `0ef83db` | Update IDC code for OHIF 3.13.10 compatibility | -| `bb372d3` | Update IDC CI/CD scripts for OHIF 3.13 | -| `b97fe4d` | Add IDC dependencies and generate pnpm lockfile | - ---- +5. **When CS3D #2882 (LABELMAP) merges:** + - Update Cornerstone3D version + - Remove `@cornerstonejs__adapters.patch` -## Post-Merge Cleanup +### Final Cleanup - [ ] Remove this file after all items verified - [ ] Update README if any workflow changes