I am looking for the MNI coordinates for the subcortical regions included in the Schaefer 456 atlas after postprocessing rs-fMRI using xcp-d. I have been able to find the cortical regions MNI on this repository (AtlasPack/tpl-MNI152NLin6Asym_atlas-4S656Parcels_dseg.json at main 路 PennLINC/AtlasPack 路 GitHub). But am really struggling to find the MNI coordinates for the subcortical regions included.
If anyone could point me in the right directions that would be fabulous
Do you mean all of the MNI coordinates for each subcortical region, or just the centroids?
Also, just to be clear- the Schaefer atlas only has cortical regions. The atlases in AtlasPack (i.e., 4S) are the Schaefer with subcortical regions added from other atlases.
Sorry I am quite new to this all. I currently have this file that has the MNI coordinates for the cortical Schaefer 400 regions, I believe these values must be the centroids:
I don鈥檛 think we have them logged anywhere, but you could do something like the following to load the atlas and find each region鈥檚 center of mass. This will probably only work on the NIfTI.
import nibabel as nb
import numpy as np
from scipy.ndimage import center_of_mass
# Load the atlas file and get 3D array of region IDs
img = nb.load("atlas_file")
data = img.get_fdata()
for i in np.unique(data):
if i == 0:
# Skip the background
continue
# Create a binary array where the region is True and
# everything else is False
arr = (data == i)
# Get the center of mass
ijk = center_of_mass(arr)
ijk = np.round(ijk).astype(int)
# Convert the center of mass from matrix coordinates to MNI
xyz = nb.affines.apply_affine(img.affine, ijk)
print(f"{i}: {xyz}")