Commit a946bee1 authored by Baptiste Esteban's avatar Baptiste Esteban
Browse files

Merge branch 'development/alphatree' into 'next'

Improve alphatree in the library

See merge request !116
parents e1be240d 038e22a5
Pipeline #28327 passed with stages
in 26 minutes and 24 seconds
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="127.9pt" height="267.725pt" viewBox="0 0 127.9 267.725" version="1.1">
<defs>
<g>
<symbol overflow="visible" id="glyph0-0">
<path style="stroke:none;" d=""/>
</symbol>
<symbol overflow="visible" id="glyph0-1">
<path style="stroke:none;" d="M 4.578125 -3.1875 C 4.578125 -3.984375 4.53125 -4.78125 4.1875 -5.515625 C 3.734375 -6.484375 2.90625 -6.640625 2.5 -6.640625 C 1.890625 -6.640625 1.171875 -6.375 0.75 -5.453125 C 0.4375 -4.765625 0.390625 -3.984375 0.390625 -3.1875 C 0.390625 -2.4375 0.421875 -1.546875 0.84375 -0.78125 C 1.265625 0.015625 2 0.21875 2.484375 0.21875 C 3.015625 0.21875 3.78125 0.015625 4.21875 -0.9375 C 4.53125 -1.625 4.578125 -2.40625 4.578125 -3.1875 Z M 2.484375 0 C 2.09375 0 1.5 -0.25 1.328125 -1.203125 C 1.21875 -1.796875 1.21875 -2.71875 1.21875 -3.3125 C 1.21875 -3.953125 1.21875 -4.609375 1.296875 -5.140625 C 1.484375 -6.328125 2.234375 -6.421875 2.484375 -6.421875 C 2.8125 -6.421875 3.46875 -6.234375 3.65625 -5.25 C 3.765625 -4.6875 3.765625 -3.9375 3.765625 -3.3125 C 3.765625 -2.5625 3.765625 -1.890625 3.65625 -1.25 C 3.5 -0.296875 2.9375 0 2.484375 0 Z M 2.484375 0 "/>
</symbol>
<symbol overflow="visible" id="glyph0-2">
<path style="stroke:none;" d="M 2.9375 -6.375 C 2.9375 -6.625 2.9375 -6.640625 2.703125 -6.640625 C 2.078125 -6 1.203125 -6 0.890625 -6 L 0.890625 -5.6875 C 1.09375 -5.6875 1.671875 -5.6875 2.1875 -5.953125 L 2.1875 -0.78125 C 2.1875 -0.421875 2.15625 -0.3125 1.265625 -0.3125 L 0.953125 -0.3125 L 0.953125 0 C 1.296875 -0.03125 2.15625 -0.03125 2.5625 -0.03125 C 2.953125 -0.03125 3.828125 -0.03125 4.171875 0 L 4.171875 -0.3125 L 3.859375 -0.3125 C 2.953125 -0.3125 2.9375 -0.421875 2.9375 -0.78125 Z M 2.9375 -6.375 "/>
</symbol>
<symbol overflow="visible" id="glyph0-3">
<path style="stroke:none;" d="M 1.265625 -0.765625 L 2.328125 -1.796875 C 3.875 -3.171875 4.46875 -3.703125 4.46875 -4.703125 C 4.46875 -5.84375 3.578125 -6.640625 2.359375 -6.640625 C 1.234375 -6.640625 0.5 -5.71875 0.5 -4.828125 C 0.5 -4.28125 1 -4.28125 1.03125 -4.28125 C 1.203125 -4.28125 1.546875 -4.390625 1.546875 -4.8125 C 1.546875 -5.0625 1.359375 -5.328125 1.015625 -5.328125 C 0.9375 -5.328125 0.921875 -5.328125 0.890625 -5.3125 C 1.109375 -5.96875 1.65625 -6.328125 2.234375 -6.328125 C 3.140625 -6.328125 3.5625 -5.515625 3.5625 -4.703125 C 3.5625 -3.90625 3.078125 -3.125 2.515625 -2.5 L 0.609375 -0.375 C 0.5 -0.265625 0.5 -0.234375 0.5 0 L 4.203125 0 L 4.46875 -1.734375 L 4.234375 -1.734375 C 4.171875 -1.4375 4.109375 -1 4 -0.84375 C 3.9375 -0.765625 3.28125 -0.765625 3.0625 -0.765625 Z M 1.265625 -0.765625 "/>
</symbol>
<symbol overflow="visible" id="glyph0-4">
<path style="stroke:none;" d="M 2.890625 -3.515625 C 3.703125 -3.78125 4.28125 -4.46875 4.28125 -5.265625 C 4.28125 -6.078125 3.40625 -6.640625 2.453125 -6.640625 C 1.453125 -6.640625 0.6875 -6.046875 0.6875 -5.28125 C 0.6875 -4.953125 0.90625 -4.765625 1.203125 -4.765625 C 1.5 -4.765625 1.703125 -4.984375 1.703125 -5.28125 C 1.703125 -5.765625 1.234375 -5.765625 1.09375 -5.765625 C 1.390625 -6.265625 2.046875 -6.390625 2.40625 -6.390625 C 2.828125 -6.390625 3.375 -6.171875 3.375 -5.28125 C 3.375 -5.15625 3.34375 -4.578125 3.09375 -4.140625 C 2.796875 -3.65625 2.453125 -3.625 2.203125 -3.625 C 2.125 -3.609375 1.890625 -3.59375 1.8125 -3.59375 C 1.734375 -3.578125 1.671875 -3.5625 1.671875 -3.46875 C 1.671875 -3.359375 1.734375 -3.359375 1.90625 -3.359375 L 2.34375 -3.359375 C 3.15625 -3.359375 3.53125 -2.6875 3.53125 -1.703125 C 3.53125 -0.34375 2.84375 -0.0625 2.40625 -0.0625 C 1.96875 -0.0625 1.21875 -0.234375 0.875 -0.8125 C 1.21875 -0.765625 1.53125 -0.984375 1.53125 -1.359375 C 1.53125 -1.71875 1.265625 -1.921875 0.984375 -1.921875 C 0.734375 -1.921875 0.421875 -1.78125 0.421875 -1.34375 C 0.421875 -0.4375 1.34375 0.21875 2.4375 0.21875 C 3.65625 0.21875 4.5625 -0.6875 4.5625 -1.703125 C 4.5625 -2.515625 3.921875 -3.296875 2.890625 -3.515625 Z M 2.890625 -3.515625 "/>
</symbol>
<symbol overflow="visible" id="glyph0-5">
<path style="stroke:none;" d="M 2.9375 -1.640625 L 2.9375 -0.78125 C 2.9375 -0.421875 2.90625 -0.3125 2.171875 -0.3125 L 1.96875 -0.3125 L 1.96875 0 C 2.375 -0.03125 2.890625 -0.03125 3.3125 -0.03125 C 3.734375 -0.03125 4.25 -0.03125 4.671875 0 L 4.671875 -0.3125 L 4.453125 -0.3125 C 3.71875 -0.3125 3.703125 -0.421875 3.703125 -0.78125 L 3.703125 -1.640625 L 4.6875 -1.640625 L 4.6875 -1.953125 L 3.703125 -1.953125 L 3.703125 -6.484375 C 3.703125 -6.6875 3.703125 -6.75 3.53125 -6.75 C 3.453125 -6.75 3.421875 -6.75 3.34375 -6.625 L 0.28125 -1.953125 L 0.28125 -1.640625 Z M 2.984375 -1.953125 L 0.5625 -1.953125 L 2.984375 -5.671875 Z M 2.984375 -1.953125 "/>
</symbol>
<symbol overflow="visible" id="glyph0-6">
<path style="stroke:none;" d="M 4.46875 -2 C 4.46875 -3.1875 3.65625 -4.1875 2.578125 -4.1875 C 2.109375 -4.1875 1.671875 -4.03125 1.3125 -3.671875 L 1.3125 -5.625 C 1.515625 -5.5625 1.84375 -5.5 2.15625 -5.5 C 3.390625 -5.5 4.09375 -6.40625 4.09375 -6.53125 C 4.09375 -6.59375 4.0625 -6.640625 3.984375 -6.640625 C 3.984375 -6.640625 3.953125 -6.640625 3.90625 -6.609375 C 3.703125 -6.515625 3.21875 -6.3125 2.546875 -6.3125 C 2.15625 -6.3125 1.6875 -6.390625 1.21875 -6.59375 C 1.140625 -6.625 1.125 -6.625 1.109375 -6.625 C 1 -6.625 1 -6.546875 1 -6.390625 L 1 -3.4375 C 1 -3.265625 1 -3.1875 1.140625 -3.1875 C 1.21875 -3.1875 1.234375 -3.203125 1.28125 -3.265625 C 1.390625 -3.421875 1.75 -3.96875 2.5625 -3.96875 C 3.078125 -3.96875 3.328125 -3.515625 3.40625 -3.328125 C 3.5625 -2.953125 3.59375 -2.578125 3.59375 -2.078125 C 3.59375 -1.71875 3.59375 -1.125 3.34375 -0.703125 C 3.109375 -0.3125 2.734375 -0.0625 2.28125 -0.0625 C 1.5625 -0.0625 0.984375 -0.59375 0.8125 -1.171875 C 0.84375 -1.171875 0.875 -1.15625 0.984375 -1.15625 C 1.3125 -1.15625 1.484375 -1.40625 1.484375 -1.640625 C 1.484375 -1.890625 1.3125 -2.140625 0.984375 -2.140625 C 0.84375 -2.140625 0.5 -2.0625 0.5 -1.609375 C 0.5 -0.75 1.1875 0.21875 2.296875 0.21875 C 3.453125 0.21875 4.46875 -0.734375 4.46875 -2 Z M 4.46875 -2 "/>
</symbol>
<symbol overflow="visible" id="glyph0-7">
<path style="stroke:none;" d="M 2.3125 -6.671875 C 2.21875 -6.796875 2.21875 -6.8125 2.03125 -6.8125 L 0.328125 -6.8125 L 0.328125 -6.5 L 0.625 -6.5 C 0.765625 -6.5 0.96875 -6.484375 1.109375 -6.484375 C 1.34375 -6.453125 1.359375 -6.4375 1.359375 -6.25 L 1.359375 -1.046875 C 1.359375 -0.78125 1.359375 -0.3125 0.328125 -0.3125 L 0.328125 0 C 0.671875 -0.015625 1.171875 -0.03125 1.5 -0.03125 C 1.828125 -0.03125 2.3125 -0.015625 2.65625 0 L 2.65625 -0.3125 C 1.640625 -0.3125 1.640625 -0.78125 1.640625 -1.046875 L 1.640625 -6.234375 C 1.6875 -6.1875 1.6875 -6.171875 1.734375 -6.109375 L 5.796875 -0.125 C 5.890625 -0.015625 5.90625 0 5.96875 0 C 6.109375 0 6.109375 -0.0625 6.109375 -0.265625 L 6.109375 -5.765625 C 6.109375 -6.03125 6.109375 -6.5 7.140625 -6.5 L 7.140625 -6.8125 C 6.78125 -6.796875 6.296875 -6.78125 5.96875 -6.78125 C 5.640625 -6.78125 5.15625 -6.796875 4.8125 -6.8125 L 4.8125 -6.5 C 5.828125 -6.5 5.828125 -6.03125 5.828125 -5.765625 L 5.828125 -1.5 Z M 2.3125 -6.671875 "/>
</symbol>
<symbol overflow="visible" id="glyph0-8">
<path style="stroke:none;" d="M 4.6875 -2.140625 C 4.6875 -3.40625 3.703125 -4.46875 2.5 -4.46875 C 1.25 -4.46875 0.28125 -3.375 0.28125 -2.140625 C 0.28125 -0.84375 1.3125 0.109375 2.484375 0.109375 C 3.6875 0.109375 4.6875 -0.875 4.6875 -2.140625 Z M 2.5 -0.140625 C 2.0625 -0.140625 1.625 -0.34375 1.359375 -0.8125 C 1.109375 -1.25 1.109375 -1.859375 1.109375 -2.21875 C 1.109375 -2.609375 1.109375 -3.140625 1.34375 -3.578125 C 1.609375 -4.03125 2.078125 -4.25 2.484375 -4.25 C 2.921875 -4.25 3.34375 -4.03125 3.609375 -3.59375 C 3.875 -3.171875 3.875 -2.59375 3.875 -2.21875 C 3.875 -1.859375 3.875 -1.3125 3.65625 -0.875 C 3.421875 -0.421875 2.984375 -0.140625 2.5 -0.140625 Z M 2.5 -0.140625 "/>
</symbol>
<symbol overflow="visible" id="glyph0-9">
<path style="stroke:none;" d="M 3.78125 -0.546875 L 3.78125 0.109375 L 5.25 0 L 5.25 -0.3125 C 4.5625 -0.3125 4.46875 -0.375 4.46875 -0.875 L 4.46875 -6.921875 L 3.046875 -6.8125 L 3.046875 -6.5 C 3.734375 -6.5 3.8125 -6.4375 3.8125 -5.9375 L 3.8125 -3.78125 C 3.53125 -4.140625 3.09375 -4.40625 2.5625 -4.40625 C 1.390625 -4.40625 0.34375 -3.421875 0.34375 -2.140625 C 0.34375 -0.875 1.3125 0.109375 2.453125 0.109375 C 3.09375 0.109375 3.53125 -0.234375 3.78125 -0.546875 Z M 3.78125 -3.21875 L 3.78125 -1.171875 C 3.78125 -1 3.78125 -0.984375 3.671875 -0.8125 C 3.375 -0.328125 2.9375 -0.109375 2.5 -0.109375 C 2.046875 -0.109375 1.6875 -0.375 1.453125 -0.75 C 1.203125 -1.15625 1.171875 -1.71875 1.171875 -2.140625 C 1.171875 -2.5 1.1875 -3.09375 1.46875 -3.546875 C 1.6875 -3.859375 2.0625 -4.1875 2.609375 -4.1875 C 2.953125 -4.1875 3.375 -4.03125 3.671875 -3.59375 C 3.78125 -3.421875 3.78125 -3.40625 3.78125 -3.21875 Z M 3.78125 -3.21875 "/>
</symbol>
<symbol overflow="visible" id="glyph0-10">
<path style="stroke:none;" d="M 1.109375 -2.515625 C 1.171875 -4 2.015625 -4.25 2.359375 -4.25 C 3.375 -4.25 3.484375 -2.90625 3.484375 -2.515625 Z M 1.109375 -2.296875 L 3.890625 -2.296875 C 4.109375 -2.296875 4.140625 -2.296875 4.140625 -2.515625 C 4.140625 -3.5 3.59375 -4.46875 2.359375 -4.46875 C 1.203125 -4.46875 0.28125 -3.4375 0.28125 -2.1875 C 0.28125 -0.859375 1.328125 0.109375 2.46875 0.109375 C 3.6875 0.109375 4.140625 -1 4.140625 -1.1875 C 4.140625 -1.28125 4.0625 -1.3125 4 -1.3125 C 3.921875 -1.3125 3.890625 -1.25 3.875 -1.171875 C 3.53125 -0.140625 2.625 -0.140625 2.53125 -0.140625 C 2.03125 -0.140625 1.640625 -0.4375 1.40625 -0.8125 C 1.109375 -1.28125 1.109375 -1.9375 1.109375 -2.296875 Z M 1.109375 -2.296875 "/>
</symbol>
<symbol overflow="visible" id="glyph0-11">
<path style="stroke:none;" d="M 1.09375 -3.421875 L 1.09375 -0.75 C 1.09375 -0.3125 0.984375 -0.3125 0.3125 -0.3125 L 0.3125 0 C 0.671875 -0.015625 1.171875 -0.03125 1.453125 -0.03125 C 1.703125 -0.03125 2.21875 -0.015625 2.5625 0 L 2.5625 -0.3125 C 1.890625 -0.3125 1.78125 -0.3125 1.78125 -0.75 L 1.78125 -2.59375 C 1.78125 -3.625 2.5 -4.1875 3.125 -4.1875 C 3.765625 -4.1875 3.875 -3.65625 3.875 -3.078125 L 3.875 -0.75 C 3.875 -0.3125 3.765625 -0.3125 3.09375 -0.3125 L 3.09375 0 C 3.4375 -0.015625 3.953125 -0.03125 4.21875 -0.03125 C 4.46875 -0.03125 5 -0.015625 5.328125 0 L 5.328125 -0.3125 C 4.671875 -0.3125 4.5625 -0.3125 4.5625 -0.75 L 4.5625 -2.59375 C 4.5625 -3.625 5.265625 -4.1875 5.90625 -4.1875 C 6.53125 -4.1875 6.640625 -3.65625 6.640625 -3.078125 L 6.640625 -0.75 C 6.640625 -0.3125 6.53125 -0.3125 5.859375 -0.3125 L 5.859375 0 C 6.203125 -0.015625 6.71875 -0.03125 6.984375 -0.03125 C 7.25 -0.03125 7.765625 -0.015625 8.109375 0 L 8.109375 -0.3125 C 7.59375 -0.3125 7.34375 -0.3125 7.328125 -0.609375 L 7.328125 -2.515625 C 7.328125 -3.375 7.328125 -3.671875 7.015625 -4.03125 C 6.875 -4.203125 6.546875 -4.40625 5.96875 -4.40625 C 5.140625 -4.40625 4.6875 -3.8125 4.53125 -3.421875 C 4.390625 -4.296875 3.65625 -4.40625 3.203125 -4.40625 C 2.46875 -4.40625 2 -3.984375 1.71875 -3.359375 L 1.71875 -4.40625 L 0.3125 -4.296875 L 0.3125 -3.984375 C 1.015625 -3.984375 1.09375 -3.921875 1.09375 -3.421875 Z M 1.09375 -3.421875 "/>
</symbol>
<symbol overflow="visible" id="glyph0-12">
<path style="stroke:none;" d="M 3.3125 -0.75 C 3.359375 -0.359375 3.625 0.0625 4.09375 0.0625 C 4.3125 0.0625 4.921875 -0.078125 4.921875 -0.890625 L 4.921875 -1.453125 L 4.671875 -1.453125 L 4.671875 -0.890625 C 4.671875 -0.3125 4.421875 -0.25 4.3125 -0.25 C 3.984375 -0.25 3.9375 -0.703125 3.9375 -0.75 L 3.9375 -2.734375 C 3.9375 -3.15625 3.9375 -3.546875 3.578125 -3.921875 C 3.1875 -4.3125 2.6875 -4.46875 2.21875 -4.46875 C 1.390625 -4.46875 0.703125 -4 0.703125 -3.34375 C 0.703125 -3.046875 0.90625 -2.875 1.171875 -2.875 C 1.453125 -2.875 1.625 -3.078125 1.625 -3.328125 C 1.625 -3.453125 1.578125 -3.78125 1.109375 -3.78125 C 1.390625 -4.140625 1.875 -4.25 2.1875 -4.25 C 2.6875 -4.25 3.25 -3.859375 3.25 -2.96875 L 3.25 -2.609375 C 2.734375 -2.578125 2.046875 -2.546875 1.421875 -2.25 C 0.671875 -1.90625 0.421875 -1.390625 0.421875 -0.953125 C 0.421875 -0.140625 1.390625 0.109375 2.015625 0.109375 C 2.671875 0.109375 3.125 -0.296875 3.3125 -0.75 Z M 3.25 -2.390625 L 3.25 -1.390625 C 3.25 -0.453125 2.53125 -0.109375 2.078125 -0.109375 C 1.59375 -0.109375 1.1875 -0.453125 1.1875 -0.953125 C 1.1875 -1.5 1.609375 -2.328125 3.25 -2.390625 Z M 3.25 -2.390625 "/>
</symbol>
<symbol overflow="visible" id="glyph0-13">
<path style="stroke:none;" d="M 1.71875 -3.75 L 1.71875 -4.40625 L 0.28125 -4.296875 L 0.28125 -3.984375 C 0.984375 -3.984375 1.0625 -3.921875 1.0625 -3.484375 L 1.0625 1.171875 C 1.0625 1.625 0.953125 1.625 0.28125 1.625 L 0.28125 1.9375 C 0.625 1.921875 1.140625 1.90625 1.390625 1.90625 C 1.671875 1.90625 2.171875 1.921875 2.515625 1.9375 L 2.515625 1.625 C 1.859375 1.625 1.75 1.625 1.75 1.171875 L 1.75 -0.59375 C 1.796875 -0.421875 2.21875 0.109375 2.96875 0.109375 C 4.15625 0.109375 5.1875 -0.875 5.1875 -2.15625 C 5.1875 -3.421875 4.234375 -4.40625 3.109375 -4.40625 C 2.328125 -4.40625 1.90625 -3.96875 1.71875 -3.75 Z M 1.75 -1.140625 L 1.75 -3.359375 C 2.03125 -3.875 2.515625 -4.15625 3.03125 -4.15625 C 3.765625 -4.15625 4.359375 -3.28125 4.359375 -2.15625 C 4.359375 -0.953125 3.671875 -0.109375 2.9375 -0.109375 C 2.53125 -0.109375 2.15625 -0.3125 1.890625 -0.71875 C 1.75 -0.921875 1.75 -0.9375 1.75 -1.140625 Z M 1.75 -1.140625 "/>
</symbol>
<symbol overflow="visible" id="glyph0-14">
<path style="stroke:none;" d="M 0.5625 -3.40625 C 0.5625 -1.34375 2.171875 0.21875 4.03125 0.21875 C 5.65625 0.21875 6.625 -1.171875 6.625 -2.328125 C 6.625 -2.421875 6.625 -2.5 6.5 -2.5 C 6.390625 -2.5 6.390625 -2.4375 6.375 -2.328125 C 6.296875 -0.90625 5.234375 -0.09375 4.140625 -0.09375 C 3.53125 -0.09375 1.578125 -0.421875 1.578125 -3.40625 C 1.578125 -6.375 3.53125 -6.71875 4.140625 -6.71875 C 5.21875 -6.71875 6.109375 -5.8125 6.3125 -4.359375 C 6.328125 -4.21875 6.328125 -4.1875 6.46875 -4.1875 C 6.625 -4.1875 6.625 -4.21875 6.625 -4.421875 L 6.625 -6.78125 C 6.625 -6.953125 6.625 -7.03125 6.515625 -7.03125 C 6.484375 -7.03125 6.4375 -7.03125 6.359375 -6.90625 L 5.859375 -6.171875 C 5.5 -6.53125 4.984375 -7.03125 4.03125 -7.03125 C 2.15625 -7.03125 0.5625 -5.4375 0.5625 -3.40625 Z M 0.5625 -3.40625 "/>
</symbol>
<symbol overflow="visible" id="glyph0-15">
<path style="stroke:none;" d="M 1.09375 -3.421875 L 1.09375 -0.75 C 1.09375 -0.3125 0.984375 -0.3125 0.3125 -0.3125 L 0.3125 0 C 0.671875 -0.015625 1.171875 -0.03125 1.453125 -0.03125 C 1.703125 -0.03125 2.21875 -0.015625 2.5625 0 L 2.5625 -0.3125 C 1.890625 -0.3125 1.78125 -0.3125 1.78125 -0.75 L 1.78125 -2.59375 C 1.78125 -3.625 2.5 -4.1875 3.125 -4.1875 C 3.765625 -4.1875 3.875 -3.65625 3.875 -3.078125 L 3.875 -0.75 C 3.875 -0.3125 3.765625 -0.3125 3.09375 -0.3125 L 3.09375 0 C 3.4375 -0.015625 3.953125 -0.03125 4.21875 -0.03125 C 4.46875 -0.03125 5 -0.015625 5.328125 0 L 5.328125 -0.3125 C 4.8125 -0.3125 4.5625 -0.3125 4.5625 -0.609375 L 4.5625 -2.515625 C 4.5625 -3.375 4.5625 -3.671875 4.25 -4.03125 C 4.109375 -4.203125 3.78125 -4.40625 3.203125 -4.40625 C 2.46875 -4.40625 2 -3.984375 1.71875 -3.359375 L 1.71875 -4.40625 L 0.3125 -4.296875 L 0.3125 -3.984375 C 1.015625 -3.984375 1.09375 -3.921875 1.09375 -3.421875 Z M 1.09375 -3.421875 "/>
</symbol>
<symbol overflow="visible" id="glyph0-16">
<path style="stroke:none;" d="M 1.71875 -3.984375 L 3.15625 -3.984375 L 3.15625 -4.296875 L 1.71875 -4.296875 L 1.71875 -6.125 L 1.46875 -6.125 C 1.46875 -5.3125 1.171875 -4.25 0.1875 -4.203125 L 0.1875 -3.984375 L 1.03125 -3.984375 L 1.03125 -1.234375 C 1.03125 -0.015625 1.96875 0.109375 2.328125 0.109375 C 3.03125 0.109375 3.3125 -0.59375 3.3125 -1.234375 L 3.3125 -1.796875 L 3.0625 -1.796875 L 3.0625 -1.25 C 3.0625 -0.515625 2.765625 -0.140625 2.390625 -0.140625 C 1.71875 -0.140625 1.71875 -1.046875 1.71875 -1.21875 Z M 1.71875 -3.984375 "/>
</symbol>
<symbol overflow="visible" id="glyph0-17">
<path style="stroke:none;" d="M 6.640625 -6.75 L 0.546875 -6.75 L 0.359375 -4.5 L 0.609375 -4.5 C 0.75 -6.109375 0.890625 -6.4375 2.40625 -6.4375 C 2.578125 -6.4375 2.84375 -6.4375 2.9375 -6.421875 C 3.15625 -6.375 3.15625 -6.265625 3.15625 -6.046875 L 3.15625 -0.78125 C 3.15625 -0.453125 3.15625 -0.3125 2.109375 -0.3125 L 1.703125 -0.3125 L 1.703125 0 C 2.109375 -0.03125 3.125 -0.03125 3.59375 -0.03125 C 4.046875 -0.03125 5.078125 -0.03125 5.484375 0 L 5.484375 -0.3125 L 5.078125 -0.3125 C 4.03125 -0.3125 4.03125 -0.453125 4.03125 -0.78125 L 4.03125 -6.046875 C 4.03125 -6.234375 4.03125 -6.375 4.21875 -6.421875 C 4.328125 -6.4375 4.59375 -6.4375 4.78125 -6.4375 C 6.296875 -6.4375 6.4375 -6.109375 6.578125 -4.5 L 6.828125 -4.5 Z M 6.640625 -6.75 "/>
</symbol>
<symbol overflow="visible" id="glyph0-18">
<path style="stroke:none;" d="M 1.671875 -3.3125 L 1.671875 -4.40625 L 0.28125 -4.296875 L 0.28125 -3.984375 C 0.984375 -3.984375 1.0625 -3.921875 1.0625 -3.421875 L 1.0625 -0.75 C 1.0625 -0.3125 0.953125 -0.3125 0.28125 -0.3125 L 0.28125 0 C 0.671875 -0.015625 1.140625 -0.03125 1.421875 -0.03125 C 1.8125 -0.03125 2.28125 -0.03125 2.6875 0 L 2.6875 -0.3125 L 2.46875 -0.3125 C 1.734375 -0.3125 1.71875 -0.421875 1.71875 -0.78125 L 1.71875 -2.3125 C 1.71875 -3.296875 2.140625 -4.1875 2.890625 -4.1875 C 2.953125 -4.1875 2.984375 -4.1875 3 -4.171875 C 2.96875 -4.171875 2.765625 -4.046875 2.765625 -3.78125 C 2.765625 -3.515625 2.984375 -3.359375 3.203125 -3.359375 C 3.375 -3.359375 3.625 -3.484375 3.625 -3.796875 C 3.625 -4.109375 3.3125 -4.40625 2.890625 -4.40625 C 2.15625 -4.40625 1.796875 -3.734375 1.671875 -3.3125 Z M 1.671875 -3.3125 "/>
</symbol>
</g>
<clipPath id="clip1">
<path d="M 14 171 L 127.898438 171 L 127.898438 252 L 14 252 Z M 14 171 "/>
</clipPath>
<clipPath id="clip2">
<path d="M 14 137 L 127.898438 137 L 127.898438 139 L 14 139 Z M 14 137 "/>
</clipPath>
<clipPath id="clip3">
<path d="M 14 81 L 127.898438 81 L 127.898438 82 L 14 82 Z M 14 81 "/>
</clipPath>
<clipPath id="clip4">
<path d="M 14 24 L 127.898438 24 L 127.898438 25 L 14 25 Z M 14 24 "/>
</clipPath>
<clipPath id="clip5">
<path d="M 99 123 L 127.898438 123 L 127.898438 153 L 99 153 Z M 99 123 "/>
</clipPath>
</defs>
<g id="surface1">
<g clip-path="url(#clip1)" clip-rule="nonzero">
<path style="fill:none;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;" d="M 0.00140625 0.00034375 L 113.388125 0.00034375 M 0.00140625 19.844094 L 113.388125 19.844094 M 0.00140625 39.683937 L 113.388125 39.683937 M 0.00140625 59.527687 L 113.388125 59.527687 M 0.00140625 79.359719 L 113.388125 79.359719 M 0.00140625 0.00034375 L 0.00140625 79.371437 M 28.345156 0.00034375 L 28.345156 79.371437 M 56.692813 0.00034375 L 56.692813 79.371437 M 85.040469 0.00034375 L 85.040469 79.371437 M 113.376406 0.00034375 L 113.376406 79.371437 " transform="matrix(1,0,0,-1,14.315,251.473)"/>
</g>
<g clip-path="url(#clip2)" clip-rule="nonzero">
<path style="fill:none;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(100%,0%,0%);stroke-opacity:1;stroke-dasharray:2.98883,2.98883;stroke-miterlimit:10;" d="M 0.00140625 113.387062 L 113.388125 113.387062 " transform="matrix(1,0,0,-1,14.315,251.473)"/>
</g>
<g clip-path="url(#clip3)" clip-rule="nonzero">
<path style="fill:none;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(100%,0%,0%);stroke-opacity:1;stroke-dasharray:2.98883,2.98883;stroke-miterlimit:10;" d="M 0.00140625 170.082375 L 113.388125 170.082375 " transform="matrix(1,0,0,-1,14.315,251.473)"/>
</g>
<g clip-path="url(#clip4)" clip-rule="nonzero">
<path style="fill:none;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(100%,0%,0%);stroke-opacity:1;stroke-dasharray:2.98883,2.98883;stroke-miterlimit:10;" d="M 0.00140625 226.773781 L 113.388125 226.773781 " transform="matrix(1,0,0,-1,14.315,251.473)"/>
</g>
<g style="fill:rgb(100%,0%,0%);fill-opacity:1;">
<use xlink:href="#glyph0-1" x="3.321" y="141.297"/>
</g>
<g style="fill:rgb(100%,0%,0%);fill-opacity:1;">
<use xlink:href="#glyph0-2" x="3.321" y="84.604"/>
</g>
<g style="fill:rgb(100%,0%,0%);fill-opacity:1;">
<use xlink:href="#glyph0-3" x="3.321" y="27.911"/>
</g>
<path style="fill-rule:nonzero;fill:rgb(100%,100%,100%);fill-opacity:1;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;" d="M 65.446719 226.773781 C 65.446719 231.609719 61.52875 235.527687 56.692813 235.527687 C 51.860781 235.527687 47.938906 231.609719 47.938906 226.773781 C 47.938906 221.94175 51.860781 218.019875 56.692813 218.019875 C 61.52875 218.019875 65.446719 221.94175 65.446719 226.773781 Z M 65.446719 226.773781 " transform="matrix(1,0,0,-1,14.315,251.473)"/>
<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
<use xlink:href="#glyph0-1" x="68.517" y="27.911"/>
</g>
<path style="fill-rule:nonzero;fill:rgb(100%,100%,100%);fill-opacity:1;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;" d="M 22.927187 170.082375 C 22.927187 174.914406 19.009219 178.832375 14.173281 178.832375 C 9.337344 178.832375 5.419375 174.914406 5.419375 170.082375 C 5.419375 165.246437 9.337344 161.328469 14.173281 161.328469 C 19.009219 161.328469 22.927187 165.246437 22.927187 170.082375 Z M 22.927187 170.082375 " transform="matrix(1,0,0,-1,14.315,251.473)"/>
<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
<use xlink:href="#glyph0-2" x="25.998" y="84.604"/>
</g>
<path style="fill-rule:nonzero;fill:rgb(100%,100%,100%);fill-opacity:1;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;" d="M 65.446719 170.082375 C 65.446719 174.914406 61.52875 178.832375 56.692813 178.832375 C 51.860781 178.832375 47.938906 174.914406 47.938906 170.082375 C 47.938906 165.246437 51.860781 161.328469 56.692813 161.328469 C 61.52875 161.328469 65.446719 165.246437 65.446719 170.082375 Z M 65.446719 170.082375 " transform="matrix(1,0,0,-1,14.315,251.473)"/>
<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
<use xlink:href="#glyph0-3" x="68.517" y="84.604"/>
</g>
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(100%,100%,100%);fill-opacity:1;" d="M 122.28125 138.085938 C 122.28125 133.25 118.363281 129.332031 113.527344 129.332031 C 108.695312 129.332031 104.777344 133.25 104.777344 138.085938 C 104.777344 142.921875 108.695312 146.839844 113.527344 146.839844 C 118.363281 146.839844 122.28125 142.921875 122.28125 138.085938 Z M 122.28125 138.085938 "/>
<g clip-path="url(#clip5)" clip-rule="nonzero">
<path style="fill:none;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;" d="M 107.96625 113.387062 C 107.96625 118.223 104.048281 122.140969 99.212344 122.140969 C 94.380313 122.140969 90.462344 118.223 90.462344 113.387062 C 90.462344 108.551125 94.380313 104.633156 99.212344 104.633156 C 104.048281 104.633156 107.96625 108.551125 107.96625 113.387062 Z M 107.96625 113.387062 " transform="matrix(1,0,0,-1,14.315,251.473)"/>
</g>
<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
<use xlink:href="#glyph0-4" x="111.037" y="141.297"/>
</g>
<path style="fill-rule:nonzero;fill:rgb(100%,100%,100%);fill-opacity:1;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;" d="M 22.927187 113.387062 C 22.927187 118.223 19.009219 122.140969 14.173281 122.140969 C 9.337344 122.140969 5.419375 118.223 5.419375 113.387062 C 5.419375 108.551125 9.337344 104.633156 14.173281 104.633156 C 19.009219 104.633156 22.927187 108.551125 22.927187 113.387062 Z M 22.927187 113.387062 " transform="matrix(1,0,0,-1,14.315,251.473)"/>
<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
<use xlink:href="#glyph0-5" x="25.998" y="141.297"/>
</g>
<path style="fill-rule:nonzero;fill:rgb(100%,100%,100%);fill-opacity:1;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;" d="M 65.446719 113.387062 C 65.446719 118.223 61.52875 122.140969 56.692813 122.140969 C 51.860781 122.140969 47.938906 118.223 47.938906 113.387062 C 47.938906 108.551125 51.860781 104.633156 56.692813 104.633156 C 61.52875 104.633156 65.446719 108.551125 65.446719 113.387062 Z M 65.446719 113.387062 " transform="matrix(1,0,0,-1,14.315,251.473)"/>
<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
<use xlink:href="#glyph0-6" x="68.517" y="141.297"/>
</g>
<path style="fill:none;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;" d="M 19.544375 177.242531 L 49.169375 216.742531 " transform="matrix(1,0,0,-1,14.315,251.473)"/>
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(0%,0%,0%);fill-opacity:1;" d="M 65.636719 31.859375 C 64.839844 32.589844 63.324219 33.613281 62.050781 34.152344 L 64.441406 35.945312 C 64.601562 34.570312 65.160156 32.828125 65.636719 31.859375 "/>
<path style="fill:none;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;" d="M 56.692813 179.031594 L 56.692813 214.234719 " transform="matrix(1,0,0,-1,14.315,251.473)"/>
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(0%,0%,0%);fill-opacity:1;" d="M 71.007812 33.652344 C 70.808594 34.714844 70.210938 36.441406 69.515625 37.636719 L 72.503906 37.636719 C 71.804688 36.441406 71.207031 34.714844 71.007812 33.652344 "/>
<path style="fill:none;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;" d="M 96.071719 121.769875 L 61.095156 215.0355 " transform="matrix(1,0,0,-1,14.315,251.473)"/>
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(0%,0%,0%);fill-opacity:1;" d="M 74.152344 33.082031 C 74.339844 34.144531 74.386719 35.972656 74.152344 37.335938 L 76.949219 36.285156 C 75.878906 35.414062 74.710938 34.003906 74.152344 33.082031 "/>
<path style="fill:none;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;" d="M 14.173281 122.340187 L 14.173281 157.543312 " transform="matrix(1,0,0,-1,14.315,251.473)"/>
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(0%,0%,0%);fill-opacity:1;" d="M 28.488281 90.34375 C 28.289062 91.40625 27.691406 93.132812 26.992188 94.328125 L 29.984375 94.328125 C 29.285156 93.132812 28.6875 91.40625 28.488281 90.34375 "/>
<path style="fill:none;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;" d="M 56.692813 122.340187 L 56.692813 157.543312 " transform="matrix(1,0,0,-1,14.315,251.473)"/>
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(0%,0%,0%);fill-opacity:1;" d="M 71.007812 90.34375 C 70.808594 91.40625 70.210938 93.132812 69.515625 94.328125 L 72.503906 94.328125 C 71.804688 93.132812 71.207031 91.40625 71.007812 90.34375 "/>
<path style="fill:none;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,100%);stroke-opacity:1;stroke-dasharray:2.98883,2.98883;stroke-miterlimit:10;" d="M 56.692813 99.215187 L 70.868594 70.867531 " transform="matrix(1,0,0,-1,14.315,251.473)"/>
<path style="fill:none;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,100%);stroke-opacity:1;stroke-dasharray:2.98883,2.98883;stroke-miterlimit:10;" d="M 56.692813 99.215187 L 70.868594 42.519875 " transform="matrix(1,0,0,-1,14.315,251.473)"/>
<path style="fill:none;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,100%);stroke-opacity:1;stroke-dasharray:2.98883,2.98883;stroke-miterlimit:10;" d="M 56.692813 99.215187 L 42.520938 70.867531 " transform="matrix(1,0,0,-1,14.315,251.473)"/>
<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
<use xlink:href="#glyph0-7" x="48.592" y="262.467"/>
<use xlink:href="#glyph0-8" x="56.06395" y="262.467"/>
</g>
<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
<use xlink:href="#glyph0-9" x="61.324203" y="262.467"/>
<use xlink:href="#glyph0-10" x="66.859423" y="262.467"/>
</g>
<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
<use xlink:href="#glyph0-11" x="74.604349" y="262.467"/>
<use xlink:href="#glyph0-12" x="82.906183" y="262.467"/>
<use xlink:href="#glyph0-13" x="87.887483" y="262.467"/>
</g>
<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
<use xlink:href="#glyph0-14" x="34.603" y="10.128"/>
<use xlink:href="#glyph0-8" x="41.79799" y="10.128"/>
<use xlink:href="#glyph0-11" x="46.77929" y="10.128"/>
<use xlink:href="#glyph0-13" x="55.081124" y="10.128"/>
</g>
<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
<use xlink:href="#glyph0-8" x="60.895298" y="10.128"/>
<use xlink:href="#glyph0-15" x="65.876598" y="10.128"/>
<use xlink:href="#glyph0-10" x="71.411818" y="10.128"/>
<use xlink:href="#glyph0-15" x="75.839198" y="10.128"/>
</g>
<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
<use xlink:href="#glyph0-16" x="81.095465" y="10.128"/>
</g>
<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
<use xlink:href="#glyph0-17" x="88.287466" y="10.128"/>
</g>
<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
<use xlink:href="#glyph0-18" x="94.65556" y="10.128"/>
<use xlink:href="#glyph0-10" x="98.557911" y="10.128"/>
<use xlink:href="#glyph0-10" x="102.98529" y="10.128"/>
</g>
</g>
</svg>
\documentclass[svgnames,tikz]{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\draw[y=0.7cm, step=1] (0, 0) grid (4, 4);
\draw[dashed, red] (0, 4) -- (4, 4);
\draw[dashed, red] (0, 6) -- (4, 6);
\draw[dashed, red] (0, 8) -- (4, 8);
\node[red] () at (-0.3, 4) {0};
\node[red] () at (-0.3, 6) {1};
\node[red] () at (-0.3, 8) {2};
\node[draw, circle, fill=white] (0) at (2, 8) {0};
\node[draw, circle, fill=white] (1) at (0.5, 6) {1};
\node[draw, circle, fill=white] (2) at (2, 6) {2};
\node[draw, circle, fill=white] (3) at (3.5, 4) {3};
\node[draw, circle, fill=white] (4) at (0.5, 4) {4};
\node[draw, circle, fill=white] (5) at (2, 4) {5};
\draw[->, >=latex] (1) -- (0);
\draw[->, >=latex] (2) -- (0);
\draw[->, >=latex] (3) -- (0);
\draw[->, >=latex] (4) -- (1);
\draw[->, >=latex] (5) -- (2);
\draw[blue, dashed] (2, 3.5) -- (2.5, 2.5);
\draw[blue, dashed] (2, 3.5) -- (2.5, 1.5);
\draw[blue, dashed] (2, 3.5) -- (1.5, 2.5);
\node () at (2, -0.3) {Node map};
\node () at (2, 8.6) {Component Tree};
\end{tikzpicture}
\end{document}
\ No newline at end of file
Alpha Tree
==========
Include :file:`<mln/morpho/alphatree.hpp>`
* Include :file:`<mln/morpho/alphatree.hpp>`
.. cpp:namespace:: mln::morpho
.. cpp:function:: auto alphatree(Image f, Neighborhood nbh);
.. cpp:function:: auto alphatree(Image f, Neighborhood nbh, F dist);
Compute the alphatree (also known as quasi-flat zone hierarchy) and returns a pair
Compute the alpha tree (also known as quasi-flat zone hierarchy) and returns a pair
`(tree, node_map)`. See :doc:`component_tree` for more information about the
representation of tree.
representation of tree. The implementation is based on the Kruskal algorithm [Naj13]_.
:param input: The input image
:param nbh: The neighborhood
:return: A pair `(tree, node_map)` where *tree* is of type
`component_tree<image_value_t<I>>` and `node_map` is a mapping from each point to the
node *id* in the tree.
:precondition: ``f.domain().has(pinf)``
:param nbh: The neighborhood
:param dist: The function weighting the edges between two pixels. For grayscale images, this is generally the absolute difference between two values.
:return: A pair `(tree, node_map)` where *tree* is of type ``component_tree<std::invoke_result_t<F, image_value_t<Image>, image_value_t<Image>>>`` and *node_map* is a mapping between the image pixels and the node of the tree.
.. rubric:: Requirements
* ``image_value_t<I>`` is :cpp:concept:`std::totally_ordered`
* ``std::invoke_result_t<F, image_value_t<Image>, image_value_t<Image>>`` is :cpp:concept:`std::totally_ordered`
Definition
----------
The Alpha tree is the tree of :math:`\alpha`-connected components. An :math:`\alpha`-connected component in an image :math:`f`, for a pixel :math:`p`, is defined as
.. math::
\alpha-CC(p) = \{p\}\ \cup\ \{q\ |\ \text{there exists a path}\ \Pi = \{\pi_0, ..., \pi_n\}\ \text{between}\ p\ \text{and}\ q\ \text{such that}\ d(f(\pi_i), f(\pi_{i+1})) \leq \alpha\}
where :math:`d` is a dissimilarity function between two pixels of the image :math:`f`.
The :math:`\alpha`-connected components form an ordered sequence when :math:`\alpha` is growing, such that for :math:`\alpha_i < \alpha_j`,
:math:`\alpha_i-CC(p) \subseteq \alpha_j-CC(p)`. Thus, the alphatree is the hierarchy where the parenthood relationship represents the inclusion of the
:math:`\alpha`-connected components.
Representation
--------------
.. image:: /figures/morpho/alphatree_repr.svg
:align: center
:width: 30%
The ``alphatree`` function returns a tree and a node map. The tree has two attributes:
* ``parent``: The parenthood relationship of the node :math:`i`, representing the inclusion relationship of the :math:`\alpha`-connected components.
* ``values``: The value of :math:`\alpha` assigned to a node :math:`i`.
Then, the node map is the relation between a pixel of the image and its related node in the tree, a leaf for the case of the alphatree.
.. rubric:: Example
The image above illustrates the representation of the alpha tree in Pylene, the parenthood relationship being illustrated in arrows, the values of alpha, assigned to each node, being in red, and the relation
between a node of the tree and a pixel of the image being represented by blue dashed lines.
Example
-------
This example is used to generate the grayscale lena cut with a threshold of 3 below.
::
#include <mln/accu/accumulators/mean.hpp>
#include <mln/morpho/alphatree.hpp>
#include <mln/core/image/ndimage.hpp>
#include <mln/core/neighborhood/c4.hpp>
mln::image2d<uint8_t> input = ...;
// Compute the alpha tree
auto [tree, node_map] = mln::morpho::alphatree(input, mln::c4);
// Compute an attribute (for example the average pixels value at each node, as below)
auto mean = t.compute_attribute_on_values(node_map, input, mln::accu::accumulators::mean<uint8_t>());
// Making an horizontal cut of the tree
const auto threshold = 3; // Threshold of the horizontal cut, that means the lowest alpha in the cut
auto nodemap_cut = t.horizontal_cut(threshold, node_map); // Return a new nodemap associated to the cut
// Labelizing the cut with the mean values of each node
auto out = t.reconstruct_from(nodemap_cut, ranges::make_span(mean)); // Using range-v3 span
.. list-table::
* - .. figure:: /images/alphatree_cut_color.png
Cut of the alpha tree with a threshold of 10
- .. figure:: /images/alphatree_cut_gray.png
Cut of the alpha tree with a threshold of 3
Notes
-----
......@@ -48,3 +98,5 @@ Complexity
References
----------
.. [Naj13] Laurent Najman, Jean Cousty, and Benjamin Perret (2013). Playing with kruskal: algorithms for morphological trees in edge-weighted graphs. *International Symposium on Mathematical Morphology and Its Applications to Signal and Image Processing*. Springer, Berlin, Heidelberg. 135-146
\ No newline at end of file
......@@ -148,9 +148,9 @@ A :cpp:class:`component_tree` `t` has the following methods.
.. cpp:namespace-push:: template <class V> component_tree
.. cpp:function:: auto accumulate_on_points(Image node_map, Accumulator accu) const
auto accumulate_on_values(Image node_map, Image values, Accumulator accu) const
auto accumulate_on_pixels(Image node_map, Image values, Accumulator accu) const
.. cpp:function:: auto compute_attribute_on_points(Image node_map, Accumulator accu) const
auto compute_attribute_on_values(Image node_map, Image values, Accumulator accu) const
auto compute_attribute_on_pixels(Image node_map, Image values, Accumulator accu) const
Accumulate the points of each component.
......@@ -190,7 +190,7 @@ Example: computing the size (number of points) of the components.
#include <mln/accu/accumulators/count.hpp>
auto sizes = tree.accumulate_on_points(node_map, mln::accu::features::count<>());
auto sizes = tree.compute_attribute_on_points(node_map, mln::accu::features::count<>());
.. cpp:function:: auto compute_depth() const
......@@ -255,6 +255,7 @@ A :cpp:class:`component_tree` `t` has the following methods.
auto pred = [&](int id) { nchildren > 1; };
t.filter(CT_FILTER_DIRECT, pred);
Image reconstruction
--------------------
......@@ -279,7 +280,19 @@ the image from the filtered tree.
t.filter(CT_FILTER_DIRECT, [&area](int id) { return area[id] > 20; });
auto out = t.reconstruct(node_map);
Horizontal cut
--------------
When the tree is a hierarchy of partition, such as the :doc:`alphatree`, it is possible
to make an horizontal cut of this tree.
.. cpp:function:: I horizontal_cut(const T threshold, I nodemap) const
I horizontal_cut_from_levels(const T threshold, I nodemap, ::ranges::span<V> levels) const
Make an horizontal cut at threshold ``threshold`` of the tree and return the nodemap associated to the cut.
:param threshold: The threshold of the horizontal cut
:param nodemap: An image thats maps ``point -> node id``
:param levels: (Optional) The altitude of each node in the tree (for example the :math:`\alpha` associated to each node for the alphatree).
A complete example
------------------
......
......@@ -57,6 +57,8 @@ add_image("area_filter"
add_image("blobs_watershed" "${DOCUMENTATION_IMAGE_DIR}/blobs_binary.png" blobs_distance_transform.png blobs_segmentation.png)
add_image("alphatree_example" "${PYLENE_IMAGE_DIR}/lena.ppm" alphatree_cut_color.png)
add_image("alphatree_example" "${PYLENE_IMAGE_DIR}/lena.pgm" alphatree_cut_gray.png)
add_custom_target(build-images
DEPENDS "${DOCUMENTATION_IMAGES}")
......@@ -70,6 +72,7 @@ target_link_libraries(doc-lib Pylene::Pylene)
link_libraries(Pylene::Pylene)
link_libraries(doc-lib)
add_executable(alphatree_example alphatree_example.cpp)
add_executable(erosion-cli erosion-cli.cpp)
add_executable(staff_lines staff_lines.cpp)
add_executable(component_tree_1 component_tree_1.cpp)
......
#include <mln/accu/accumulators/mean.hpp>
#include <mln/core/colors.hpp>
#include <mln/core/image/ndimage.hpp>
#include <mln/core/image/view/cast.hpp>
#include <mln/core/neighborhood/c4.hpp>
#include <mln/io/imread.hpp>
#include <mln/io/imsave.hpp>
#include <mln/morpho/alphatree.hpp>
#include <iostream>
template <typename V>
void process_example(const mln::image2d<V>& img, const std::string& cut_filename, const double threshold)
{
// 2. Build the alphatree
auto [t, nm] = mln::morpho::alphatree(img, mln::c4);
// 3. Compute the mean attribute
auto mean = t.compute_attribute_on_values(nm, img, mln::accu::accumulators::mean<V>());
// 4. Compute a cut of the alphatree
auto cut_nm = t.horizontal_cut(threshold, nm);
// 5. Labelize the cut
auto cut = t.reconstruct_from(cut_nm, ::ranges::make_span(mean));
// 5. Save the output cut
mln::io::imsave(mln::view::cast<V>(cut), cut_filename);
}
int main(int argc, char* argv[])
{
if (argc < 3)
{
std::cerr << "Invalid number of argument\nUsage: " << argv[0] << " input_filename cut_filename\n";
return 1;
}
auto in_filename = std::string(argv[1]);
auto cut_filename = std::string(argv[2]);
// 1. Read the input image
mln::ndbuffer_image in;
in = mln::io::imread(in_filename);
if (in.sample_type() == mln::sample_type_id::UINT8)
{
const auto* img = in.cast_to<std::uint8_t, 2>();
process_example(*img, cut_filename, 3);
}
else if (in.sample_type() == mln::sample_type_id::RGB8)
{
const auto* img = in.cast_to<mln::rgb8, 2>();
process_example(*img, cut_filename, 10);
}
else
{
std::cerr << "Unhandled sample type format\n";
return 1;
}
return 0;
}
\ No newline at end of file
......@@ -51,7 +51,7 @@ namespace mln
};
public:
extend_by_projection_view_base<I, Proj>(I ima, Proj proj)
extend_by_projection_view_base(I ima, Proj proj)
: base_t{std::move(ima)}
, m_proj{std::move(proj)}
{
......
......@@ -4,13 +4,15 @@
#include <mln/core/concepts/image.hpp>
#include <mln/core/concepts/neighborhood.hpp>
#include <mln/core/functional_ops.hpp>
#include <mln/core/algorithm/for_each.hpp>
#include <mln/morpho/component_tree.hpp>
#include <mln/core/functional_ops.hpp>
#include <mln/morpho/canvas/unionfind.hpp>
#include <mln/morpho/component_tree.hpp>
#include <mln/morpho/private/directional_hqueue.hpp>
#include <type_traits>
#include <algorithm>
#include <type_traits>
#include <range/v3/functional/concepts.hpp>
......@@ -33,26 +35,71 @@ namespace mln::morpho
/******************************************/
namespace internal
{
/// \brief Canvas for the edges in the alphatree. Using different data
/// structures related to the type of the edges.
template <typename P, typename N, typename W>
class alphatree_edges;
template <class P, class W>
struct alphatree_edge_t
template <typename P, typename N, typename W>
requires(std::is_integral_v<W>&& std::is_unsigned_v<W> && sizeof(W) <= 2) class alphatree_edges<P, N, W>
{
P a;
P b;
W w;
public:
void push(int dir, W w, P p) { m_cont.insert(dir, w, p); }
std::tuple<P, P, W> pop() { return m_cont.pop(); }
W top() const { return m_cont.current_level(); }
bool empty() const { return m_cont.empty(); }
void on_finish_insert() {}
private:
details::directional_hqueue<P, N, W> m_cont;
};
template <typename P, typename W>
struct edge_t
{
P p;
P q;
W w;
};
template <typename P, typename N, typename W>
class alphatree_edges
{
public:
void push(int dir, W w, P p) { m_cont.push_back({p, p + cn.after_offsets()[dir], w}); }
std::tuple<P, P, W> pop()
{
assert(m_current < m_cont.size());
const auto e = m_cont[m_current++];
return {std::move(e.p), std::move(e.q), std::move(e.w)};
}
W top() const
{
assert(m_current < m_cont.size());
return m_cont[m_current].w;
}
bool empty() const { return m_cont.size() == m_current; }
void on_finish_insert()
{
std::sort(m_cont.begin(), m_cont.end(), [](const edge_t<P, W>& a, const edge_t<P, W>& b) { return a.w < b.w; });
}
private:
static constexpr auto cn = N();
std::vector<edge_t<P, W>> m_cont;
std::size_t m_current = 0;
};
// Compute a node_id for each flat zone
template <class I, class J>
[[gnu::noinline]]
std::size_t alphatree_create_nodemap(I node_map, J zpar)
[[gnu::noinline]] std::size_t alphatree_create_nodemap(I node_map, J zpar)
{
std::size_t node_count = 0;
mln_foreach(auto px, node_map.pixels())
mln_foreach (auto px, node_map.pixels())
{
auto p = px.point();
auto rp = canvas::impl::zfindroot(zpar, p);
......@@ -66,21 +113,18 @@ namespace mln::morpho
// Compute flat zone of the image using union-find structures
// It returns the number of edges processed
template <class E, class J>
std::size_t alphatree_compute_flatzones(const E* edges, std::size_t n, J zpar)
void alphatree_compute_flatzones(E& edges, J zpar)
{
canvas::impl::union_find_init_par(zpar);
std::size_t i;
for (i = 0; i < n && edges[i].w == 0; ++i)
while (!edges.empty() && edges.top() == 0)
{
auto p = edges[i].a;
auto q = edges[i].b;
auto rp = canvas::impl::zfindroot(zpar, p);
auto rq = canvas::impl::zfindro