API¶
The following functions are used to generate the surfaces seen in ZFBrain. Generally speaking, the following procedure is followed:
Get xml file of brain region outline using Neurolucida software.
Load xml file into one of the functions below to generate *.surf file
These *.surf files are loaded into ZFBrain at runtime.
-
zfbrain.surface_plotting.generate_HVC_surf(input_file)[source]¶ Generates two HVC surf files for hemispheres.
-
zfbrain.surface_plotting.generate_RA_surf(input_file)[source]¶ Generates two RA surf files for hemispheres.
-
zfbrain.surface_plotting.generate_X_surf(input_file)[source]¶ Generates two Area X surf files for hemispheres.
-
zfbrain.surface_plotting.generate_brainexterior_surf(input_file)[source]¶ Generates exterior surface of brain surf file.
This code assumes that the hemisphere cut-off is given by the last slice and is in the z-direction, and starts at zero.
Note: This code is outdated. See generate_brainexterior_surf_new.
-
zfbrain.surface_plotting.generate_brainexterior_surf_new(input_file)[source]¶ New function to generate 2 hemispheres of exterior surface.
-
zfbrain.surface_plotting.get_interpolant(xvals, yvals, Nvals)[source]¶ Gets Nvals interpolant of periodic values (xvals, yvals).
-
zfbrain.surface_plotting.mirror_nodes(new_nodes, N_interp, num_slices, MID_Z, DELTA_Z, OFFSET)[source]¶ Generates mirror nodes across hemispheres.
-
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.read_surface_left(file_name)[source]¶ Similar to read_surface(file_name) leaves right surface open.
Not currently working as expected.
-
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.