Check shape and affine in masking.apply_mask