def traverse(next):
enter = do_something() # same as the enter callback
children = next(enter)
leave = do_something_else(children) # same as leave the callback
return leave
Tree.from_swc(...).traverse(traverse)
The advantage of this onion-ring API design is that users can hold a closure to easily retain some information. However, I am not quite sure if such a call would lead to a too deep call stack (in some extreme cases, a neuron may have hundreds of thousands of points).
The advantage of this onion-ring API design is that users can hold a closure to easily retain some information. However, I am not quite sure if such a call would lead to a too deep call stack (in some extreme cases, a neuron may have hundreds of thousands of points).