neurocollage.mesh_helper

3D collage module.

Classes

MeshHelper(atlas_path, region[, hemisphere])

Helper class to deal with meshes in atlas with trimesh.

class neurocollage.mesh_helper.MeshHelper(atlas_path, region, hemisphere=None)

Bases: AtlasHelper

Helper class to deal with meshes in atlas with trimesh.

property annotation

Returns the voxell data with layer annotation.

property boundary_mask

Get a mask of inner and boundary voxel of a region.

property depths

Returns the depths in the associated brain region.

directions_to_indices(direction)

Convert directions to indices based coordinates.

Basically just flip directions wrt signs voxel_dimensions.

get_boundary_mesh(subregion=None)

Create boundary mesh.

get_layer_meshes(alpha=0.5, colors=None)

Get layer meshes.

get_meshes(plane=None)

Get layer pia and region meshes.

get_pia_mesh(cutoff=3)

Get pia mesh.

get_total_boundary_mesh()

Get entire boundary mesh where depth is defined.

get_vector_field(step=1.0, length=5.0, direction=None, hemisphere=None, slices=None, plane=None)

Get vector field from orientations as points and line objects to plot.

Parameters:
  • step (float) – number of vectors per voxel in each direction

  • length (float) – lengths of vectors

  • direction (list) – vector direction (default is PIA_DIRECTION=[0, 1, 0])

  • hemisphere (bool) – which hemisphere to onsider

  • slices (bool) – to specify a custom bounding box, default to region mask

  • plane (dict) – a dict representing a plane to plot only within it

indices_to_positions(indices)

Simpler indices_to_positions.

property layer_annotation

Returns a dict with layer annotation and layer mapping.

load_morph(morph)

Load a morphology.

load_morphs(cells_df)

Load multiple morphologies.

load_planes(planes=None)

Load planes to render as meshes.

positions_to_indices(points)

Simpler positions_to_indices.

render(data=None, plane=None, filename=None, show=True, line_width=1.0)

Render the meshes with additional data.

Parameters:
  • data – pass any data which can be rendered

  • plane – give a plane to slice the rendering

  • filename (str) – if given, the figure is exported to this file path

  • show (bool) – if set to True the figure is shown at execution time

  • line_width (float) – the line width used for rendering

static show()

Show the renderings.

slice_mesh(mesh, plane, cap=False)

Slice mesh.

slice_meshes(meshes, plane)

Slice meshes.