Skip to main content

📦 Welcome to ximage

Deployment PyPI Conda
Activity PyPI Downloads Conda Downloads
Python Versions Python Versions
Supported Systems Linux macOS Windows
Project Status Project Status
Build Status Tests Lint Docs
Linting Black Ruff Codespell
Code Coverage Coveralls Codecov
Code Quality Codefactor Codacy CodeScene
License License
Community Slack GitHub Discussions
Citation DOI

Slack | Docs

ℹ️ Software Overview

The software currently enables to:

  • label n-dimensional xarray objects
  • extract patches around n-dimensional labels
  • extract patches from n-dimensional xarray objects

Join the Slack Workspace to meet the community !

🚀 Quick Start

ximage provides an easy-to-use interface to manipulate image, videos and n-dimensional arrays with classical image processing techniques.

The ximage xarray accessor provides a convenient way to labelling and extract patches in n-dimensional arrays !

Image labelling
# Define labelling parameters
min_value_threshold = 1
max_value_threshold = np.inf
min_area_threshold = 5
max_area_threshold = np.inf
footprint = None
sort_by = "area"
sort_decreasing = True
label_name = "label"

# Label xarray object
xr_obj = da.ximage.label(
    min_value_threshold=min_value_threshold,
    max_value_threshold=max_value_threshold,
    min_area_threshold=min_area_threshold,
    max_area_threshold=max_area_threshold,
    footprint=footprint,
    sort_by=sort_by,
    sort_decreasing=sort_decreasing,
    label_name=label_name,
)
# Display labels
xr_obj[label_name].ximage.plot.labels()
Extract patches around labels
# Define labelling parameters
# - Output Options
n_patches = 10
n_labels = None
labels_id = None
highlight_label_id = False
# - Patch Extraction Options
patch_size = (100, 100)
centered_on = "label_bbox"
padding = 0
n_patches_per_label = None
n_patches_per_partition = 1
# - Tiling/Sliding Options
partitioning_method = None  # "tiling" / "sliding"
n_partitions_per_label = None
kernel_size = None
buffer = 0
stride = None
include_last = True
ensure_slice_size = True
debug = True
verbose = True

# Run patch extraction
da_patch_gen = xr_obj.ximage.label_patches(
    label_name=label_name,
    patch_size=patch_size,
    variable=variable,
    # Output Options
    n_patches=n_patches,
    n_labels=n_labels,
    labels_id=labels_id,
    highlight_label_id=highlight_label_id,
    # Patch Extraction Options
    centered_on=centered_on,
    padding=padding,
    n_patches_per_label=n_patches_per_label,
    n_patches_per_partition=n_patches_per_partition,
    # Tiling/Sliding Options
    partitioning_method=partitioning_method,
    n_partitions_per_label=n_partitions_per_label,
    kernel_size=kernel_size,
    buffer=buffer,
    stride=stride,
    include_last=include_last,
    ensure_slice_size=ensure_slice_size,
    debug=debug,
    verbose=verbose,
)

📖 Explore the ximage documentation

To discover all ximage utilities, please read the software documentation.

🛠️ Installation

conda

ximage can be installed via conda on Linux, Mac, and Windows. Install the package by typing the following command in the terminal:

conda install ximage

In case conda-forge is not set up for your system yet, see the easy to follow instructions on conda-forge.

pip

ximage can be installed also via pip on Linux, Mac, and Windows. On Windows you can install WinPython to get Python and pip running.

Install the ximage package by typing the following command in the terminal:

pip install ximage

To install the latest development version via pip, see the documentation.

💭 Feedback and Contributing Guidelines

If you aim to contribute or discuss the future development of ximage, we highly suggest to join the Slack Workspace

Feel free to also open a GitHub Issue or a GitHub Discussion specific to your questions or ideas.

✍️ Contributors

Citation

You can cite the ximage software by:

Ghiggi Gionata & Son Pham-Ba . ghiggi/ximage. Zenodo. https://doi.org/10.5281/zenodo.8131552

If you want to cite a specific version, have a look at the Zenodo site.

License

The content of this repository is released under the terms of the MIT license.

📚 Requirements:

Metadata

Release files for ximage 0.0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ximage 0.0.6
File Size Uploaded
ximage-0.0.6.tar.gz 46.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ximage 0.0.6
File Interpreter ABI Platform
ximage-0.0.6-py3-none-any.whl Python 3 none any Details

Total release size: 86.9 kB

Release files / ximage-0.0.6.tar.gz

Download URL ximage-0.0.6.tar.gz
Size 46.5 kB
Tags Source
SHA-256 checksum
How to use checksums
bbdea31b16f6906c37f3412c957f79e5f4c2ce01e6b8246b6ce7c8c87908a0fd
BLAKE2b-256 checksum
How to use checksums
0225f25374e9b5408bbe765d16ad16b596e33e9a45c3560cc03d04ebe3eaf0db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / ximage-0.0.6-py3-none-any.whl

Download URL ximage-0.0.6-py3-none-any.whl
Size 40.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5ac2e567249fa28e7ef738a07bd5ffbe19d12f09df2ea559d1e8f531e928a391
BLAKE2b-256 checksum
How to use checksums
02c13ff7266a5d6364a5fa8a1ff4915e842839b38fa0ed50e917086b3558bfb8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release history Release notifications | RSS feed

This release

0.0.6 This release

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page