Skip to content

Conversation

sadhana-r
Copy link
Contributor

@sadhana-r sadhana-r commented Jun 16, 2025

Closes #372

For review

Confirm that scaling is applied correctly using the sliding widget

@sadhana-r sadhana-r force-pushed the 372_scaling_origin branch from 6b7ecc0 to 030c2a2 Compare June 16, 2025 21:14
@sadhana-r sadhana-r requested a review from ebrahimebrahim June 16, 2025 21:15
@sadhana-r sadhana-r marked this pull request as ready for review June 16, 2025 21:15
@sadhana-r sadhana-r force-pushed the 372_scaling_origin branch from 030c2a2 to 8a64ec2 Compare June 17, 2025 14:36
Comment on lines 747 to 763
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
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

Choose a reason for hiding this comment

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

much clearer thank you!

Copy link
Contributor

@ebrahimebrahim ebrahimebrahim left a 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)
Copy link
Contributor

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

@peterhollender
Copy link
Contributor

Would it be possible to align the transformation handles to the center of the MRI coordinates (the scene origin), after we've performed fiducial registration? I had a situation where there was a small piece of stray geometry returned by photogrammetry reconstruction that offset the handle location and orientation.

image

Would this situation be handled well by the current proposed solution? Otherwise, once the fiducial registration has been completed, we already know approximately how the head should be positioned and oriented.

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.

Mesh scaling origin issues

3 participants