I want to build a mask of the Amygdala from the Jülich probabilistic atlas.

The whole atlas comes in a 4D nifti file and I need to take several images along the 4th axis and merge them into one 3D file.

I could turn the images seperately to numpy arrays and squeeze them togheter in one 3D matrix, but this seems kind of janky.

I have been looking for a way to do it with a nilearn built-in function but I’m starting to run in circles.

Is there a way to solve this issue with a nilearn function?

One reason I don’t want to squeeze it with numpy is that I want to threshold the probability atlas at 50% chance and then binarize it. And I feel the numpy method will mess with the values in each voxel… which a nilearn function might also do - but faster.

Thanks for any help!

Hi @Lightnjer

I’m not sure what you exactly want to achieve: something like an argmax of the Julich atlas to get a per-voxel label ?

While It is not unreasonable to work with Numpy array, you probably want to use `nilearn.image.math_img`

to perform computations at the image level.

Also, you may wnat to use `index_img`

to get access to components images in the probabilistic atlas, but I guess that you already knew that ?

HTH,

Bertrand

Hi!

Basically I want a binary mask of the whole amygdala to use it for datadriven rs-fMRI clustering.

The problem was that the Jülich prob atlas’ Amygdala subregions are overlapping and I wanted to ask if there is some nilearn algorithm that melts multiple volumes down into one single volume - while coping with the overlapping signals in the same voxel. But on second thought that sounds a bit difficult to do.

In the mean time I found out about `nilearn.image.math_img`

which was very useful.

I solved the issue by thresholding every single subregion, sum them up with `nilearn.image.math_img`

and *then* binarizing the image.

Thank you for your help!