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

Jump to click and voisync for volume3d #678

Merged

Conversation

Sofien-Sellami
Copy link
Contributor

@Sofien-Sellami Sofien-Sellami commented Jul 4, 2023

Context

In this pull request i wanted to add jump to click and voiSync for the volume 3D viewport, with these last changes i refactored the viewport classes, i find it easier to put all the methods in BaseVolumeViewport and then reuse them in any desired class.

Changes & Results

Testing

Checklist

PR

  • My Pull Request title is descriptive, accurate and follows the
    semantic-release format and guidelines.

Code

Public Documentation Updates

  • The documentation page has been updated as necessary for any public API
    additions or removals.

Tested Environment

  • "OS:
  • "Node version:
  • "Browser:

@netlify
Copy link

netlify bot commented Jul 4, 2023

Deploy Preview for cornerstone-3d-docs ready!

Name Link
🔨 Latest commit bd4c1a8
🔍 Latest deploy log https://app.netlify.com/sites/cornerstone-3d-docs/deploys/64aed02c98ccbf0008696b31
😎 Deploy Preview https://deploy-preview-678--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 configuration.

@@ -274,6 +274,10 @@
"generateImageFromTimeData": {
"name": "Generate 3D Volume From 4D Data",
"description": "Demostrates generating a 3D volume from 4D data using subtract, average or sum."
},
"mprVolume3d": {
Copy link
Member

Choose a reason for hiding this comment

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

what is the difference between this example and the ptct example we have here? https://www.cornerstonejs.org/live-examples/petct

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @sedghi, it's exactly the same example but Volume3D instead of Volume in the MIP viewport, now I've just modified the PTCT example by adding a button to switch to Volume3D.

Copy link
Member

Choose a reason for hiding this comment

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

That would be much better thanks

@sedghi
Copy link
Member

sedghi commented Jul 6, 2023

can you please update this now

PET MIP:
- Mouse Wheel: Rotate PET
- Left click: Jump all views to the point of highest SUV in the region clicked.

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.

see my comments

@@ -32,7 +33,10 @@ export default function voiSyncCallback(

const tViewport = renderingEngine.getViewport(targetViewport.viewportId);

if (tViewport instanceof VolumeViewport) {
if (
tViewport instanceof VolumeViewport ||
Copy link
Member

Choose a reason for hiding this comment

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

You should say instance of BaseVolumeViewport instead of both

@@ -621,7 +621,7 @@ class Viewport implements IViewport {
* be detected for pan/zoom values)
* @returns boolean
*/
protected resetCamera(
public resetCamera(
Copy link
Member

Choose a reason for hiding this comment

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

Why are you making this public, protected is good enough

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @sedghi, resetCamera should be public in Viewport.ts because in the others viewports classes it convert it to public
VolumeViewport.ts:
resetCamera( resetPan?: boolean, resetZoom?: boolean, resetToCenter?: boolean ): boolean { return super.resetCamera(resetPan, resetZoom, resetToCenter); }
VolumeViewport3D.ts:
public resetCamera( resetPan = true, resetZoom = true, resetToCenter = true ): boolean { super.resetCamera(resetPan, resetZoom, resetToCenter); this.resetVolumeViewportClippingRange(); return; }

const volume = await volumeLoader.createAndCacheVolume(ptVolumeId, {
imageIds: ptImageIds,
});
volume.load();
Copy link
Member

Choose a reason for hiding this comment

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

you don't need to create another volume for this, the same volume can be used in a different viewport type

viewportIds.FUSION.AXIAL,
viewportIds.FUSION.SAGITTAL,
viewportIds.FUSION.CORONAL,
viewportIds.PETMIP.CORONAL,
Copy link
Member

Choose a reason for hiding this comment

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

Also I don't think you need to redefine the toolgroups, just grab the existing toolGroup for the MIP and modify its viewport (I don't think that is even needed, maybe just re-enable it?)

@Sofien-Sellami Sofien-Sellami requested a review from sedghi July 7, 2023 11:16
Copy link
Collaborator

@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.

Generally looks good to me, but will let Alireza approve.

@sedghi
Copy link
Member

sedghi commented Jul 11, 2023

seems there are some conflicts for merging @Sofien-Sellami can you please resolve them? thanks

# Conflicts:
#	packages/core/src/RenderingEngine/BaseVolumeViewport.ts
#	packages/tools/src/synchronizers/callbacks/voiSyncCallback.ts
@sedghi sedghi merged commit 8342ff4 into cornerstonejs:main Jul 12, 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.

3 participants