Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clipping sliceplanes #556

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Clipping sliceplanes #556

wants to merge 2 commits into from

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 :)

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.

1 participant