Image registration by matching relational structures