Visualization

Trace Visualization

brainlit.viz.snap_points(img: np.ndarray, points: pd.DataFrame, radius: list = [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: np.ndarray, points: pd.DataFrame)

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: np.ndarray, points: pd.DataFrame)

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: np.ndarray, points: pd.DataFrame)

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: int, y1: int, z1: int, x2: int, y2: int, z2: int)

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