Example #1
0
 # Load file containing roto-translation from US image to global
 matrix = np.load('matrices_testwire_3points_15.npz')
 
 # Get roto-translation from US image to global reference frame
 T = matrix['gTim']
 
 # Get single points features from file
 fea = readFeaturesFile('testwire15.fea')   # it must contain one point feature per US image
 
 # Indicate u, v
 u = 30./278
 v = 50./463
 
 # Calculate global coordinates of P1
 idxP1 = range(79,84)
 P1 = singlePointFeaturesTo3DPointsMatrix(fea, u, v, idx=idxP1)
 print P1
 P1g = dot3(T[idxP1,:,:], P1[...,None]).squeeze()[:,0:3]  # Np x 3
 P1 = P1g.mean(axis=0)
 print P1g.std(axis=0)
 
 # Calculate global coordinates of P2
 idxP2 = range(142,147)
 P2 = singlePointFeaturesTo3DPointsMatrix(fea, u, v, idx=idxP2)
 print P2
 P2g = dot3(T[idxP2,:,:], P2[...,None]).squeeze()[:,0:3]  # Np x 3
 P2 = P2g.mean(axis=0)
 print P2g.std(axis=0)
 
 # Calculate global coordinates for P3
 idxP3 = range(188,193)
Example #2
0
    # Get single points features from file     
    fea_dyn = readFeaturesFile('feature_julie_dyn3.fea')   # it must contain one point feature per US image

    # Get metadata from dynamic trial files
    timing_data = np.load('us_time_vector_julie_dyn3.npz')
    usTimeVector = timing_data['usTimeVector'][0]
    fcOpto = 120.    
    
    # Indicate u, v (50mm as depth)
    u = 30./278
    v = 50./463
    
    # Calculate GLOBAL coordinates of muscle insertion - fem - STATIC
    idxP1 = [135,145,155,165,175]
    P1 = singlePointFeaturesTo3DPointsMatrix(fea_pap, u, v, idx=idxP1)
    P1g = dot3(T_pap[idxP1,:,:], P1[...,None]).squeeze()  # Np x 4
    P1 = P1g.mean(axis=0)
    
    # Calculate GLOBAL coordinates of tendon insertion - calc - STATIC
    idxP2 = [285,295,305,315,325]
    P2 = singlePointFeaturesTo3DPointsMatrix(fea_pap, u, v, idx=idxP2)
    P2g = dot3(T_pap[idxP2,:,:], P2[...,None]).squeeze()  # Np x 4
    P2 = P2g.mean(axis=0)
    
    # Calculate GLOBAL coordinates of muscle-tendon junction - STATIC
    idxP3s = [205,215,225,235,230]
    P3s = singlePointFeaturesTo3DPointsMatrix(fea_pap, u, v, idx=idxP3s)
    P3sg = dot3(T_pap[idxP3s,:,:], P3s[...,None]).squeeze()  # Np x 4
    P3s = P3sg.mean(axis=0)
    
Example #3
0
 # Load file containing roto-translation from US image to global
 matrix = np.load('matrices_plantar_3points.npz')
 
 # Get roto-translation from US image to global reference frame
 T = matrix['gTim']
 
 # Get single points features from file
 fea = readFeaturesFile('plantar_position1.fea')   # it must contain one point feature per US image
 
 # Indicate u, v
 u = 30./278
 v = 50./463
 
 # Calculate global coordinates of muscle insertion
 idxP1 = [3,5,8,12,16]
 P1 = singlePointFeaturesTo3DPointsMatrix(fea, u, v, idx=idxP1)
 P1g = dot3(T[idxP1,:,:], P1[...,None]).squeeze()[:,0:3]  # Np x 3
 P1 = P1g.mean(axis=0)
 
 # Calculate global coordinates of tendon insertion
 idxP2 = [510,512,515,518,521]
 P2 = singlePointFeaturesTo3DPointsMatrix(fea, u, v, idx=idxP2)
 P2g = dot3(T[idxP2,:,:], P2[...,None]).squeeze()[:,0:3]  # Np x 3
 P2 = P2g.mean(axis=0)
 
 # Calculate global coordinates for muscle-tendon junction
 idxP3 = [146,149,154,156,159]
 P3 = singlePointFeaturesTo3DPointsMatrix(fea, u, v, idx=idxP3)
 P3g = dot3(T[idxP3,:,:], P3[...,None]).squeeze()[:,0:3]  # Np x 3
 P3 = P3g.mean(axis=0)