1. A method comprising: receiving image data; in a first operating mode yielding first merged regions: identifying spatially adjacent regions in the image data; merging spatially adjacent regions having a spectral similarity above a minimum spectral similarity threshold; in a second operating mode yielding second merged regions: computing a spectral similarity value for all regions, including spatially non-adjacent regions and spatially adjacent regions, in the image data having at least a minimum number of pixels; weighting the minimum spectral similarity threshold to yield a weighted minimum spectral similarity threshold; merging spatially non-adjacent regions by comparing respective spectral similarity values to the weighted minimum spectral similarity threshold; and outputting a combination of the first merged regions and the second merged regions.