Hi
I’m doing an analysis in which I’m finding the most activated voxel in a certain area, draw a sphere around it (10mm radius) and average the activity over this sphere. Having defined the voxel, I use input_data.NiftiSpheresMasker to do the extraction of activity for this sphere.
This is my code to get an overview:
for index2, (area,subarea) in enumerate(brainAreas.items()):
print(' Fit %s from atlas and get k voxels ' % (area))
subjectActivity[df][contrast][area] = {}
#Insert here choice of coord: first or mean of first and second
xyz = kVoxels[df][contrast][area][0]
voxMask = input_data.NiftiSpheresMasker([xyz])
sphereMask = input_data.NiftiSpheresMasker([xyz], radius = 10)
subjectActivity[df][contrast][area]['Voxels'] = []
subjectActivity[df][contrast][area]['Sphere'] = []
for ind, num in enumerate(sub_list):
print(' Fit %s from atlas and get voxel ' % (num))
single_scan = globals()[f"z_map{df}"][contrast][ind]
subjectActivity[df][contrast][area]['Voxels'].append(voxMask.fit_transform(single_scan)[0][0])
subjectActivity[df][contrast][area]['Sphere'].append(sphereMask.fit_transform(single_scan)[0][0])
I would like to plot my spheres to see that they are not going beyond the boundaries of my anatomical region (i.e. that the sphere around the most activated voxel in the amygdala does not go beyond the amygdala). Has anyone done this or can help me out how to do it?
Thanks
Max