get_anno_array_from_state_file - jaybgager/tracertools GitHub Wiki
This function extracts a numpy array of point coordinates from a point annotation layer in a locally-stored neuroglancer JSON state file.
Arguments:
layer_name(string, mandatory)- the name of the point annotation layer in the JSON state file
json_path(type, mandatory)- the absolute file path to the JSON state file on your local machine
- e.g. "/home/username/ng_jsons/state.json"
Returns:
points((n,3)-shape numpy array of integers)- array of 3-integer arrays representing point coordinates
Example
INPUT:
import tracertools as tt
anno_array = tt.get_anno_array_from_state_file(
json_filepath = "/home/user/ng_states/state01.json",
layer_name = "annotation1"
)
print(anno_array)
OUTPUT:
array([
[x1, y1, z1],
[x2, y2, z2],
[x3, y3, z3],
...
[xn, yn, zn]
])