MicroSSIM
MicroSSIM is an image measure aimed at addressing the shortcomings of the Structural Similarity Index Measure (SSIM), in particular in the context of microscopy images. Indeed, in microscopy, degraded images (e.g. lower signal to noise ratio) often have a different dynamic range than the original images. This can lead to a poor performance of SSIM.
The measure normalizes the images using background subtraction and a more appropriate range estimation. It then estimates a scaling factor used to scale the image to the target (original image or ground truth). The metric is then computed similarly to the SSIM.
MicroSSIM is easily extensible to other SSIM-like measures, such as Multi-Scale SSIM (MS-SSIM), for which we provide an example.
See the paper for more details.
Installation
pip install microssim
Usage
import numpy as np
from microssim import MicroSSIM, micro_structural_similarity
from skimage.metrics import structural_similarity
rng = np.random.default_rng(42)
N = 5
gt = 200 + rng.integers(0, 65535, (N, 256, 256)) # stack of different images
pred = rng.poisson(gt) / 10
# using the convenience function
result = micro_structural_similarity(gt, pred)
print(f"MicroSSIM: {result} (convenience function)")
# using the class allows fitting a large dataset, then scoring a subset
microssim = MicroSSIM()
microssim.fit(gt, pred) # fit the parameters
for i in range(N):
score = microssim.score(gt[i], pred[i]) # score a single pair
print(f"MicroSSIM ({i}): {score}")
# compare with SSIM from skimage
for i in range(N):
score = structural_similarity(gt[i], pred[i], data_range=65535)
print(f"SSIM ({i}): {score}")
The code is similar for MicroMS3IM.
Tips for deep learning
MicroSSIM was developed in the context of deep-learning, in which SSIM is often used as a measure to compare denoised and ground-truth images. The tips presented here are valid beyond deep-learning.
The larger the dataset, the better the estimate of the scaling factor will be. Therefore,
it is recommended to fit the measure on the entire dataset (e.g. the whole training
dataset). Once the data fitted, the MSSIM class has registered the parameters used
for normalization and scaling. You can then score a subset of the data (e.g. the validation
or test datasets) using the score method.
Cite us
If you use MicroSSIM in your research, please cite us:
Ashesh, Ashesh, Joran Deschamps, and Florian Jug. "MicroSSIM: Improved Structural Similarity for Comparing Microscopy Data." arXiv preprint arXiv:2408.08747 (2024). link.
Metadata
Release files for microssim 0.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| microssim-0.0.5.tar.gz | 5.4 MB | With provenance | Details for microssim-0.0.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| microssim-0.0.5-py3-none-any.whl | Python 3 | none | any | Details for microssim-0.0.5-py3-none-any.whl |
Total release size: 5.5 MB
Release files / microssim-0.0.5.tar.gz
| Download URL | microssim-0.0.5.tar.gz |
|---|---|
| Size | 5.4 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1dcda02780a819cff4117a9254ab80d9416d16fe3f34fcb9334e6aa7c6025b4e
|
|
BLAKE2b-256 checksum How to use checksums |
be1cbca9d0fafe065e7a2fdb27338b28183e6e2c592060d5d226f023eb484956
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 11, 2026.
Transparency logRelease files / microssim-0.0.5-py3-none-any.whl
| Download URL | microssim-0.0.5-py3-none-any.whl |
|---|---|
| Size | 21.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0ca553d08638c93de5cdf294ce9f2e015943df92b900776a73974ca4b6502017
|
|
BLAKE2b-256 checksum How to use checksums |
613e4034d1655fdaceec731fa4d09e363a5dc6e9d8b114b4cde1402f5d8c6674
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 11, 2026.
Transparency logSecurity for microssim 0.0.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for microssim-0.0.5.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 11, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.