Method of forming an image of a sample at a sample position by scanning a finely focused beam of charged particles over the sample, as a result of which backscattered electrons emerge from the sample, the image formed by detecting backscattered electrons, the beam focused by a compound charged particle lens, the compound lens showing • a symmetry axis; • a first magnetic lens pole near the sample position and a second magnetic lens pole more removed from the sample position; • a first coil for generating a focusing magnetic field between the first magnetic lens pole and the second magnetic lens pole; • a second lens coil for generating a focusing immersion magnetic field between the first magnetic lens pole and the sample position; and • an electrode with a central hole, the central hole for passing the beam of charged particles through the lens to the sample, the electrode for generating a decelerating electric field between the lens and the sample by applying a voltage difference between the electrode and the sample; the compound lens thus having at least three parameters to determine the focal strength of the compound lens; the compound lens comprising an electron detector showing a sensitive surface with a central hole, the sensitive surface coinciding with and electrically forming a part of the electrode; the method comprising • exciting the immersion coil, the lens coil and the decelerating electric field of the compound lens so that o the finely focused beam is focused at the sample; and o the voltage difference of the sample is a predetermined voltage difference; and • detecting backscattered electrons impacting on the detector, the backscattered electrons emerging from the sample with a selected angle α and a selected energy E, with α the angle with which the backscattered electrons leave the sample with respect to the symmetry axis of the compound lens, and E the energy with which the backscattered electrons leave the sample; characterized in that • the electron detector is equipped to distinguish backscattered electrons of a first group and a second group, the first group impacting on the detector closer to the symmetry axis than the second group, the backscattered electrons from the first group having different combinations of α and E than electrons of the second group; and • the ratio of exciting the first coil and the second coil is used to control the part of the backscattered electrons belonging to the first group and the part of the backscattered electrons belonging to the second group, while keeping the beam focused on the sample. • a symmetry axis; • a first magnetic lens pole near the sample position and a second magnetic lens pole more removed from the sample position; • a first coil for generating a focusing magnetic field between the first magnetic lens pole and the second magnetic lens pole; • a second lens coil for generating a focusing immersion magnetic field between the first magnetic lens pole and the sample position; and • an electrode with a central hole, the central hole for passing the beam of charged particles through the lens to the sample, the electrode for generating a decelerating electric field between the lens and the sample by applying a voltage difference between the electrode and the sample; • exciting the immersion coil, the lens coil and the decelerating electric field of the compound lens so that o the finely focused beam is focused at the sample; and o the voltage difference of the sample is a predetermined voltage difference; and o the finely focused beam is focused at the sample; and o the voltage difference of the sample is a predetermined voltage difference; and • detecting backscattered electrons impacting on the detector, the backscattered electrons emerging from the sample with a selected angle α and a selected energy E, with α the angle with which the backscattered electrons leave the sample with respect to the symmetry axis of the compound lens, and E the energy with which the backscattered electrons leave the sample; • the electron detector is equipped to distinguish backscattered electrons of a first group and a second group, the first group impacting on the detector closer to the symmetry axis than the second group, the backscattered electrons from the first group having different combinations of α and E than electrons of the second group; and • the ratio of exciting the first coil and the second coil is used to control the part of the backscattered electrons belonging to the first group and the part of the backscattered electrons belonging to the second group, while keeping the beam focused on the sample.