My aim is to mask a 3D image at a given location with a 3d spherical mask. I want to extract all of the values of the image within this 3D mask
I am currently using python's nilearn.image.NiftiSpheresMasker function to achieve this in the following way:
central_coordinates=(x,y,z)
masker = NiftiSpheresMasker(central_coordinates, radius=rad)
values=masker.fit_transform(resampled_image)
However, this only returns the mean signal within the ROI. Is there a way to either:
P.s I have already tried using FSL's fslmaths -kernel
which works for cubes but not spheres.
I managed to solve this by using the function create_sphere
from the package nltools
See this link: https://github.com/ljchang/nltools/issues/122