-
Notifications
You must be signed in to change notification settings - Fork 5
Scale photoscan mesh from model centroid #414
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
base: main
Are you sure you want to change the base?
Conversation
6b7ecc0
to
030c2a2
Compare
030c2a2
to
8a64ec2
Compare
def getPhotoscanCentroidRAS(self): | ||
"""Calculates the centroid of the photoscan model node""" | ||
|
||
bounds = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0] | ||
self.wizard().photoscan.model_node.GetRASBounds(bounds) | ||
center_world = [ | ||
(bounds[0] + bounds[1]) / 2, | ||
(bounds[2] + bounds[3]) / 2, | ||
(bounds[4] + bounds[5]) / 2 | ||
] | ||
|
||
center_local = [0.0,0.0,0.0] | ||
transform_from_world = vtk.vtkGeneralTransform() | ||
self.photoscan_to_volume_transform_node.GetTransformFromWorld(transform_from_world) | ||
transform_from_world.TransformPoint(center_world,center_local ) | ||
|
||
return center_local |
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 am confused by the naming of things here. It returns center_local which sounds like it would be in local photoscan coordinates, but the function is called getPhotoscanCentroidRAS
which sounds like it's in global coordinates. I think it's returning something in world coordinates.. right?
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'll update the naming - it is confusing. You're right its returning the photoscan coordinates in world coordinates. The local here is referring to the fact that the coordinates after transformed bythe photoscan-volume transform but its confusing. I'll update the names/docstrings to clarify.
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.
much clearer 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.
It seems to still not be centered: when I drag the photoscan off to the side and drag the scaling slider, the centroid moves around
(No need to keep working on this atm unless you really want to -- we can leave the PR up!)
|
||
centroid_transformed = [0.0,0.0,0.0] | ||
transform_from_world = vtk.vtkGeneralTransform() | ||
self.photoscan_to_volume_transform_node.GetTransformFromWorld(transform_from_world) |
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.
When locking and unlocking things in the transducer tracking wizard, here I sometimes get AttributeError: 'NoneType' object has no attribute 'GetTransformFromWorld'
, so it seems getTransformedPhotoscanCentroid
can get called while self.photoscan_to_volume_transform_node
is None
Closes #372
For review
Confirm that scaling is applied correctly using the sliding widget