A `Shape` is a set of pixels based on a level set of an
image. It can be a level set itself, one of its connected component,
or a shape as defined by the FLST (see module `flst`

) that is,
in short, a connected component of a level set with filled holes.
Notice that a `Shape` has no reference to the image in which it is extracted,
so a `Shape` can be constructed from scratch, without an initial image.

The basic fields are:

`inferior_type`

: a nonzero value indicates that the`Shape`corresponds to a lower level set of level ( {*x*:*u*(*x*) }^{1}or {*x*:*u*(*x*) < }, those sets being noted in short by [*u*] and [*u*< ]), while a zero value indicates an upper level set ( [*u*] or [*u*> ]).`value`

: the gray level of the level set.`area`

: the area, i.e., the number of pixels of the shape.`pixels`

: an array of pixel coordinates containing`area`

elements.`boundary`

: a`Flist`of dimension two containing the vertices of a polygonal representation of the boundary.`open`

: a nonzero value indicates that the`Shape`meets the border of the image. The name of this field comes from the fact that if the boundary is a curve, it is an open curve.

`removed`

indicating if the
shape is to be taken into account. This field is interesting only in the case
where the shape is part of a structure.
A shape is supposed to be included in a tree structure driven by
inclusion. This is the case for example when the shapes are all lower (or all
upper) level sets: in this case the tree has no ramification, since the level
sets are monotone for inclusion. There is a true tree structure when they are
*connected components* of lower (or upper) level sets. This is also true
for the shapes in the sense of the FLST.

In the vocabulary of graphs, the edges of the tree adjacent to the shape are
stored in the fields `parent`

, `child`

and
`next_sibling`

. The `child`

field corresponds actually to the
first child of the shape. The other ones can be recovered by following the
pointers `next_sibling`

. For example, to call the function `foo`

successively with the children of shape `s`

as argument, we would write
the following code snippet:

`for(c = s->child; c != NULL; c=c->next_sibling) foo(c);`

The parent contains the shape while the shape contains its children. Functions
for accessing these three fields are given: they take into account that
some shapes may be ignored, as indicated by the field `removed`

.

It is dangerous to remove the root of the tree by setting its `removed`

field: many functions rely on the fact that we have a root.