Skip to content

Conversation

@alexhuth
Copy link
Contributor

This adds the option to clip the brain surface at sliceplanes. This enables simultaneous viewing of surface and deeper subcortical data. (Although to make this really useful we might need a way to have different datasets visible on the surface and sliceplanes, perhaps?)

It adds a new submenu, clip, under sliceplanes, with boolean toggles for clip_{x,y,z} and flip_{x,y,z}. The clip toggles hide the surface on one side of the sliceplane, and flip toggles switch which side that is. The sliceplanes can be moved and rotated as normal.

Here's a small script that you can run to test (it works better if you use a subject where the brainmask.nii.gz volume is available unlike the default subject S1; in that case replace 'raw' with 'brainmask'):

import numpy as np
import cortex

subject = "S1"
anatdata = cortex.db.get_anat(subject, 'raw').get_fdata().T
anatdata[anatdata < 5] = np.nan
anatvol = cortex.Volume(anatdata, subject, 'identity')

cortex.webshow(anatvol)

I've also attached a screenshot of what it looks like with a subject where the masked brain is available.
Screen Shot 2024-10-17 at 15 01 44

I haven't tested how this works with vertex data or RGB data or really anything but what you see. It's a start, anyway :)

@mvdoc
Copy link
Contributor

mvdoc commented Jul 21, 2025

@alexhuth did you add anything new or can we merge?

@alexhuth
Copy link
Contributor Author

Nothing new, do it!

@mvdoc mvdoc merged commit ddec378 into main Jul 21, 2025
16 checks passed
@mvdoc mvdoc deleted the slicing_sliceplanes branch July 21, 2025 21:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants