# encoding: utf-8
# module dipy.tracking.streamlinespeed
# from C:\Users\xukai\Downloads\发票2\venv\Lib\site-packages\dipy\tracking\streamlinespeed.cp311-win_amd64.pyd
# by generator 1.147
# no doc

# imports
import builtins as __builtins__ # <module 'builtins' (built-in)>
import numpy as np # C:\Users\xukai\Downloads\发票2\venv\Lib\site-packages\numpy\__init__.py

# functions

def compress_streamlines(streamline, tol_error=0.2): # real signature unknown; restored from __doc__
    """
    Compress streamlines by linearization as in [Presseau15]_.
    
        The compression consists in merging consecutive segments that are
        nearly collinear. The merging is achieved by removing the point the two
        segments have in common.
    
        The linearization process [Presseau15]_ ensures that every point being
        removed are within a certain margin (in mm) of the resulting streamline.
        Recommendations for setting this margin can be found in [Presseau15]_
        (in which they called it tolerance error).
    
        The compression also ensures that two consecutive points won't be too far
        from each other (precisely less or equal than `max_segment_length`mm).
        This is a tradeoff to speed up the linearization process [Rheault15]_. A low
        value will result in a faster linearization but low compression, whereas
        a high value will result in a slower linearization but high compression.
    
        Parameters
        ----------
        streamlines : one or a list of array-like of shape (N,3)
            Array representing x,y,z of N points in a streamline.
        tol_error : float (optional)
            Tolerance error in mm (default: 0.01). A rule of thumb is to set it
            to 0.01mm for deterministic streamlines and 0.1mm for probabilitic
            streamlines.
        max_segment_length : float (optional)
            Maximum length in mm of any given segment produced by the compression.
            The default is 10mm. (In [Presseau15]_, they used a value of `np.inf`).
    
        Returns
        -------
        compressed_streamlines : one or a list of array-like
            Results of the linearization process.
    
        Examples
        --------
        >>> from dipy.tracking.streamlinespeed import compress_streamlines
        >>> import numpy as np
        >>> # One streamline: a wiggling line
        >>> rng = np.random.RandomState(42)
        >>> streamline = np.linspace(0, 10, 100*3).reshape((100, 3))
        >>> streamline += 0.2 * rng.rand(100, 3)
        >>> c_streamline = compress_streamlines(streamline, tol_error=0.2)
        >>> len(streamline)
        100
        >>> len(c_streamline)
        10
        >>> # Multiple streamlines
        >>> streamlines = [streamline, streamline[::2]]
        >>> c_streamlines = compress_streamlines(streamlines, tol_error=0.2)
        >>> [len(s) for s in streamlines]
        [100, 50]
        >>> [len(s) for s in c_streamlines]
        [10, 7]
    
    
        Notes
        -----
        Be aware that compressed streamlines have variable step sizes. One needs to
        be careful when computing streamlines-based metrics [Houde15]_.
    
        References
        ----------
        .. [Presseau15] Presseau C. et al., A new compression format for fiber
                        tracking datasets, NeuroImage, no 109, 73-83, 2015.
        .. [Rheault15] Rheault F. et al., Real Time Interaction with Millions of
                       Streamlines, ISMRM, 2015.
        .. [Houde15] Houde J.-C. et al. How to Avoid Biased Streamlines-Based
                     Metrics for Streamlines with Variable Step Sizes, ISMRM, 2015.
    """
    pass

