for ax in maxes: for n in cg.nodes(): cg.node[n][ax] = -cg.node[n][ax] if ii < len(args.translate): cell_pos[fname] = [int(x) for x in args.translate[ii].split()] else: cell_pos[fname] = [0, 0, 0] if ii < len(args.rotate): rot = args.rotate[ii].split() for jj in range(0, len(rot), 2): rot[jj + 1] = float(rot[jj + 1]) cell_rot[fname] = zip(rot[0::2], rot[1::2]) else: cell_rot[fname] = [] if args.branches: lnodes, edges = zip(*ng.branch_points(cg)) label_nodes[fname] = list(lnodes) if args.leaves: label_nodes[fname] += [ node for node in cg.nodes() if cg.degree(node) == 1 ] if len(args.sid) > 0: sid_node_map = ng.get_stype_node_map(cg) for sid in args.sid: label_nodes[fname] += sid_node_map[sid] show_neurons(cell_graphs, lines=args.lines, label_nodes_dict=label_nodes, labels_dict={}, pos_dict=cell_pos, rot_dict=cell_rot,
if len(args.rotate) > ii: xrot, yrot, zrot = args.rotate[ii] tmatrix = make_tmatrix(xshift, yshift, zshift, xrot, yrot, zrot) print('Transformation matrix for', fname) print(tmatrix) rigid_transform_graph(cellgraph, tmatrix) if ii > 0: maxnode = max(combined_cellgraph.nodes()) for node in cellgraph.nodes(): cellgraph.node[node]['p'] += maxnode mapping = {n: n + maxnode for n in cellgraph.nodes()} cellgraph = nx.relabel_nodes(cellgraph, mapping) combined_cellgraph = nx.union(combined_cellgraph, cellgraph) label_nodes = [] if args.branches: label_nodes, degrees = zip(*ng.branch_points(combined_cellgraph)) label_nodes = list(label_nodes) if args.leaves: label_nodes += [node for node in combined_cellgraph.nodes() if combined_cellgraph.degree(node) == 1] if len(args.sid) > 0: sid_node_map = ng.get_stype_node_map(combined_cellgraph) for sid in args.sid: label_nodes += sid_node_map[sid] if module == 'mplot3d': ax = mp.plot_3d_lines(combined_cellgraph) plt.show() elif module == 'vtk': neuron3d(combined_cellgraph, lines=lines, label_nodes=label_nodes, labels=label_nodes, nodecolor=colormap, background=background, axes=args.scalebar,