help='angle (in degrees) for y rotation', dest='yangle', default=0.0) parser.add_argument('-z', type=float, help='angle (in degrees) for z rotation', dest='zangle', default=0.0) parser.add_argument('-f', '--frames', type=int, help='number of frames per degree', dest='fpd', default=100) parser.add_argument('-r', '--rate', type=int, help='frame rate', dest='framerate', default=25) parser.add_argument('-o', '--output', type=str, help='output filename', dest='outfile', required=True) args = parser.parse_args() infile = args.infile outfile = args.outfile fpd = args.fpd framerate = args.framerate print(args.xangle, args.yangle, args.zangle, fpd, framerate) graph = ng.tograph(infile) dump_movie(outfile, graph, xrot=args.xrot, yrot=args.yrot, zrot=args.zrot, xangle=args.xangle, yangle=args.yangle, zangle=args.zangle, frames_per_degree=fpd, framerate=framerate) print('Saved movie in', outfile) # # vtk_dump_movie.py ends here
try: colormap = ng.colormaps[args.colormap] except KeyError: print('Colormap must be one of', ng.colormaps.keys()) sys.exit(0) background = [0, 0, 0] for ii, fstr in enumerate(args.bg.split()): background[ii] = float(fstr) if ii >= 3: break cell_graphs = {} cell_pos = {} cell_rot = {} label_nodes = defaultdict(list) for ii, fname in enumerate(args.filenames): cg = ng.tograph(fname) cell_graphs[fname] = cg if ii < len(args.mirror): maxes = args.mirror[ii].split() 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])
sys.exit(0) if args.bg: background = (0, 0, 0) else: background = (1, 1, 1) if module == 'vispy': from morph3d_vispy import neuron3d elif module == 'vpython': from morph3d_vpython import neuron3d else: from morph3d_vtk import neuron3d # Build the graph combined_cellgraph = nx.DiGraph() for ii, fname in enumerate(args.filenames): print('Opening', fname) cellgraph = ng.tograph(fname) xshift, yshift, zshift = (0, 0, 0) print('##', args.translate) if len(args.translate) > ii: xshift, yshift, zshift = args.translate[ii] xrot, yrot, zrot = (0, 0, 0) 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