catpy.util module

catpy.util.get_virtual_treenodes(treenodes_response, z_depth)[source]

Get the locations of all virtual nodes in the given skeleton response, with the IDs of the material nodes proximal and distal to the virtual slab.

Parameters:
treenodes_response: sequence of sequences of any

“nodes” element of compact-skeleton or compact-arbor API response: row values are [treenode_id, parent_id, _, location_x, location_y, location_z, …]

z_depth: float

Z resolution of the stack

Returns:
iterator of (

(proximal_treenode_id, distal_treenode_id), [

(proximal_vnode_x, proximal_vnode_y, proximal_vnode_z), … (distal_vnode_x, distal_vnode_y, distal_vnode_z)

]

)
catpy.util.interpolate_treenodes(parent_xyz, child_xyz, z_depth)[source]

Yield the locations of virtual treenodes between two material treenodes.

The parent and child’s z coordinates will be quantized to the nearest multiple of z_depth. Virtual nodes will be projected onto any multiples of z_depth between the parent and child, and their (x, y, z) coordinates will be yielded in parent -> child order.

Parameters:
parent_xyz : sequence of (float, float, float)
child_xyz : sequence of (float, float, float)
z_depth : float

e.g. z-resolution

Returns:
Iterator of (x,y,z) tuples