class_docstr: Class for stateful representation of collections of streamlines
  Object designed to be identical no matter the file format
  (trk, tck, vtk, fib, dpy). Facilitate transformation between space and
  data manipulation for each streamline / point.
class_docstr_tok: ["Class","for","stateful","representation","of","collections","of","streamlines","Object","designed","to","be","identical","no","matter","the","file","format","(","trk",",","tck",",","vtk",",","fib",",","dpy",")",".","Facilitate","transformation","between","space","and","data","manipulation","for","each","streamline","\/","point","."]
docstr: Remove streamlines with invalid coordinates from the object.
  Will also remove the data_per_point and data_per_streamline.
  Invalid coordinates are any X,Y,Z values above the reference
  dimensions or below zero
  
  Parameters
  ----------
  epsilon : float (optional)
      Epsilon value for the bounding box verification.
      Default is 1e-6.
  
  Returns
  -------
  output : tuple
      Tuple of two list, indices_to_remove, indices_to_keep
docstr_tok: ["Remove","streamlines","with","invalid","coordinates","from","the","object",".","Will","also","remove","the","data_per_point","and","data_per_streamline",".","Invalid","coordinates","are","any","X",",","Y",",","Z","values","above","the","reference","dimensions","or","below","zero","Parameters","--","--","--","--","--","epsilon",":","float","(","optional",")","Epsilon","value","for","the","bounding","box","verification",".","Default","is","1e-6",".","Returns","--","--","--","-","output",":","tuple","Tuple","of","two","list",",","indices_to_remove",",","indices_to_keep"]
code: def remove_invalid_streamlines(self, epsilon=1e-3):
      """Remove streamlines with invalid coordinates from the object.
      Will also remove the data_per_point and data_per_streamline.
      Invalid coordinates are any X,Y,Z values above the reference
      dimensions or below zero
  
      Parameters
      ----------
      epsilon : float (optional)
          Epsilon value for the bounding box verification.
          Default is 1e-6.
  
      Returns
      -------
      output : tuple
          Tuple of two list, indices_to_remove, indices_to_keep
      """
      if not self.streamlines:
          return
  
      old_space = deepcopy(self.space)
      old_origin = deepcopy(self.origin)
  
      self.to_vox()
      self.to_corner()
  
      min_condition = (
          np.min(self._tractogram.streamlines._data, axis=1) < epsilon
      )
      max_condition = np.any(
          self._tractogram.streamlines._data
          > self._dimensions - epsilon,
          axis=1,
      )
      ic_offsets_indices = np.where(
          np.logical_or(min_condition, max_condition)
      )[0]
  
      indices_to_remove = []
      for i in ic_offsets_indices:
          indices_to_remove.append(
              bisect(self._tractogram.streamlines._offsets, i) - 1
          )
  
      indices_to_remove = sorted(set(indices_to_remove))
  
      indices_to_keep = list(
          np.setdiff1d(
              np.arange(len(self._tractogram)),
              np.array(indices_to_remove),
          ).astype(int)
      )
  
      tmp_streamlines = self.streamlines[indices_to_keep]
      tmp_dpp = self._tractogram.data_per_point[indices_to_keep]
      tmp_dps = self._tractogram.data_per_streamline[indices_to_keep]
  
      ori_dtype = self._tractogram.streamlines._data.dtype
      tmp_streamlines = tmp_streamlines.copy()
      tmp_streamlines._data = tmp_streamlines._data.astype(ori_dtype)
      self._tractogram = Tractogram(
          tmp_streamlines,
          data_per_point=tmp_dpp,
          data_per_streamline=tmp_dps,
          affine_to_rasmm=np.eye(4),
      )
  
      self.to_space(old_space)
      self.to_origin(old_origin)
  
      return indices_to_remove, indices_to_keep
  
imports: from bisect import bisect
  from collections import OrderedDict
  from copy import deepcopy
  import enum
  from itertools import product
  import logging
  from nibabel.affines import apply_affine
  from nibabel.streamlines.tractogram import Tractogram, PerArraySequenceDict, PerArrayDict
  import numpy
  from dipy.io.dpy import Streamlines
  from dipy.io.utils import get_reference_info, is_reference_info_valid, is_header_compatible
label_desc: Use image node_id 38 for calling the StatefulTractogram obj's underlying member method code with example usage: obj.remove_invalid_streamlines(epsilon) and returns: indices_to_remove,  indices_to_keep