Skip to content

Refactor pre-alignment to use center of mass instead of image center #30

@zh320

Description

@zh320

Currently, the pre-alignment pipeline rotates volumes around the image center rather than the center of mass of the segmentation mask. This leads to instability and artifacts, especially after cropping. In particular, we observe cases where the fixed and moving volumes become mirrored after pre-alignment.

To address this, we propose the following updated workflow for the pre-alignment process:

  1. Compute the center of mass (CoM) of each segmentation mask and run PCA on the CoM-centered point cloud.
  2. Apply the PCA-based rotation to each volume, rotating about its CoM.
  3. Rotate the original 8 bounding-box corners after shifting them by the CoM.
  4. Take the minimum and maximum coordinates across both rotated volumes to compute a shared union bounding box.
  5. Shift both rotated volumes so they fit into the union bounding box.

Additionally, we should visualize the principal axes centered at the CoM to explicitly denote the rotation center and orientation.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions