Ah! Substitution Rule Number 2. Neither the techical reference name nor tutorial name seem conversant with the notion that a $
-prefixed selection name resolves to the highest-value image index that is encompassed by the named selection. Being by nature terse, I suppose one might excuse the technical reference, but the tutorial needs upgrading. Throw another one on the TODO list (clunk!).
gmic 1,1,1,3,[127,127,127] name Gray echo "Select Gray: "\$Gray
[gmic]-0./ Start G'MIC interpreter.
[gmic]-0./ Input image at position 0, with values '[127,127,127]' (1 image 1x1x1x3).
[gmic]-1./ Set name of image [0] to 'Gray'.
[gmic]-1./ Select gray: 0
[gmic]-1./ Display image [0] = 'Gray'.
[0] = 'Gray':
size = (1,1,1,3) [12 b of floats].
data = (127 ^ 127 ^ 127).
min = 127, max = 127, mean = 127, std = 0, coords_min = (0,0,0,0), coords_max = (0,0,0,0).
[gmic]-1./ End G'MIC interpreter.
The image indices encompassed by named selections track the repositioning of constituent images, and the substitution form reflects such resequencing:
$ gmic 1,1,1,3,[127,127,127] name Gray [Gray]x4 name[1--1:2] LightPink name[2--1:2] DarkGreen fill_color[LightPink] 255,188,250 fill_color[DarkGreen] 79,107,53 echo "Select Gray: "\$Gray echo "Select LightPink: "\$LightPink echo "Select DarkGreen: "\$DarkGreen -d0 -luminance sort_list +,i echo "$Select Gray: "\$Gray echo "Select LightPink: "\$LightPink echo "Select DarkGreen: "\$DarkGreen -d0
$ gmic 1,1,1,3,[127,127,127] name Gray [Gray]x4 name[1--1:2] LightPink name[2--1:2] DarkGreen fill_color[LightPink] 255,188,250 fill_color[DarkGreen] 79,107,53 echo "Select Gray: "\$Gray echo "Select LightPink: "\$LightPink echo "Select DarkGreen: "\$DarkGreen -d0 -luminance sort_list +,i echo "$Select Gray: "\$Gray echo "Select LightPink: "\$LightPink echo "Select DarkGreen: "\$DarkGreen -d0
[gmic]-0./ Start G'MIC interpreter.
[gmic]-0./ Input image at position 0, with values '[127,127,127]' (1 image 1x1x1x3).
[gmic]-1./ Set name of image [0] to 'Gray'.
[gmic]-1./ Input 4 copies of image [0] at position 1 (4 images [0] = 1x1x1x3, (...),[3] = 1x1x1x3).
[gmic]-5./ Set names of images [1,3] to 'LightPink'.
[gmic]-5./ Set names of images [2,4] to 'DarkGreen'.
[gmic]-2./ Fill images [1,3] with color (255,188,250).
[gmic]-2./ Fill images [2,4] with color (79,107,53).
[gmic]-5./ Select Gray: 0
[gmic]-5./ Select LightPink: 3
[gmic]-5./ Select DarkGreen: 4
[gmic]-5./ Start interactive display of 2d images [0,1,2,3,4].
[gmic]-5./d0/_display2d/ Print images [0,1,2,3,4] = 'Gray, (...), DarkGreen'.
[0] = 'Gray':
size = (1,1,1,3) [12 b of floats].
data = (127 ^ 127 ^ 127).
min = 127, max = 127, mean = 127, std = 0, coords_min = (0,0,0,0), coords_max = (0,0,0,0).
[1] = 'LightPink':
size = (1,1,1,3) [12 b of floats].
data = (255 ^ 188 ^ 250).
min = 188, max = 255, mean = 231, std = 37.3229, coords_min = (0,0,0,1), coords_max = (0,0,0,0).
[2] = 'DarkGreen':
size = (1,1,1,3) [12 b of floats].
data = (79 ^ 107 ^ 53).
min = 53, max = 107, mean = 79.6667, std = 27.0062, coords_min = (0,0,0,2), coords_max = (0,0,0,1).
[3] = 'LightPink':
size = (1,1,1,3) [12 b of floats].
data = (255 ^ 188 ^ 250).
min = 188, max = 255, mean = 231, std = 37.3229, coords_min = (0,0,0,1), coords_max = (0,0,0,0).
[4] = 'DarkGreen':
size = (1,1,1,3) [12 b of floats].
data = (79 ^ 107 ^ 53).
min = 53, max = 107, mean = 79.6667, std = 27.0062, coords_min = (0,0,0,2), coords_max = (0,0,0,1).
[gmic]-5./ Compute luminance of images [0,1,2,3,4].
[gmic]-5./ Sort list of images [0,1,2,3,4] in ascending order, according to the image criterion 'i'.
[gmic]-5./ Gray: 2
[gmic]-5./ Select LightPink: 4
[gmic]-5./ Select DarkGreen: 1
[gmic]-5./ Start interactive display of 2d images [0,1,2,3,4].
[gmic]-5./d0/_display2d/ Print images [0,1,2,3,4] = 'DarkGreen, (...), LightPink'.
[0] = 'DarkGreen':
size = (1,1,1,1) [4 b of floats].
data = (99.0701).
min = 99.0701, max = 99.0701, mean = 99.0701, std = 0, coords_min = (0,0,0,0), coords_max = (0,0,0,0).
[1] = 'DarkGreen':
size = (1,1,1,1) [4 b of floats].
data = (99.0701).
min = 99.0701, max = 99.0701, mean = 99.0701, std = 0, coords_min = (0,0,0,0), coords_max = (0,0,0,0).
[2] = 'Gray':
size = (1,1,1,1) [4 b of floats].
data = (127).
min = 127, max = 127, mean = 127, std = 0, coords_min = (0,0,0,0), coords_max = (0,0,0,0).
[3] = 'LightPink':
size = (1,1,1,1) [4 b of floats].
data = (209.488).
min = 209.488, max = 209.488, mean = 209.488, std = 0, coords_min = (0,0,0,0), coords_max = (0,0,0,0).
[4] = 'LightPink':
size = (1,1,1,1) [4 b of floats].
data = (209.488).
min = 209.488, max = 209.488, mean = 209.488, std = 0, coords_min = (0,0,0,0), coords_max = (0,0,0,0).
[gmic]-5./ End G'MIC interpreter.
Is it possible to programmatically resolve the (possible) vector which a named selection could represent? For example, above, the named selection “LightPink” initially represented a vector of image indices [1,3], and after sorting, that name selection became vector [3,4], reflecting the repositioning of members of the selection. I could imagine circumstances where I could make use of obtaining such dynamically changing vectors, as in: “Where are the members of “LightGreen” now on the image list?”