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(reslicecursor): expose a convenient getPlaneExtremities function #2980

Merged
merged 1 commit into from Jan 8, 2024

Conversation

finetjul
Copy link
Member

@finetjul finetjul commented Jan 6, 2024

This is useful to control the center using sliders.

Context

It is not obvious how to control the reslice cursor widget with sliders.

Results

This PR demonstrates how to control the reslice cursor widget with sliders and expose a convient function.

Changes

  • Documentation and TypeScript definitions were updated to match those changes
  • ResliceCursorWidget.getPlaneExtremities() has been created

PR and Code Checklist

  • semantic-release commit messages
  • Run npm run reformat to have correctly formatted code

Testing

  • This change adds or fixes unit tests
  • Tested environment:
    • vtk.js: master
    • OS: Windows
    • Browser: Chrome

@finetjul finetjul requested a review from floryst January 6, 2024 20:15
@finetjul finetjul force-pushed the reslicecursorwidget-add-sliders branch from 6fa6d80 to 1d3594e Compare January 6, 2024 20:29
This is useful to control the center using sliders.
@finetjul finetjul force-pushed the reslicecursorwidget-add-sliders branch from 1d3594e to 8454ca8 Compare January 8, 2024 17:09
[]
);
// FIXME: support oriented bounds
const intersectionPoints = vtkBox.intersectWithLine(
Copy link
Contributor

Choose a reason for hiding this comment

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

An idea of solution:
From the image direction, we already have the 3 normals of the 6 planes of the image oriented bounding box.
Now let's say we have for each plane i the equation X.N_i = a_i (the equation of a plane, we get a_i using indexToWorld)
And the equation of the line X = b * N
Then the intersection of the plane i and the line verifies: (b * N). N_i = a_i so b = a / (N.N_i) when N.N_i is not 0.
We get 6 different values for b and only keep the biggest negative and the smallest positive (if there is a negative and a positive value).
From b, we get the point by doing X = b * N.

@finetjul finetjul added this pull request to the merge queue Jan 8, 2024
Merged via the queue into Kitware:master with commit eace711 Jan 8, 2024
3 checks passed
Copy link

github-actions bot commented Jan 8, 2024

🎉 This PR is included in version 29.4.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions github-actions bot added the released Automated label label Jan 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released Automated label
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants