A method of manipulating a focused light beam, the method comprising: focusing a beam of excitation light with a lens to a focal spot within a sample, wherein a cross-section of the beam at a rear pupil of the lens includes a plurality of individual beamlets (308, 310, 312, 316, 318, 320); changing a location of the focal spot to a plurality of different positions within the sample; detecting emission light emitted from the focal spot when the focal spot is at the different positions; generating an image of the sample based on the detected emission light from the different positions of the focal spot; and, when the focal spot is at the different position, characterised in that: while the plurality of the beamlets illuminate the rear pupil, individually varying, with the wavefront modulating element, directions of the individual beamlets of the excitation beam at the rear pupil of the lens_as directions of the other beamlets of the plurality of beamlets remain fixed; while the plurality of the beamlets illuminate the rear pupil, detecting emission light emitted from the focal spot while the directions of the individual beamlets are varied as the directions of the other beamlets of the plurality of beamlets remain fixed; while the plurality of the beamlets illuminate the rear pupil, based on the detected emission light, controlling the directions of the individual beamlets at the rear pupil of the lens to either maximize or minimize the emission light from the focal spot; while the plurality of the beamlets illuminate the rear pupil, individually varying, with the wavefront modulating element, relative phases of the individual beamlets of the excitation beam at the rear pupil of the lens while phases of the other beamlets of the plurality of beamlets remain fixed; while the plurality of the beamlets illuminate the rear pupil, detecting emission light emitted from the focal spot while the relative phases of the individual beamlets are varied as the phases of the other beamlets of the plurality of beamlets remain fixed; and while the plurality of the beamlets illuminate the rear pupil, based on the detected emission light emitted from the focal spot while the relative phases of the individual beamlets are varied, controlling the relative phases of individual beamlets at the rear pupil of the lens to increase the emission light from the focal spot. while the plurality of the beamlets illuminate the rear pupil, individually varying, with the wavefront modulating element, directions of the individual beamlets of the excitation beam at the rear pupil of the lens_as directions of the other beamlets of the plurality of beamlets remain fixed; while the plurality of the beamlets illuminate the rear pupil, detecting emission light emitted from the focal spot while the directions of the individual beamlets are varied as the directions of the other beamlets of the plurality of beamlets remain fixed; while the plurality of the beamlets illuminate the rear pupil, based on the detected emission light, controlling the directions of the individual beamlets at the rear pupil of the lens to either maximize or minimize the emission light from the focal spot; while the plurality of the beamlets illuminate the rear pupil, individually varying, with the wavefront modulating element, relative phases of the individual beamlets of the excitation beam at the rear pupil of the lens while phases of the other beamlets of the plurality of beamlets remain fixed; while the plurality of the beamlets illuminate the rear pupil, detecting emission light emitted from the focal spot while the relative phases of the individual beamlets are varied as the phases of the other beamlets of the plurality of beamlets remain fixed; and while the plurality of the beamlets illuminate the rear pupil, based on the detected emission light emitted from the focal spot while the relative phases of the individual beamlets are varied, controlling the relative phases of individual beamlets at the rear pupil of the lens to increase the emission light from the focal spot.