algorithm/vol_tools.py
def roi2vox(self, roimask):
        """
        Compute connectivity between roi and other voxels
        --------------------------------------------------
        Parameters:
            roimask: roi mask. Contain one roi only, note!
        Output:
            corrmap: corr values map
            pmap: p values map
        Example:
            >>> corrmap, pmap = m.roi2vox(roimask)
        """
        roilabel = np.unique(roimask)[1:]
        assert len(roilabel) == 1
        rmap = np.zeros(self._imgdata.shape[:3])
        pmap = np.zeros_like(rmap)
        roiseries, roiloc = _avgseries(self._imgdata, roimask, roilabel[0])
        roiseries = np.expand_dims(roiseries, axis=1).T
        for i in range(self._imgdata.shape[0]):
            for j in range(self._imgdata.shape[1]):
                r_tmp, p_tmp = tools.pearsonr(roiseries, self._imgdata[i,j,...])
                rmap[i,j,:], pmap[i,j,:] = r_tmp.flatten(), p_tmp.flatten()
            print('{}% finished'.format(100.0*i/self._imgdata.shape[0]))
        rmap[np.isnan(rmap)] = 0
        pmap[pmap == 1] = 0
        if self._transform_z is False:
            corrmap = rmap
        else:
            print('Perform the Fisher r-to-z transformation')
            corrmap = tools.r2z(rmap)
        return corrmap, pmap

        Compute connectivity between roi and other voxels
        --------------------------------------------------
        Parameters:
            roimask: roi mask. Contain one roi only, note!
        Output:
            corrmap: corr values map
            pmap: p values map
        Example:
            >>> corrmap, pmap = m.roi2vox(roimask)
        
Compute connectivity between roi and other voxels
Compute connectivity between roi and other voxels
def roi2vox(self, roimask):
        roilabel = np.unique(roimask)[1:]
        assert len(roilabel) == 1
        rmap = np.zeros(self._imgdata.shape[:3])
        pmap = np.zeros_like(rmap)
        roiseries, roiloc = _avgseries(self._imgdata, roimask, roilabel[0])
        roiseries = np.expand_dims(roiseries, axis=1).T
        for i in range(self._imgdata.shape[0]):
            for j in range(self._imgdata.shape[1]):
                r_tmp, p_tmp = tools.pearsonr(roiseries, self._imgdata[i,j,...])
                rmap[i,j,:], pmap[i,j,:] = r_tmp.flatten(), p_tmp.flatten()
            print('{}% finished'.format(100.0*i/self._imgdata.shape[0]))
        rmap[np.isnan(rmap)] = 0
        pmap[pmap == 1] = 0
        if self._transform_z is False:
            corrmap = rmap
        else:
            print('Perform the Fisher r-to-z transformation')
            corrmap = tools.r2z(rmap)
        return corrmap, pmap
def roi2vox ( self , roimask ) : roilabel = np . unique ( roimask ) [ 1 : ] assert len ( roilabel ) == 1 rmap = np . zeros ( self . _imgdata . shape [ : 3 ] ) pmap = np . zeros_like ( rmap ) roiseries , roiloc = _avgseries ( self . _imgdata , roimask , roilabel [ 0 ] ) roiseries = np . expand_dims ( roiseries , axis = 1 ) . T for i in range ( self . _imgdata . shape [ 0 ] ) : for j in range ( self . _imgdata . shape [ 1 ] ) : r_tmp , p_tmp = tools . pearsonr ( roiseries , self . _imgdata [ i , j , ... ] ) rmap [ i , j , : ] , pmap [ i , j , : ] = r_tmp . flatten ( ) , p_tmp . flatten ( ) print ( '{}% finished' . format ( 100.0 * i / self . _imgdata . shape [ 0 ] ) ) rmap [ np . isnan ( rmap ) ] = 0 pmap [ pmap == 1 ] = 0 if self . _transform_z is False : corrmap = rmap else : print ( 'Perform the Fisher r-to-z transformation' ) corrmap = tools . r2z ( rmap ) return corrmap , pmap
Compute connectivity between roi and other voxels
Compute connectivity between roi and other voxels
"""
        Compute connectivity between roi and other voxels
        --------------------------------------------------
        Parameters:
            roimask: roi mask. Contain one roi only, note!
        Output:
            corrmap: corr values map
            pmap: p values map
        Example:
            >>> corrmap, pmap = m.roi2vox(roimask)
        """
self
roimask
roi mask. Contain one roi only, note!
roi mask . Contain one roi only note!
examples
>>> corrmap, pmap = m.roi2vox(roimask)
>>> corrmap pmap = m . roi2vox ( roimask )