Visualization

Trace Visualization

brainlit.viz.snap_points(img, points, radius=[3, 3, 3])

Moves neuron marker points to the highest intensity within a certain radius

Parameters
  • {3d array} -- image (img) --

  • {pandas dataframe} -- dataframe with swc points as output by combine_swc_img.points2voxel (points) --

Keyword Arguments

{list} -- voxel radius within which to search for highest intensity (default (radius) -- {[3,3,3]})

Returns

x,y,z, columns are unchanged)

Return type

[pandas dataframe] -- dataframe with same format as points, with new xvox, yvox, zvox values (Note

brainlit.viz.point_threshold(img, points)

Threshold image according to the minimum intensity of a set of points

Parameters
  • {3d array} -- image (img) --

  • {pandas dataframe} -- dataframe with swc points as output by combine_swc_img.points2voxel (points) --

Returns

[3d array] -- binary mask from thresholding [int] -- threshold value

brainlit.viz.skeletonize(img, points)

Draw lines between points that are connected to produce binary mask

Parameters
  • {3d array} -- image (img) --

  • {pandas dataframe} -- dataframe with swc points as output by combine_swc_img.points2voxel (points) --

Returns

[3d array] -- binary mask showing skeletonization between points

brainlit.viz.skeleton_threshold_intersect(img, points)

Compute intersection between two masks: thresholded image and skeletonization of points

Parameters
  • {3d array} -- image (img) --

  • {pandas dataframe} -- dataframe with swc points as output by combine_swc_img.points2voxel (points) --

Returns

[3d array] -- binary mask of intersection [int] -- when the threshold is lowered to obtain a single connected component, this indicates the number of iterations used

brainlit.viz.Bresenham3D(x1, y1, z1, x2, y2, z2)

Takes two coordinates and gives the set of coordinates that connects them with a straight line

Adapted from https://www.geeksforgeeks.org/bresenhams-algorithm-for-3-d-line-drawing/

Parameters
  • {int} -- first x coodinate (x1) --

  • {int} -- first y coodinate (y1) --

  • {int} -- first z coodinate (z1) --

  • {int} -- second x coodinate (x2) --

  • {int} -- second y coodinate (y2) --

  • {int} -- second z coodinate (z2) --

Returns

[list] -- list of x coordinate connecting the points [list] -- list of y coordinate connecting the points [list] -- list of z coordinate connecting the points