An optimized and flexible configuration for the magnetic filter in the SPIDER experiment