def length(streamline): # real signature unknown; restored from __doc__
    """
    Euclidean length of streamlines
    
        Length is in mm only if streamlines are expressed in world coordinates.
    
        Parameters
        ----------
        streamlines : ndarray or a list or :class:`dipy.tracking.Streamlines`
            If ndarray, must have shape (N,3) where N is the number of points
            of the streamline.
            If list, each item must be ndarray shape (Ni,3) where Ni is the number
            of points of streamline i.
            If :class:`dipy.tracking.Streamlines`, its `common_shape` must be 3.
    
        Returns
        -------
        lengths : scalar or ndarray shape (N,)
           If there is only one streamline, a scalar representing the length of the
           streamline.
           If there are several streamlines, ndarray containing the length of every
           streamline.
    
        Examples
        --------
        >>> from dipy.tracking.streamline import length
        >>> import numpy as np
        >>> streamline = np.array([[1, 1, 1], [2, 3, 4], [0, 0, 0]])
        >>> expected_length = np.sqrt([1+2**2+3**2, 2**2+3**2+4**2]).sum()
        >>> length(streamline) == expected_length
        True
        >>> streamlines = [streamline, np.vstack([streamline, streamline[::-1]])]
        >>> expected_lengths = [expected_length, 2*expected_length]
        >>> lengths = [length(streamlines[0]), length(streamlines[1])]
        >>> np.allclose(lengths, expected_lengths)
        True
        >>> length([])
        0.0
        >>> length(np.array([[1, 2, 3]]))
        0.0
    """
    pass

def set_number_of_points(streamline, *args, **kwargs): # real signature unknown; NOTE: unreliably restored from __doc__ 
    """
    Change the number of points of streamlines
            (either by downsampling or upsampling)
    
        Change the number of points of streamlines in order to obtain
        `nb_points`-1 segments of equal length. Points of streamlines will be
        modified along the curve.
    
        Parameters
        ----------
        streamlines : ndarray or a list or :class:`dipy.tracking.Streamlines`
            If ndarray, must have shape (N,3) where N is the number of points
            of the streamline.
            If list, each item must be ndarray shape (Ni,3) where Ni is the number
            of points of streamline i.
            If :class:`dipy.tracking.Streamlines`, its `common_shape` must be 3.
    
        nb_points : int
            integer representing number of points wanted along the curve.
    
        Returns
        -------
        new_streamlines : ndarray or a list or :class:`dipy.tracking.Streamlines`
            Results of the downsampling or upsampling process.
    
        Examples
        --------
        >>> from dipy.tracking.streamline import set_number_of_points
        >>> import numpy as np
    
        One streamline, a semi-circle:
    
        >>> theta = np.pi*np.linspace(0, 1, 100)
        >>> x = np.cos(theta)
        >>> y = np.sin(theta)
        >>> z = 0 * x
        >>> streamline = np.vstack((x, y, z)).T
        >>> modified_streamline = set_number_of_points(streamline, 3)
        >>> len(modified_streamline)
        3
    
        Multiple streamlines:
    
        >>> streamlines = [streamline, streamline[::2]]
        >>> new_streamlines = set_number_of_points(streamlines, 10)
        >>> [len(s) for s in streamlines]
        [100, 50]
        >>> [len(s) for s in new_streamlines]
        [10, 10]
    """
    pass

def __pyx_unpickle_Enum(*args, **kwargs): # real signature unknown
    pass

# classes

