[Neuroimaging] select all voxels in one hemisphere

Sam W samfmri at gmail.com
Wed Nov 20 17:25:08 EST 2019


Hello!
I've been trying unsuccessfully to select all voxels in one hemisphere
using nilearn/nibabel
I tried selecting all voxels that are to the left of the center of the
image, something along these lines:

im = load_img('my_im.nii')
mid = int(np.ceil(im.shape[0]/2)) #centre of image
data = im.get_data()
data[mid:,:,:] #this should select the left side of image

This wont work however because mid might not be exactly the middle of the
brain...
Is there a better way to do this?
Thanks!
Sam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/neuroimaging/attachments/20191120/3c787dae/attachment.html>


More information about the Neuroimaging mailing list