code: def target_line_based(streamlines, affine, target_mask, include=True):
      """Filter streamlines based on whether or not they pass through a ROI,
      using a line-based algorithm. Mostly used as a replacement of `target`
      for compressed streamlines.
  
      This function never returns single-point streamlines, whatever the
      value of `include`.
  
      Parameters
      ----------
      streamlines : iterable
          A sequence of streamlines. Each streamline should be a (N, 3) array,
          where N is the length of the streamline.
      affine : array (4, 4)
          The mapping between voxel indices and the point space for seeds.
          The voxel_to_rasmm matrix, typically from a NIFTI file.
      target_mask : array-like
          A mask used as a target. Non-zero values are considered to be within
          the target region.
      include : bool, default True
          If True, streamlines passing through `target_mask` are kept. If False,
          the streamlines not passing through `target_mask` are kept.
  
      Returns
      -------
      streamlines : generator
          A sequence of streamlines that pass through `target_mask`.
  
      References
      ----------
      [Bresenham5] Bresenham, Jack Elton. "Algorithm for computer control of a
                   digital plotter", IBM Systems Journal, vol 4, no. 1, 1965.
      [Houde15] Houde et al. How to avoid biased streamlines-based metrics for
                streamlines with variable step sizes, ISMRM 2015.
  
      See Also
      --------
      dipy.tracking.utils.density_map
      dipy.tracking.streamline.compress_streamlines
  
      """
      target_mask = np.array(target_mask, dtype=np.uint8, copy=True)
      lin_T, offset = _mapping_to_voxel(affine)
      streamline_index = _streamlines_in_mask(
          streamlines, target_mask, lin_T, offset
      )
      yield
      # End of initialization
  
      for idx in np.where(streamline_index == [0, 1][include])[0]:
          yield streamlines[idx]
  
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 10 for calling a global function with example usage: target_line_based(streamlines, affine, target_mask, include) without return types