Band pass filter only for pixels inside a mask

Thanks. Is there a way to have the effect of the filter as if it was applied with its center as the center of rectangle mask.