Retrieval of crystal defect structures from HREM images by simulated evolution I. Basic technique