algorithm/vol_tools.py
def roidistance(self, targdata, extloc = 'peak', metric = 'euclidean'):
        """
        Compute distance between ROIs which contains in a mask
        ---------------------------------------------
        Input:
            targdata: target nifti data, pay attention that this data is not labelled data
            extloc: 'peak' or 'center' in extraction of coordinate
            metric: methods for calculating distance
        """
        try:
            targdata.shape
        except AttributeError:
            targdata = nib.load(targdata).get_data()
            print('targdata should be an array')
        if self._roimask.shape != targdata.shape:
            raise Exception('targdata shape should have the save shape as target data')

        peakcoord = get_coordinate(targdata, self._roimask, method = extloc, labelnum = self._roinumber)
        dist_array = np.empty((peakcoord.shape[0], peakcoord.shape[0]))
        for i in range(peakcoord.shape[0]):
            for j in range(peakcoord.shape[0]):
                dist_array[i,j] = tools.calcdist(peakcoord[i,:], peakcoord[j,:], metric = metric)
        return dist_array

        Compute distance between ROIs which contains in a mask
        ---------------------------------------------
        Input:
            targdata: target nifti data, pay attention that this data is not labelled data
            extloc: 'peak' or 'center' in extraction of coordinate
            metric: methods for calculating distance
        
Compute distance between ROIs which contains in a mask
Input:
targdata: target nifti data, pay attention that this data is not labelled data
extloc: 'peak' or 'center' in extraction of coordinate
metric: methods for calculating distance
Compute distance between ROIs which contains in a mask Input : targdata : target nifti data pay attention that this data is not labelled data extloc : ' peak ' or ' center ' in extraction of coordinate metric : methods for calculating distance
def roidistance(self, targdata, extloc = 'peak', metric = 'euclidean'):
        try:
            targdata.shape
        except AttributeError:
            targdata = nib.load(targdata).get_data()
            print('targdata should be an array')
        if self._roimask.shape != targdata.shape:
            raise Exception('targdata shape should have the save shape as target data')
        peakcoord = get_coordinate(targdata, self._roimask, method = extloc, labelnum = self._roinumber)
        dist_array = np.empty((peakcoord.shape[0], peakcoord.shape[0]))
        for i in range(peakcoord.shape[0]):
            for j in range(peakcoord.shape[0]):
                dist_array[i,j] = tools.calcdist(peakcoord[i,:], peakcoord[j,:], metric = metric)
        return dist_array
def roidistance ( self , targdata , extloc = 'peak' , metric = 'euclidean' ) : try : targdata . shape except AttributeError : targdata = nib . load ( targdata ) . get_data ( ) print ( 'targdata should be an array' ) if self . _roimask . shape != targdata . shape : raise Exception ( 'targdata shape should have the save shape as target data' ) peakcoord = get_coordinate ( targdata , self . _roimask , method = extloc , labelnum = self . _roinumber ) dist_array = np . empty ( ( peakcoord . shape [ 0 ] , peakcoord . shape [ 0 ] ) ) for i in range ( peakcoord . shape [ 0 ] ) : for j in range ( peakcoord . shape [ 0 ] ) : dist_array [ i , j ] = tools . calcdist ( peakcoord [ i , : ] , peakcoord [ j , : ] , metric = metric ) return dist_array
Compute distance between ROIs which contains in a mask
Input:
targdata: target nifti data, pay attention that this data is not labelled data
extloc: 'peak' or 'center' in extraction of coordinate
metric: methods for calculating distance
Compute distance between ROIs which contains in a mask Input : targdata : target nifti data pay attention that this data is not labelled data extloc : ' peak ' or ' center ' in extraction of coordinate metric : methods for calculating distance
"""
        Compute distance between ROIs which contains in a mask
        ---------------------------------------------
        Input:
            targdata: target nifti data, pay attention that this data is not labelled data
            extloc: 'peak' or 'center' in extraction of coordinate
            metric: methods for calculating distance
        """
self
targdata
extloc
metric