jazzon wrote:
In the end, 65 channels are created each one representing a mask which will show a given altitude and all points above that altitude (or if applied reversed, all points below that altitude) in 1000 foot increments.
My problem lies in identifying the clusters.
If I understand you correctly, it is not necessary to identify the clusters; you want to identify the levels.
Consider the following XCF file (use the "Original file" download link):
http://barn.kerosenecow.net/u/saul/m/contour-map-xcf/Starting with a solid noise rendering, I used "Colors->Posterize..." to create 6 levels (this would be changed to 65 levels for your example). I did an "Colors->Auto->Equalize" just to give a more even distribution -- this should not be done if you are using actual map data.
I then figured out the values of the six colors (i.e., 0, 51, 102, 153, 204, and 255) and, after ensuring nothing was selected, looped through them from brightest (255) to darkest (0), each time through the loop adding the region of the current color to the selection and saving the selection to a new channel. The first time through the loop, all of the white regions are selected, the second time through all of the regions with color [204, 204, 204] are added to the selection, third time [153, 153, 153], and so on.
The Script-fu code for this loop is (
shades is a list of the six colors):
(let loop ((levels (reverse shades))
(channels '()))
(if (null? (cdr levels))
(reverse channels)
(begin
(gimp-image-select-color image CHANNEL-OP-ADD posterized (make-list 3 (car levels)))
(loop (cdr levels) (cons (car (gimp-selection-save image)) channels)))))
In the XCF file, you will see the five channels that are generated.
Attachment:
SScontour-masks.png [ 7.69 KiB | Viewed 1887 times ]
EDIT: I screwed up the labels of the channels in the above screenshot (there should be no '=' signs), nonetheless the masks themselves are correct and the approach should be explained sufficiently for you to confirm or deny whether this is satisfactory for your needs.