1. A method of generating a composite image of a non-flat surface of a test object using a microscope, the method comprising: acquiring, using the microscope, a plurality of three-dimensional images of different areas of the non-flat surface, where each image comprises a region of overlap with at least one adjacent image, the microscope having sufficient resolution to image in the overlap region and in three dimensions a microstructure on the non-flat surface having a lateral dimension of 10 microns or less and a height of 10 nm or less; identifying, for each region of overlap, a corresponding microstructure having a lateral dimension of 10 microns or less and a height of 10 nm or less; determining, for each of the images, a set of rigid body parameters relating a position and an orientation of the test object in the image to a common coordinate system, where the set of rigid body parameters is determined by fitting the resolved microstructure in the overlap region in the image with the corresponding microstructure in the overlap region of the adjacent image, wherein fitting the resolved microstructure in the overlap region in the image with the corresponding microstructure in the overlap region of the adjacent image is performed for a series of adjacent image pairs, and wherein, for each adjacent image pair, the fitting results in an intermediate set of rigid body parameters relating a relative position and orientation of the test object between the images in the image pair; performing a global optimization to obtain a final set of rigid body parameters that best matches the intermediate sets of parameters; and combining the plurality of images based on the final set of rigid body parameters to generate a composite image of the surface.