gallantlab / pycortex

Pycortex is a python-based toolkit for surface visualization of fMRI data
https://gallantlab.github.io/pycortex
BSD 2-Clause "Simplified" License
581 stars 137 forks source link

FIX Improve masks returned by `get_roi_masks` and correctly split into left/right hemispheres #504

Closed mvdoc closed 10 months ago

mvdoc commented 10 months ago

When loading an ROI mask or a set of vertices within an ROI, the code previously returned only vertices on the flatmap. This is fine in general, but if the ROI spans a cut, then those vertices won't be included and the ROI mask will ignore some voxels.

This PR fixes this issue by including the neighboring vertices that are not present in the flatmap.

Example: before/after for get_roi_verts.

Before

verts_before

After

verts_after

Example: before/after for get_roi_masks.

Before

mask_before

After

mask_after
mvdoc commented 10 months ago

Pinging @marklescroart to double check if there are some edge cases I haven't thought about that would fail miserably here.

mvdoc commented 10 months ago

b5f0f76 fixes an additional bug with split_lr.

Before:

image

After:

image