MorphoTreeAdjust
MorphoTreeAdjust provides the core C++ and Python implementation for dynamic updates of component trees and connected alternating sequential filters (CASF). The repository is organized around a small public API, example programs, and developer tools for experiments, validation, and benchmarks.
Research Context
The repository is centered on dynamic update problems for component trees.
Let f be an image, and let T_f^min and T_f^max be the min-tree and
max-tree of f.
We set:
S: a subtree inT_f^minT_g^min: the min-tree obtained after pruningSfromT_f^ming: the image reconstructed fromT_g^minT_g^max: the max-tree ofg
The central question is:
How to modify
T_f^maxto obtainT_g^max?
This is the basis for the dual min/max tree incremental filtering work and for CASF implementations derived from those structures.
Related papers:
- Wonder Alves, Nicolas Passat, Dênnis José da Silva, Alexandre Morimitsu, Ronaldo F. Hashimoto. Efficient connected alternating sequential filters based on component trees. International Conference on Discrete Geometry and Mathematical Morphology (DGMM), November 2025, Groningen, Netherlands. hal-05163556
- Wonder Alves, Nicolas Passat, Dênnis José da Silva, Alexandre Morimitsu, Ronaldo F. Hashimoto. Component tree: Update rather than rebuild. Journal of Mathematical Imaging and Vision (under review), 2026.
Quick Start
If you want the Python surface first, install it from PyPI:
python -m pip install morphoTreeAdjust
If you want the current repository version instead, install it from the repository root:
python -m pip install .
The package build is pyproject.toml-driven and uses scikit-build-core
with CMake for the native extension.
Then use the public module:
import numpy as np
import morphoTreeAdjust as mta
image = np.array(
[
[4, 4, 2, 1],
[4, 3, 2, 1],
[5, 5, 2, 0],
[5, 6, 6, 0],
],
dtype=np.uint8,
)
adj = mta.AdjacencyRelation(image.shape[0], image.shape[1], 1.5)
maxtree = mta.DynamicComponentTree(image, True, adj)
mintree = mta.DynamicComponentTree(image, False, adj)
adjust = mta.DualMinMaxTreeIncrementalFilter(mintree, maxtree)
casf = mta.ComponentTreeCasf(image, "area", adj)
filtered = casf.filter([1, 2])
For a complete runnable script, see examples/core_python_api_example.py.
If you want a developer build with benchmarks and tools:
cmake -S dev-tools -B ../build/MorphoTreeAdjust/dev-tools
cmake --build ../build/MorphoTreeAdjust/dev-tools
If you want the install surface from the root project:
cmake -S . -B ../build/MorphoTreeAdjust/install \
-DPYTHON_EXECUTABLE="$(python -c 'import sys; print(sys.executable)')"
cmake --build ../build/MorphoTreeAdjust/install
cmake --install ../build/MorphoTreeAdjust/install --prefix /tmp/mta-install
cmake --install publishes:
- the Python package under
lib/morphoTreeAdjust; - the public C++ headers under
include/MorphoTreeAdjustwhenMTA_INSTALL_PUBLIC_CORE_HEADERS=ON.
Repository Layout
- Public C++ entrypoint: morphoTreeAdjust/include/MorphoTreeAdjust.hpp
- Core headers: morphoTreeAdjust/include
- Python bindings: morphoTreeAdjust/morphoTreeAdjust.cpp
- Examples: examples
- Notebooks: notebooks
- Documentation: docs
- Developer tools and benchmarks: dev-tools
Recommended documentation entry points:
Developer Tools
Ad hoc debug binaries under dev-tools/tools/debug_*.cpp are excluded from the
default developer build. Enable them explicitly when needed:
cmake -S dev-tools -B ../build/MorphoTreeAdjust/dev-tools \
-DMTA_BUILD_DEBUG_TOOLS=ON
cmake --build ../build/MorphoTreeAdjust/dev-tools
Core benchmark example:
../build/MorphoTreeAdjust/dev-tools/benchmarks/jmiv2026_benchmark \
--repeat 5 --warmup 1 --json --no-validate image1.png image2.png
dynamic_casf_apply
dynamic_casf_apply applies connected alternating sequential filters on
grayscale images and compares the dynamic implementations against the naive
rebuild-based baseline.
After building dev-tools, the executable is available at:
../build/MorphoTreeAdjust/dev-tools/tools/dynamic_casf_apply
Usage:
../build/MorphoTreeAdjust/dev-tools/tools/dynamic_casf_apply \
[--mode dynamic-subtree|dynamic-leaf|naive|compare] \
[--attribute area|bbox_width|bbox_height|bbox_diagonal] \
[--radio-adj <radius>] \
[--iter-timing] \
[--no-output] \
<input.png> [<output.png>] <threshold1> [threshold2 ...]
Modes:
dynamic-subtree: CASF with dynamic subtree-based updates;dynamic-leaf: CASF with dynamic leaf-based updates;naive: CASF by rebuilding the trees at every threshold;compare: runsdynamic-subtree,dynamic-leaf, andnaive, checks that outputs match, and prints a timing summary.
Attributes:
areabbox_widthbbox_heightbbox_diagonal
Examples:
../build/MorphoTreeAdjust/dev-tools/tools/dynamic_casf_apply \
--mode dynamic-subtree \
--attribute area \
cameraman.png cameraman_dynamic.png 64 128 256
../build/MorphoTreeAdjust/dev-tools/tools/dynamic_casf_apply \
--mode compare \
--attribute bbox_diagonal \
--radio-adj 1.5 \
--no-output \
cameraman.png 64 128 256
Timing output:
Initialization time: dynamic setup cost before the threshold loop, including adjacency creation, max-tree/min-tree construction, attribute computer setup, initial attribute computation, and attribute binding;Iteration time: accumulated threshold-loop time, excluding initialization and final reconstruction;Reconstruction time: final image reconstruction time;Total time:Initialization time + Iteration time + Reconstruction time.
For naive, Total time measures the full per-threshold rebuild-and-filter
work. In compare mode, the reported dynamic totals include initialization so
they are directly comparable to the naive baseline.
Metadata
Release files for morphoTreeAdjust 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| morphotreeadjust-1.0.1.tar.gz | 2.6 MB | Without provenance | Details |
Built distributions (wheels)
Total release size: 4.8 MB
Release files / morphotreeadjust-1.0.1.tar.gz
| Download URL | morphotreeadjust-1.0.1.tar.gz |
|---|---|
| Size | 2.6 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2ca7ab210bd50ddc8eb7b3d93f5e97f4cc624368b12569e74d87a9e6f4c06e5a
|
|
BLAKE2b-256 checksum How to use checksums |
1867db04a0c20962147c9a111db56efc22154dd25db6f229021d95136ec4561c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / morphotreeadjust-1.0.1-cp312-cp312-win_amd64.whl
| Download URL | morphotreeadjust-1.0.1-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 176.7 kB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
e0234cb3320a46dde19d36c6088fa9f9fbb1ea3476cc32b6fb25190fc9cf232b
|
|
BLAKE2b-256 checksum How to use checksums |
7b96f2553874aa072bffc91838c3addd3c924f519aae019e1dc6f5204a449230
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / morphotreeadjust-1.0.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | morphotreeadjust-1.0.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 223.2 kB |
| Tags | CPython 3.12 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
e46cecf26663625b9d256838d6ff6c1f9da501e121aa67b46c451c20b2cf6640
|
|
BLAKE2b-256 checksum How to use checksums |
5c045d106aebf987936451771271f25593a56da19f52590aaf061d235a20fe26
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / morphotreeadjust-1.0.1-cp312-cp312-macosx_11_0_arm64.whl
| Download URL | morphotreeadjust-1.0.1-cp312-cp312-macosx_11_0_arm64.whl |
|---|---|
| Size | 175.9 kB |
| Tags | CPython 3.12 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
ed21f61e9f772e9c5aac2cf8b5b170bcbe19c1dd249063dfbbfb01e9238552e6
|
|
BLAKE2b-256 checksum How to use checksums |
120d3c89d0a3b48e53d5de49fca036e61b1f00893015aa892558571874c6cd59
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / morphotreeadjust-1.0.1-cp312-cp312-macosx_10_13_x86_64.whl
| Download URL | morphotreeadjust-1.0.1-cp312-cp312-macosx_10_13_x86_64.whl |
|---|---|
| Size | 181.0 kB |
| Tags | CPython 3.12 macOS 10.13+ x86-64 |
|
SHA-256 checksum How to use checksums |
9f9eb08e3bbd048ef9e016831056a1e4ee816025f5fba7e790d3cbb88fd1aad9
|
|
BLAKE2b-256 checksum How to use checksums |
9fe5dbb8f74d89df38c23ddd023c6a1a375e942a72f706b5be02ecbc3b8eee16
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / morphotreeadjust-1.0.1-cp311-cp311-win_amd64.whl
| Download URL | morphotreeadjust-1.0.1-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 173.9 kB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
d20beec70cf78612e0798f29402af6caf882f288228e55be137cbe23b86fb0f1
|
|
BLAKE2b-256 checksum How to use checksums |
cfccfb8500769dfccba54f363a336e839c63fa853958a39bb497d69a78984b6c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / morphotreeadjust-1.0.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | morphotreeadjust-1.0.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 223.2 kB |
| Tags | CPython 3.11 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
579b92e3c046130b9ac55cd0a237a3050de1ed87cab91a49a96e0d0361e48cb4
|
|
BLAKE2b-256 checksum How to use checksums |
cbd160bc264c7b6663468b4cae62ebcfff3e6111dafb1d8da40128dc86fe66b3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / morphotreeadjust-1.0.1-cp311-cp311-macosx_11_0_arm64.whl
| Download URL | morphotreeadjust-1.0.1-cp311-cp311-macosx_11_0_arm64.whl |
|---|---|
| Size | 173.9 kB |
| Tags | CPython 3.11 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
1776333d0e82a4158e941c88e5fe14239bd7f2fd66635511288f61b47c65522f
|
|
BLAKE2b-256 checksum How to use checksums |
ba4e3b444dfd0ef28c84348a2119133787e5d456df3cddefcdac3b190033ff31
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / morphotreeadjust-1.0.1-cp311-cp311-macosx_10_9_x86_64.whl
| Download URL | morphotreeadjust-1.0.1-cp311-cp311-macosx_10_9_x86_64.whl |
|---|---|
| Size | 179.0 kB |
| Tags | CPython 3.11 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
bd5b38e814415a19f06eff036ff8bef43d851d0827ce169c89fcfde1d0194a7a
|
|
BLAKE2b-256 checksum How to use checksums |
d8b495c64d272718616e1cc1756165f794cdccf3748d807856076038f12a2b49
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / morphotreeadjust-1.0.1-cp310-cp310-win_amd64.whl
| Download URL | morphotreeadjust-1.0.1-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 173.2 kB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
ced2b1682eab327de3bc1b92dc25ad501b81f9183493a22994e774be170083b7
|
|
BLAKE2b-256 checksum How to use checksums |
7eb986e1a45b52cf6482c9226099cf4a1e657bb724c7bf22f19549dcc123061b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / morphotreeadjust-1.0.1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | morphotreeadjust-1.0.1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 222.3 kB |
| Tags | CPython 3.10 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
9fd6a3df72e130440b6a5f0462e9c0c9a261c556bee8effc47e17e9111a291f3
|
|
BLAKE2b-256 checksum How to use checksums |
35a580267abf6df921662fcdfa07ead7556325020f7c637ca75303990a4ad904
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / morphotreeadjust-1.0.1-cp310-cp310-macosx_11_0_arm64.whl
| Download URL | morphotreeadjust-1.0.1-cp310-cp310-macosx_11_0_arm64.whl |
|---|---|
| Size | 172.6 kB |
| Tags | CPython 3.10 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
287f9b6e78c33a53b055780ee71e4ead9f672f202ae571b95999a9447d5c4f02
|
|
BLAKE2b-256 checksum How to use checksums |
dade8d1a066c53c97e040e0ddd115a9ffaf7b5bdc96c1913b67fff283f56b57d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / morphotreeadjust-1.0.1-cp310-cp310-macosx_10_9_x86_64.whl
| Download URL | morphotreeadjust-1.0.1-cp310-cp310-macosx_10_9_x86_64.whl |
|---|---|
| Size | 177.6 kB |
| Tags | CPython 3.10 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
10e85739c20a93f9c86cf91e2660b244b33426d919cf667e9f9860cf1e3baae2
|
|
BLAKE2b-256 checksum How to use checksums |
94cb0e601c4359a4a1db71cf5029702cf0028a795aa3a4b4daf529412df1068d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Security for morphoTreeAdjust 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.