Contour Tools

Contour extraction and processing utilities.

Module Reference

Tools for creating and manipulating contours.

class physiomotion4d.contour_tools.ContourTools(log_level=20)[source]

Tools for creating and manipulating contours.

__init__(log_level=20)[source]

Initialize ContourTools.

Parameters:

log_level (int | str) – Logging level (default: logging.INFO)

extract_contours(mask_image)[source]

Make contours from a mask image.

Parameters:
  • mask_image (itk.image) – The mask image to create contours from

  • output_file (str, optional) – If provided, save the contours to this VTP file

Returns:

The contours as a PyVista PolyData object

Return type:

pv.PolyData

transform_contours(contours, tfm, with_deformation_magnitude=False)[source]

Transform contours using a given transform.

Parameters:

tfm (itk.Transform) – The transform to use

Returns:

The transformed contours with deformation magnitude

Return type:

pv.PolyData

merge_meshes(meshes)[source]

Merge multiple fixed meshes into a single mesh.

Returns:

Merged mesh

Return type:

pv.PolyData

create_reference_image(mesh, spatial_resolution=0.5, buffer_factor=0.25, ptype=itk.F)[source]

Create a reference image from a mesh.

Return type:

Image

create_mask_from_mesh(mesh, reference_image)[source]
Return type:

itk.Image

create_distance_map(mesh, reference_image, squared_distance=False, negative_inside=True, zero_inside=False, norm_to_max_distance=0.0)[source]
Return type:

itk.Image

create_deformation_field(points, point_displacements, reference_image, blur_sigma=2.5, ptype=itk.D)[source]

Create a displacement map from model points and displacements.

Return type:

Image

Navigation

Transform Tools | Utility Modules | NRRD Conversion | Test Tools