I know you ask for this to be done in python3, but I will mention that AFNI has 3dRSFC for calculating RSFC parameters such as ALFF, fALFF, sigma_RSFC, etc. I has a -mask .. option to allow you to apply a mask.
Note that if you have applied censoring/scrubbing in your dataset, then you have to use a program that can handle having non-regular time points. This is an issue because ALFF is defined typically using the frequency spectrum, which is generally calculated via the Fourier Transform, which in turn assumes that the input time series have exactly uniform sampling. FMRI datasets have constant TR, but censoring/scrubbing effectively makes temporal sampling irregular meaning that you can no longer apply the FT.
So, in AFNI we have the following pair of programs that can still be used in tandem to estimate RSFC parameters in this case: 3dLombScargle and 3dAmpToRSFC. (The Lomb-Scargle transform is effectively a generalization of the Fourier Transform, applicable with non-systematically-missing data—thanks, astrophysicists!).
Further related to processing, you might be fine estimating ALFF if you have bandpassed your data to low frequency fluctuations (LFFs) in a common range of approx. 0.01-0.1 Hz. Actually, the standard deviation of your time series will closely relate to ALFF then because you should only have power in those frequencies, as long as you did simultaneous bandpassing and regressing. However, to estimate fALFF, you must not have included bandpassing in your time series analysis.
So, this is probably a longer email than you wanted, and it still isn’t providing a python3-based program as you had asked—my apologies!
I think you might want to calculate ALFF in each voxel, and then take the average across the ROI? To do so,
You will want to have both your final, processed FMRI data and the Shen atlas in the same space and on the same grid (check/verify with 3dinfo -same_all_grid -prefix DSET_FMRI DSET_SHEN)
Then, depending on how you processed your FMRI data (e.g. including censoring or not), you would calculated ALFF per voxel:
with 3dRSFC, if no censoring was used
with 3dLombScarge+3dAmpToRSFC, if censoring was used.
Then you could used 3dROIstats to get the average ALFF value within each ROI.