Centerline Functions

multimodars.align_three_point(centerline, geometry, main_ref_pt, counterclockwise_ref_pt, clockwise_ref_pt, angle_step_deg=1.0, write=False, watertight=True, interpolation_steps=0, output_dir='output/aligned', contour_types=None, case_name='None', align_wall_anomalous=False)[source]

Align a geometry (or geometry pair) to the centerline using three reference points.

Creates centerline-aligned meshes based on three anatomical reference points (main ostium, counterclockwise side, clockwise side). Only works for elliptic vessels such as coronary artery anomalies.

Parameters:
  • centerline (PyCenterline) – Centerline of the vessel.

  • geometry (PyGeometryPair | PyGeometry) – Single geometry or diastolic/systolic geometry pair to align.

  • main_ref_pt (tuple[float, float, float]) – (x, y, z) reference point at the aortic ostium.

  • counterclockwise_ref_pt (tuple[float, float, float]) – (x, y, z) counterclockwise reference point (viewed proximal → distal).

  • clockwise_ref_pt (tuple[float, float, float]) – (x, y, z) clockwise reference point (viewed proximal → distal).

  • angle_step_deg (float) – Step size in degrees for the rotation search. Default is 1.0.

  • write (bool) – Whether to write the aligned meshes to OBJ files. Default is False.

  • watertight (bool) – Whether to write a watertight or shell mesh. Default is True.

  • interpolation_steps (int) – Number of interpolation steps between phases. Only used when geometry is a PyGeometryPair. Default is 0.

  • output_dir (str) – Output directory for aligned meshes. Default is "output/aligned".

  • contour_types (list[PyContourType] | None) – Contour types to export. Default is [PyContourType.Lumen, PyContourType.Catheter, PyContourType.Wall].

  • case_name (str) – Case name used as a filename prefix. Default is "None".

  • align_wall_anomalous (bool) – When True, rotate the Wall contour in every frame (from frame 2 onward) so its aortic straight portion aligns to the plane defined by frames 0 and 1. Only meaningful for anomalous vessels. Default is False.

Return type:

tuple[PyGeometryPair | PyGeometry, PyCenterline]

Returns:

  • geometry (PyGeometryPair or PyGeometry) – Aligned geometry, matching the type of the input.

  • centerline (PyCenterline) – Resampled centerline.

Examples

>>> import multimodars as mm
>>> result, cl = mm.align_three_point(
...     centerline,
...     geometry_pair,
...     (12.2605, -201.3643, 1751.0554),
...     (11.7567, -202.1920, 1754.7975),
...     (15.6605, -202.1920, 1749.9655),
... )
multimodars.align_manual(centerline, geometry, rotation_angle, ref_point, write=False, watertight=True, interpolation_steps=0, output_dir='output/aligned', contour_types=None, case_name='None', align_wall_anomalous=False)[source]

Align a geometry (or geometry pair) to the centerline using a manual rotation angle.

Creates centerline-aligned meshes using an explicit rotation angle and a single reference point on the centerline. Only works for elliptic vessels such as coronary artery anomalies.

Parameters:
  • centerline (PyCenterline) – Centerline of the vessel.

  • geometry (PyGeometryPair | PyGeometry) – Single geometry or diastolic/systolic geometry pair to align.

  • rotation_angle (float) – Rotation angle in radians to apply.

  • ref_point (tuple[float, float, float]) – (x, y, z) reference point on the centerline.

  • write (bool) – Whether to write the aligned meshes to OBJ files. Default is False.

  • watertight (bool) – Whether to write a watertight or shell mesh. Default is True.

  • interpolation_steps (int) – Number of interpolation steps between phases. Only used when geometry is a PyGeometryPair. Default is 0.

  • output_dir (str) – Output directory for aligned meshes. Default is "output/aligned".

  • contour_types (list[PyContourType] | None) – Contour types to export. Default is [PyContourType.Lumen, PyContourType.Catheter, PyContourType.Wall].

  • case_name (str) – Case name used as a filename prefix. Default is "None".

  • align_wall_anomalous (bool) – When True, rotate the Wall contour in every frame (from frame 2 onward) so its aortic straight portion aligns to the plane defined by frames 0 and 1. Only meaningful for anomalous vessels. Default is False.

Return type:

tuple[PyGeometryPair | PyGeometry, PyCenterline]

Returns:

  • geometry (PyGeometryPair or PyGeometry) – Aligned geometry, matching the type of the input.

  • centerline (PyCenterline) – Resampled centerline.

Examples

>>> import multimodars as mm
>>> result, cl = mm.align_manual(
...     centerline, geometry_pair, rotation_angle=1.57, ref_point=(1.0, 2.0, 3.0)
... )
multimodars.align_combined(centerline, geometry, main_ref_pt, counterclockwise_ref_pt, clockwise_ref_pt, points, angle_step_deg=1.0, angle_range_deg=15.0, index_range=2, write=False, watertight=True, interpolation_steps=0, output_dir='output/aligned', contour_types=None, case_name='None', align_wall_anomalous=False)[source]

Align a geometry (or geometry pair) using three reference points and Hausdorff refinement.

Creates centerline-aligned meshes using three anatomical reference points for an initial orientation and a set of additional points for Hausdorff distance-based fine-tuning of the rotation.

Parameters:
  • centerline (PyCenterline) – Centerline of the vessel.

  • geometry (PyGeometryPair | PyGeometry) – Single geometry or diastolic/systolic geometry pair to align.

  • main_ref_pt (tuple[float, float, float]) – (x, y, z) reference point at the aortic ostium.

  • counterclockwise_ref_pt (tuple[float, float, float]) – (x, y, z) counterclockwise reference point (viewed proximal → distal).

  • clockwise_ref_pt (tuple[float, float, float]) – (x, y, z) clockwise reference point (viewed proximal → distal).

  • points (list[tuple[float, float, float]]) – Point cloud used for Hausdorff distance calculation during rotation refinement.

  • angle_step_deg (float) – Step size in degrees for the rotation search. Default is 1.0.

  • angle_range_deg (float) – Total rotation search range in degrees. Default is 15.0.

  • index_range (int) – Number of centerline indices considered around the reference. Default is 2.

  • write (bool) – Whether to write the aligned meshes to OBJ files. Default is False.

  • watertight (bool) – Whether to write a watertight or shell mesh. Default is True.

  • interpolation_steps (int) – Number of interpolation steps between phases. Only used when geometry is a PyGeometryPair. Default is 0.

  • output_dir (str) – Output directory for aligned meshes. Default is "output/aligned".

  • contour_types (list[PyContourType] | None) – Contour types to export. Default is [PyContourType.Lumen, PyContourType.Catheter, PyContourType.Wall].

  • case_name (str) – Case name used as a filename prefix. Default is "None".

  • align_wall_anomalous (bool) – When True, rotate the Wall contour in every frame (from frame 2 onward) so its aortic straight portion aligns to the plane defined by frames 0 and 1. Only meaningful for anomalous vessels. Default is False.

Return type:

tuple[PyGeometryPair | PyGeometry, PyCenterline]

Returns:

  • geometry (PyGeometryPair or PyGeometry) – Aligned geometry, matching the type of the input.

  • centerline (PyCenterline) – Resampled centerline.

Examples

>>> import multimodars as mm
>>> result, cl = mm.align_combined(
...     centerline,
...     geometry_pair,
...     (12.2605, -201.3643, 1751.0554),
...     (11.7567, -202.1920, 1754.7975),
...     (15.6605, -202.1920, 1749.9655),
...     point_cloud,
... )