An imaging apparatus with a wavefront controller and a method for controlling the apparatus. Sending control data based on a first setting to the wavefront controller to adjust an irradiation wavefront so as to set a beam shape of the irradiation beam of light. Receiving data that is representative of a wavefront of measurement light. Sending updated control data to the wavefront controller to readjust the irradiation wavefront based on the measurement wavefront data while at the same time also using the wavefront controller to control the beam shape of the irradiation beam of light based on the first setting.