NodeNets
RealNeuralNetworks.NodeNets.NodeNet
— MethodNodeNet(bin_im)
Parameters: bin_im: binary mask. the object voxel should be false, non-object voxel should be true Return: nodeNet object
RealNeuralNetworks.NodeNets.NodeNet
— MethodNodeNet( seg, obj_id; penalty_fn=alexs_penalty)
Perform the teasar algorithm on the passed binary array.
RealNeuralNetworks.NodeNets.NodeNet
— MethodNodeNet( points; penalty_fn = alexs_penalty )
Perform the teasar algorithm on the passed Nxd array of points
RealNeuralNetworks.NodeNets.alexs_penalty
— Functionalexs_penalty( weights, dbf )
Returns a version of the edge weights, modified by the DBF-based teasar penalty:
w = w * 5000 .* (1 - dbf/maxDBF).^(16)
The factor of 5000 shouldn't make a difference, but I've left it here
RealNeuralNetworks.NodeNets.consolidate_paths
— Methodconsolidate_paths( path_list )
Extracts the unique nodes and edges among all paths in the list
RealNeuralNetworks.NodeNets.create_node_lookup
— Methodcreate_node_lookup( points )
Abstractly represent the points as a volume by means of linear indexes into a sparse vector.
RealNeuralNetworks.NodeNets.distill!
— MethodParameters:
point_array: a Nx3 array recording all the voxel coordinates inside the object.
path_nodes: the indexes of nodeNet voxels in the point_array
path_edges: the index pairs of nodeNet in the point_array
In the pathnodes, the nodes were encoded as the index of the pointarray. Since we do not need pointarray anymore, which could be pretty big, we'll only reserve the nodeNet coordinates and let the gc release the pointarray. the same applys to path_edges
RealNeuralNetworks.NodeNets.find_closest_node_id
— Methodfind_closest_node_id(self::NodeNet{T}, point::NTuple{3,T}) where T
look for the id of the closest node
RealNeuralNetworks.NodeNets.find_new_root_node_V1
— Methodfind_new_root_node( points )
Extracts the point with the lowest linear index from the Array of passed points
RealNeuralNetworks.NodeNets.find_new_root_node_id
— Methodfind_new_root_node( dbf )
Extracts the point with the largest dbf from the Array of passed points
RealNeuralNetworks.NodeNets.get_connectivity_matrix
— Methodget_connectivity_matrix(edges::Vector)
construct sparse connectivity matrix accordint to the edges
RealNeuralNetworks.NodeNets.get_edge_num
— Methodthe connectivity matrix is symmetric, so the connection is undirected
RealNeuralNetworks.NodeNets.get_neuroglancer_precomputed
— Methodget binary buffer formatted as neuroglancer nodeNet.
Binary format
UInt32: number of vertex
UInt32: number of edges
Array{Float32,2}: Nx3 array, xyz coordinates of vertex
Array{UInt32,2}: Mx2 arrray, node index pair of edges
reference: https://github.com/seung-lab/neuroglancer/wiki/Skeletons
RealNeuralNetworks.NodeNets.get_node_array
— Methodget_node_array(self::NodeNet)
Return: nodeArray::Array{T,2}: size is (nd, np), nd is the dimention of each node, np is the number of nodes
RealNeuralNetworks.NodeNets.get_num_segment_point
— Methodget_segment_point_num(self::NodeNet)
get number of branching points
RealNeuralNetworks.NodeNets.get_num_segmentes
— Methodassume that the graph is acyclic, no loop.
RealNeuralNetworks.NodeNets.get_sholl_number
— Methodget_sholl_number(self::NodeNet, radius::AbstractFloat)
get the number of points which is in neurite and incounters with a sphere centered on root node
RealNeuralNetworks.NodeNets.local_max_multiplicative_penalty
— Methodlocal_max_multiplicative_penalty( weights, dbf, G )
Returns a version of the edge weights, modified by the DBF-based penalty
w = w * (1 - DBFdest/DBFstar)
Where DBFstar is the maximum DBF value of an outwards neighbor for each node
RealNeuralNetworks.NodeNets.make_neighbor_graph
— Methodmake_neighbor_graph( points )
Creates a LightGraphs graph from a point cloud, such that each point has a node (indexed in the same order as the rows), and each node is connected to its neighbors (by 26-connectivity).
Also returns a sparse matrix of weights for these edges equal to the euclidean distance between the indices of each point. These can be weighted or modified easily upon return.
RealNeuralNetworks.NodeNets.nodes_within_radius
— Methodnodes_within_radius( sub, sub2node, r, max_dims )
Identifies the node indices within the subscript
RealNeuralNetworks.NodeNets.remove_path_from_rns!
— Functionremove_path_from_rns!( reachableNodeList, path, points, sub2node, dbf, max_dims, scale_param, const_param)
Identifies the nodes to remove from the reachable nodes within the graph. Probably the ugliest function here, and should be optimized later
TO OPTIMIZE
RealNeuralNetworks.NodeNets.save
— Methodsave(self::NodeNet, cellId::UInt32, d_json::Associative, d_bin::Associative)
save nodeNet in google cloud storage for neuroglancer visualization the format is the same with meshes
RealNeuralNetworks.NodeNets.save_edges
— Methodsave binary file of point pairs used in neuroglancer python interface to visualize the nodeNet
RealNeuralNetworks.NodeNets.translate_to_origin!
— Methodtranslate_to_origin!( points::Matrix{T} )
Normalize the point dimensions by subtracting the min across each dimension. This step isn't extremely necessary, but might be useful for compatibility with the MATLAB code. record the offset and add it back after building the nodeNet
RealNeuralNetworks.NodeNets.DBFs.compute_DBF
— Methodcompute_DBF( pointCloud )
Returns an array of DBF values for the point cloud. Currently creates a binary image, and runs bwd2 on it, though ideally we'd get rid of the need for an explicit bin_im
RealNeuralNetworks.NodeNets.DBFs.compute_DBF
— Methoduse segmentation to get binary image to save memory usage
RealNeuralNetworks.NodeNets.DBFs.compute_DBF
— Methodcompute_DBF( bin_im )
RealNeuralNetworks.NodeNets.DBFs.compute_DBF
— Methodcompute Distance from Boundary Field (DBF) based on point cloud and the boundary points
WARN: this function do not work correctly!
RealNeuralNetworks.NodeNets.DBFs.create_binary_image
— Methodcreate_binary_image( seg, obj_id )
Creates a boolean volume where the non-segment indices map to true, while the segment indices map to false
RealNeuralNetworks.NodeNets.DBFs.create_binary_image
— Methodcreate_binary_image( pointCloud )
Creates a boolean volume where the non-segment indices map to true, while the segment indices map to false.
RealNeuralNetworks.NodeNets.DBFs.distance_transform
— Methoddistance_transform( d::AbstractArray{T,N}, voxelSize::Vector{Float32}=ones(Float32, N) )
Returns a euclidean distance transformation of the mask provided by d. The return value will be a volume of the same size as d where the value at each index corresponds to the distance between that location and the nearest location for which d > 0.
RealNeuralNetworks.NodeNets.DBFs.extract_dbf_values
— Methodextract_dbf_values( dbf_image, pointCloud )
Takes an array where rows indicate subscripts, and extracts the values within a volume at those subscripts (in row order)
RealNeuralNetworks.NodeNets.DBFs.fill_f0!
— MethodFills an n-dimensional volume with initial states for edt transformation, inf for non-feature voxels, and 0 for feature voxels
RealNeuralNetworks.NodeNets.DBFs.fv_isfurther
— MethodGetting too tired to document these next few, but will be worth it if it works
RealNeuralNetworks.NodeNets.DBFs.remove_euclidean_distance_transform
— Methodremove_euclidean_distance_transform
RealNeuralNetworks.NodeNets.DBFs.row_voronoi_edt!
— MethodPerforms the edt over a specific row in the volume, following the first dimension
RealNeuralNetworks.NodeNets.DBFs.vol_voronoi_edt!
— MethodPerforms the edt transformation along the first dimension of the N-dimensional volume