Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(4D): added support for 4D data rendering #438

Merged
merged 11 commits into from
Feb 28, 2023
Merged

feat(4D): added support for 4D data rendering #438

merged 11 commits into from
Feb 28, 2023

Conversation

lscoder
Copy link
Collaborator

@lscoder lscoder commented Feb 16, 2023

cornerstone now loads 4D volumes when using cornerstoneStreamingDynamicImageVolume schema. Currently it is implemented only for (0054,1300) FrameReferenceTime tag. Minor changes are needed to add support for some other 4D tags as follow:

  • (0018,1060) Trigger Time
  • (0018,0081) Echo Time
  • (0018,0086) Echo Number
  • (0020,0100) Temporal Position Identifier

changes:

  • scalarData is now private to ImageVolume and need to be accessed via getScalarData()

@netlify
Copy link

netlify bot commented Feb 16, 2023

Deploy Preview for cornerstone-3d-docs ready!

Name Link
🔨 Latest commit 64d2efa
🔍 Latest deploy log https://app.netlify.com/sites/cornerstone-3d-docs/deploys/63fd70d9668271000895ff13
😎 Deploy Preview https://deploy-preview-438--cornerstone-3d-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

Copy link
Member

@sedghi sedghi left a comment

Choose a reason for hiding this comment

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

Good start, there is a lot of methods for the 3D which doesn't make sense such as imageIdIndexToFrameIndex , getScalarDataByImageIdIndex , getActiveScalarData. I guess the design of the inheritance hierarchy is not optimal. Maybe we need a BaseStreamingImageVolume and then StreamingImageVolume3D and StreamingImageVolume4D. What do you think

instanceMetaData = JSON.parse(JSON.stringify(instanceMetaData));

// It was using JSON.parse(JSON.stringify(...)) before but it is 8x slower
instanceMetaData = removeInvalidTags(instanceMetaData);
Copy link
Member

Choose a reason for hiding this comment

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

i'm not sure why we were doing the json strigify either, do we really need this? does it really throw error if we have null or undefiend?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, it does fail when there are null/undefined values but at least it is taking 110ms vs 936ms before for the PT/CT demo dataset we are using to test it.

The only issue that I see after removing JSON.stringify is related to this change because it adds isMultiFrame: undefined. We would have to remove it from the json and keep it private to the metadataManager context or make sure it's set to false instead of undefined. But even after making this change I would not be 100% sure if it would work for all scenarios because JSON.stringify was added one year ago while that isMultiFrame property was added only one month ago. It may have another reason for calling it.

Copy link
Member

@sedghi sedghi left a comment

Choose a reason for hiding this comment

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

almost there, see my comments

Comment on lines +612 to +613
const scalarData =
'getScalarData' in image ? image.getScalarData() : image.scalarData;
Copy link
Collaborator Author

@lscoder lscoder Feb 28, 2023

Choose a reason for hiding this comment

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

image is returned by getTargetIdImage(...). This function returns IImageData | CPUIImageData | IImageVolume but only IImageData has getScalarData().

Copy link
Member

@sedghi sedghi left a comment

Choose a reason for hiding this comment

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

Looks great, thanks a lot !
Can you please update the PR with listing the breaking changes?

  • scalarData is now private and need to be accessed via getScalarData
  • ....

@sedghi sedghi changed the title feat(4D): added support for 4D datasets + examples feat(4D): added support for 4D data rendering Feb 28, 2023
@sedghi sedghi merged commit 975e596 into cornerstonejs:main Feb 28, 2023
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.

2 participants