Calculate the binary reference image using k-means clustering. K-Means is run on the first npcs principal components to speed up the calculations.
npcs
Useful links