1. A method of performing adaptive optics correction of an eye, the method comprising the steps of: a. causing light to enter the eye; b. receiving a first image of the light emitted or reflected from the eye; c. computing a first image quality metric value for at least a portion of the first received image; d. using an optimization algorithm that is based on an image quality metric to adjust a first correcting element to increase the computed image quality metric value for at least a portion of subsequently received images of the eye, wherein the optimization algorithm is a stochastic parallel gradient descent algorithm, wherein the stochastic parallel gradient descent algorithm is defined as: 
 u i k+1 =u i k +Γ(Δ J k )(δ u i k ) wherein Γ is a gain parameter that determines the amount of voltage change applied to the first correcting element in response to a computed image quality metric value, u i k is a control signal for an actuator that controls the first correcting element, δu i k is a random perturbation applied to the control signal, and ΔJ k is a computed image quality metric value; e. receiving a second image of the light emitted or reflected from the eye; f. computing a second image quality metric value for at least a portion of the second received image; and g. repeating steps a through f until a computed image quality metric value reaches a predefined value.