1. A method for image processing, comprising: providing a microscopic image of a structure fabricated on a substrate and computer-aided design (CAD) data used in fabricating the structure; processing the microscopic image by a computer so as to generate a first directionality map, which comprises, for a matrix of points in the microscopic image, respective directionality vectors corresponding to magnitudes and directions of edges at the points irrespective of a sign of the magnitudes; processing the CAD data by the computer so as to produce a simulated image based on the CAD data and to generate a second directionality map based on the simulated image; and comparing the first and second directionality maps by the computer so as to register the microscopic image with the CAD data.