Skip to main content

Pystack3D: A Python package for fast image stack correction

Project description

PyPI Github Doc status

Introduction

PyStack3D is a package dedicated to images correction intended -for instance- to FIB-SEM stack images postprocessing before image segmentation.

The pystack3d workflow includes the following process steps which can be activated or not and executed in any order:

  • cropping to reduce the image field of view to a ROI (Region Of Interest)
  • background removal to reduce from polynomial approximations artefacts issued for instance from shadowing, charging, ...
  • intensity rescaling to homogenize the 'gray' intensity distribution between successive frames/slices
  • registration to correct the images misalignment due to shifting, drift, rotation, ... during the images acquisition
  • destriping to minimize artefacts like stripes that can appear in some image acquisition techniques
  • resampling to correct non uniform spatial steps

An additional step named cropping_final can be used to eliminate artefacts produced near the edges during the image processing or to select another ROI at the end.

Pystack3d can be launched in scripting mode using .toml configuration files (see documentation), or through a dedicated GUI designed with Napari.


a) Synthetic case illustrating the defects to be removed by PyStack3D. b) Corrected stack. c) Ground truth.


Illustration of a FIB-SEM image correction using some of the PyStack3D process steps.

Installation

For a simple install (execution by scripts):

pip install pystack3d

For a GUI install and execution:

pip install pystack3d[gui]
pip install PyQt5           # or PyQt6, PySide2, PySide6, if no Qt backend have been already installed in your env.
pystack3d

(The GUI install required ~900MB free space on disk)

For a GPU acceleration during the destriping process:

python -m pyvsnr.install_cupy

Refer to pyvsnr for more details.

Tests and examples execution

For tests and examples execution, the full pystack3d project has to be installed via git:

git clone https://github.com/CEA-MetroCarac/pystack3d.git
cd [path_to_your_pystack3d_project]

Once the project has been cloned, the python environment has to be created and completed with the pytest package (for testing):

pip install .
pip install pytest

Then the tests and the examples can be executed as follows:

pytest
cd examples
python ex_synthetic_stack.py
python ex_real_stack.py

Usage

Refer to the PyStack3D documentation.

Contributing / Reporting an issue

Contributions and issue reporting are more than welcome! Please read through our Developers notes.

Acknowledgements

This work, carried out on the CEA - Platform for Nanocharacterisation (PFNC), was supported by the “Recherche Technologique de Base” program of the French National Research Agency (ANR).

Warm thanks to the JOSS reviewers (@kasasxav, @sklumpe and @xiuliren) and editor (@mstimberg) for their contributions to enhancing PyStack3D.

Citations

In case you use the results of this code in an article, please cite:

additional citations for the destriping:

  • Pavy K., Quéméré P. (2024). Pyvsnr 2.0.0. Zenodo. https://doi.org/10.5281/zenodo.10623640.

  • Fehrenbach J., Weiss P., Lorenzo C. (2012). Variational algorithms to remove stationary noise: applications to microscopy imaging. IEEE Transactions on Image Processing 21.10 (2012): 4420-4430.

additional citation for the registration:

  • Thévenaz P., Ruttimann U.E., Unser M. (1998), A Pyramid Approach to Subpixel Registration Based on Intensity, IEEE Transactions on Image Processing, vol. 7, no. 1, pp. 27-41, January 1998.

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

pystack3d-2026.1.tar.gz (47.4 kB view details)

Uploaded Source

Built Distribution

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

pystack3d-2026.1-py3-none-any.whl (53.7 kB view details)

Uploaded Python 3

File details

Details for the file pystack3d-2026.1.tar.gz.

File metadata

  • Download URL: pystack3d-2026.1.tar.gz
  • Upload date:
  • Size: 47.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pystack3d-2026.1.tar.gz
Algorithm Hash digest
SHA256 348678459d8965131c1b0143b0b18992d6820ec26c1190e0e1660c551d20e968
MD5 c6ddae2833d2105a2a80b1a8a121eff5
BLAKE2b-256 5be8aa65f080931b7c38f63429a2761c7fc429372e81892496170694111056c4

See more details on using hashes here.

File details

Details for the file pystack3d-2026.1-py3-none-any.whl.

File metadata

  • Download URL: pystack3d-2026.1-py3-none-any.whl
  • Upload date:
  • Size: 53.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pystack3d-2026.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a6db5e8bbd15c6837119330ff6fe78e314cec4e6536d3071f8cd992b99d5e07d
MD5 9be74a190cc0b7572fc53664c191cfe2
BLAKE2b-256 6a42776e41015a623843a59971d39109c7d07822ff38c344137f7b305437eb38

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