Point cloud (point_cloud)¶
Terms¶
- Point cloud
A set of vertex positions with no connectivity. The type constant is
GEOM_POINT_CLOUD,"point_cloud".
Introduction¶
A point cloud stores positions and optional per-vertex attributes. It suits data whose points are independent: lidar, synchrotron point data, single-molecule localisation microscopy, spatial transcriptomics.
Without objects, the writer stores one fragment per occupied bin in each
chunk, so a reader can fetch part of a chunk. With object_ids=, fragments
follow objects instead of bins. What every type shares is on
Geometry types.
Technical reference¶
Arrays present¶
At level 0 of a store written by write_points:
Path |
Present |
Description |
|---|---|---|
|
Always |
One fragment per occupied bin (or per object) per chunk |
|
With |
Vector attributes, such as RGB colour, have a |
|
With |
One manifest per object |
|
With |
|
|
With |
Group-to-object lists |
A point cloud has no links/ group. Its root attributes:
{
"geometry_types": ["point_cloud"],
"base_bin_shape": [50.0, 50.0, 50.0],
...
}
base_bin_shape is written only when bin_shape= is given. No
links_convention is written; a reader parses its absence as
implicit_sequential.
Write and read API¶
import numpy as np
from zarr_vectors.building import write_points
from zarr_vectors.types.points import read_points
rng = np.random.default_rng(0)
positions = rng.uniform(0, 1000, (100_000, 3)).astype(np.float32)
intensity = rng.uniform(0, 1, 100_000).astype(np.float32)
colour = rng.integers(0, 256, (100_000, 3)).astype(np.uint8)
summary = write_points(
"scan.zarrvectors",
positions,
chunk_shape=(200.0, 200.0, 200.0),
bin_shape=(50.0, 50.0, 50.0),
vertex_attributes={"intensity": intensity, "colour": colour},
)
print(summary)
# {'vertex_count': 100000, 'chunk_count': 125, 'object_count': 0,
# 'group_count': 0, 'bins_per_chunk': (4, 4, 4)}
result = read_points(
"scan.zarrvectors",
bbox=(np.array([100.0, 100.0, 100.0]), np.array([200.0, 200.0, 200.0])),
attribute_names=["colour"],
)
print(result["vertex_count"], result["vertex_attributes"]["colour"].shape) # 99 (99, 3)
Without chunk_shape=, the writer derives one chunk size from the data’s
bounds; without bin_shape=, a bin is a chunk. String and object-dtype
attributes are dictionary-encoded as integer codes plus a categories
table. The deprecated attributes= name still works but warns. Through
the dataset API, use ds.add_points(...).
read_points returns:
Key |
Type |
Description |
|---|---|---|
|
|
Vertex positions |
|
|
The attributes named in |
|
|
Vertices returned |
|
|
Owning object of each vertex; only when |
Validation¶
Level |
Check |
|---|---|
L3 |
For a store whose only type is |
L4 |
A |