construct_meshes_from_annotation#

brainglobe_atlasapi.atlas_generation.mesh_utils.construct_meshes_from_annotation(save_path: Path, volume: ndarray, structures_list, closing_n_iters=2, decimate_fraction=0, smooth=False, parallel: bool = True, num_threads: int = -1, verbosity: int = 0)[source]#

Retrieve or construct atlas region meshes for a given annotation volume.

If an atlas is packaged with mesh files, reuse those. Otherwise, construct the meshes using the existing volume and structure tree. Returns a dictionary mapping structure IDs to their corresponding .obj mesh files.

Parameters:
  • save_path (Path) – Path to the directory where new mesh files will be saved.

  • volume (np.ndarray) – 3D annotation volume.

  • structures_list (list) – List of structure dictionaries containing id information.

  • smooth (bool) – if True the surface mesh is smoothed

  • closing_n_iters (int) – number of iterations of closing morphological operation. set to None to avoid applying morphological operations

  • decimate_fraction (float in range [0, 1].) – What fraction of the original number of vertices is to be kept. EG .5 means that 50% of the vertices are kept, the others are removed.

  • parallel (bool) – If True, uses multiprocessing to speed up mesh creation

  • num_threads (int) – Number of threads to use for parallel processing. If -1, threads are set to the maximum number based on available memory. If > 0, uses that many threads.

  • verbosity (int) – Level of verbosity for logging. 0 for no output, 1 for basic info.

Returns:

Dictionary of structure IDs and paths to their .obj mesh files.

Return type:

dict