Large-scale surveys have brought about a revolution in astronomy. To analyse the resulting wealth of data, we need automated tools to identify, classify, and quantify the important underlying structures. We present here a method for classifying and quantifying a pixelated structure, based on its principal moments of inertia. The method enables us to automatically detect, and objectively compare, centrally condensed cores, elongated filaments, and hollow rings. We illustrate the method by applying it to (i) observations of surface density from Hi-GAL, and (ii) simulations of filament growth in a turbulent medium. We limit the discussion here to 2D data; in a future paper, we will extend the method to 3D data.