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

[5.6] Streamline Endoscopy UX removing "Use this curve" button #7462

Merged
merged 31 commits into from Dec 11, 2023

Conversation

jcfr
Copy link
Member

@jcfr jcfr commented Dec 11, 2023

Leengit and others added 9 commits December 11, 2023 14:44
This commit addresses an issue introduced during the integration of the pull request
associated with commit 717fd6f (ENH: Add support for managing orientation keyframes
in Endoscopy).

The logic that was inadvertently removed is now reinstated to prevent unintended modification
events triggered by changes to the input curve. The variable "ignoreInputCurveModified"
is reintroduced to manage and prevent a second modification event.

Additionally, this commit addresses typos in comments.

Co-authored-by: Jean-Christophe Fillion-Robin <jchris.fillionr@kitware.com>
(cherry picked from commit c8599af)
Supporting an API allowing to get output using both "return by value"
and "pass mutable object as argument" is error-prone.

Considering the returned value is only few bytes (e.g 32 bytes for wxyz
orientation and 128 bytes for a 4x4 matrix), the added complexity it not
worth it.

To adhere to the principle of least surprise and make the code more
readable, this commit simplifies the API and updates the code accordingly.

(cherry picked from commit 474872a)
The introduction of this code through 717fd6f (ENH: Add support for
managing orientation keyframe in Endoscopy ) was likely on oversight as
the functions matrix3x3ToQuaternion and quaternionToMatrix3x3 are not
available in vtk.vtkMath

(cherry picked from commit efcc1a5)
… functions

This is intended to facilitate the reading and understanding of the code
by directly using the vtkMRMLMarkupsNode::SetNthControlPointOrientation API.

It also removes the unused function getRelativeOrientation()

(cherry picked from commit b021205)
Co-authored-by: Lee Newberg <lee.newberg@kitware.com>
(cherry picked from commit eda7a41)
…egree"

Co-authored-by: Lee Newberg <lee.newberg@kitware.com>
(cherry picked from commit 3476a2f)
The logic for when to loadCameraOrientations and recompute EndoscopyLogic
fields was not working in all cases.  The lazy approach to loading and
recomputing could have been modified to fix this, but we did not pursue this
approach because the lazy approach has a flaw: the user interface (e.g. number
of frames available) should be available immediately, not lazily (e.g. only
once the user starts a flythrough).

(cherry picked from commit 5e45824)
@jcfr jcfr requested a review from Leengit December 11, 2023 19:51
@jcfr jcfr mentioned this pull request Dec 11, 2023
18 tasks
Co-authored-by: Lee Newberg <lee.newberg@kitware.com>
(cherry picked from commit c6a86d9)
…entations

This allows to set and get the input curve CameraOrientations independently
of the EndoscopyWidget.

To support this it also updates the `interpolateOrientations` to require
a cameraOrientations parameter. This allows to remove the need for maintaining
a dedicated "cameraOrientations" instance variable.

It also renames the functions:
* `loadCameraOrientations` to `getCameraOrientationsFromInputCurve`
* `saveCameraOrientations` to `setInputCurveCameraOrientations`

(cherry picked from commit b6975a4)
Following cc0ee37 (ENH: Update Endoscopy removing obsolete "model"
cursor type), there is no need to keep track of the model instance. User
may retrieve the model node by its name set as "Path-{curveName}".

(cherry picked from commit 76cb6af)
Directly set references to the transform and cursor nodes on the
input curve node and introduce API methods for creating and retrieving
the associated nodes:
* createTransformFromInputCurve() / getTransformFromInputCurve() / setTransformToInputCurve()
* createCursorFromInputCurve() / getCursorFromInputCurve() / setCursorToInputCurve()

(cherry picked from commit 9ef20a6)
…points

Since the function ensures a smooth transition of orientations along
the control points, this name explicitly mentions the interpolation
of orientations and clarifies that it is associated with control points.

Suggested-by: Lee Newberg <lee.newberg@kitware.com>
(cherry picked from commit 06f0e27)
…t curve

Follow-up on commit e3eceb6 and rename "setControlPoints" to
"setControlPointsByResamplingAndInterpolationFromInputCurve".

This name emphasizes a direct relationship with the input curve and
reflects the process of updating or creating control points through
resampling and interpolation.

Suggested-by: Lee Newberg <lee.newberg@kitware.com>
(cherry picked from commit ee01826)
…ions

Remove the need to explicitly interpolate orientations by systematically
calling "interpolateOrientationsForControlPoints()" after saving or deleting
orientations.

(cherry picked from commit fb0675e)
…erence

Remove cameraNode instance variable and manage association of camera with
input curve by adding a "Camera" reference.

(cherry picked from commit 280e7f3)
Selecting the curve is now sufficient to work with the associated flythrough
path.

Summary of changes:

* Remove "Use this curve" button and instead use the input curve upon
  selection.

* Simplify and instantiate one EndoscopyLogic

* Remove enableOrDisableCreateButton and consolidate all UI update in updateWidgetFromMRML

* Remove ignoreInputCurveModified instance variable and instead introduce a
  updatingControlPoints variable to guard setControlPoints

* Observe the more specific curve events "PointModifiedEvent" and "PointEndInteractionEvent"
  instead of "ModifiedEvent" and adds the corresponding callbacks "onInputCurveControlPointModified" and
  "onInputCurveControlPointEndInteractionEvent". This ensures to have the flythrough path
  updated only when user is done updating the curve or when the input curve is programmatically modified.

* Rename "onPlayButtonToggled" to "setPlaybackEnabled" to allow programmatic
  start/stop of playback.

* Reset input curve and stop playback on module cleanup or when
  "slicer.mrmlScene.StartCloseEvent" is invoked.

(cherry picked from commit 738aca6)
This commit addresses an issue in `EndoscopyLogic` related to obtaining
and setting camera properties. The problem arose from the camera being
set as a reference on the input curve, leading to inconsistencies in
managing camera observers.

The warnings "does not have observer" and "already has observer" were
reported upon closing the scene, indicating a desynchronization in camera
observer management. This commit resolves these warnings by simply removing
the observation of the camera.

Further investigation revealed that observing the camera is unnecessary
because:

1. Camera properties are retrieved during keyframe saving.
2. Camera properties are updated when adjusting the position along the flythrough path.
3. Camera view angle is updated during adjustments.

(cherry picked from commit 81e12b6)
This commit ensures that clicking on the Back and Next buttons does not
progress beyond the behavior triggered by clicking on the First and Last
buttons.

(cherry picked from commit 083595b)
@jcfr jcfr enabled auto-merge (rebase) December 11, 2023 21:54
Copy link
Contributor

@Leengit Leengit left a comment

Choose a reason for hiding this comment

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

LGTM, my test drive works.

I see that Line 34 of Endoscopy.py is

self.parent.dependencies = []

with this pull request, but is

self.parent.dependencies = ["Markups"]

with the main branch. If that is what you intended then all is good.

@jcfr jcfr merged commit 945cb69 into Slicer:5.6 Dec 11, 2023
6 checks passed
@jcfr jcfr deleted the 5.6-backport/Endoscopy branch December 11, 2023 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants