algorithm/vol_tools.py
def mvpa_space_searchlight(self, voxloc, radius = [2,2,2], thr = 1e-3):
        """
        Searchlight method search in global brain
        Note that I'm not quite sure whether the details are right
        In future maybe I need to fix details
        --------------------------------------------
        Parameters:
            voxloc: voxel location
            radius: sphere radius, by default is [2,2,2]
            thr: threshold values of raw activation values
                 higher value means smaller checking range, with smaller computational time
        Output:
            rdata: r maps
            pdata: p maps
        Example:
            >>> rdata, pdata = mvpa_space_searchlight(voxloc)
        """   
        assert np.ndim(self._imgdata) == 3, "Dimension of inputdata, imgdata, should be 3 in space mvpa"
        rdata = np.zeros_like(self._imgdata)
        pdata = np.zeros_like(self._imgdata)
        sphere_org, _ = sphere_roi(voxloc, radius, 1, self._imgshape)
        signal_org = get_signals(self._imgdata, sphere_org, 'voxel')[0]
        for i in range(self._imgshape[0]):
            for j in range(self._imgshape[1]):
                for k in range(self._imgshape[2]):
                    if np.abs(self._imgdata[i,j,k]) < thr:
                        continue
                    else:
                        sphere_dest, _ = sphere_roi([i,j,k], radius, 1, self._imgshape)
                        if sphere_dest[sphere_dest!=0].shape[0]!=sphere_org[sphere_org!=0].shape[0]:
                            continue
                        signal_dest = get_signals(self._imgdata, sphere_dest, 'voxel')[0]
                        rdata[i,j,k], pdata[i,j,k] = stats.pearsonr(signal_org, signal_dest)
            print('{}% finished'.format(100.0*i/91))
        return rdata, pdata

        Searchlight method search in global brain
        Note that I'm not quite sure whether the details are right
        In future maybe I need to fix details
        --------------------------------------------
        Parameters:
            voxloc: voxel location
            radius: sphere radius, by default is [2,2,2]
            thr: threshold values of raw activation values
                 higher value means smaller checking range, with smaller computational time
        Output:
            rdata: r maps
            pdata: p maps
        Example:
            >>> rdata, pdata = mvpa_space_searchlight(voxloc)
        
Searchlight method search in global brain
Note that I'm not quite sure whether the details are right
In future maybe I need to fix details
Searchlight method search in global brain Note that I ' m not quite sure whether the details are right In future maybe I need to fix details
def mvpa_space_searchlight(self, voxloc, radius = [2,2,2], thr = 1e-3):
        assert np.ndim(self._imgdata) == 3, "Dimension of inputdata, imgdata, should be 3 in space mvpa"
        rdata = np.zeros_like(self._imgdata)
        pdata = np.zeros_like(self._imgdata)
        sphere_org, _ = sphere_roi(voxloc, radius, 1, self._imgshape)
        signal_org = get_signals(self._imgdata, sphere_org, 'voxel')[0]
        for i in range(self._imgshape[0]):
            for j in range(self._imgshape[1]):
                for k in range(self._imgshape[2]):
                    if np.abs(self._imgdata[i,j,k]) < thr:
                        continue
                    else:
                        sphere_dest, _ = sphere_roi([i,j,k], radius, 1, self._imgshape)
                        if sphere_dest[sphere_dest!=0].shape[0]!=sphere_org[sphere_org!=0].shape[0]:
                            continue
                        signal_dest = get_signals(self._imgdata, sphere_dest, 'voxel')[0]
                        rdata[i,j,k], pdata[i,j,k] = stats.pearsonr(signal_org, signal_dest)
            print('{}% finished'.format(100.0*i/91))
        return rdata, pdata
def mvpa_space_searchlight ( self , voxloc , radius = [ 2 , 2 , 2 ] , thr = 1e-3 ) : assert np . ndim ( self . _imgdata ) == 3 , "Dimension of inputdata, imgdata, should be 3 in space mvpa" rdata = np . zeros_like ( self . _imgdata ) pdata = np . zeros_like ( self . _imgdata ) sphere_org , _ = sphere_roi ( voxloc , radius , 1 , self . _imgshape ) signal_org = get_signals ( self . _imgdata , sphere_org , 'voxel' ) [ 0 ] for i in range ( self . _imgshape [ 0 ] ) : for j in range ( self . _imgshape [ 1 ] ) : for k in range ( self . _imgshape [ 2 ] ) : if np . abs ( self . _imgdata [ i , j , k ] ) < thr : continue else : sphere_dest , _ = sphere_roi ( [ i , j , k ] , radius , 1 , self . _imgshape ) if sphere_dest [ sphere_dest != 0 ] . shape [ 0 ] != sphere_org [ sphere_org != 0 ] . shape [ 0 ] : continue signal_dest = get_signals ( self . _imgdata , sphere_dest , 'voxel' ) [ 0 ] rdata [ i , j , k ] , pdata [ i , j , k ] = stats . pearsonr ( signal_org , signal_dest ) print ( '{}% finished' . format ( 100.0 * i / 91 ) ) return rdata , pdata
Searchlight method search in global brain
Note that I'm not quite sure whether the details are right
In future maybe I need to fix details
Searchlight method search in global brain Note that I ' m not quite sure whether the details are right In future maybe I need to fix details
"""
        Searchlight method search in global brain
        Note that I'm not quite sure whether the details are right
        In future maybe I need to fix details
        --------------------------------------------
        Parameters:
            voxloc: voxel location
            radius: sphere radius, by default is [2,2,2]
            thr: threshold values of raw activation values
                 higher value means smaller checking range, with smaller computational time
        Output:
            rdata: r maps
            pdata: p maps
        Example:
            >>> rdata, pdata = mvpa_space_searchlight(voxloc)
        """
self
voxloc
None
radius
None
thr
threshold values of raw activation values
higher value means smaller checking range, with smaller computational time
threshold values of raw activation values higher value means smaller checking range with smaller computational time
examples
>>> rdata, pdata = mvpa_space_searchlight(voxloc)
>>> rdata pdata = mvpa_space_searchlight ( voxloc )