algorithm/vol_tools.py
def peakn_location(data, ncluster = 5, rgsize = 10, reverse = False):
    """
    Using region growth to extract highest/lowest clusters
    --------------------------------------
    Parameters:
        data: raw data
        ncluster: cluster numbers by using information of data values
        rgsize: region growth size (voxel), constraint neighbouring voxels
        reverse: if True, get locations start from the largest values
                 if False, start from the lowest values
    Return:
        nth_loc: list of locations
    """
    if reverse is True:
        filterdata = np.argmin
    else:
        filterdata = np.argmax
    median_data = np.median(data)
    nth_loc = []
    for i in range(ncluster):
        temploc = np.unravel_index(filterdata(data), data.shape)
        nth_loc.append(temploc)
        tempdata, loc_rg = region_growing(data, temploc, rgsize)
        for j in loc_rg:
            data[j[0], j[1], j[2]] = median_data
    return nth_loc, tempdata

    Using region growth to extract highest/lowest clusters
    --------------------------------------
    Parameters:
        data: raw data
        ncluster: cluster numbers by using information of data values
        rgsize: region growth size (voxel), constraint neighbouring voxels
        reverse: if True, get locations start from the largest values
                 if False, start from the lowest values
    Return:
        nth_loc: list of locations
    
Using region growth to extract highest/lowest clusters
Using region growth to extract highest / lowest clusters
def peakn_location(data, ncluster = 5, rgsize = 10, reverse = False):
    if reverse is True:
        filterdata = np.argmin
    else:
        filterdata = np.argmax
    median_data = np.median(data)
    nth_loc = []
    for i in range(ncluster):
        temploc = np.unravel_index(filterdata(data), data.shape)
        nth_loc.append(temploc)
        tempdata, loc_rg = region_growing(data, temploc, rgsize)
        for j in loc_rg:
            data[j[0], j[1], j[2]] = median_data
    return nth_loc, tempdata
def peakn_location ( data , ncluster = 5 , rgsize = 10 , reverse = False ) : if reverse is True : filterdata = np . argmin else : filterdata = np . argmax median_data = np . median ( data ) nth_loc = [ ] for i in range ( ncluster ) : temploc = np . unravel_index ( filterdata ( data ) , data . shape ) nth_loc . append ( temploc ) tempdata , loc_rg = region_growing ( data , temploc , rgsize ) for j in loc_rg : data [ j [ 0 ] , j [ 1 ] , j [ 2 ] ] = median_data return nth_loc , tempdata
Using region growth to extract highest/lowest clusters
Using region growth to extract highest / lowest clusters
"""
    Using region growth to extract highest/lowest clusters
    --------------------------------------
    Parameters:
        data: raw data
        ncluster: cluster numbers by using information of data values
        rgsize: region growth size (voxel), constraint neighbouring voxels
        reverse: if True, get locations start from the largest values
                 if False, start from the lowest values
    Return:
        nth_loc: list of locations
    """
data
None
ncluster
cluster numbers by using information of data values
cluster numbers by using information of data values
rgsize
region growth size (voxel), constraint neighbouring voxels
region growth size ( voxel ) constraint neighbouring voxels
reverse
if True, get locations start from the largest values
if False, start from the lowest values
if True get locations start from the largest values if False start from the lowest values