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

examples: Add image (ijk) coordinates to stackCanvasToWorld example #1292

Merged
merged 2 commits into from
Jun 5, 2024

Conversation

sedghi
Copy link
Member

@sedghi sedghi commented May 30, 2024

Related to #391

Updates the stackCanvasToWorld example to include image (ijk) coordinates alongside canvas and world coordinates.

  • Imports the worldToImageCoords utility from @cornerstonejs/core to facilitate the conversion of world coordinates to image (ijk) coordinates.
  • Adds a new UI element to display the image (ijk) coordinates, enhancing the example's output with additional information.
  • Implements the conversion of world coordinates to image (ijk) coordinates using the worldToImageCoords utility and displays these coordinates in the newly added UI element.

For more details, open the Copilot Workspace session.

Copy link

netlify bot commented May 30, 2024

Deploy Preview for cornerstone-3d-docs ready!

Name Link
🔨 Latest commit fd92875
🔍 Latest deploy log https://app.netlify.com/sites/cornerstone-3d-docs/deploys/66609f0b0801350008a6f342
😎 Deploy Preview https://deploy-preview-1292--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.

Comment on lines 115 to 117
imagePosElement.innerText = `image (ijk): (${imagePos[0].toFixed(
2
)}, ${imagePos[1].toFixed(2)}, ${imagePos[2].toFixed(2)})`;
Copy link
Contributor

Choose a reason for hiding this comment

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

I have a small suggestion that might help improve the readability and maintainability of the code:

const [i, j, k] = imagePos.map(item => item.toFixed(2));
imagePosElement.innerText = `image (ijk): (${i}, ${j}, ${k})`;

Copy link
Member Author

Choose a reason for hiding this comment

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

I was trying the github copilot workspace to see if it works haha, i guess your suggestion makes sense

@sedghi sedghi changed the title Add image (ijk) coordinates to stackCanvasToWorld example examples: Add image (ijk) coordinates to stackCanvasToWorld example Jun 5, 2024
@sedghi sedghi merged commit 7621bd1 into main Jun 5, 2024
10 checks passed
@sedghi sedghi deleted the sedghi/add-image-coords-3 branch January 22, 2025 16:06
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