def make_neurites(rdw):
post_action = _NEURITE_ACTION[rdw.fmt]<EOL>trunks = rdw.neurite_root_section_ids()<EOL>if not trunks:<EOL><INDENT>return [], []<EOL><DEDENT>nodes = tuple(Section(section_id=i,<EOL>points=rdw.data_block[sec.ids],<EOL>section_type=_TREE_TYPES[sec.ntype])<EOL>for i, sec in enumerate(rdw.sections))<EOL>for i, node in enumerate(nodes):<EOL><INDENT>parent_id = rdw.sections[i].pid<EOL>parent_type = nodes[parent_id].type<EOL>if parent_id != ROOT_ID and parent_type != NeuriteType.soma:<EOL><INDENT>nodes[parent_id].add_child(node)<EOL><DEDENT><DEDENT>neurites = tuple(Neurite(nodes[i]) for i in trunks)<EOL>if post_action is not None:<EOL><INDENT>for n in neurites:<EOL><INDENT>post_action(n.root_node)<EOL><DEDENT><DEDENT>return neurites, nodes<EOL>
Build neurite trees from a raw data wrapper