feat: Cornerstone3D 5.0 - #2748
Conversation
* bump version * bump version [BUMP BETA MAJOR]
Update beta 20260313
Update beta 20260317 The ohif downstream only has the specific issues that are known to occur on that backend, so merging
merge: cs3d 20260413
Merge/cs3d 20260423
Merge/20260427
Merge/main beta 20260506
* feat: Add metadata module to single-source metadata
* Revert some of hte changes to dicom image loader in favour of deprecation
* Undo change
* Move unit tests to metadata package
* Revert changes to adapters
* Revert unneeded changes
* Update metadata module to use AsyncDicomListener format
* fix: Add unit test
* Add metadata provider and init for the new metadata function
* Split module lists
* update metadata versoin
* Move audit to end so build steps are viewable
* fix: Audit last
* fix lock file mismatch
* fix: metadata reference
* fix: Link to metadata
* fix: Move audit to a single build to allow overall PR status
Previously the audit happened early and multiple times, causing issues
when the audit failures were unrelated to other changes.
* fix: Unused components, add ecg module
* Remove subdirectory import
* fix: ecg module
* Remove unused lower camel case reader
* Switch new/old flag to be useLegacyMetadataProvider
* Add metadata module for github builds
* useLegacyMetadataProvider for the karma tests needing it
* Add legacy module name
* PR comments
* fix: Wado URI test
* Update version
* Missing PR rename issue
* Fix init/register options to allow registering new provider
This explains the differences between the legacy/default metadata
provider and the data loaders themselves, which still need
registering.
* Add rebuild:canvas command to fix missing canvas
* fix: Update way that loadImage functions with naturalized data
* Cleaner listener design/setup and pas (more) tests
* fix: loadImage with metadata module
* fix: Transfer syntax return as string
* fix: Wrong load image was getting used
* Update the register to clear data
* Store worker log to loglevel
* fix: Various karma tests
* fix: Remaining karma issues
* fix: Scaling data unit tests weren't running correctly
* Use fixed page size to make tests run consistently.
* Set size for consistency
* docusaurus build issues
* Build fixes
* Version fix
* Update to include metadata module
* Include metadata module in circleci config
* fix: Build when linked
* fix: workspace dependency to allow yarn 1.x
* Update package module for adapters build
* Try to fix adapters build issue
* Export suv scaling factor
* Update bun version to push an update
* Link suv module specifically
* fix: Merge issues
* bun lock
* Make node directory if it doesn't exist
* fix: Add migration guide and remove prebuild:esm
* Rename natural to naturalizedMetadata
* More renames natural => naturalized
* PR review comments
* Push test versoin
* Run against master instead of beta
* Rerun tests
* fix: Allow lower ohif_ref for reference
* Invalid image position for PT and some positions with parent position
* Kick updated build
* PR comments to use a separate pipeline for the add handling
* fix: Aspect ratio - merge had gone bad and undo missed changes
* fix: Unintended merge
* Only remove imageId prefix if there are at least two schemes
* PR review comment fixes
* Create @corenrstonejs/utils package with initial contents
* fix: install
* Use load local instead of upload
* Fix karma tests
* fix: Build issues
* fix: Types on toNumber
* fix: ohif-downstream to use build:esm
* toNumber
* Force retest
* Change to allow 120 minutes for CS3D playwright tests
* Update retries to match OHIF
* Upload playwright results on failure
* fix: Add utils path
* Rename addPart10Instance
* Remove cache warm up in utils
* Fix function rename
* PR comments - use enum values instead of literals.
- Keep beta version 5.0.0-beta.2 for all package versions - Incorporate 4.22.8 (security) and 4.22.9 (angle tool fix) changelog entries - Update @babel/preset-env to 7.29.5 from main security update - Retain @babel/plugin-transform-typescript 7.28.6 from beta Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Merge/main 20260515 into beta
…60526 Update/beta from main 20260526 Still has a couple of playwright bugs to resolve, but these will be done in the viewports pr
* feat: pnpm 11 build/install for cs3d * Format check runs at root level rather than in each package * Enable corepack detection of pnpm version * Fix audit issue * ohif-downstream build issue * Update to beta.3 for pnpm * Update beta 3 in pnpm lock * Re-run test on updated OHIF * Fix pnpm build based on merge commit * Fix link/unlik * Fixes for linking * fix cs3d link with ohif * ci: pin Node 24 and bump pnpm to 11.4.0 playwright.yml's matrix had regressed to Node 20 during the beta merge, but pnpm 11 requires Node >=22.13 (uses node:sqlite), so installs crashed with ERR_UNKNOWN_BUILTIN_MODULE. Restore Node 24 everywhere and move pnpm 11.1.1 -> 11.4.0 across all workflows and packageManager. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore: drop exact packageManager pin, rely on engines pnpm>=11 The packageManager: pnpm@11.4.0 pin forced pnpm's precise-version auto-switch, which broke commits for anyone whose local pnpm couldn't fetch that exact build. engines.pnpm ">=11" is sufficient; CI still pins 11.4.0 via pnpm/action-setup. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore: restore packageManager pnpm pin for nested-repo corepack CS3D lives inside the OHIF repo, whose package.json pins packageManager: yarn. With corepack enabled, dropping CS3D's own packageManager field makes corepack walk up and resolve yarn for CS3D, breaking the pnpm-based husky hook. Pin pnpm here so corepack uses (and auto-fetches) pnpm for this workspace. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(ohif-downstream): install OHIF with bun, not pnpm OHIF is a bun/yarn project checked out inside this pnpm workspace. Installing it with pnpm walks up to this repo's pnpm-workspace.yaml (node-linker: hoisted) and produces a mixed node_modules where OHIF's jest and CS3D's jest copies get tangled, so jest-runner resolves to a different instance than @jest/core -> "Cannot read properties of undefined (reading 'leakDetector')". Install/run the OHIF side with bun (its native package manager) so it gets a self-contained node_modules. Adds a Set up Bun step; CS3D's own install/build stay on pnpm. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Update bun lock * frozen workfiles * Move frozen lockfile flag to pnpm-workspace.yaml * lock * Rerun build, resetting ohif-downstream to default * fix: unit test run * Fix chrome headless run for karma tests * Update tmp 0.2.6 to resolve the high severity issue --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Co-authored-by: Joe Boccanfuso <joe.boccanfuso@radicalimaging.com>
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.
Tip: disable this comment in your organization's Code Review settings.
|
Important Review skippedToo many files! This PR contains 296 files, which is 146 over the limit of 150. To get a review, narrow the scope: ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (4)
📒 Files selected for processing (296)
You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
This also needs: |
Bump vitest and @vitest/browser-playwright to 4.1.8 to clear the critical GHSA-2h32-95rg-cppp advisory blocking the CircleCI checkout job's security audit. Also address CodeQL findings introduced by the viewport refactor diff: switch example RNGs to crypto APIs, guard the annotation manager against prototype-polluting keys, and run rspack via spawnSync with an args array instead of a shell-interpolated string. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Insert a HOLD_FOR_APPROVAL job between BUILD and NPM_PUBLISH in the TEST_AND_RELEASE workflow so the computed version can be reviewed and approved in the CircleCI UI before any release is published. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The GenericViewport (compat, ?type=next) render path produces a deterministic sub-pixel resampling shift in the oblique reformat viewport (~1% of pixels, visually identical) versus the baselines captured in the 5.0 merge (#2748). Regenerate the three compat MPR baselines to match current GenericViewport output. Legacy and next suites are unaffected.
…eate Ported onto the Cornerstone3D 5.0 generic-viewport rearchitecture (cornerstonejs#2748), which moved the stack labelmap sync into syncStackLabelmapActors. Each scroll on a StackViewport with segmentations removed every labelmap actor for the previous slice and created fresh VTK objects (vtkImageData + backing TypedArray) for the new slice. vtk.js internal caches retain the discarded objects, so the heap grows linearly while scrolling (~3.9 MB per scroll with many segmentations) and is never reclaimed. For the legacy StackViewport (which renders directly from each actor's vtkImageData and does not track actors through the generic-viewport data registry), reuse the existing actors on scroll: when no actor exactly matches a slice's derived image id, swap a stale actor's underlying labelmap image and origin in place via setDerivedImage / updateVTKImageDataWithCornerstoneImage. Stale actors form a reuse pool that is consumed at most once per derived image, so overlapping segments (multiple labelmap groups on the same slice) cannot steal one another's actor. Pooled actors not reused are removed, and brand-new actors are only created when the pool is exhausted. Registry-backed viewports (PlanarViewport and its legacy adapter, detected via the presence of removeData) own their actors by dataId, so their existing remove/recreate flow is preserved to avoid desyncing that state. Also destructure callback out of addImages in StackViewport before the spread, so the callback closure (which can reference a large vtkImageData) is not persisted on the long-lived actor entry in the _actors map. Made-with: Cursor
Rewritten against the Cornerstone3D 5.0 labelmap rendering. The original _needsTransferFunctionUpdate guard (and its segmentsHidden reference-equality check) was removed in the 5.0 rearchitecture (cornerstonejs#2748), so the labelmap transfer functions are now rebuilt unconditionally on every segmentation render. setLabelmapColorAndOpacity runs for every labelmap actor on every render (e.g. every scroll) and rebuilds the vtk color/opacity transfer functions and invalidates the actor + mapper each time, even when nothing changed. With many segmentations this produces hundreds of redundant transfer-function updates and re-renders per scroll. Compute the desired style first (color/opacity nodes, outline thickness, visibility, image-slice flags) and compare a signature of it against the last style applied to that actor. When identical, skip the vtk rebuild and the actor/mapper invalidation entirely. Any change to colors, per-segment style, segment visibility, outline config, or active/visibility state changes the signature and forces a rebuild, so rendered output is unchanged. preLoad consumers run a custom apply path and always rebuild. Made-with: Cursor
OHIF_REF: ohifohifupdateplaywightimgaes
Context
This PR merges the
betabranch intomainto ship Cornerstone3D 5.0. The branch has been baking for months as the 5.x line; merging here promotes it to a tagged GA release on themainline.The CircleCI
TEST_AND_RELEASEworkflow now has a manual approval gate (HOLD_FOR_APPROVAL) betweenBUILDandNPM_PUBLISH, so the computed release version (5.0.0) can be reviewed in the CircleCI UI before anything is published to npm.What's in 5.0
Rendering & viewports
cornerstone3d redo viewports, cornerstone3d redo viewports #2666) — introduces theGenericViewport<TCamera, TViewportPresentation, TDataPresentation>base with explicit render paths per data type (planar CPU/GPU, video, ECG, WSI, Volume3D). Cleanly separates camera state, viewport presentation, and per-data presentation.WebGLContextPoolinContextPoolRenderingEngine(feat(rendering): Introduce WebGLContextPool for parallel rendering in ContextPoolRenderingEngine #2190).Tools
orthogonalT/lineSegmentmodes for open U-shape contours (feat(tools): implement orthogonalT and lineSegment modes for PlanarFreehandROI open U-shape contours #2615); adapter sub-types forLivewireContourandSplineROI(fix(adapters): Added adapters as subtypes of PlanarFreehandROI for LivewireContour and SplineROI. #2642).Core / infra
CI hardening (in this PR's tail commits)
fix: resolve CI failures from audit and CodeQL alerts— bumpsvitest/@vitest/browser-playwrightto4.1.8to clear GHSA-2h32-95rg-cppp, switches example RNGs tocrypto.getRandomValues/crypto.randomUUID, guardsFrameOfReferenceSpecificAnnotationManager.addAnnotationagainst__proto__/constructor/prototypekeys, and replacesshell.execin the example runner withspawnSync+ args array.ci: add manual approval gate before npm publish— newHOLD_FOR_APPROVALjob in.circleci/config.ymlso 5.0.0 only ships once explicitly approved.Release version
Per
version.mjs, merging intomainwith currentpackages/core/package.jsonat5.0.0-beta.3resolves to5.0.0(bothsemver.inc(..., 'patch')andsemver.inc(..., 'minor')collapse a prerelease to its base release). The approval gate above guards this.Docs
Testing
HOLD_FOR_APPROVAL, verify thev5.0.0tag and that@cornerstonejs/*packages publish at5.0.0on npm.Checklist