API reference
cave_mapper.map_points(points, root_id, client, initial_distance=0, max_distance=4, verbose=False, *, point_offset=None, convention='round', timestamp=None, lru_bytes=int(100000000.0))
¶
Map points in space to voxels and their corresponding supervoxels.
Each point goes to a voxel (see convention). If that voxel is not part of
root_id, the search grows one voxel shell at a time, up to max_distance,
and keeps the nearest voxel of the root in the first shell that holds one.
The chunkedgraph calls use the client's own retry settings. For long runs, raise
them before building the client, for example
caveclient.set_session_defaults(max_retries=10, backoff_factor=1,
backoff_max=240, status_forcelist=(429, 500, 502, 503, 504)). The
segmentation reads are retried by CloudFiles.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
points
|
ndarray
|
Array of points in space to be mapped. Must be of shape (n_points, 3), and are assumed to be in coordinates of nanometers. |
required |
root_id
|
int
|
The root id of the object to map to. |
required |
client
|
CAVEclient
|
The CAVEclient object to use for mapping. |
required |
initial_distance
|
int
|
The initial distance to search for a mapping. Default is 0. Units are in voxels. |
0
|
max_distance
|
int
|
The maximum distance to search for a mapping. Default is 4. Units are in voxels. |
4
|
verbose
|
Whether to print progress messages. |
False
|
|
point_offset
|
Nanometers added to every point before the voxel conversion. |
None
|
|
convention
|
str
|
How a point becomes a voxel. |
'round'
|
timestamp
|
The time for the |
None
|
|
lru_bytes
|
int
|
Size of the CloudVolume chunk cache. Points close together share chunks. |
int(100000000.0)
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
A DataFrame with one row per point, in the input order. A point with no
voxel of the root within
|
cave_mapper.map_points_via_mesh(points, root_id, client, max_distance=4, verbose=False)
¶
Map points in space to a mesh and then to voxels and their corresponding supervoxels.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
points
|
ndarray
|
Array of points in space to be mapped. Must be of shape (n_points, 3), and are assumed to be in coordinates of nanometers. |
required |
root_id
|
int
|
The root id of the object to map to. |
required |
client
|
CAVEclient
|
The CAVEclient object to use for mapping. |
required |
max_distance
|
int
|
The maximum distance to search for a mapping. Default is 4. Units are in voxels. |
4
|
verbose
|
Whether to print progress messages. |
False
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
A DataFrame containing the mapping information. The DataFrame will have the following columns:
|
cave_mapper.mesh_point_offset(cv)
¶
The offset, in nanometers, to add to a point taken from a mesh before looking up the voxel that holds it.
Meshes are built from a downsampled segmentation (the mesh "mip") and sit half
a voxel of that mip off the voxel grid. This returns that half voxel,
resolution(mesh_mip) / 2.
Measured on MICrONS (minnie65_phase3_v1, mesh mip 2): the shift is about
(15, 8, 19) nm, against (16, 16, 20) from this rule. With the rule and
convention="floor", deep points inside spine meshes landed on the root
100% and 99.8% of the time on three cells, against 96% to 98% for medoids
with round. On H01 (h01_c3_flat, mesh mip 2) the measured shift is about
(3, 6, 15) nm, against (16, 16, 16.5). The rule still gave 99.58% there,
against 99.68% for the measured offset and 99.34% for none.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cv
|
CloudVolume
|
The segmentation CloudVolume. Its mesh info must name the mesh |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Array of shape (3,), in nanometers. |
cave_mapper.points_to_voxels(points, resolution, convention='round')
¶
Convert points in nanometers to mip-0 voxel indices.
convention="floor" is the voxel that holds the point: voxel i covers
[i * res, (i + 1) * res). CloudVolume, Neuroglancer and the CAVE
materialization engine all use it. convention="round" is the older behavior
of this package, which treats i * res as the voxel center.