class Streamlines(object):
    """
    Sequence of ndarrays having variable first dimension sizes.
    
        This is a container that can store multiple ndarrays where each ndarray
        might have a different first dimension size but a *common* size for the
        remaining dimensions.
    
        More generally, an instance of :class:`ArraySequence` of length $N$ is
        composed of $N$ ndarrays of shape $(d_1, d_2, ... d_D)$ where $d_1$
        can vary in length between arrays but $(d_2, ..., d_D)$ have to be the
        same for every ndarray.
    """
    def append(self, element, cache_build=False): # reliably restored by inspect
        """
        Appends `element` to this array sequence.
        
                Append can be a lot faster if it knows that it is appending several
                elements instead of a single element.  In that case it can cache the
                parameters it uses between append operations, in a "build cache".  To
                tell append to do this, use ``cache_build=True``.  If you use
                ``cache_build=True``, you need to finalize the append operations with
                :meth:`finalize_append`.
        
                Parameters
                ----------
                element : ndarray
                    Element to append. The shape must match already inserted elements
                    shape except for the first dimension.
                cache_build : {False, True}
                    Whether to save the build cache from this append routine.  If True,
                    append can assume it is the only player updating `self`, and the
                    caller must finalize `self` after all append operations, with
                    ``self.finalize_append()``.
        
                Returns
                -------
                None
        
                Notes
                -----
                If you need to add multiple elements you should consider
                `ArraySequence.extend`.
        """
        pass

    def copy(self): # reliably restored by inspect
        """
        Creates a copy of this :class:`ArraySequence` object.
        
                Returns
                -------
                seq_copy : :class:`ArraySequence` instance
                    Copy of `self`.
        
                Notes
                -----
                We do not simply deepcopy this object because we have a chance to use
                less memory. For example, if the array sequence being copied is the
                result of a slicing operation on an array sequence.
        """
        pass

    def extend(self, elements): # reliably restored by inspect
        """
        Appends all `elements` to this array sequence.
        
                Parameters
                ----------
                elements : iterable of ndarrays or :class:`ArraySequence` object
                    If iterable of ndarrays, each ndarray will be concatenated along
                    the first dimension then appended to the data of this
                    ArraySequence.
                    If :class:`ArraySequence` object, its data are simply appended to
                    the data of this ArraySequence.
        
                Returns
                -------
                None
        
                Notes
                -----
                The shape of the elements to be added must match the one of the data of
                this :class:`ArraySequence` except for the first dimension.
        """
        pass

    def finalize_append(self): # reliably restored by inspect
        """
        Finalize process of appending several elements to `self`
        
                :meth:`append` can be a lot faster if it knows that it is appending
                several elements instead of a single element.  To tell the append
                method this is the case, use ``cache_build=True``.  This method
                finalizes the series of append operations after a call to
                :meth:`append` with ``cache_build=True``.
        """
        pass

    def get_data(self): # reliably restored by inspect
        """
        Returns a *copy* of the elements in this array sequence.
        
                Notes
                -----
                To modify the data on this array sequence, one can use
                in-place mathematical operators (e.g., `seq += ...`) or the use
                assignment operator (i.e, `seq[...] = value`).
        """
        pass

    @classmethod
    def load(cls, *args, **kwargs): # real signature unknown
        """ Loads a :class:`ArraySequence` object from a .npz file. """
        pass

    def save(self, filename): # reliably restored by inspect
        """ Saves this :class:`ArraySequence` object to a .npz file. """
        pass

    def shrink_data(self): # reliably restored by inspect
        # no doc
        pass

    def _check_shape(self, arrseq): # reliably restored by inspect
        """ Check whether this array sequence is compatible with another. """
        pass

    def _get_next_offset(self): # reliably restored by inspect
        """ Offset in ``self._data`` at which to write next rowelement """
        pass

    def _op(self, op, value=None, inplace=False): # reliably restored by inspect
        """
        Applies some operator to this arraysequence.
        
                This handles both unary and binary operators with a scalar or another
                array sequence. Operations are performed directly on the underlying
                data, or a copy of it, which depends on the value of `inplace`.
        
                Parameters
                ----------
                op : str
                    Name of the Python operator (e.g., `"__add__"`).
                value : scalar or :class:`ArraySequence`, optional
                    If None, the operator is assumed to be unary.
                    Otherwise, that value is used in the binary operation.
                inplace: bool, optional
                    If False, the operation is done on a copy of this array sequence.
                    Otherwise, this array sequence gets modified directly.
        """
        pass

    def _resize_data_to(self, n_rows, build_cache): # reliably restored by inspect
        """ Resize data array if required """
        pass

    def __abs__(self): # reliably restored by inspect
        """ abs(self) """
        pass

    def __add__(self, value): # reliably restored by inspect
        """ Return self+value. """
        pass

    def __and__(self, value): # reliably restored by inspect
        """ Return self&value. """
        pass

    def __eq__(self, value): # reliably restored by inspect
        """ Return self==value. """
        pass

    def __floordiv__(self, value): # reliably restored by inspect
        """ Return self//value. """
        pass

    def __getitem__(self, idx): # reliably restored by inspect
        """
        Get sequence(s) through standard or advanced numpy indexing.
        
                Parameters
                ----------
                idx : int or slice or list or ndarray
                    If int, index of the element to retrieve.
                    If slice, use slicing to retrieve elements.
                    If list, indices of the elements to retrieve.
                    If ndarray with dtype int, indices of the elements to retrieve.
                    If ndarray with dtype bool, only retrieve selected elements.
        
                Returns
                -------
                ndarray or :class:`ArraySequence`
                    If `idx` is an int, returns the selected sequence.
                    Otherwise, returns a :class:`ArraySequence` object which is a view
                    of the selected sequences.
        """
        pass

    def __ge__(self, value): # reliably restored by inspect
        """ Return self>=value. """
        pass

    def __gt__(self, value): # reliably restored by inspect
        """ Return self>value. """
        pass

    def __iadd__(self, value): # reliably restored by inspect
        """ Return self+=value. """
        pass

    def __iand__(self, value): # reliably restored by inspect
        """ Return self&=value. """
        pass

    def __ifloordiv__(self, value): # reliably restored by inspect
        """ Return self//=value. """
        pass

    def __ilshift__(self, value): # reliably restored by inspect
        """ Return self<<=value. """
        pass

    def __imod__(self, value): # reliably restored by inspect
        """ Return self%=value. """
        pass

    def __imul__(self, value): # reliably restored by inspect
        """ Return self*=value. """
        pass

    def __init__(self, iterable=None, buffer_size=4): # reliably restored by inspect
        """
        Initialize array sequence instance
        
                Parameters
                ----------
                iterable : None or iterable or :class:`ArraySequence`, optional
                    If None, create an empty :class:`ArraySequence` object.
                    If iterable, create a :class:`ArraySequence` object initialized
                    from array-like objects yielded by the iterable.
                    If :class:`ArraySequence`, create a view (no memory is allocated).
                    For an actual copy use :meth:`.copy` instead.
                buffer_size : float, optional
                    Size (in Mb) for memory allocation when `iterable` is a generator.
        """
        pass

    def __invert__(self): # reliably restored by inspect
        """ ~self """
        pass

    def __ior__(self, value): # reliably restored by inspect
        """ Return self|=value. """
        pass

    def __ipow__(self, value): # reliably restored by inspect
        """ Return self**=value. """
        pass

    def __irshift__(self, value): # reliably restored by inspect
        """ Return self>>=value. """
        pass

    def __isub__(self, value): # reliably restored by inspect
        """ Return self-=value. """
        pass

    def __iter__(self): # reliably restored by inspect
        # no doc
        pass

    def __itruediv__(self, value): # reliably restored by inspect
        """ Return self/=value. """
        pass

    def __ixor__(self, value): # reliably restored by inspect
        """ Return self^=value. """
        pass

    def __len__(self): # reliably restored by inspect
        # no doc
        pass

    def __le__(self, value): # reliably restored by inspect
        """ Return self<=value. """
        pass

    def __lshift__(self, value): # reliably restored by inspect
        """ Return self<<value. """
        pass

    def __lt__(self, value): # reliably restored by inspect
        """ Return self<value. """
        pass

    def __mod__(self, value): # reliably restored by inspect
        """ Return self%value. """
        pass

    def __mul__(self, value): # reliably restored by inspect
        """ Return self*value. """
        pass

    def __neg__(self): # reliably restored by inspect
        """ -self """
        pass

    def __ne__(self, value): # reliably restored by inspect
        """ Return self!=value. """
        pass

    def __or__(self, value): # reliably restored by inspect
        """ Return self|value. """
        pass

    def __pow__(self, value): # reliably restored by inspect
        """ Return pow(self, value, mod). """
        pass

    def __repr__(self): # reliably restored by inspect
        # no doc
        pass

    def __rshift__(self, value): # reliably restored by inspect
        """ Return self>>value. """
        pass

    def __setitem__(self, idx, elements): # reliably restored by inspect
        """
        Set sequence(s) through standard or advanced numpy indexing.
        
                Parameters
                ----------
                idx : int or slice or list or ndarray
                    If int, index of the element to retrieve.
                    If slice, use slicing to retrieve elements.
                    If list, indices of the elements to retrieve.
                    If ndarray with dtype int, indices of the elements to retrieve.
                    If ndarray with dtype bool, only retrieve selected elements.
                elements: ndarray or :class:`ArraySequence`
                    Data that will overwrite selected sequences.
                    If `idx` is an int, `elements` is expected to be a ndarray.
                    Otherwise, `elements` is expected a :class:`ArraySequence` object.
        """
        pass

    def __sub__(self, value): # reliably restored by inspect
        """ Return self-value. """
        pass

    def __truediv__(self, value): # reliably restored by inspect
        """ Return self/value. """
        pass

    def __xor__(self, value): # reliably restored by inspect
        """ Return self^value. """
        pass

    common_shape = property(lambda self: object(), lambda self, v: None, lambda self: None)  # default
    """Matching shape of the elements in this array sequence."""

    is_array_sequence = property(lambda self: object(), lambda self, v: None, lambda self: None)  # default

    is_sliced_view = property(lambda self: object(), lambda self, v: None, lambda self: None)  # default

    total_nb_rows = property(lambda self: object(), lambda self, v: None, lambda self: None)  # default
    """Total number of rows in this array sequence."""

    __weakref__ = property(lambda self: object(), lambda self, v: None, lambda self: None)  # default
    """list of weak references to the object (if defined)"""


    __dict__ = None # (!) real value is "mappingproxy({'__module__': 'nibabel.streamlines.array_sequence', '__doc__': 'Sequence of ndarrays having variable first dimension sizes.\\n\\n    This is a container that can store multiple ndarrays where each ndarray\\n    might have a different first dimension size but a *common* size for the\\n    remaining dimensions.\\n\\n    More generally, an instance of :class:`ArraySequence` of length $N$ is\\n    composed of $N$ ndarrays of shape $(d_1, d_2, ... d_D)$ where $d_1$\\n    can vary in length between arrays but $(d_2, ..., d_D)$ have to be the\\n    same for every ndarray.\\n    ', '__init__': <function ArraySequence.__init__ at 0x000001D4AC8FFF60>, 'is_sliced_view': <property object at 0x000001D4AC915710>, 'is_array_sequence': <property object at 0x000001D4AC915A30>, 'common_shape': <property object at 0x000001D4AC915CB0>, 'total_nb_rows': <property object at 0x000001D4AC915E40>, 'get_data': <function ArraySequence.get_data at 0x000001D4AC9282C0>, '_check_shape': <function ArraySequence._check_shape at 0x000001D4AC928360>, '_get_next_offset': <function ArraySequence._get_next_offset at 0x000001D4AC928400>, 'append': <function ArraySequence.append at 0x000001D4AC9284A0>, 'finalize_append': <function ArraySequence.finalize_append at 0x000001D4AC928540>, '_resize_data_to': <function ArraySequence._resize_data_to at 0x000001D4AC9285E0>, 'shrink_data': <function ArraySequence.shrink_data at 0x000001D4AC928680>, 'extend': <function ArraySequence.extend at 0x000001D4AC928720>, 'copy': <function ArraySequence.copy at 0x000001D4AC9287C0>, '__getitem__': <function ArraySequence.__getitem__ at 0x000001D4AC928860>, '__setitem__': <function ArraySequence.__setitem__ at 0x000001D4AC928900>, '_op': <function ArraySequence._op at 0x000001D4AC9289A0>, '__iter__': <function ArraySequence.__iter__ at 0x000001D4AC928A40>, '__len__': <function ArraySequence.__len__ at 0x000001D4AC928AE0>, '__repr__': <function ArraySequence.__repr__ at 0x000001D4AC928B80>, 'save': <function ArraySequence.save at 0x000001D4AC928C20>, 'load': <classmethod(<function ArraySequence.load at 0x000001D4AC928CC0>)>, '__dict__': <attribute '__dict__' of 'ArraySequence' objects>, '__weakref__': <attribute '__weakref__' of 'ArraySequence' objects>, '__add__': <function _define_operators.<locals>._wrap.<locals>.fn_binary_op at 0x000001D4AC928E00>, '__iadd__': <function _define_operators.<locals>._wrap.<locals>.fn_binary_op at 0x000001D4AC928EA0>, '__sub__': <function _define_operators.<locals>._wrap.<locals>.fn_binary_op at 0x000001D4AC928F40>, '__isub__': <function _define_operators.<locals>._wrap.<locals>.fn_binary_op at 0x000001D4AC928FE0>, '__mul__': <function _define_operators.<locals>._wrap.<locals>.fn_binary_op at 0x000001D4AC929080>, '__imul__': <function _define_operators.<locals>._wrap.<locals>.fn_binary_op at 0x000001D4AC929120>, '__mod__': <function _define_operators.<locals>._wrap.<locals>.fn_binary_op at 0x000001D4AC9291C0>, '__imod__': <function _define_operators.<locals>._wrap.<locals>.fn_binary_op at 0x000001D4AC929260>, '__pow__': <function _define_operators.<locals>._wrap.<locals>.fn_binary_op at 0x000001D4AC929300>, '__ipow__': <function _define_operators.<locals>._wrap.<locals>.fn_binary_op at 0x000001D4AC9293A0>, '__floordiv__': <function _define_operators.<locals>._wrap.<locals>.fn_binary_op at 0x000001D4AC929440>, '__ifloordiv__': <function _define_operators.<locals>._wrap.<locals>.fn_binary_op at 0x000001D4AC9294E0>, '__truediv__': <function _define_operators.<locals>._wrap.<locals>.fn_binary_op at 0x000001D4AC929580>, '__itruediv__': <function _define_operators.<locals>._wrap.<locals>.fn_binary_op at 0x000001D4AC929620>, '__lshift__': <function _define_operators.<locals>._wrap.<locals>.fn_binary_op at 0x000001D4AC9296C0>, '__ilshift__': <function _define_operators.<locals>._wrap.<locals>.fn_binary_op at 0x000001D4AC929760>, '__rshift__': <function _define_operators.<locals>._wrap.<locals>.fn_binary_op at 0x000001D4AC929800>, '__irshift__': <function _define_operators.<locals>._wrap.<locals>.fn_binary_op at 0x000001D4AC9298A0>, '__or__': <function _define_operators.<locals>._wrap.<locals>.fn_binary_op at 0x000001D4AC929940>, '__ior__': <function _define_operators.<locals>._wrap.<locals>.fn_binary_op at 0x000001D4AC9299E0>, '__and__': <function _define_operators.<locals>._wrap.<locals>.fn_binary_op at 0x000001D4AC929A80>, '__iand__': <function _define_operators.<locals>._wrap.<locals>.fn_binary_op at 0x000001D4AC929B20>, '__xor__': <function _define_operators.<locals>._wrap.<locals>.fn_binary_op at 0x000001D4AC929BC0>, '__ixor__': <function _define_operators.<locals>._wrap.<locals>.fn_binary_op at 0x000001D4AC929C60>, '__eq__': <function _define_operators.<locals>._wrap.<locals>.fn_binary_op at 0x000001D4AC929D00>, '__ne__': <function _define_operators.<locals>._wrap.<locals>.fn_binary_op at 0x000001D4AC929DA0>, '__lt__': <function _define_operators.<locals>._wrap.<locals>.fn_binary_op at 0x000001D4AC929E40>, '__le__': <function _define_operators.<locals>._wrap.<locals>.fn_binary_op at 0x000001D4AC929EE0>, '__gt__': <function _define_operators.<locals>._wrap.<locals>.fn_binary_op at 0x000001D4AC929F80>, '__ge__': <function _define_operators.<locals>._wrap.<locals>.fn_binary_op at 0x000001D4AC92A020>, '__neg__': <function _define_operators.<locals>._wrap.<locals>.fn_unary_op at 0x000001D4AC928D60>, '__abs__': <function _define_operators.<locals>._wrap.<locals>.fn_unary_op at 0x000001D4AC92A0C0>, '__invert__': <function _define_operators.<locals>._wrap.<locals>.fn_unary_op at 0x000001D4AC92A160>})"


