algorithm/surf_tools.py
def inflated_roi_by_rg(orig_mask, ref_mask, faces):
    """
    Inflate orig_mask by extracting connected parcel of ref_mask
    A detailed explanation of this method:
    We have a more stricted orig_mask which pointed relatively correct position of a specific region (e.g. hMT/V5+)
    To use a larger ref_mask as constraints, by extracting connected parcels in ref_mask (the seed point comes from orig_mask), we can get a larger relatively accurate ROI of a specific region

    Parameters:
    -----------
    orig_mask: original mask with a/several small parcel(s)
    ref_mask: reference mask with larger parcel(s)
    faces: relationship of connection
    """
    orig_maskset = set(np.where(orig_mask!=0)[0])
    ref_maskset = set(np.where(orig_mask!=0)[0])

    connvex = set()
    dif_connvex = orig_maskset.difference(connvex)
    parcel_num = 0
    while len(dif_connvex) != 0:
        seedpt = random.choice(tuple(dif_connvex))
        parcel_connvex = get_connvex(seedpt, faces, ref_mask)
        connvex.update(parcel_connvex)
        dif_connvex = orig_maskset.difference(connvex)
        parcel_num += 1
        print('parcel number: {0}'.format(parcel_num))
    return connvex

    Inflate orig_mask by extracting connected parcel of ref_mask
    A detailed explanation of this method:
    We have a more stricted orig_mask which pointed relatively correct position of a specific region (e.g. hMT/V5+)
    To use a larger ref_mask as constraints, by extracting connected parcels in ref_mask (the seed point comes from orig_mask), we can get a larger relatively accurate ROI of a specific region

    Parameters:
    -----------
    orig_mask: original mask with a/several small parcel(s)
    ref_mask: reference mask with larger parcel(s)
    faces: relationship of connection
    
Inflate orig_mask by extracting connected parcel of ref_mask
A detailed explanation of this method:
We have a more stricted orig_mask which pointed relatively correct position of a specific region
To use a larger ref_mask as constraints, by extracting connected parcels in ref_mask (the seed point comes from orig_mask), we can get a larger relatively accurate ROI of a specific region



original mask with a/several small parcel(s)
ref_mask: reference mask with larger parcel(s)
faces: relationship of connection
Inflate orig_mask by extracting connected parcel of ref_mask A detailed explanation of this method : We have a more stricted orig_mask which pointed relatively correct position of a specific region To use a larger ref_mask as constraints by extracting connected parcels in ref_mask ( the seed point comes from orig_mask ) we can get a larger relatively accurate ROI of a specific region original mask with a / several small parcel ( s ) ref_mask : reference mask with larger parcel ( s ) faces : relationship of connection
def inflated_roi_by_rg(orig_mask, ref_mask, faces):
    orig_maskset = set(np.where(orig_mask!=0)[0])
    ref_maskset = set(np.where(orig_mask!=0)[0])
    connvex = set()
    dif_connvex = orig_maskset.difference(connvex)
    parcel_num = 0
    while len(dif_connvex) != 0:
        seedpt = random.choice(tuple(dif_connvex))
        parcel_connvex = get_connvex(seedpt, faces, ref_mask)
        connvex.update(parcel_connvex)
        dif_connvex = orig_maskset.difference(connvex)
        parcel_num += 1
        print('parcel number: {0}'.format(parcel_num))
    return connvex
def inflated_roi_by_rg ( orig_mask , ref_mask , faces ) : orig_maskset = set ( np . where ( orig_mask != 0 ) [ 0 ] ) ref_maskset = set ( np . where ( orig_mask != 0 ) [ 0 ] ) connvex = set ( ) dif_connvex = orig_maskset . difference ( connvex ) parcel_num = 0 while len ( dif_connvex ) != 0 : seedpt = random . choice ( tuple ( dif_connvex ) ) parcel_connvex = get_connvex ( seedpt , faces , ref_mask ) connvex . update ( parcel_connvex ) dif_connvex = orig_maskset . difference ( connvex ) parcel_num += 1 print ( 'parcel number: {0}' . format ( parcel_num ) ) return connvex
Inflate orig_mask by extracting connected parcel of ref_mask
A detailed explanation of this method:
We have a more stricted orig_mask which pointed relatively correct position of a specific region (e.g.
Inflate orig_mask by extracting connected parcel of ref_mask A detailed explanation of this method : We have a more stricted orig_mask which pointed relatively correct position of a specific region ( e . g .
"""
    Inflate orig_mask by extracting connected parcel of ref_mask
    A detailed explanation of this method:
    We have a more stricted orig_mask which pointed relatively correct position of a specific region (e.g. hMT/V5+)
    To use a larger ref_mask as constraints, by extracting connected parcels in ref_mask (the seed point comes from orig_mask), we can get a larger relatively accurate ROI of a specific region

    Parameters:
    -----------
    orig_mask: original mask with a/several small parcel(s)
    ref_mask: reference mask with larger parcel(s)
    faces: relationship of connection
    """
orig_mask
ref_mask
faces