code: def _with_initialize(generator):
      """Allow one to write a generator with initialization code.
  
      All code up to the first yield is run as soon as the generator function is
      called and the first yield value is ignored.
  
      """
  
      @wraps(generator)
      def helper(*args, **kwargs):
          gen = generator(*args, **kwargs)
          next(gen)
          return gen
  
      return helper
  
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 8 for calling a global function with example usage: _with_initialize(generator) and returns: helper, gen