iamxt: Educative Max-tree Toolbox


This page contains the implementation and the documentation of an alpha version of the Max-tree toolbox. The toolbox was implemented in Python and the critical functions were implemented in C++ and optimized using OpenMP and wrapped in Python. We have a different max-tree structure that is more suitable for array processing [Souza2015b], and allows a fast development of new methods with a reasonable processing time. Our main goal in providing this toolbox is to spread the max-tree data structure further among the scientific community, investigate it further, and develop new tools that may be applied to solve real signal, image processing, and pattern recognition problems. The toolbox is available for download at our GitHub page: http://github.com/rmsouza01/iamxt and we have a handout that we are preparing to be presented in a 6-hour tutorial at the at the 29th edition of the Conference on Graphics, Patterns and Images (SIBGRAPI).

Warnings and messages

  • Ad-blocker: if your browser has ad-blockers it may prevent the documentation from appearing properly. Please, disable it when going through our documentation.
  • Firewall: If you are trying to access our interactive max-tree demo, it may not work if your network has a firewall like most Hospital's networks.
  • Collaborate: If you want to collaborate in improving our documentation or adding new features to our toolbox, please send an email to roberto.medeiros.souza@gmail.com. We may grant you an account and editing permissions to Adessowiki.
  • Comments: the wiki has an add comment option at the end of ech page. The admins of the toolbox will recieve a message each time someone comments on a page. If you have any doubts or suggestions about a demo, please add a message.
  • Reading and displaying images: Adessowiki has its own set of functions for reading (adread) and displaying (adshow) images. When trying to reproduce on your personal computer code presented at Adessowiki, please replace these functions for alternative libraries like OpenCV or PIL.

Interactive max-tree tool

This interactive max-tree tool demo corresponds to the following [Tavares2015a]. It is a very interesting tool to learn more about max-trees. We encourage you to test it and give us feedback!

Toolbox Data Structure

Source Code and Documentation


Figure 1: Class diagram.


  • MorphTreeAlpha

    • Constructor - Constructor of the class MorphTreeAlpha.
    • getImage - This method returns the image corresponding to the morphological tree structure.
    • clone - This method returns a deep copy of the object.
    • recConnectedComponent - This method returns the connected component corresponding to the node of morphological tree structure.
    • getChildren - This method returns the children of node.
    • getAncestors - This method returns the ancestors of node.
    • getBifAncestor - This method returns the first ancestor of node that bifurcates.
    • getDescendants - This method returns the descendants of node.
    • getSubBranches - This method computes the sub-branches of the tree.
    • generateGraph - This method generates the graphviz code to draw the morphological tree.
    • generateCCGraph - This method draws the morphological tree displaying the connected components in the places of the tree nodes.
    • generateCCPathGraph - This method draws the connected components path connecting two nodes of the tree.
    • contractDR - This method implementd the direct rule for node contraction.
    • prune - This method implements the pruning strategy.
    • compact - This method updates the node_array and node_index at the end of each filtering procedure.
    • areaOpen - This method implements the area-open filter.
    • bbox - This method implements the bbox filter.
    • computeRR - This method computes the rectangularity ratio descriptor of each node of the tree.
    • computeHistogram - This method computes histograms of the max-tree nodes.
    • computeNodeGrayAvg - This method computes the average gray-level of the max-tree nodes.
    • computeNodeGrayVar - This method computes the gray-level variance of the max-tree nodes.
    • computeEccentricity - This method computes the eccentricity of the max-tree nodes.
    • computeNodeCentroid - This method computes the centroids of the max-tree nodes.
    • computeNodeCoordsVar - This method computes the coordinates variance of the max-tree nodes. (Not implemented yet)
  • MaxTreeAlpha

    • Constructor - Constructor of the class MaxTreeAlpha.
    • contractSR - This method implementd the subtractive rule for node contraction.
    • draw1DImageTree - This method draws the max-tree or component tree of 1D images with grey-levels varying between 0 and 7.
    • computeHeight - This method computes the height attribute of the max-tree nodes.
    • computeVolume - This method computes the volume attribute of the max-tree nodes.
    • computeStabilityMeasure - This method computes the MSER stability measure of the max-tree nodes.
    • computeExtinctionValues - This method computes the height, area or volume extinction values of the max-tree nodes.
    • getSignature - This method computes the signature of a node. The signature may be either of area or volume, and it takes in consideration the max-tree composite nodes.
    • hmax - This method implements the hmax filter.
    • vmax - This method implements the vmax filter.
    • extinctionFilter - This method implements the extinction filter.
    • mmsT - This method implements the MMS-T filter.
    • mmsMSER - This method implements the MMS-MSER filter.
    • areaDifference - This method implements the area difference filter.
    • progAreaDifference - This method implements the progressive area difference filter.
  • MaxTreeAlpha2 (under development, this class is not stable and is not available in the GitHub distribution yet)

Auxiliary Functions

Other interesting libraries

We list here some libraries/demos related to max-trees:
  • LIBTIM for simple component tree
  • CG for the component graph
  • PINK image processing library with max-tree implementation
  • TW topological watershed implementation
  • MTDemo max-tree filtering demo
  • Morph

If you have any other libraries that you think should be added in this list, please make a comment at the end of the page. We will add it to our list.


[Salembier1998] P. Salembier, A. Oliveras and L. Garrido, "Antiextensive connected operators for image and sequence processing," Image Processing, IEEE Transactions on , vol.7, no.4, pp.555,570, Apr 1998. doi: 10.1109/83.663500

[Jones1999] R. Jones, R., "Connected filtering and segmentation using component trees", Computer Vision and Image Understanding, v.75 n.3, p.215-228, Sept. 1999. doi>10.1006/cviu.1999.0777.

[Matas2002] J. Matas, O. Chum, M. Urban and T. Pajdla, "Robust wide baseline stereo from maximally stable extremal regions," Proc. of British Machine Vision Conference, pages 384-396, 2002.

[Souza2014a] R. Souza, "Maximal Max-tree Simplification," M.Sc. dissertation presented at the University of Campinas (UNICAMP), March 2014.

[Souza2014b] R. Souza, L. Ríttner, R. Machado and R. Lotufo, "Maximal Max-tree Simplification," Proceedings of the 22nd International Conference on Pattern Recognition, Stockholm, Sweden, August 2014.

[Carlinet2014] E. Carlinet, T. Geraud, "A Comparative Review of Component Tree Computation Algorithms," Image Processing, IEEE Transactions on , vol.23, no.9, pp.3885,3895, Sept. 2014.

[Souza2015a] R. Souza, L. Rittner, R. Machado, R. Lotufo: A comparison between extinction filters and attribute filters. In: International Symposium on Mathematical Morphology, 2015, Reykjavik.

[Souza2015b] R. Souza, L. Rittner, R. Machado, R. Lotufo: An Array-based Node-Oriented Max-tree Representation. In: International Conference on Image Processing, 2015, Quebec.

[Tavares2015a] L. Tavares, R. Souza, L. Rittner, R. Machado and R. Lotufo, "Interactive max-tree visualization tool for image processing and analysis," 2015 International Conference on Image Processing Theory, Tools and Applications (IPTA), Orleans, 2015, pp. 119-124.

Drafts (only for developers)



Recently modified pages
Recently commented pages