siibra.experimental.plane3d

Module Contents

Classes

Plane3D

A 3D plane in reference space.

class siibra.experimental.plane3d.Plane3D(point1: siibra.locations.point.Point, point2: siibra.locations.point.Point, point3: siibra.locations.point.Point)

A 3D plane in reference space. This shall eventually be derived from siibra.Location

property distance_from_origin
property normal
classmethod from_image(image: siibra.volumes.volume.Volume)

Derive an image plane by assuming the volume to be a 2D image. The smallest dimension in voxel space is considered flat. The plane is defined in the physical space of the volume.

get_enclosing_patch(points: siibra.locations.pointset.PointSet, margin=[0.5, 0.5])

Computes the enclosing patch in the given plane which contains the projections of the given points. The orientation of the patch follows the principal axis.

intersect_line_segments(startpoints: numpy.ndarray, endpoints: numpy.ndarray)

Intersects a set of straight line segments with the plane. Returns the set of intersection points. The line segments are given by two Nx3 arrays of their start- and endpoints. The result is an Nx3 list of intersection coordinates. TODO This returns an intersection even if the line segment intersects the plane,

intersect_mesh(mesh: dict)

Intersects a 3D surface mesh with the plane. Returns a set of split 2D contours, represented by ordered coordinate lists. The output contour coordinates are intersection points of mesh edges going through the plane, and only combined into a contour if arising from neighboring edges in the mesh. The mesh is passed as a dictionary with an Nx3 array “verts” of vertex coordinates, and an Mx3 array “faces” of face definitions. Each row in the face array corresponds to the three indices of vertices making up the triangle. The result is a list of contour segments, each represented as a PointSet holding the ordered list of contour points. The point labels in each “contour” PointSet hold the index of the face in the mesh which made up each contour point.

project_points(points: siibra.locations.pointset.PointSet)

projects the given points onto the plane.

sidedness(points: numpy.ndarray)

Computes labels for a set of 3D coordinates classifying them by the halfspaces spanned by this plane.