-
Notifications
You must be signed in to change notification settings - Fork 182
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
Fixed #550 : Added necessary allignment between glyph creation and ac… #551
Conversation
… and actor mapping. If a vtkSource is not aligned with the X axis, provide 4x4 orientation matrix to repeat_sources to align
Hello @Sassafrass6! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found: There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻 Comment last updated at 2022-04-04 20:08:36 UTC |
Hi @Sassafrass6, Thank you for this PR. Quite a busy period for me, Not sure I will have time to look at your PR this week or next week. @guaje, Can you look at this, please? |
Could you also address all pep8 issues as you can see here |
Codecov Report
@@ Coverage Diff @@
## master #551 +/- ##
==========================================
- Coverage 88.61% 88.55% -0.06%
==========================================
Files 55 55
Lines 10953 10979 +26
Branches 1080 1083 +3
==========================================
+ Hits 9706 9723 +17
- Misses 952 959 +7
- Partials 295 297 +2
|
…lyphs which must be oriented before mapping to actors
…dicular to the camera
…r to camera's focal point
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Sassafrass6
Thanks for catching and fixing this. I have added some specific comments and I would like to ask you to add a new function to test the new orientation
parameter. You can add it to fury.tests.test_utils.py
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Sassafrass6 I have added some additional requests based on your latest changes/commits.
@@ -706,7 +706,7 @@ def get_actor_from_primitive(vertices, triangles, colors=None, | |||
|
|||
|
|||
def repeat_sources(centers, colors, active_scalars=1., directions=None, | |||
source=None, vertices=None, faces=None): | |||
source=None, vertices=None, faces=None, orientation=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Testing the orientation argument is not possible without a test on repeat_sources.
Yes, please do add a test in fury.tests.test_utils.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your implementation of test_advanced_geometry_actor is nice, thank you. I've committed the change.
repeat_sources is used by several actors. Testing its functionality requires careful thought and definitely some effort.
Because I did not author this routine, and am only trying to submit a bug fix to the code, I respectfully decline.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand. You have addressed all my comments. IDK if @skoudoro has anything else to add.
Any update on the acceptance of this PR? The modification is critical, for the cylinder actor to function. |
Hi @Sassafrass6, Apologize for not giving news. The core maintainers (including me) are really focused on this workshop that we are organizing: https://dipy.org/workshops/dipy-workshop-2022 That's why we were not so active these past 2 - 3 weeks. The workshop finishes this Friday, so everything will get back to normal, next week (review, update, etc...). I agree this is an important update which might imply a quick-release also. |
Should not it be applied to all actors? I am surprised that only the cylinders are oriented along the Y-axis. I suppose this is the case for all vtksource. Which vtksource is aligned along the X-axis? I need to look deeper at this, when I see this tutorial, they seem to have all the same orientations. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some additional comments. Thank you again @Sassafrass6.
I am currently checking some vtk features and after your update, it should be good to merge
src = CylinderSource() if faces is None else None | ||
|
||
if src is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to keep this. It allows using your own faces and vertices if you build yourself a cylinder.
it give us flexibility for future change in the API
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This appears to be from an early commit, before I addressed Guaje's comments. In the more recent commits, values for src and rotate are appropriately set to None if faces is not None.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you point which commit?
I do not find it on master as you can see here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, can you revert it? thank you
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’m looking on the glyph_orientation branch of my GitHub’s fury fork, here
.
The link you’ve posted is from fury_gl:master, right?
There is no orientation argument, no disk function, etc.
What are you referencing, when you ask me to “revert it”?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is fury-gl:master
. If I merge your PR as it is, this modification will be applied which we do not want.
So either:
- you rebase your PR
- you merge
master
in your branch. - you just change this part of the code yourself and commit it.
Sorry for not being explicit, this is what I meant by reverting it (keep this feature already in master).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I review the history of this, no need to do any changes, I will go ahead and merge it. Thanks @Sassafrass6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see what you mean now.
15 commits is a lot to review. Thank you for looking through it all.
The orientation vector of the disk. | ||
colors : ndarray (N,3) or (N, 4) or tuple (3,) or tuple (4,) | ||
RGB or RGBA (for opacity) R, G, B and A should be at the range [0, 1] | ||
rinner : float |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
float, optional
instead
RGB or RGBA (for opacity) R, G, B and A should be at the range [0, 1] | ||
rinner : float | ||
disk inner radius, default: 0.3 | ||
router : float |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
float, optional
instead
fury/actor.py
Outdated
disk inner radius, default: 0.3 | ||
router : float | ||
disk outer radius, default: 0.5 | ||
cresolution: int, default: 6 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
int, optional
instead
fury/actor.py
Outdated
disk outer radius, default: 0.5 | ||
cresolution: int, default: 6 | ||
Number of facets used to define perimeter of disk. | ||
rresolution: int, default: 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
int, optional
instead
In this example that you have linked, the arrow and cone are aligned along x. The cylinder is aligned along y, and the disk is aligned such that the normal is along z. I'm making the format changes now. -Frank Update: Changes committed |
I confirm. This is ready to go as soon as you address my last comment. |
Thank you for this useful update @Sassafrass6 |
Added necessary alignment between glyph creation and actor mapping. If a vtkSource is not aligned with the X axis, provide 4x4 orientation matrix to repeat_sources to align.
This is necessary for the Cylinder object, which is aligned to the global Y axis in vtk. Without the correct orientation of the glyph, rotation into the z plane is not possible.
Also, the DiskSource is default aligned to the Z axis in vtk.
A similar routine for plotting discs (i.e. another use case for this patch) is included in actor.py.
Cylinder's with same specified direction as Arrows, original:
Trivial implementation of Disks (Non-functional in a similar manner to cylinders):
Correct implementation of Cylinders and Disks: