Context : The ubiquitous presence of filamentary structures in the interstellar medium asks for an unbiased characterization of their properties including a stability analysis . Aims : We propose a novel technique to measure the spectrum of filaments in any two-dimensional data set . By comparing the power in isotropic and anisotropic structures we can measure the relative importance of spherical and cylindrical collapse modes . Methods : Using anisotropic wavelets we can quantify and distinguish local and global anisotropies and measure the size distribution of filaments . The wavelet analysis does not need any assumptions on the alignment or shape of filaments in the maps , but directly measures their typical spatial dimensions . In a rigorous test program , we calibrate the scale-dependence of the method and test the angular and spatial sensitivity . We apply the method to molecular line maps from magneto-hydrodynamic ( MHD ) simulations and observed column density maps from Herschel observations . Results : When applying the anisotropic wavelet analysis to the MHD data , we find that the observed filament sizes depend on the combination of magnetic-field dominated density-velocity correlations with radiative transfer effects . This can be exploited by observing tracers with different optical depth to measure the transition from a globally ordered large-scale structure to small-scale filaments with entangled field lines . The unbiased view to Herschel column density maps does not confirm a universal characteristic filament width . The map of the Polaris Flare shows an almost scale-free filamentary spectrum up to the size of the dominating filament of about 0.4 pc . For the Aquila molecular cloud the range of filament widths is limited to 0.05–0.2 pc . The filaments in Polaris show no preferential direction in contrast to the global alignment that we trace in Aquila . Conclusions : By comparing the power in isotropic and anisotropic structures we can measure the relative importance of spherical and cylindrical collapse modes and their spatial distribution .