Gray matter mask per functional run

Hi everyone,

I would like to generate a gray matter mask in T1w space, similar to the ./func/ files that are automatically created by fMRIPrep for each individual run. Which steps are needed to achieve that goal?

I still didn’t manage to generate such a mask. Does anyone have any insights into this?