A method of calibrating, in a scanning probe microscopy system, an optical microscope configured for providing a reference data for positioning a probe tip on a surface of a substrate, wherein the calibration is performed using a calibration structure being a spatial structure including features at different Z-levels relative to a Z-axis, the Z-axis being perpendicular to the surface of the substrate, wherein the method comprises the steps of:
- obtaining, with the optical microscope, at least two images of at least a part of the calibration structure, wherein the at least two images are focused in at least two different levels of the Z-levels;
- and
- determining a lateral shift, in a direction perpendicular to the Z-axis, of the calibration structure as depicted in the at least two images focused in the at least two different levels.