make_volume_mesh_from_state_file - jaybgager/tracertools GitHub Wiki
This function locally generates a precomputed single-res unsharded convex hull mesh in a legacy-format neuroglancer volume from a point annotation layer in a locally-stored neuroglancer JSON state file.
[!NOTE] This function doesn't work on Windows OS due to the volume format requiring colons
:in several file names, which is prohibited on Windows. Currently there's no way around this limitation.
Arguments:
datastack(string, mandatory)- the name of the CAVE datastack the JSON state is from
- for a list of datastacks currently supported with tracertools configs, use get_supported_configs
json_path(string, mandatory)- the absolute path to the neuroglancer JSON state file to pull annotations from
- e.g. "/home/username/ng_jsons/state.json"
layer_name(string, mandatory)- the name of the point annotation layer to pull from, e.g.
"annotation1"
- the name of the point annotation layer to pull from, e.g.
output_path(string, mandatory)- the absolute path to the folder where you want to save the mesh output, e.g. '/home/username/ng_meshes'
- last folder in directory will be the top-level folder of the volume
- this will create folders where none exist
export_obj(boolean, optional, default=False)- optional toggle to export the mesh as an OBJ file in addition to making volume
- OBJ file will save in same directory as volume as
hull.obj
Returns:
- creates local neuroglancer volume with mesh made from chosen annotation layer in JSON state file
- optionally also makes
hull.objfile in same directory as volume ifexport_objset toTrue
Example
The code below will create a neuroglancer volume called volume_01 containing a convex hull mesh made from the annotation layer annotation1 of the brain_and_nerve_cord datastack JSON state file state.json in the directory /home/user/ng_states and save it in the /home/user/meshes directory. It will also save an OBJ file called annotation1.obj in the same directory.
INPUT:
import tracertools as tt
tt.make_volume_mesh_from_state_file(
datastack = "brain_and_nerve_cord",
json_path = "/home/user/ng_states/state.json",
layer_name = "annotation1",
output_path = "/home/user/meshes/volume_01",
export_obj = True,
)