algorithm/surf_tools.py
def _extractcenter(roisignal):
    """
    Compute center of mass from ROI which included magnitudes in each vertex
    Surface has its special data construction, they're not consistent across whole ROI. It's better to use mapping method to solve this problem.

    Parameters:
    -----------
    roisignal: ROI that included magnitudes in each vertex

    Returns:
    --------
    center_point: center of mass from ROI
    """
    raw_idx = np.where(roisignal!=0)[0] 
    new_idx = tools.convert_listvalue_to_ordinal(raw_idx)
    new_center = sum(roisignal[e]*new_idx[i] for i,e in enumerate(raw_idx))/sum(roisignal[e] for _,e in enumerate(raw_idx))
    new_center = int(new_center)
    center_point = (raw_idx[i] for i,e in enumerate(new_idx) if e == new_center).next()
    return center_point

    Compute center of mass from ROI which included magnitudes in each vertex
    Surface has its special data construction, they're not consistent across whole ROI. It's better to use mapping method to solve this problem.

    Parameters:
    -----------
    roisignal: ROI that included magnitudes in each vertex

    Returns:
    --------
    center_point: center of mass from ROI
    
Compute center of mass from ROI which included magnitudes in each vertex
Surface has its special data construction, they're not consistent across whole ROI. It's better to use mapping method to solve this problem.



ROI that included magnitudes in each vertex



center of mass from ROI
Compute center of mass from ROI which included magnitudes in each vertex Surface has its special data construction they ' re not consistent across whole ROI . It ' s better to use mapping method to solve this problem . ROI that included magnitudes in each vertex center of mass from ROI
def _extractcenter(roisignal):
    raw_idx = np.where(roisignal!=0)[0] 
    new_idx = tools.convert_listvalue_to_ordinal(raw_idx)
    new_center = sum(roisignal[e]*new_idx[i] for i,e in enumerate(raw_idx))/sum(roisignal[e] for _,e in enumerate(raw_idx))
    new_center = int(new_center)
    center_point = (raw_idx[i] for i,e in enumerate(new_idx) if e == new_center).next()
    return center_point
def _extractcenter ( roisignal ) : raw_idx = np . where ( roisignal != 0 ) [ 0 ] new_idx = tools . convert_listvalue_to_ordinal ( raw_idx ) new_center = sum ( roisignal [ e ] * new_idx [ i ] for i , e in enumerate ( raw_idx ) ) / sum ( roisignal [ e ] for _ , e in enumerate ( raw_idx ) ) new_center = int ( new_center ) center_point = ( raw_idx [ i ] for i , e in enumerate ( new_idx ) if e == new_center ) . next ( ) return center_point
Compute center of mass from ROI which included magnitudes in each vertex
Surface has its special data construction, they're not consistent across whole ROI.
Compute center of mass from ROI which included magnitudes in each vertex Surface has its special data construction they ' re not consistent across whole ROI .
"""
    Compute center of mass from ROI which included magnitudes in each vertex
    Surface has its special data construction, they're not consistent across whole ROI. It's better to use mapping method to solve this problem.

    Parameters:
    -----------
    roisignal: ROI that included magnitudes in each vertex

    Returns:
    --------
    center_point: center of mass from ROI
    """
roisignal