Measuring habitat complexity and spatial heterogeneity in ecology