G'MIC - GREYC's Magic for Image Computing: A Full-Featured Open-Source Framework for Image Processing
Banner Institutions GREYC CNRS ENSICAEN UNICAEN

A Full-Featured Open-Source Framework for Image Processing



Latest stable version: 4.0.4 (2026/08/19)

Reference
Table of Contents  ▸  List of Commands  ▸  Reptorian's Commands  ▸  rep_str2bin_struct◀  x_whirl    |    rep_ls  ▶

rep_str2bin_struct

No arguments

Description:

Create a binary tree image from a control string as interpreted by BinArbor coding language

 
(Also made by Reptorian.).
 
Control characters:
  ^ = Move to parent node.
  < = Create left child if needed, then move to it.
  > = Create right child if needed, then move to it.
  : = Create missing left/right children without moving.
  ~ = Move to sibling branch. Creates sibling if missing.
  * = Move to current subtree root.*
  + = Move upward along same branch direction.
  - = Move downward along same branch direction.
 
  *A subtree root is the node where the current local branch context began.
 
Random leaf navigation:
  ( = Move to random node missing a left child.
  ) = Move to random node missing a right child.
  | = Move to random node missing either child.
 
Expressions and local branching:
  {...} = Evaluate expression and store result in node.
  [...] = Evaluate inside local subtree context.
 
Variables:
  name  = Assign current node to variable name.*
  @name = Move to variable node.
 
Cannot begin with _ or a number!
Repeat loops:
  N{...} = Repeat enclosed block N times.
  N... = Repeat next section until ''.
 
Expression Functions:
  dir()  = Return current branch direction.
           Error at subtree root.
 
  root() = Return value of current subtree root.
           Error at subtree root.
 
  L()    = Return value of left child.
           Error if no left child exists.
 
  R()    = Return value of right child.
           Error if no right child exists.
 
  For this implementation, all G'MIC JIT expressions are supported.
 
Ignored characters:
  space, newline, /
 
Output Binary tree node layout:
  0 = parent index*
  1 = left child index
  2 = right child index
  3 = depth level
  4+ = stored values (if vector_size > 0)
 
 *For the very first pixel at the top, parent index is actually maximum depth level
 
Example:
 
  <>~:
 
Produces:
      o
     /
    o
   /
  o   o
 /
o   o
 
Author: Reptorian.
G'MIC - GREYC's Magic for Image Computing: A Full-Featured Open-Source Framework for Image Processing

G'MIC is an open-source software distributed under the CeCILL free software licenses (LGPL-like and/or
GPL-compatible). Copyrights (C) Since July 2008, David Tschumperlé - GREYC UMR CNRS 6072, Image Team.