skshapes.applications package

Submodules

skshapes.applications.barycentric_landmark_setter module

Landmark setter with barycentric coordinates.

Not usable at the moment.

class skshapes.applications.barycentric_landmark_setter.BarycentricLandmarkSetter(meshes, **kwargs)

Bases: Plotter

This class has bugs and is not used in the library.

A LandmarkSetter is a vedo application that allows the user to select landmarks on a set of meshes.

This version allows to select landmarks that are barycentric coordinates of the vertices of the mesh.

Parameters:
  • meshes (list[PolyData]) – The meshes on which the landmarks are selected.

  • **kwargs – Keyword arguments passed to the vedo.Plotter constructor.

property landmarks

Return the landmarks as a list of two lists of 3D points.

property landmarks_as_3d_point_cloud

Return the landmarks as a list of two lists of 3D points.

start()

Start the landmark setter.

skshapes.applications.barycentric_landmark_setter.barycentric_coordinates(mesh, point)

skshapes.applications.browser module

Wrapper around [vedo.applications.Browser](https://vedo.embl.es/docs/vedo/applications.html#Browser).

class skshapes.applications.browser.Browser(shapes)

Bases: object

Application to browse a sequence of shapes with a slider.

Based on [vedo.applications.Browser](https://vedo.embl.es/docs/vedo/applications.html#Browser).

Parameters:

shapes (list[polydata_type | image_type]) – The shapes to visualize.

Examples

You can visualize any sequence of shapes with a slider to navigate through:

import skshapes as sks

# Create a sequence of translated spheres to visualize
meshes = [sks.Sphere() for _ in range(5)]
for i in range(5):
    meshes[i].points += torch.tensor([i / 5, 0, 0])
# Create a browser to visualize the sequence
browser = sks.Browser(meshes)
browser.show()

This application is useful to visualize the intermediate shapes in a registration task:

import skshapes as sks
import torch

source, target = sks.Sphere(), sks.Sphere()
# Translate the target
target.points += torch.tensor([1, 0, 0])
# Create a registration task with a rigid motion model and L2 loss
model = sks.RigidMotion(n_steps=5)
loss = sks.L2Loss()
task = sks.Registration(model=model, loss=loss, n_iter=5)
task.fit(source=source, target=target)
# Visualize the intermediate shapes
path = task.path_
browser = sks.Browser(path)
browser.show()
show()

Show the browser.

skshapes.applications.vertices_landmark_setter module

Landmark setter application.

class skshapes.applications.vertices_landmark_setter.LandmarkSetter(shapes)

Bases: object

Landmark setter for a PolyData or a list of PolyData.

Select landmarks on a single shape or corresponding landmarks on a set of shapes. Landmarks are vertices of the shape(s).

If a list is provided, the first shape is considered as the reference shape and the landmarks are selected on this shape. Then, the same landmarks must be selected on the other shapes.

Parameters:

shapes (list[polydata_type] | polydata_type) – The shape or list of shapes on which the landmarks are selected.

Examples

import skshapes as sks
from pyvista import examples

shape1 = sks.PolyData(examples.download_human())
shape2 = sks.PolyData(examples.download_doorman())

app = sks.LandmarkSetter([shape1, shape2])
app.start()

# Landmarks are now stored in the shapes
shape1.landmark_indices  # The indices of the landmarks on shape1
shape2.landmark_points  # The coordinates of the landmarks on shape2

See [here](../../../generated/gallery/applications/plot_landmark_setter/) for the full example.

start()

Start the landmark setter.

class skshapes.applications.vertices_landmark_setter.LandmarkSetterMultipleMeshes(shapes)

Bases: Plotter

Multiple PolyData landmark setter.

The same number of landmarks must be selected on each shape, and the landmarks must be selected in the same order on each shape, in order to use the landmarks for registration between these.

Parameters:

shapes (list[polydata_type]) – The list of PolyData on which the landmarks are selected.

start()

Start the landmark setter.

class skshapes.applications.vertices_landmark_setter.LandmarkSetterSingleMesh(shape)

Bases: Plotter

Single PolyData landmark setter.

Parameters:

shape (polydata_type) – The PolyData on which the landmarks are selected.

start()

Start the landmark setter.

skshapes.applications.vertices_landmark_setter.closest_vertex(points, point)

Clostest vertex computation.

Given a list of vertices and a point, return the indice of the closest vertex.

skshapes.applications.window_generator module

Simple Qt windows generator.