Is it possible to pass a variable to math_img? E.g.:
threshold = 3
mask = math_img ('img > threshold', img=t_img, threshold=threshold)
I also want to binarize a nifti file to use it later as a mask for NiftiMasker but I need the treshold to be a variable so that it can be optimized in nested cross validation. Currently I use img_threshold to set every value below the threshold to zero and after that I set every ‘left over’ value which is not zero to one. I find this pretty inconvenient and it would be nice to have a function such as math_img which also accepts variables.