Hi,
I have my post-fmri prep data and I want to use Harvard-Oxford atlas to fetch the activity in 3 specific subcortical regions (label Ids 10,20, 26).
So it should be something like:
Hard to say with the limited amount of code you provided. Here’s an example from scratch:
from nilearn.datasets import fetch_atlas_harvard_oxford
from nilearn.maskers import NiftiLabelsMasker
from nilearn.image import index_img
nii_file = "/PATH/TO/IMAGE.nii.gz"
# FETCH ATLAS
ho = fetch_atlas_harvard_oxford('sub-maxprob-thr50-1mm') # Note this is deterministic 3D atlas, not probabilistic
ho_img = ho.maps
ho_labels = ho.labels
# GET ATLAS VALUES IN IMAGE
masker = NiftiLabelsMasker(labels_img=ho_img, labels=ho_labels)
ho_vals = masker.fit_transform(nii_file)
You can then index into ho_vals however you like. However, the subcortical atlas only has 21 regions, so it is not clear to me where your desired index of 26 is coming from.
Thanks!
Can you please explain the difference between deterministic/probabilistic atlas, and between atlas and parcellation?
Also, I looked for but couldn’t find a ref as to what considered ventral and dorsal striatum (assuming I want to contrast them), do you maybe have one?
Probabilistic - 4D image, composed of one 3D image per ROI. The values correspond to the probability that the given ROI is there (usually based off of some population overlap)
Deterministic - In this case, it is simply thresholding the probability maps at a given threshold (e.g., 50%) and then combining all of them into a single 3D image, where the values correspond to the label.
A parcellation can be defined as the splitting of an object into non-overlapping components. Since an atlas divide the brain into regions, atlasing can be considered a kind of parcellation. Reciprocally, any kind of brain parcellation can be considered an “atlas”. A difference is that an atlas is often expected to be defined on an entire brain, while a parcellation can be limited to a specific region (e.g. thalamus parcellation). A parcellation can also be applied for example to the cortical GM (the outer layer of the brain) or the subcortical GM for deep GM (GM structures below the cortex).
You can use any atlas in nilearn, provided it is formatted appropriately (3D image in standard space with values denoting ROI labels); it does not have to be built in to nilearn to be used in NiftiLabelsMasker.
I do not, I have not worked with that atlas. But if you have that atlas you can load it with nilearn.image.load_img and use that as the labels_img, provided it is formatted as I described above.
Just one last question please - is there an overlap between areas in that atlas?
Meaning, lets say I want to compare activity between two neighboring regions - can I be sure that there are no overlapping voxels?
Some of the low-probabilistic regions might extend to each other (I haven’t checked), but in the deterministic version each voxel is assigned a unique value.