siibra.locations.pointcloud
A set of coordinates on a reference space.
Classes
A set of 3D points in the same reference space, |
Functions
|
Create a PointCloud from an iterable of Points. |
Module Contents
- class siibra.locations.pointcloud.PointCloud(coordinates: List[Tuple] | numpy.ndarray, space=None, sigma_mm: int | float | List[int | float] = 0, labels: List[int | float | tuple] = None)
A set of 3D points in the same reference space, defined by a list of coordinates.
- __eq__(other: PointCloud)
Required to provide comparison and making the object hashable
- __getitem__(index: int)
- __hash__()
- __iter__()
Return an iterator over the coordinate locations.
- __len__()
The number of points in this PointCloud.
- __str__()
- as_list()
Return the point set as a list of 3D tuples.
- find_clusters(min_fraction: float = 1 / 200, max_fraction: float = 1 / 8) List[int]
Find clusters using HDBSCAN (https://dl.acm.org/doi/10.1145/2733381) implementation of scikit-learn (https://dl.acm.org/doi/10.5555/1953048.2078195).
- Parameters:
min_fraction (min cluster size as a fraction of total points in the PointCloud) –
max_fraction (max cluster size as a fraction of total points in the PointCloud) –
- Returns:
Returns the cluster labels found by skilearn.cluster.HDBSCAN.
Note
Replaces the labels of the PointCloud instance with these labels.
- Return type:
List[int]
- Raises:
RuntimeError – If a sklearn version without HDBSCAN is installed.
- intersection(other: siibra.locations.location.Location)
Return the subset of points that are inside the given mask.
NOTE: The affine matrix of the image must be set to warp voxels coordinates into the reference space of this Bounding Box.
- transform(affine: numpy.ndarray, space=None)
Returns a new PointCloud obtained by transforming the coordinates of this one with the given affine matrix.
- Parameters:
affine (numpy 4x4 ndarray) – affine matrix
space (reference space (id, name, or Space)) – Target reference space which is reached after applying the transform. Note that the consistency of this cannot be checked and is up to the user.
- warp(space, chunksize=1000)
Creates a new point set by warping its points to another space
- property boundingbox
Return the bounding box of these points, or None in the special case of an empty PointCloud.
- property centroid
- property coordinates: numpy.ndarray
- property has_constant_sigma: bool
- property homogeneous
Access the list of 3D point as an Nx4 array of homogeneous coordinates.
- property label_colors
return a color for the given label.
- labels = None
- property volume
- siibra.locations.pointcloud.from_points(points: List[siibra.locations.point.Point], newlabels: List[int | float | tuple] = None) PointCloud
Create a PointCloud from an iterable of Points.
- Parameters:
points (Iterable[point.Point]) –
newlabels (List[int], optional) – Use these labels instead of the original labels of the points.
- Return type: