Topology-aware reconstruction of thin tubular structures