How to use the brainspace.vtk_interface.decorators.append_vtk function in brainspace

To help you get started, we’ve selected a few brainspace examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github MICA-MNI / BrainSpace / brainspace / mesh / array_operations.py View on Github external
@append_vtk(to='cell')
def map_pointdata_to_celldata(surf, point_data, red_func='mean',
                              dtype=None, append=False, key=None):
    """Map point data to cell data.

    Parameters
    ----------
    surf : vtkPolyData or BSPolyData
        Input surface.
    point_data : str, 1D ndarray
        Array with point data. If str, it is in the point data attributes
        of `surf`. If ndarray, use this array as point data.
    red_func : {'sum', 'mean', 'mode', 'min', 'max'} or callable, optional
        Function used to compute data of each cell from data of its points.
        Default is 'mean'.
    dtype : dtype, optional
        Data type of new array. If None, use the same data type of point data
github MICA-MNI / BrainSpace / brainspace / mesh / array_operations.py View on Github external
@append_vtk(to='point')
def compute_point_area(surf, cell_area=None, area_as='one_third',
                       append=False, key='point_area'):
    """Compute point area from its adjacent cells.

    Parameters
    ----------
    surf : vtkPolyData or BSPolyData
        Input surface.
    cell_area : str, 1D ndarray or None, optional
        Array with cell areas. If str, it must be in the cell data attributes
        of `surf`. If None, cell areas are computed first.
        Default is None.
    area_as : {'one_third', 'sum', 'mean'}, optional
        Compute point area as 'one_third', 'sum' or 'mean' of adjacent cells.
        Default is 'one_third'.
    append : bool, optional
github MICA-MNI / BrainSpace / brainspace / mesh / array_operations.py View on Github external
@append_vtk(to='point')
def map_celldata_to_pointdata(surf, cell_data, red_func='mean',
                              dtype=None, append=False, key=None):
    """Map cell data to point data.

    Parameters
    ----------
    surf : vtkPolyData or BSPolyData
        Input surface.
    cell_data : str, 1D ndarray
        Array with cell data. If str, it must be in cell data attributes
        of `surf`.
    red_func : str or callable, optional.
        Function used to compute point data from data of neighboring
        cells. If str, options are {'sum', 'mean', 'mode', 'one_third', 'min',
        'max'}. Default is 'mean'.
    dtype : dtype, optional
github MICA-MNI / BrainSpace / brainspace / mesh / array_operations.py View on Github external
@append_vtk(to='cell')
def compute_cell_center(surf, append=False, key='cell_center'):
    """Compute center of cells (parametric center).

    Parameters
    ----------
    surf : vtkPolyData or BSPolyData
        Input surface.
    append : bool, optional
        If True, append array to cell data attributes of input surface and
        return surface. Otherwise, only return array. Default is False.
    key : str, optional
        Array name to append to surface's cell data attributes. Only used if
        ``append == True``. Default is 'cell_center'.

    Returns
    -------
github MICA-MNI / BrainSpace / brainspace / mesh / array_operations.py View on Github external
@append_vtk(to='point')
def propagate_labeling(surf, labeling, no_label=np.nan, mask=None, alpha=0.99,
                       n_iter=30, tol=0.001, n_ring=1, mode='connectivity',
                       append=False, key='propagated'):
    """Propagate labeling on surface points.

    Parameters
    ----------
    surf : vtkPolyData or BSPolyData
        Input surface.
    labeling : str, 1D ndarray
        Array with initial labels. If str, it must be in the point data
        attributes of `surf`. If ndarray, use this array as the initial
        labeling.
    no_label : int or np.nan, optional
        Value for unlabeled points. Default is np.nan.
    mask : 1D ndarray, optional
github MICA-MNI / BrainSpace / brainspace / mesh / array_operations.py View on Github external
@append_vtk(to='point')
def get_parcellation_centroids(surf, labeling, non_centroid=0, mask=None,
                               append=False, key='centroids'):
    """Compute parcels centroids.

    Parameters
    ----------
    surf : vtkPolyData or BSPolyData
        Input surface.
    labeling : str, 1D ndarray
        Array with labels. If str, it must be in the point data
        attributes of `surf`. If ndarray, use this array as the labeling.
    non_centroid : int, optional
        Label assigned to non-centroid points. Default is 0.
    mask : 1D ndarray, optional
        Binary mask. If specified, only consider points within the mask.
        Default is None.
github MICA-MNI / BrainSpace / brainspace / mesh / array_operations.py View on Github external
@append_vtk(to='point')
def get_labeling_border(surf, labeling, append=False, key='border'):
    """Get labeling borders.

    Parameters
    ----------
    surf : vtkPolyData or BSPolyData
        Input surface.
    labeling : str, 1D ndarray
        Array with labels. If str, it must be in the point data
        attributes of `surf`.
    append : bool, optional
        If True, append array to point data attributes of input surface and
        return surface. Otherwise, only return array. Default is False.
    key : str, optional
        Array name to append to surface's point data attributes. Only used if
        ``append == True``. Default is 'border'.
github MICA-MNI / BrainSpace / brainspace / mesh / array_operations.py View on Github external
@append_vtk(to='point')
def smooth_array(surf, point_data, n_iter=5, mask=None, kernel='gaussian',
                 relax=0.2, sigma=None, append=False, key=None):
    """Propagate labeling on surface points.

    Parameters
    ----------
    surf : vtkPolyData or BSPolyData
        Input surface.
    point_data : str, ndarray
        Input array to smooth. If str, it must be in the point data
        attributes of `surf`. If ndarray, use this array.
    n_iter : int, optional
        Number of smoothing iterations. Default is 5.
    mask : str or 1D ndarray, optional
        Binary mask. If specified, smoothing is only performed on points
        within the mask. If str, it must be in the point data
github MICA-MNI / BrainSpace / brainspace / mesh / array_operations.py View on Github external
@append_vtk(to='point')
def get_n_adjacent_cells(surf, append=False, key='point_ncells'):
    """Compute number of adjacent cells for each point.

    Parameters
    ----------
    surf : vtkPolyData or BSPolyData
        Input surface.
    append : bool, optional
        If True, append array to cell data attributes of input surface and
        return surface. Otherwise, only return array. Default is False.
    key : str, optional
        Array name to append to surface's point data attributes. Only used if
        ``append == True``. Default is 'point_ncells'.

    Returns
    -------
github MICA-MNI / BrainSpace / brainspace / mesh / array_operations.py View on Github external
@append_vtk(to='cell')
def compute_cell_area(surf, append=False, key='cell_area'):
    """Compute cell area.

    Parameters
    ----------
    surf : vtkPolyData or BSPolyData
        Input surface.
    append : bool, optional
        If True, append array to cell data attributes of input surface
        and return surface. Otherwise, only return array. Default is False.
    key : str, optional
        Array name to append to surface's cell data attributes. Only used if
        ``append == True``. Default is 'cell_area'.

    Returns
    -------