Interactive image and video sequence viewer
Project description
twxtools
twxtools is an interactive image and video sequence viewer built on top of matplotlib. It provides a convenient twx() function for quickly displaying, comparing, and navigating through images and video sequences in Python.
Features
- Display single images or compare multiple images side-by-side
- Navigate video sequences frame-by-frame with keyboard shortcuts
- Automatic intensity range detection (with optional percentile clipping)
- Support for grayscale and RGB data
- Flexible data layout modes:
HW,HWC,CHW,NHW,NHWC,NCHW - Interactive colormap switching
- Accepts NumPy arrays, lists, tuples, or dicts
Installation
pip install twxtools
Quick Start
import numpy as np
from twxtools import twx
# Display a single grayscale image
img = np.random.rand(256, 256)
twx(img)
# Compare two images
img1 = np.random.rand(256, 256)
img2 = np.random.rand(256, 256)
twx([img1, img2])
# Display a grayscale video sequence (N x H x W)
video = np.random.rand(30, 256, 256)
twx(video)
# Use a dict to label images automatically
twx({'original': img1, 'processed': img2})
API Reference
twx(data, dataRange=[], cmap='gray', mode=None, titles=None)
Parameters:
| Parameter | Type | Description |
|---|---|---|
data |
ndarray, list, tuple, or dict |
Image(s) or video sequence(s) to display. Each item can be a NumPy array of up to 4 dimensions. |
dataRange |
list |
Intensity range(s) for display. See details below. |
cmap |
str |
Colormap for grayscale data (default: 'gray'). Ignored for RGB data. |
mode |
str or None |
Dimension layout of the input data. Auto-detected if None. |
titles |
list of str or None |
Labels for each input. Auto-generated as '1', '2', … if not provided. When data is a dict, keys are used as titles. |
dataRange options
[]— use[min(data), max(data)][P]— use[percentile(data, P), percentile(data, 100-P)][low, high]— use the given fixed range
mode options
| Mode | Shape | Description |
|---|---|---|
'HW' |
H × W |
Grayscale image |
'HWC' |
H × W × C |
RGB image (channels last) |
'CHW' |
C × H × W |
RGB image (channels first) |
'NHW' |
N × H × W |
Grayscale video sequence |
'NHWC' |
N × H × W × C |
RGB video sequence (channels last) |
'NCHW' |
N × C × H × W |
RGB video sequence (channels first) |
If mode is not provided, it is auto-detected from the array shape.
Keyboard Controls
| Key | Action |
|---|---|
1–9, 0 |
Switch to the corresponding input (1–10) |
↑ / ↓ |
Previous / next frame in a video |
a |
Toggle colorbar |
m |
Cycle through colormaps |
Requirements
- Python ≥ 3.8
- numpy
- matplotlib
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file twxtools-0.1.0.tar.gz.
File metadata
- Download URL: twxtools-0.1.0.tar.gz
- Upload date:
- Size: 11.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
42756e26a5cdf2c37b56521b57bfc6d2c3d2e1dcaba97e932f6d2f5670dde55b
|
|
| MD5 |
2aeb08bed04e7f0289168cb5d7ccfb34
|
|
| BLAKE2b-256 |
1bfd46468a0ee92976ff5c006c6c0c2b18c380cc3d42008c40c32da177e44eb6
|
Provenance
The following attestation bundles were made for twxtools-0.1.0.tar.gz:
Publisher:
python-publish.yml on aram-danielyan/twx
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
twxtools-0.1.0.tar.gz -
Subject digest:
42756e26a5cdf2c37b56521b57bfc6d2c3d2e1dcaba97e932f6d2f5670dde55b - Sigstore transparency entry: 1084167880
- Sigstore integration time:
-
Permalink:
aram-danielyan/twx@f28e07b6c7d42cff053d85ad041fa2edf62a9b80 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/aram-danielyan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@f28e07b6c7d42cff053d85ad041fa2edf62a9b80 -
Trigger Event:
release
-
Statement type:
File details
Details for the file twxtools-0.1.0-py3-none-any.whl.
File metadata
- Download URL: twxtools-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8d2a0e498a0e2f12fe6bf34e2a040ae165d2289b20a9fef4bea573bf1196cb8d
|
|
| MD5 |
e27380bfacc79955eac710e42634c982
|
|
| BLAKE2b-256 |
e64b34f97244db1f96061ddef41d3d688405b31512df43b832cb04950b94d96d
|
Provenance
The following attestation bundles were made for twxtools-0.1.0-py3-none-any.whl:
Publisher:
python-publish.yml on aram-danielyan/twx
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
twxtools-0.1.0-py3-none-any.whl -
Subject digest:
8d2a0e498a0e2f12fe6bf34e2a040ae165d2289b20a9fef4bea573bf1196cb8d - Sigstore transparency entry: 1084167956
- Sigstore integration time:
-
Permalink:
aram-danielyan/twx@f28e07b6c7d42cff053d85ad041fa2edf62a9b80 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/aram-danielyan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@f28e07b6c7d42cff053d85ad041fa2edf62a9b80 -
Trigger Event:
release
-
Statement type: