In order to prepare raw data from scanning transmission electron microscopy for analysis, pattern detection algorithms are developed that allow to identify automatically higher-order feature such as crystalline grains, lattice defects, etc. from atomically resolved measurements.