Mask filter effect?

Does anyone know if it’s possible to mask filters? Attached an example of what I mean. Can you apply an effect on the image and then mask the text like that without filter? And without duplicating the image?