calc_3d_distance - jaybgager/tracertools GitHub Wiki
Calculates the 3D distance between two points at a given xyz resolution in nanometers.
Arguments:
point_a(list of 3 integers, mandatory)- xyz coordinates of first point e.g. [1,2,3]
point_b(list of 3 integers, mandatory)- xyz coordinates of second point e.g. [1,2,3]
res(list of 3 integers, mandatory)- resolution in nm/voxel of each spatial dimension e.g. [4,4,45] for
brain_and_nerve_cord
- resolution in nm/voxel of each spatial dimension e.g. [4,4,45] for
Returns:
distance(float)- the distance between the two points in nanometers
Example
Let's say we wanted to get the approximate width of the neck connective as it exits the VNC in the brain_and_nerve_cord datastack. You could pick two points on opposite sides of the overall mesh and feed them into this function with the viewer resolution to get the result.
INPUT:
import tracertools as tt
distance = tt.calc_3d_distance(
point_a = [119837, 127150, 2758],
point_b = [134142, 123812, 2724],
res = [4,4,45],
)
print("Your points are", distance, "nanometers apart.")
OUTPUT:
Your points are 58777.08060120033 nanometers apart.