An algorithm for centroid detection in an image, comprising: a) acquiring an XxY size wavefront image represented by a variable pixel signal intensity containing a plurality of spots; b) compressing the XxY size wavefront image to an X/n x Y/m size image, where n, m equal any integers and X/n, Y/m are integer values; c) determining a background intensity for any position in the compressed image and subtracting this background from the compressed image; d) detecting a plurality of approximately positioned centroids in the background subtracted compressed image comprising: da) determining a maximum signal value in the image; db) setting a threshold value as a predetermined percentage of the maximum; dc) determining an X-position, a Y-position, and a signal strength of each pixel that has a signal strength greater than the threshold value; dd) sorting the values from step (c) in descending order of signal strength; de) assigning the highest signal strength as first approximately positioned centroid; and df) selecting a pre-set condition for defining all sorted values as approximately positioned centroids, which obey the pre-set condition, wherein the pre-set condition is that the position of each subsequent approximately positioned centroid is a farther distance away than a pre-set distance from all yet determined approximately positioned centroids; e) iterating step (d) until approximate positions of a desired plurality of centroids are detected; f) converting the approximate position of the desired plurality of centroids into more exact positions in the XxY size wavefront image, whereby every centroid position in the image has been identified. a) acquiring an XxY size wavefront image represented by a variable pixel signal intensity containing a plurality of spots; b) compressing the XxY size wavefront image to an X/n x Y/m size image, where n, m equal any integers and X/n, Y/m are integer values; c) determining a background intensity for any position in the compressed image and subtracting this background from the compressed image; d) detecting a plurality of approximately positioned centroids in the background subtracted compressed image comprising: da) determining a maximum signal value in the image; db) setting a threshold value as a predetermined percentage of the maximum; dc) determining an X-position, a Y-position, and a signal strength of each pixel that has a signal strength greater than the threshold value; dd) sorting the values from step (c) in descending order of signal strength; de) assigning the highest signal strength as first approximately positioned centroid; and df) selecting a pre-set condition for defining all sorted values as approximately positioned centroids, which obey the pre-set condition, wherein the pre-set condition is that the position of each subsequent approximately positioned centroid is a farther distance away than a pre-set distance from all yet determined approximately positioned centroids; da) determining a maximum signal value in the image; db) setting a threshold value as a predetermined percentage of the maximum; dc) determining an X-position, a Y-position, and a signal strength of each pixel that has a signal strength greater than the threshold value; dd) sorting the values from step (c) in descending order of signal strength; de) assigning the highest signal strength as first approximately positioned centroid; and df) selecting a pre-set condition for defining all sorted values as approximately positioned centroids, which obey the pre-set condition, e) iterating step (d) until approximate positions of a desired plurality of centroids are detected; f) converting the approximate position of the desired plurality of centroids into more exact positions in the XxY size wavefront image,