def add_nodes_as_trees(): # Test merging skeleton with multiple trees from nodes skel = Skeleton('testdata/02_ref.nml') nodes = skel.define_nodes([40000, 40100, 40200], [45000, 45100, 45200], [1000, 1100, 1200]) skel.add_nodes_as_trees(nodes) skel.write_nml('testdata/01_NT_merged_gen.nml')
def construct_from_parameters_add_tree(): parameters = Skeleton.define_parameters('2017-01-12_FD0156-2', (11.24, 11.24, 32)) skel = Skeleton(parameters=parameters) nodes = skel.define_nodes([40000, 40100, 40200], [45000, 45100, 45200], [1000, 1100, 1200], [1, 2, 3]) edges = [(1, 3), (2, 3)] skel.add_tree(nodes, edges) skel.write_nml('testdata/PA_gen.nml')
cx = meshes_val['x'][xi, yi, zi] cy = meshes_val['y'][xi, yi, zi] cz = meshes_val['z'][xi, yi, zi] positions = np.array([ [cx, cy, cz], [cx - input_shape[0]/2, cy - input_shape[1]/2, cz], [cx - input_shape[0]/2, cy + input_shape[1]/2, cz], [cx + input_shape[0]/2, cy - input_shape[1]/2, cz], [cx + input_shape[0]/2, cy + input_shape[1]/2, cz], [cx + input_shape[0]/2, cy + input_shape[1]/2 - 1, cz] ]) max_id = min_id + positions.shape[0] - 1 # nodes = skel.define_nodes_from_positions(positions) nodes = skel.define_nodes( position_x=positions[:, 0].tolist(), position_y=positions[:, 1].tolist(), position_z=positions[:, 2].tolist(), id=list(range(min_id, max_id + 1)) ) edges = np.array([ [1, 2], [1, 3], [1, 4], [1, 5], [2, 3], [2, 4], [3, 5], [4, 6] ]) + skel.max_node_id() if zi not in skel.group_ids: skel.add_group(id=zi, name='plane{:03d}:X'.format(zi))