# variables with complex values

__loader__ = None # (!) real value is '<_frozen_importlib_external.ExtensionFileLoader object at 0x000001D4AC925950>'

__pyx_capi__ = {
    '__pyx_fuse_0c_arclengths': None, # (!) real value is '<capsule object "void (__pyx_t_4dipy_8tracking_15streamlinespeed_float2d, double *)" at 0x000001D4AC93E520>'
    '__pyx_fuse_0c_length': None, # (!) real value is '<capsule object "double (__pyx_t_4dipy_8tracking_15streamlinespeed_float2d)" at 0x000001D4AC93E490>'
    '__pyx_fuse_0c_set_number_of_points': None, # (!) real value is '<capsule object "void (__pyx_t_4dipy_8tracking_15streamlinespeed_float2d, __pyx_t_4dipy_8tracking_15streamlinespeed_float2d)" at 0x000001D4AC93E580>'
    '__pyx_fuse_1c_arclengths': None, # (!) real value is '<capsule object "void (__pyx_t_4dipy_8tracking_15streamlinespeed_double2d, double *)" at 0x000001D4AC93E550>'
    '__pyx_fuse_1c_length': None, # (!) real value is '<capsule object "double (__pyx_t_4dipy_8tracking_15streamlinespeed_double2d)" at 0x000001D4AC93E460>'
    '__pyx_fuse_1c_set_number_of_points': None, # (!) real value is '<capsule object "void (__pyx_t_4dipy_8tracking_15streamlinespeed_double2d, __pyx_t_4dipy_8tracking_15streamlinespeed_double2d)" at 0x000001D4AC93E5B0>'
}

__spec__ = None # (!) real value is "ModuleSpec(name='dipy.tracking.streamlinespeed', loader=<_frozen_importlib_external.ExtensionFileLoader object at 0x000001D4AC925950>, origin='C:\\\\Users\\\\xukai\\\\Downloads\\\\??2\\\\venv\\\\Lib\\\\site-packages\\\\dipy\\\\tracking\\\\streamlinespeed.cp311-win_amd64.pyd')"

__test__ = {
    'compress_streamlines (line 540)': " Compress streamlines by linearization as in [Presseau15]_.\n\n    The compression consists in merging consecutive segments that are\n    nearly collinear. The merging is achieved by removing the point the two\n    segments have in common.\n\n    The linearization process [Presseau15]_ ensures that every point being\n    removed are within a certain margin (in mm) of the resulting streamline.\n    Recommendations for setting this margin can be found in [Presseau15]_\n    (in which they called it tolerance error).\n\n    The compression also ensures that two consecutive points won't be too far\n    from each other (precisely less or equal than `max_segment_length`mm).\n    This is a tradeoff to speed up the linearization process [Rheault15]_. A low\n    value will result in a faster linearization but low compression, whereas\n    a high value will result in a slower linearization but high compression.\n\n    Parameters\n    ----------\n    streamlines : one or a list of array-like of shape (N,3)\n        Array representing x,y,z of N points in a streamline.\n    tol_error : float (optional)\n        Tolerance error in mm (default: 0.01). A rule of thumb is to set it\n        to 0.01mm for deterministic streamlines and 0.1mm for probabilitic\n        streamlines.\n    max_segment_length : float (optional)\n        Maximum length in mm of any given segment produced by the compression.\n        The default is 10mm. (In [Presseau15]_, they used a value of `np.inf`).\n\n    Returns\n    -------\n    compressed_streamlines : one or a list of array-like\n        Results of the linearization process.\n\n    Examples\n    --------\n    >>> from dipy.tracking.streamlinespeed import compress_streamlines\n    >>> import numpy as np\n    >>> # One streamline: a wiggling line\n    >>> rng = np.random.RandomState(42)\n    >>> streamline = np.linspace(0, 10, 100*3).reshape((100, 3))\n    >>> streamline += 0.2 * rng.rand(100, 3)\n    >>> c_streamline = compress_streamlines(streamline, tol_error=0.2)\n    >>> len(streamline)\n    100\n    >>> len(c_streamline)\n    10\n    >>> # Multiple streamlines\n    >>> streamlines = [streamline, streamline[::2]]\n    >>> c_streamlines = compress_streamlines(streamlines, tol_error=0.2)\n    >>> [len(s) for s in streamlines]\n    [100, 50]\n    >>> [len(s) for s in c_streamlines]\n    [10, 7]\n\n\n    Notes\n    -----\n    Be aware that compressed streamlines have variable step sizes. One needs to\n    be careful when computing streamlines-based metrics [Houde15]_.\n\n    References\n    ----------\n    .. [Presseau15] Presseau C. et al., A new compression format for fiber\n                    tracking datasets, NeuroImage, no 109, 73-83, 2015.\n    .. [Rheault15] Rheault F. et al., Real Time Interaction with Millions of\n                   Streamlines, ISMRM, 2015.\n    .. [Houde15] Houde J.-C. et al. How to Avoid Biased Streamlines-Based\n                 Metrics for Streamlines with Variable Step Sizes, ISMRM, 2015.\n    ",
    'length (line 55)': ' Euclidean length of streamlines\n\n    Length is in mm only if streamlines are expressed in world coordinates.\n\n    Parameters\n    ----------\n    streamlines : ndarray or a list or :class:`dipy.tracking.Streamlines`\n        If ndarray, must have shape (N,3) where N is the number of points\n        of the streamline.\n        If list, each item must be ndarray shape (Ni,3) where Ni is the number\n        of points of streamline i.\n        If :class:`dipy.tracking.Streamlines`, its `common_shape` must be 3.\n\n    Returns\n    -------\n    lengths : scalar or ndarray shape (N,)\n       If there is only one streamline, a scalar representing the length of the\n       streamline.\n       If there are several streamlines, ndarray containing the length of every\n       streamline.\n\n    Examples\n    --------\n    >>> from dipy.tracking.streamline import length\n    >>> import numpy as np\n    >>> streamline = np.array([[1, 1, 1], [2, 3, 4], [0, 0, 0]])\n    >>> expected_length = np.sqrt([1+2**2+3**2, 2**2+3**2+4**2]).sum()\n    >>> length(streamline) == expected_length\n    True\n    >>> streamlines = [streamline, np.vstack([streamline, streamline[::-1]])]\n    >>> expected_lengths = [expected_length, 2*expected_length]\n    >>> lengths = [length(streamlines[0]), length(streamlines[1])]\n    >>> np.allclose(lengths, expected_lengths)\n    True\n    >>> length([])\n    0.0\n    >>> length(np.array([[1, 2, 3]]))\n    0.0\n\n    ',
    'set_number_of_points (line 266)': ' Change the number of points of streamlines\n        (either by downsampling or upsampling)\n\n    Change the number of points of streamlines in order to obtain\n    `nb_points`-1 segments of equal length. Points of streamlines will be\n    modified along the curve.\n\n    Parameters\n    ----------\n    streamlines : ndarray or a list or :class:`dipy.tracking.Streamlines`\n        If ndarray, must have shape (N,3) where N is the number of points\n        of the streamline.\n        If list, each item must be ndarray shape (Ni,3) where Ni is the number\n        of points of streamline i.\n        If :class:`dipy.tracking.Streamlines`, its `common_shape` must be 3.\n\n    nb_points : int\n        integer representing number of points wanted along the curve.\n\n    Returns\n    -------\n    new_streamlines : ndarray or a list or :class:`dipy.tracking.Streamlines`\n        Results of the downsampling or upsampling process.\n\n    Examples\n    --------\n    >>> from dipy.tracking.streamline import set_number_of_points\n    >>> import numpy as np\n\n    One streamline, a semi-circle:\n\n    >>> theta = np.pi*np.linspace(0, 1, 100)\n    >>> x = np.cos(theta)\n    >>> y = np.sin(theta)\n    >>> z = 0 * x\n    >>> streamline = np.vstack((x, y, z)).T\n    >>> modified_streamline = set_number_of_points(streamline, 3)\n    >>> len(modified_streamline)\n    3\n\n    Multiple streamlines:\n\n    >>> streamlines = [streamline, streamline[::2]]\n    >>> new_streamlines = set_number_of_points(streamlines, 10)\n    >>> [len(s) for s in streamlines]\n    [100, 50]\n    >>> [len(s) for s in new_streamlines]\n    [10, 10]\n\n    ',
}

