Skip to main content

Multiclass Minimum Barrier Distance segmentation algorithm

Project description

mc_mbd: Multiclass Minimum Barrier Distance Segmentation

PyPI version License Python 3.9+

Strand, R., Malmberg, F., Saha, P. K., & Linnér, E. (2014). The Minimum Barrier Distance – Stability to Seed Point Position. In Advanced Information Systems Engineering (pp. 111–121). Springer Berlin Heidelberg. https://doi.org/10.1007/978-3-319-09955-2_10

mc-mbd is a fast, cross-platform implementation of the Multiclass Minimum Barrier Distance (MBD) algorithm for seeded image segmentation. It supports multi-label propagation and is accelerated by a C++ core with Python fallback. The package is installable via PyPI and works out-of-the-box for research and practical segmentation tasks.

Installation (pip)

Install from PyPI (package name uses an underscore so it's importable):

pip install mc_mbd

After installing via pip you can import the library in Python (package name stays mbd):

from mc_mbd import segment_image

For Development (build from source)

To build and develop locally:

# Create and activate a virtual environment
python -m venv .mc_mbd
# On Windows (PowerShell):
.\.mc_mbd\Scripts\Activate.ps1
# On Windows (cmd):
.\.mc_mbd\Scripts\activate.bat
# On macOS/Linux:
source .mc_mbd/bin/activate

# Install dependencies
pip install -r requirements.txt

# Build the C++ core extension in-place
python setup.py build_ext --inplace

Performance

Segmentation accuracy: mc-mbd achieves a mean intersection-over-union (mIoU) of 55.5% on the PASCAL VOC 2012 dataset using the ScribblesForAll dataset for initial seeds, without iterative refinement (one-shot segmentation).

Speed: On standard 480×480 pixel images, mc-mbd segments each image in about 0.16 seconds on average, enabling fast and efficient large-scale image processing.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Quick Usage Example

# If installed from PyPI:
from mc_mbd import segment_image
import numpy as np
# image: 2D numpy array, seeds: integer mask (0=unlabeled, 1=background, 2+=foreground)
labels = segment_image(image, seeds)

License

This project is licensed under the MIT License - see the LICENSE file for details.


Copyright © 2025 Mvzvrt. All rights reserved.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mc_mbd-0.1.2.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mc_mbd-0.1.2-cp313-cp313-win_amd64.whl (76.5 kB view details)

Uploaded CPython 3.13Windows x86-64

File details

Details for the file mc_mbd-0.1.2.tar.gz.

File metadata

  • Download URL: mc_mbd-0.1.2.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for mc_mbd-0.1.2.tar.gz
Algorithm Hash digest
SHA256 7798be1c98e840d8d5a5eff77b3888c5434276ece689b52bc93009f2a4a166bb
MD5 ac09945bd58b224db785aff897ed8894
BLAKE2b-256 d174c2b3c8f0943c98ca3617a67e06f8ca0158feba1c82bb37afedef9384463e

See more details on using hashes here.

File details

Details for the file mc_mbd-0.1.2-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: mc_mbd-0.1.2-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 76.5 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for mc_mbd-0.1.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 8dfc9b58fed0504d03899fc111d55954d7a0b4a63331cdcb07f7f28b74181a4e
MD5 20daad104be8b32ce6cbb7a544463ee0
BLAKE2b-256 8d6d53060ff66619868cb321941e5a32433179e224b1eff5173d8eca775aa2ff

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page