From 699cd39f6f2423582fcaf281fa2e8c44bc2f3c7f Mon Sep 17 00:00:00 2001 From: Jason Ken Adhinarta <35003073+jasonkena@users.noreply.github.com> Date: Tue, 8 Oct 2024 16:25:54 -0400 Subject: [PATCH] make mesh_dir behavior consistent across create_meshing_tasks and create_mesh_manifest_tasks (#178) * typo fix in README, remove duplicate arguments in skeletonization example * make mesh_dir behavior consistent across create_meshing_tasks and create_mesh_manifest_tasks * fix vol.mesh.get in bounds_from_mesh --- README.md | 4 +--- igneous/task_creation/mesh.py | 5 ++++- igneous/task_creation/skeleton.py | 5 +++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index e2180d4..3248e2d 100755 --- a/README.md +++ b/README.md @@ -458,7 +458,7 @@ tasks = create_meshing_tasks( # First Pass tasks = create_mesh_manifest_tasks(layer_path, magnitude=3) # Second Pass ``` -The parameters above are mostly self explainatory, but the magnitude parameter of `create_mesh_manifest_tasks` is a bit odd. What a MeshManifestTask does is iterate through a proportion of the files defined by a filename prefix. `magnitude` splits up the work by +The parameters above are mostly self explanatory, but the magnitude parameter of `create_mesh_manifest_tasks` is a bit odd. What a MeshManifestTask does is iterate through a proportion of the files defined by a filename prefix. `magnitude` splits up the work by an additional 10^magnitude. A high magnitude (3-5+) is appropriate for horizontal scaling workloads while small magnitudes (1-2) are more suited for small volumes locally processed since there is overhead introduced by splitting up the work. @@ -515,8 +515,6 @@ tasks = tc.create_skeletonizing_tasks( dust_threshold=1000, # Don't skeletonize below this physical distance progress=False, # Show a progress bar parallel=1, # Number of parallel processes to use (more useful locally) - spatial_index=True, # generate a spatial index for querying skeletons by bounding box - sharded=False, # generate intermediate shard fragments for later processing into sharded format cross_sectional_area=False, # Compute the cross sectional area for each vertex. cross_sectional_area_smoothing_window=5, # Rolling average of vertices. ) diff --git a/igneous/task_creation/mesh.py b/igneous/task_creation/mesh.py index 21a8eaa..d18e842 100644 --- a/igneous/task_creation/mesh.py +++ b/igneous/task_creation/mesh.py @@ -168,7 +168,10 @@ def create_meshing_tasks( vol = CloudVolume(layer_path, mip) if mesh_dir is None: - mesh_dir = 'mesh_mip_{}_err_{}'.format(mip, max_simplification_error) + if 'mesh' in vol.info: + mesh_dir = vol.info['mesh'] + else: + mesh_dir = 'mesh_mip_{}_err_{}'.format(mip, max_simplification_error) if not 'mesh' in vol.info: vol.info['mesh'] = mesh_dir diff --git a/igneous/task_creation/skeleton.py b/igneous/task_creation/skeleton.py index e99ab06..2a38abf 100644 --- a/igneous/task_creation/skeleton.py +++ b/igneous/task_creation/skeleton.py @@ -48,8 +48,9 @@ def bounds_from_mesh( """Estimate the bounding box of a label from its mesh if available.""" bbxes = [] for label in labels: - mesh = vol.mesh.get(labels)[label] - if mesh is None: + try: + mesh = vol.mesh.get(label) + except ValueError: raise ValueError(f"Mesh {label} is not available.") bounds = Bbox.from_points(mesh.vertices // vol.resolution)