recon_surf.smooth_aparc¶
- recon_surf.smooth_aparc.bincount2D_vectorized(a)[source]¶
Count number of occurrences of each value in array of non-negative ints.
- Parameters:
- a
np.ndarray
Input 2D array of non-negative ints.
- a
- Returns:
np.ndarray
Array of counted values.
- recon_surf.smooth_aparc.get_adjM(trias, n)[source]¶
Create symmetric sparse adjacency matrix of triangle mesh.
- Parameters:
- Returns:
- adjM
np.ndarray
(bool
)shape
(n,n) Symmetric sparse CSR adjacency matrix, true corresponds to an edge.
- adjM
- recon_surf.smooth_aparc.main(insurfname, inaparcname, incortexname, outaparcname)[source]¶
Read files, smooth the aparc labels on the surface and save the smoothed labels.
- recon_surf.smooth_aparc.mode_filter(adjM, labels, fillonlylabel=None, novote=None)[source]¶
Apply mode filter (smoothing) to integer labels on mesh vertices.
- Parameters:
- adjM
sparse.csr_matrix
[bool
] Symmetric adjacency matrix defining edges between vertices, this determines what edges can vote so usually one adds the identity to the adjacency matrix so that each vertex is included in its own vote.
- labels
npt.NDArray
[int
] List of integer labels at each vertex of the mesh.
- fillonlylabel
int
Label to fill exclusively. Defaults to None to smooth all labels.
- novote
npt.ArrayLike
Label ids that should not vote. Defaults to None.
- adjM
- Returns:
- labels_new
npt.NDArray
[int
] New smoothed labels.
- labels_new
- recon_surf.smooth_aparc.options_parse()[source]¶
Create a command line interface and return command line options.
- Returns:
options
Namespace object holding options.
- recon_surf.smooth_aparc.smooth_aparc(surf, labels, cortex=None)[source]¶
Smooth aparc label regions on the surface and fill holes.
First all labels with 0 and -1 unside cortex are filled via repeated mode filtering, then all labels are smoothed first with a wider and then with smaller filters to produce smooth label boundaries. Labels outside cortex are set to -1 at the end.