API

The following functions are used to generate the surfaces seen in ZFBrain. Generally speaking, the following procedure is followed:

  1. Get xml file of brain region outline using Neurolucida software.

  2. Load xml file into one of the functions below to generate *.surf file

  3. These *.surf files are loaded into ZFBrain at runtime.

zfbrain.surface_plotting.generate_HVC_surf(input_file)[source]
zfbrain.surface_plotting.generate_RA_surf(input_file)[source]
zfbrain.surface_plotting.generate_X_surf(input_file)[source]
zfbrain.surface_plotting.generate_brainexterior_surf(input_file)[source]
zfbrain.surface_plotting.get_interpolant(xvals, yvals, Nvals)[source]
zfbrain.surface_plotting.mirror_nodes(new_nodes, N_interp, num_slices, MID_Z, DELTA_Z, OFFSET)[source]
zfbrain.surface_plotting.read_surface(file_name)[source]

Reads in surface data type in the *.surf format.

Note

L is the number of slices of data, N is the number of data points per slice. Each must be constant.

A typical *.surf data file is given by the following:

1
2
3
4
5
6
7
8
descriptive string of data
L N
x11 y11 z11
x12 y12 z12
    ...
x1N y1N z1N
x21 y21 z21
    ...

The total number of lines in file_name is 2+L*N

Parameters

file_name (string) – Filename for surface data.

Returns

  • verts (ndarray(dtype=float, ndim=2)) – Vertex matrix with shape (N, 3). Each row represents a point in 3D, and each column represents the X, Y, Z coordinate.

  • faces (ndarray(dtype=int, ndim=2)) – Face indices matrix with shape (N, 3). Each row represents a face (triangle), and each column represents the index of the data point for a vertex.

zfbrain.surface_plotting.write_surf(A, L, N, out_filename, description=' ')[source]

Writes *.surf data file (ASCII format) into out_filename.surf. description is the description, N is the number of points on each slice (a constant!), L is the number of slices, and A is a N*L x 3 numpy array containing all data points.