A device for transforming a charged particle beam between a coherent superposition of helical modes and a coherent superposition of plane wave modes, the device comprising a first phase changing element and a second phase changing element arranged along a beam axis (z, 60) at conjugate Fourier planes of a lens system, each of said first and second phase changing elements (20, 40) being configured to introduce a respective phase on the charged particle beam, the device being characterized in that the first phase changing element is a magnetostatic element comprising: - a first conductor (25; 25') configured to be flown by an electric current, said first conductor comprising at least one conductor portion (25a; 25a'; 25a, 25d) oriented such that flow direction of the electric current has a component parallel to the beam axis (z, 60), or - a first permanent magnet having uniform magnetization orthogonal to the beam axis (z, 60), said first permanent magnet being shaped such that flow direction of an equivalent surface current flowing along a peripheral surface portion of the first permanent magnet has a component parallel to the beam axis (z, 60); or in that the second phase changing element is a magnetostatic element comprising: - a periodic array of second conductors configured to be flown by respective electric currents in an alternating manner with respect to each other, each second conductor of the periodic array of second conductors comprising at least one conductor portion oriented such that flow direction of the respective electric current has a component parallel to the beam axis (z, 60), or - a periodic array of second permanent magnets with alternating, uniform magnetizations orthogonal to the beam axis (z, 60), each second permanent magnet of the periodic array of second permanent magnets being shaped such that flow direction of an equivalent surface current flowing along a peripheral surface portion of the second permanent magnet has a component parallel to the beam axis (z, 60). a first phase changing element and a second phase changing element arranged along a beam axis (z, 60) at conjugate Fourier planes of a lens system, each of said first and second phase changing elements (20, 40) being configured to introduce a respective phase on the charged particle beam, the device being characterized in that the first phase changing element is a magnetostatic element comprising: - a first conductor (25; 25') configured to be flown by an electric current, said first conductor comprising at least one conductor portion (25a; 25a'; 25a, 25d) oriented such that flow direction of the electric current has a component parallel to the beam axis (z, 60), or - a first permanent magnet having uniform magnetization orthogonal to the beam axis (z, 60), said first permanent magnet being shaped such that flow direction of an equivalent surface current flowing along a peripheral surface portion of the first permanent magnet has a component parallel to the beam axis (z, 60); or - a first conductor (25; 25') configured to be flown by an electric current, said first conductor comprising at least one conductor portion (25a; 25a'; 25a, 25d) oriented such that flow direction of the electric current has a component parallel to the beam axis (z, 60), or - a first permanent magnet having uniform magnetization orthogonal to the beam axis (z, 60), said first permanent magnet being shaped such that flow direction of an equivalent surface current flowing along a peripheral surface portion of the first permanent magnet has a component parallel to the beam axis (z, 60); or in that the second phase changing element is a magnetostatic element comprising: - a periodic array of second conductors configured to be flown by respective electric currents in an alternating manner with respect to each other, each second conductor of the periodic array of second conductors comprising at least one conductor portion oriented such that flow direction of the respective electric current has a component parallel to the beam axis (z, 60), or - a periodic array of second permanent magnets with alternating, uniform magnetizations orthogonal to the beam axis (z, 60), each second permanent magnet of the periodic array of second permanent magnets being shaped such that flow direction of an equivalent surface current flowing along a peripheral surface portion of the second permanent magnet has a component parallel to the beam axis (z, 60). - a periodic array of second conductors configured to be flown by respective electric currents in an alternating manner with respect to each other, each second conductor of the periodic array of second conductors comprising at least one conductor portion oriented such that flow direction of the respective electric current has a component parallel to the beam axis (z, 60), or - a periodic array of second permanent magnets with alternating, uniform magnetizations orthogonal to the beam axis (z, 60), each second permanent magnet of the periodic array of second permanent magnets being shaped such that flow direction of an equivalent surface current flowing along a peripheral surface portion of the second permanent magnet has a component parallel to the beam axis (z, 60).