Skip to main content

No project description provided

Project description

mergechannels

This project was originally conceived because I often find myself wanting to apply and blend colormaps to images while working from Python, and for historical reasons many of my favorite colormaps are distributed as FIJI lookup tables. I also care about things likes speed and memory usage (e.g., not casting large arrays to floating point dtypes), so I was interested in seeing if I could at least match matplotlib's colormapping performance with my own hand-rolled colorizer in Rust.

There are other great colormapping libraries available (e.g., microfilm, cmap) that are more feature-rich than this projecting on your needs, but which don't address the my goals. My hope is that this project can fill and un-met niche and otherwise maintain full compatibility with these and similar libraries.

Installation

Install pre-compiled binaries from PyPI:

pip install mergechannels

Build from source on your own machine:

pip install git+https://github.com/zacswider/mergechannels.git

Usage

NOTE: scikit-image is not a dependency of this project, but is used in the examples below to fetch images.

colorize a single image

from skimage import data
import matplotlib.pyplot as plt
import mergechannels as mc

img = data.camera()
fig, ax = plt.subplots()
ax.imshow(mc.apply_colormap(img, 'Orange Hot'))

apply a different colormap to each channel

from skimage import data
import matplotlib.pyplot as plt
import mergechannels as mc

cells, nuclei = data.cells3d().max(axis=0)
cells = to_uint8(cells / cells.max())       <- broken until normalization is handled
nuclei = to_uint8(nuclei / nuclei.max())    <- broken until normalization is handled
fig, (a, b, c) = plt.subplots(1, 3)
a.imshow(cells, cmap='gray')
b.imshow(nuclei, cmap='gray')

import mergechannels as mc
c.imshow(mc.merge([cells, nuclei], ['Orange Hot', 'Cyan Hot']))

Acknowledgements

This project incorporates a number of colormaps that were hand-crafted by Christophe Leterrier and were originally distributed here under the MIT license: https://github.com/cleterrier/ChrisLUTs

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

mergechannels-0.1.0.tar.gz (206.5 kB view details)

Uploaded Source

Built Distribution

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

mergechannels-0.1.0-cp311-cp311-macosx_11_0_arm64.whl (313.5 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

Details for the file mergechannels-0.1.0.tar.gz.

File metadata

  • Download URL: mergechannels-0.1.0.tar.gz
  • Upload date:
  • Size: 206.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for mergechannels-0.1.0.tar.gz
Algorithm Hash digest
SHA256 15cb3a48717b349a00a9172b55321978dfd5ffd8888395180ce76d7f0bb073bd
MD5 83ed63bda6775545d64d6d82b68194d2
BLAKE2b-256 b2e2f110783e95aeaf1d34178c8fb35aa36e53610b7888150a23a4544acf997b

See more details on using hashes here.

File details

Details for the file mergechannels-0.1.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for mergechannels-0.1.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a4454b7eb9b82eb013baa665e15a6b5abe97a2672e5b41ee8a9be1d629badf80
MD5 165d054eb81f6c885c7ec1f428b5331b
BLAKE2b-256 f3bd7e8f8f33fcdd3a7fb0d7f99f6b11f8412d314dac5281e81f19f432e58b33

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