code: def _as_segments(streamline, break_points):
      for seg in _part_segments(streamline, break_points):
          yield seg
      for seg in _part_segments(streamline[::-1], break_points[::-1]):
          yield seg
  
imports: from collections import defaultdict, OrderedDict
  from functools import wraps
  from itertools import combinations, groupby
  from warnings import warn
  import numpy
  from nibabel.affines import apply_affine
  from scipy.spatial.distance import cdist
  from dipy.core.geometry import dist_to_corner
  from dipy.tracking import metrics
  from dipy.tracking.vox2track import _streamlines_in_mask
  from dipy.tracking._utils import _mapping_to_voxel, _to_voxel_coordinates
label_desc: Use image node_id 20 for calling a global function with example usage: _as_segments(streamline, break_points) without return types