1. A computer implemented method for determining the optimal focal height for a plurality of objective lens locations in a virtual microscopy system prior to scanning a microscope slide, the virtual microscopy system having an objective lens coupled to a line scan camera and a stage for supporting a microscope slide, the method comprising: moving the stage in a direction orthogonal to the objective lens; continuously adjusting the height of the objective lens relative to the stage while the stage is in motion; scanning an image of an area on the microscope slide while the stage is moving in a direction orthogonal to the objective lens and while continuously adjusting the height of the objective lens relative to the stage along a predetermined path while the stage is in motion, wherein the predetermined path is one of sinusoidal, triangular, and saw-tooth; determining a plurality of objective lens locations having the greatest contrast in the scanned image, wherein an objective lens location comprises a planar location on the microscope slide and a height of the objective lens; combining a plurality of objective lens locations into a non-planar focal surface, wherein an objective lens height on the focal surface at other than the plurality of objective lens locations is estimate; and adjusting the height of the objective lens, using a processor, according to the non-planar focal surface during subsequent scanning of the microscope slide.