pynetstim/coordinates.py
def map_to_annot(self, annot, map_surface='white', inplace=True):
        
        """ map each point to specified annotation 
        
        Parameters:
        -----------
        annot: str
            which annotation to use 
        
        map_surface: str, {'pial','white'}
            the surface that points are projected into to get the vertices
            
        Returns:
        ---------
        structures: numpy array
            a numpy array of structures ( annotations)
        
        color: numpy array
            a numpy array (npoints x 3) that specifies the color based on the annotation provided
            
        """
        
        if len(self.hemi_not_determined)>0:
            raise ValueError('Use set_hemi_manually to assign hemiphere to these points: %s'%(','.join(self.hemi_not_determined)))
        
     
        lh_annot = Annot('lh', annot, self.subject, self.freesurfer_dir)
        rh_annot = Annot('rh', annot, self.subject, self.freesurfer_dir)
        
        colors = np.zeros((self.npoints,3))
        structures = np.empty(self.npoints,dtype='object')
            
        mapped_vertices_indices = self.map_to_surface(surface=map_surface)['vertices']
        lh_mapped_vertices_indices = mapped_vertices_indices[self.hemi=='lh']
        rh_mapped_vertices_indices = mapped_vertices_indices[self.hemi=='rh']
        
        
        if np.sum(self.hemi=='lh')>0:
            lh_colors, lh_structures = lh_annot.get_vertices_colors(lh_mapped_vertices_indices),lh_annot.get_vertices_names(lh_mapped_vertices_indices)
            colors[self.hemi=='lh',:] = lh_colors
            structures[self.hemi=='lh'] = ['lh_' + x.decode('UTF-8') for x in lh_structures]

        if np.sum(self.hemi=='rh')>0:
            rh_colors, rh_structures = rh_annot.get_vertices_colors(rh_mapped_vertices_indices),rh_annot.get_vertices_names(rh_mapped_vertices_indices)
            colors[self.hemi=='rh',:] = rh_colors
            structures[self.hemi=='rh'] = ['rh_' + x.decode('UTF-8') for x in rh_structures]
        
        if inplace:
            self.add_trait('color',colors)
            self.add_trait('name', structures)
        
        return structures, colors
 map each point to specified annotation 
        
        Parameters:
        -----------
        annot: str
            which annotation to use 
        
        map_surface: str, {'pial','white'}
            the surface that points are projected into to get the vertices
            
        Returns:
        ---------
        structures: numpy array
            a numpy array of structures ( annotations)
        
        color: numpy array
            a numpy array (npoints x 3) that specifies the color based on the annotation provided
            
        
map each point to specified annotation
Parameters.

str
which annotation to use

str, {'pial','white'}
the surface that points are projected into to get the vertices



numpy array
a numpy array of structures ( annotations)

numpy array
a numpy array (npoints x 3) that specifies the color based on the annotation provided
map each point to specified annotation Parameters . str which annotation to use str { ' pial ' ' white ' } the surface that points are projected into to get the vertices numpy array a numpy array of structures ( annotations ) numpy array a numpy array ( npoints x 3 ) that specifies the color based on the annotation provided
def map_to_annot(self, annot, map_surface='white', inplace=True):
        if len(self.hemi_not_determined)>0:
            raise ValueError('Use set_hemi_manually to assign hemiphere to these points: %s'%(','.join(self.hemi_not_determined)))
        lh_annot = Annot('lh', annot, self.subject, self.freesurfer_dir)
        rh_annot = Annot('rh', annot, self.subject, self.freesurfer_dir)
        colors = np.zeros((self.npoints,3))
        structures = np.empty(self.npoints,dtype='object')
        mapped_vertices_indices = self.map_to_surface(surface=map_surface)['vertices']
        lh_mapped_vertices_indices = mapped_vertices_indices[self.hemi=='lh']
        rh_mapped_vertices_indices = mapped_vertices_indices[self.hemi=='rh']
        if np.sum(self.hemi=='lh')>0:
            lh_colors, lh_structures = lh_annot.get_vertices_colors(lh_mapped_vertices_indices),lh_annot.get_vertices_names(lh_mapped_vertices_indices)
            colors[self.hemi=='lh',:] = lh_colors
            structures[self.hemi=='lh'] = ['lh_' + x.decode('UTF-8') for x in lh_structures]
        if np.sum(self.hemi=='rh')>0:
            rh_colors, rh_structures = rh_annot.get_vertices_colors(rh_mapped_vertices_indices),rh_annot.get_vertices_names(rh_mapped_vertices_indices)
            colors[self.hemi=='rh',:] = rh_colors
            structures[self.hemi=='rh'] = ['rh_' + x.decode('UTF-8') for x in rh_structures]
        if inplace:
            self.add_trait('color',colors)
            self.add_trait('name', structures)
        return structures, colors
def map_to_annot ( self , annot , map_surface = 'white' , inplace = True ) : if len ( self . hemi_not_determined ) > 0 : raise ValueError ( 'Use set_hemi_manually to assign hemiphere to these points: %s' % ( ',' . join ( self . hemi_not_determined ) ) ) lh_annot = Annot ( 'lh' , annot , self . subject , self . freesurfer_dir ) rh_annot = Annot ( 'rh' , annot , self . subject , self . freesurfer_dir ) colors = np . zeros ( ( self . npoints , 3 ) ) structures = np . empty ( self . npoints , dtype = 'object' ) mapped_vertices_indices = self . map_to_surface ( surface = map_surface ) [ 'vertices' ] lh_mapped_vertices_indices = mapped_vertices_indices [ self . hemi == 'lh' ] rh_mapped_vertices_indices = mapped_vertices_indices [ self . hemi == 'rh' ] if np . sum ( self . hemi == 'lh' ) > 0 : lh_colors , lh_structures = lh_annot . get_vertices_colors ( lh_mapped_vertices_indices ) , lh_annot . get_vertices_names ( lh_mapped_vertices_indices ) colors [ self . hemi == 'lh' , : ] = lh_colors structures [ self . hemi == 'lh' ] = [ 'lh_' + x . decode ( 'UTF-8' ) for x in lh_structures ] if np . sum ( self . hemi == 'rh' ) > 0 : rh_colors , rh_structures = rh_annot . get_vertices_colors ( rh_mapped_vertices_indices ) , rh_annot . get_vertices_names ( rh_mapped_vertices_indices ) colors [ self . hemi == 'rh' , : ] = rh_colors structures [ self . hemi == 'rh' ] = [ 'rh_' + x . decode ( 'UTF-8' ) for x in rh_structures ] if inplace : self . add_trait ( 'color' , colors ) self . add_trait ( 'name' , structures ) return structures , colors
map each point to specified annotation
Parameters:
map each point to specified annotation Parameters :
""" map each point to specified annotation 
        
        Parameters:
        -----------
        annot: str
            which annotation to use 
        
        map_surface: str, {'pial','white'}
            the surface that points are projected into to get the vertices
            
        Returns:
        ---------
        structures: numpy array
            a numpy array of structures ( annotations)
        
        color: numpy array
            a numpy array (npoints x 3) that specifies the color based on the annotation provided
            
        """
self
annot
map_surface
inplace