Skip to content

Conversation

@sedghi
Copy link
Member

@sedghi sedghi commented Dec 19, 2025

should be merged after cornerstonejs/cornerstone3D#2523

test with this data: #5554

CleanShot.2026-01-05.at.20.31.55.mp4

Note

Improves dynamic volume handling for multiframe series (e.g., NM with TimeSlotVector).

  • Imports metaData from @cornerstonejs/core and, when NumberOfFrames > 1 with multiple timePoints, builds firstTimePointInstances via metaData.get('instance', imageId)
  • Falls back to previous map-based lookup for single-frame or non-multitimepoint series
  • Ensures isDisplaySetReconstructable is evaluated on the correct instances for dynamic volumes

Written by Cursor Bugbot for commit 68f0739. This will update automatically on new commits. Configure here.

Copilot AI review requested due to automatic review settings December 19, 2025 03:23
@netlify
Copy link

netlify bot commented Dec 19, 2025

Deploy Preview for ohif-dev canceled.

Name Link
🔨 Latest commit 68f0739
🔍 Latest deploy log https://app.netlify.com/projects/ohif-dev/deploys/695c661fd3d1e20008505206

@sedghi sedghi changed the title 4d sssss fix: NM multiframe with TimeSlotVector Dec 19, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses multiple issues related to 4D dynamic volume handling, including null safety improvements, histogram worker optimization, and multiframe volume support.

  • Added null checks in ViewportWindowLevel opacity functions to prevent undefined reference errors
  • Optimized histogram worker registration by moving it to module load time instead of per-function call
  • Enhanced getSopClassHandlerModule to handle multiframe dynamic volumes using metadata retrieval
  • Added null check for viewportId in Preclinical4D mode and refactored cine playback initialization

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
platform/ui-next/src/tailwind.css Added a reusable ohif-disabled CSS class for disabled UI elements
modes/preclinical-4d/src/index.tsx Added null check for viewportId and refactored cine service initialization to use setCine with explicit frame rate
extensions/default/src/getSopClassHandlerModule.js Enhanced multiframe dynamic volume handling by using metaData for instance retrieval when dealing with multiframe volumes
extensions/cornerstone/src/components/ViewportWindowLevel/utils.ts Added defensive null checks for volumeActor parameter in opacity-related functions
extensions/cornerstone/src/components/ViewportWindowLevel/getViewportVolumeHistogram.ts Moved histogram worker registration to module load time and updated scalar data retrieval method for multi-timepoint volumes

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

if (volume.numTimePoints > 1) {
const targetTimePoint = volume.numTimePoints - 1; // or any other time point you need
scalarData = volume.voxelManager.getTimePointScalarData(targetTimePoint);
scalarData = volume.voxelManager.getDimensionGroupScalarData(volume.numTimePoints);
Copy link

Copilot AI Dec 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The argument passed to getDimensionGroupScalarData appears incorrect. The previous code used getTimePointScalarData(targetTimePoint) where targetTimePoint was set to volume.numTimePoints - 1 (a zero-based index). Now volume.numTimePoints (the total count) is being passed, which would be an out-of-bounds index if this method expects a zero-based time point index. This could result in undefined behavior or runtime errors when processing multi-timepoint volumes.

Suggested change
scalarData = volume.voxelManager.getDimensionGroupScalarData(volume.numTimePoints);
const targetTimePoint = volume.numTimePoints - 1;
scalarData = volume.voxelManager.getDimensionGroupScalarData(targetTimePoint);

Copilot uses AI. Check for mistakes.
@cypress
Copy link

cypress bot commented Dec 19, 2025

Viewers    Run #5851

Run Properties:  status check passed Passed #5851  •  git commit 68f0739d2f: Merge branch 'master' of https://github.com/OHIF/Viewers into 4d-sssss
Project Viewers
Branch Review 4d-sssss
Run status status check passed Passed #5851
Run duration 02m 22s
Commit git commit 68f0739d2f: Merge branch 'master' of https://github.com/OHIF/Viewers into 4d-sssss
Committer Alireza
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 37
View all changes introduced in this branch ↗︎

@wayfarer3130
Copy link
Contributor

@sedghi - could you add test notes to this? I'd like to check out the branch and run the changes - I mostly can figure it out, but it helps to have a description containing test notes.

Copy link
Contributor

@wayfarer3130 wayfarer3130 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not seeing the working when testing with the suggested sample data. I tried viewing the third example, which has 800 images, and it is clearly a time slot vector series, but it is just showing all 800 odd images in it.

@wayfarer3130
Copy link
Contributor

As well as this change, the NM modality probably needs to get added to the available modalities for running the 4d data view mode.

@sedghi
Copy link
Member Author

sedghi commented Jan 6, 2026

I updated the branch with latest cs3d, please check again against local orthanc or something

CleanShot.2026-01-05.at.20.31.55.mp4

@wayfarer3130 wayfarer3130 merged commit a74648f into master Jan 6, 2026
11 of 12 checks passed
@wayfarer3130 wayfarer3130 deleted the 4d-sssss branch January 6, 2026 13:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants