A method, controller, and medium to control an adaptive optics scanning laser ophthalmoscope. Receiving from the ophthalmoscope a plurality of wavefront elements. Each element may be associated with an area of a beam of light received from a fundus. Each element includes shape data. The shape data represents a shape of a wavefront in a area of the beam. Each element includes status data. The status data is a confidence indicator of ability of the shape data to represent the shape of the wavefront with a particular level of accuracy. Calculating control data based on the shape data in the wavefront data and local gain. The local gain includes local gain elements. Each local gain elements is adjusted based on status data. Using the control data to adjust a shape of an illumination wavefront of an illumination beam used to illuminate the fundus.