Skip to main content

Python port of the SHINE toolbox with added options (color management, dithering, EHS), optimized for large image sets.

Project description

๐ŸŒŸ SHINIER

   โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•—  โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ•—  โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—
   โ–ˆโ–ˆโ•”โ•โ•โ•โ•โ•โ–ˆโ–ˆโ•‘  โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•”โ•โ•โ•โ•โ•โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•—
   โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•”โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—  โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•”โ•
   โ•šโ•โ•โ•โ•โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘โ•šโ–ˆโ–ˆโ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•”โ•โ•โ•  โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•—
   โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘  โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘ โ•šโ–ˆโ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•‘  โ–ˆโ–ˆโ•‘
   โ•šโ•โ•โ•โ•โ•โ•โ•โ•šโ•โ•  โ•šโ•โ•โ•šโ•โ•โ•šโ•โ•  โ•šโ•โ•โ•โ•šโ•โ•โ•šโ•โ•โ•โ•โ•โ•โ•โ•šโ•โ•  โ•šโ•โ•

Spectrum, Histogram, and Intensity Normalization, Equalization, and Refinement.

License: MIT Python versions PyPI version Tests

๐ŸŽฏ Overview

SHINIER is a modern Python implementation of SHINE (Spectrum, Histogram, and Intensity Normalization and Equalization), originally developed in MATLAB by Willenbockel etย al., 2010. It provides precise control over luminance, contrast, histograms, and spectral content across large image sets for well-calibrated visual experiments.

Key Features and Improvements

  • ๐ŸŽจ Color Processing โ€” New modes for color image control with modern color-space standards (Rec.601 / Rec.709 / Rec.2020).
  • ๐Ÿ–ผ๏ธ Dithering Support โ€” Reduces quantization artifacts and enhances output image quality.
  • โšก Optimized Performance โ€” Efficient memory management and faster processing for large image sets (optional Cython/C++ convolution core).
  • ๐Ÿ•ฐ Legacy Mode โ€” Ensures full backward compatibility with MATLABโ€™s original SHINE toolbox.
  • ๐Ÿ”ข High-Precision Arithmetic โ€” Computations in floating-point precision rather than 8-bit integer space, minimizing rounding errors in multi-stage processing.
  • ๐Ÿ“ฆ Object-Oriented Design โ€” Modular, extensible architecture with a clean Python API.
  • ๐Ÿ˜€ User-Friendly CLI โ€” Guided, prompt-based interface for users who prefer not to write code.

For detailed technical documentation (algorithms, numerical choices, and MATLAB vs Python behavior), see
documentation/documentation.md.


๐Ÿš€ Quick Start

Installation

Pip Install (recommended):
pip install shinier

Note: SHINIER includes a Cython-compiled C++ extension (_cconvolve) for faster convolution. If a C/C++ compiler is available, it will build automatically during installation, otherwise, it will fall back to a slower NumPy-based implementation.

Install compilers:

macOS: xcode-select --installโ€ƒ

Linux: sudo apt install build-essentialโ€ƒ

Windows: Visual Studio C++ Build Tools

Install from source (development version):
git clone https://github.com/Charestlab/shinier.git
cd shinier
pip install -e ".[dev]"
Verify the install:
import shinier, sys
print("shinier version:", getattr(shinier, "__version__", "unknown"))

๐Ÿ˜€ User-friendly Interface

Call the following bash command to quickly start using the interactive CLI.

shinier --show_results --image_index=1

CLI demo

๐Ÿงฉ Example in Python

Run the following python code to make sure the package is running properly.

from shinier import Options, ImageDataset, ImageProcessor, utils

opt = Options(mode=3)  # Spatial frequency matching
dataset = ImageDataset(options=opt)
results = ImageProcessor(dataset=dataset, options=opt, verbose=1)
_ = utils.show_processing_overview(processor=results, img_idx=0)

Processing modes

Change the mode number (e.g. opt = Options(mode=3)) to change image processing. See details below:

Mode Operations Description
1 lum_match Luminance (mean/std) matching
2 hist_match Histogram matching
3 sf_match Rotational spatial frequency matching
4 spec_match Full 2D Fourier spectrum matching
5 hist_match โ†’ sf_match Histogram, then spatial frequency
6 hist_match โ†’ spec_match Histogram, then spectrum
7 sf_match โ†’ hist_match Spatial frequency, then histogram
8 spec_match โ†’ hist_match (default) Spectrum, then histogram (recommended)
9 dithering Dithering only

Below is an example of results obtained using mode 5 with joint histogram equalization and spatial frequency normalization.

CLI demo


๐Ÿ›๏ธ Technical information

See the accompanying the paper: The SHINIER the Better: An Adaptation of the SHINE Toolbox on Python

And documentation:

  1. Package Overview
  2. Package Architecture
  3. MATLAB vs Python Differences
  4. Detailed Processing Modes
  5. Package Main Classes
  6. Visualization Functions
  7. Implemented Algorithms
  8. Memory Management and Performance
  9. Testing and Validation
  10. Usage Demonstrations
  11. Additional Resources

๐Ÿ“š Citing

If you use SHINIER, please cite both of these articles:

References

  • Salvas-Hรฉbert, M., Dupuis-Roy, N., Landry, C., Charest, I., & Gosselin, F. (2025). The SHINIER the Better: An Adaptation of the SHINE Toolbox on Python
  • Willenbockel, V., Sadr, J., Fiset, D., Horne, G. O., Gosselin, F., & Tanaka, J. W. (2010). Controlling low-level image properties: The SHINE toolbox. Behavior Research Methods, 42(3), 671โ€“684. https://doi.org/10.3758/BRM.42.3.671

๐Ÿค Contributing

See CONTRIBUTING.md for guidelines (coding standards, tests, docs, and PR flow).


๐Ÿ“„ License

See LICENSE for more information.


๐Ÿ› ๏ธ Troubleshooting

  • No compiler available: install a C/C++ toolchain or proceed with the NumPy fallback (slower).
  • Import errors after upgrade: try pip install --upgrade pip setuptools wheel and reinstall.
  • Windows build issues: ensure MSVC Build Tools are installed and on PATH.

Code developed by Nicolas Dupuis-Roy and Mathias Salvas-Hรฉbert
Version 0.1.9 - Complete technical documentation

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

shinier-0.1.9.tar.gz (6.1 MB view details)

Uploaded Source

Built Distribution

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

shinier-0.1.9-cp312-cp312-macosx_11_0_arm64.whl (1.2 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

Details for the file shinier-0.1.9.tar.gz.

File metadata

  • Download URL: shinier-0.1.9.tar.gz
  • Upload date:
  • Size: 6.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for shinier-0.1.9.tar.gz
Algorithm Hash digest
SHA256 6b68af962b0128ac27b40d71747a83e89f0f7f599a00f3c8c71437effcf28caf
MD5 3fe0c8c3443489e041b1d787607a04c7
BLAKE2b-256 3e613c75126f0064446cb8c221dd3351ac7e79554062720a4ad4cae705b69862

See more details on using hashes here.

File details

Details for the file shinier-0.1.9-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for shinier-0.1.9-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bf25ba7097a02c04902bc0c0e77965bc73375505d63d5aa987b08b662b3e67d8
MD5 e45cdbbdf12e8b7d345201ce1a81cb9e
BLAKE2b-256 a009096fe6ee71df6ab34a650418633b506bc4e1db3d6ac5c44f7b62ba081623

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