This file is indexed.

/usr/share/pyshared/dipy/tracking/learning.py is in python-dipy 0.5.0-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
''' Learning algorithms for tractography'''
import numpy as np
import dipy.tracking.distances as pf

def detect_corresponding_tracks(indices,tracks1,tracks2):
    ''' Detect corresponding tracks from list tracks1 to list tracks2
    where tracks1 & tracks2 are lists of tracks
    
    Parameters
    ------------
    indices : sequence
       of indices of tracks1 that are to be detected in tracks2
    tracks1 : sequence 
       of tracks as arrays, shape (N1,3) .. (Nm,3)
    tracks2 : sequence 
       of tracks as arrays, shape (M1,3) .. (Mm,3)
            
    Returns
    ---------
    track2track : array (N,2) where N is len(indices) of int 
       it shows the correspondance in the following way:       
       the first column is the current index in tracks1
       the second column is the corresponding index in tracks2
    
    Examples
    ----------
    >>> import numpy as np
    >>> import dipy.tracking.learning as tl
    >>> A=np.array([[0,0,0],[1,1,1],[2,2,2]])
    >>> B=np.array([[1,0,0],[2,0,0],[3,0,0]])
    >>> C=np.array([[0,0,-1],[0,0,-2],[0,0,-3]])    
    >>> bundle1=[A,B,C]
    >>> bundle2=[B,A]    
    >>> indices=[0,1]
    >>> arr=tl.detect_corresponding_tracks(indices,bundle1,bundle2)
            
    Notes
    -------
    To find the corresponding tracks we use mam_distances with 'avg' option. Then we calculate the 
    argmin of all the calculated distances and return it for every index. (See 3rd column of arr
    in the example given below.
       
       
    '''
    li=len(indices)
    
    track2track=np.zeros((li,2))
    cnt=0
    for i in indices:                
        rt=[pf.mam_distances(tracks1[i],t,'avg') for t in tracks2]
        rt=np.array(rt)      
        track2track[cnt]=np.array([i,rt.argmin()])        
        cnt+=1
        
    return track2track.astype(int)

def detect_corresponding_tracks_plus(indices,tracks1,indices2,tracks2):
    ''' Detect corresponding tracks from 1 to 2 where tracks1 & tracks2 are sequences of tracks
    
    Parameters
    ------------
    indices : sequence
            of indices of tracks1 that are to be detected in tracks2    
    tracks1 : sequence 
            of tracks as arrays, shape (N1,3) .. (Nm,3)    
    indices2 : sequence
            of indices of tracks2 in the initial brain 
    tracks2 : sequence 
            of tracks as arrays, shape (M1,3) .. (Mm,3)
            
    Returns
    ---------
    track2track : array (N,2) where N is len(indices)
       of int showing the correspondance in th following way       
       the first colum is the current index of tracks1
       the second column is the corresponding index in tracks2
    
    Examples
    ----------
    >>> import numpy as np
    >>> import dipy.tracking.learning as tl
    >>> A=np.array([[0,0,0],[1,1,1],[2,2,2]])
    >>> B=np.array([[1,0,0],[2,0,0],[3,0,0]])
    >>> C=np.array([[0,0,-1],[0,0,-2],[0,0,-3]])    
    >>> bundle1=[A,B,C]
    >>> bundle2=[B,A]    
    >>> indices=[0,1]
    >>> indices2=indices
    >>> arr=tl.detect_corresponding_tracks_plus(indices,bundle1,indices2,bundle2)
    
    Notes
    -------
    To find the corresponding tracks we use mam_distances with 'avg' option. Then we calculate the 
    argmin of all the calculated distances and return it for every index. (See 3rd column of arr
    in the example given below.
    
    
    See also
    ----------
    distances.mam_distances
    
    '''
    li=len(indices)    
    track2track=np.zeros((li,2))
    cnt=0
    for i in indices:
        rt=[pf.mam_distances(tracks1[i],t,'avg') for t in tracks2]
        rt=np.array(rt)
        track2track[cnt]=np.array([i,indices2[rt.argmin()]])   
        cnt+=1        
    return track2track.astype(int)