**Name**

**flst** Fast Level Sets Transform of an image

**Command Synopsis**

**flst** [-a *min_area*] *image* *tree*

-amin_area: argument of the grain filter

image: Input fimage

tree: The tree of shapes

**Function Summary**

void flst (pMinArea , pImageInput , pTree )

int *pMinArea ;

Fimage pImageInput ;

Shapes pTree ;

**Description**

The Fast Level Sets Transform is a decomposition of an image
(an `Fimage` or a `Cimage`) into ``shapes'', based on connected
components of level sets and on level lines
(see [MG00][MG99][BCM01]).
As the name indicates, it is a fast algorithm, of complexity
*O*(*N* log *N*)
where *N* is the number of pixels, but the complexity depends
also on the content of the image: a highly textured image would
take more time to decompose than an image with many flat zones.
A shape is based on a connected component of superior level set
(
^{ } = [*u* ]) or of inferior
level set (
^{ } = [*u* ]). More
precisely, it is such a component in which we have filled the
holes, where the definition of a hole is as follows:

- for a component not meeting the frame of the image, a hole is any connected component of the complementary that does not meet the frame of the image.
- for a component containing all the frame of the image, a hole is any connected component of the complementary.
- for a component meeting the frame of the image without containing it, it is a connected component of the complementary not meeting the frame or a connected component of the complementary meeting the frame but having an area less than half the image.

`parent`points to the parent shape. It is a valid pointer, except for the root of the tree, for which it is`NULL`.`next_sibling`points to another child of its father.`child`is one child of the shape. The other ones can be found by following the links`next_sibling`of the`child`until it is the`NULL`pointer.

`inferior_type`is a boolean value indicating if the shape is extracted from an inferior or superior (connected component of) level set. This has no meaning for the root of the tree.`value`is the value of the threshold for the level set whose connected component generated the shape. If it is sufficiently contrasted compared to the background, there are several such thresholds, only the extremal one is kept (shapes are not duplicated in the tree).`open`is a boolean value indicating if the boundary (the level line) is open or closed. That is if the shape meets the frame of the image or not.`area`is the number of pixels in the shape, that is the number of pixels in the connected component of level set plus the areas of the holes.`removed`is a boolean value indicating if the shape should be considered in the tree or removed (see below).`pixels`is an array of points in the plane, the list of pixels in the shapes. The size of the array is the field`area`.`boundary`is the boundary of the shape (the level line), each point being at the junction of 4 pixels. The point of coordinates (*i*,*j*) is considered to be at the upper-left corner of the pixel (*i*,*j*).`data`is left free for the user to store what needed.`data_size`is the size (in bytes) of the`data`. Put it to 0 in case`data`is not meant to be saved.

`nrow`and`ncol`are the dimensions of the image.`the_shapes`is an array containing all the shapes, in no particular order, except that the one at index zero is always the root.`nb_shapes`is the size of this array.`smallest_shape`is an array of size`nrow`×`ncol`where element*y*×`ncol`+*x*is the smallest shape containing pixel (*i*,*j*). This does not take into account that this shape could be removed, so the function`mw_get_smallest_shape`should be used instead.`data`is left free for the user.`data_size`is the size (in bytes) of`data`

`pImageInput`: the image to decompose`pTree`: the tree of shapes, filled as output.`pMinArea`: arguments to a possible grain filter.

**See Also**

`fgrain`, `ll_boundaries`, `ll_edges`, `ll_extract`, `ll_sharp`.

**Version 2.0**

Last Modification date : Thu Nov 29 20:23:56 2001

**Author**

Pascal Monasse