[](https://pypi.org/project/pystack3d/)
[](https://github.com/CEA-MetroCarac/pystack3d)
[](https://cea-metrocarac.github.io/pystack3d/index.html)
[](https://joss.theoj.org/papers/c36b7ddeeff591052c0068d3b7ad66c0)
<p align="center" width="100%">
<img align="center" width=400 src=https://cea-metrocarac.github.io/pystack3d/logo.png>
</p>
## 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](https://napari.org/).
<p align="center" width="100%">
<img align="center" width=80%" src=https://cea-metrocarac.github.io/pystack3d/pystack3d.png> <br>
<em>a) Synthetic case illustrating the defects to be removed by <b>PyStack3D</b>. b) Corrected stack. c) Ground truth.</em>
</p>
<p align="center" width="100%">
<img align="center" width=100%" src=https://cea-metrocarac.github.io/pystack3d/process_steps_real.png> <br>
<em>Illustration of a FIB-SEM image correction using some of the <b>PyStack3D</b> process steps.</em>
</p>
<p align="center">
<img src="https://cea-metrocarac.github.io/pystack3d/pystack3d_napari.gif" width="100%">
</p>
## 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](https://github.com/CEA-MetroCarac/pyvsnr?tab=readme-ov-file#gpu-acceleration) 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](https://cea-metrocarac.github.io/pystack3d/getting_started.html).
## Contributing / Reporting an issue
Contributions and issue reporting are more than welcome!
Please read through [our Developers notes](https://cea-metrocarac.github.io/pystack3d/dev_notes.html).
## 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](https://joss.theoj.org/) reviewers ([@kasasxav](https://github.com/kasasxav), [@sklumpe](https://github.com/sklumpe) and [@xiuliren](https://github.com/xiuliren)) and editor ([@mstimberg](https://github.com/mstimberg)) for their contributions to enhancing PyStack3D.
## Citations
In case you use the results of this code in an article, please cite:
- Quéméré P., David T. (2024). PyStack3D: A Python package for fast image stack correction. *Journal of Open Source Software.* https://joss.theoj.org/papers/10.21105/joss.07079. *(See the About section)*.
additional citations for the <b>destriping</b>:
- 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 <b>registration</b>:
- 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.*
Raw data
{
"_id": null,
"home_page": null,
"name": "pystack3d",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "PyStack3D, stack, images, FIB-SEM, processing, correction, cropping, background removal, registration, intensity rescaling, destriping, curtains, resampling, multithreading, multiprocessing",
"author": null,
"author_email": "Patrick Qu\u00e9m\u00e9r\u00e9 <patrick.quemere@cea.fr>",
"download_url": "https://files.pythonhosted.org/packages/c2/0d/5947356ef03e384c91f8d92ffa17a8d9ebe28a184b3cb65a3ce09006aebc/pystack3d-2025.3.tar.gz",
"platform": null,
"description": "[](https://pypi.org/project/pystack3d/)\n[](https://github.com/CEA-MetroCarac/pystack3d)\n[](https://cea-metrocarac.github.io/pystack3d/index.html)\n[](https://joss.theoj.org/papers/c36b7ddeeff591052c0068d3b7ad66c0)\n\n<p align=\"center\" width=\"100%\">\n <img align=\"center\" width=400 src=https://cea-metrocarac.github.io/pystack3d/logo.png>\n</p>\n\n## Introduction\n\n**PyStack3D** is a package dedicated to images correction intended -for instance- to FIB-SEM stack images postprocessing before image segmentation.\n\nThe ``pystack3d`` workflow includes the following process steps which can be activated or not and executed in any order:\n\n- ``cropping`` to reduce the image field of view to a ROI (Region Of Interest)\n- ``background removal`` to reduce from polynomial approximations artefacts issued for instance from shadowing, charging, ...\n- ``intensity rescaling`` to homogenize the 'gray' intensity distribution between successive frames/slices\n- ``registration`` to correct the images misalignment due to shifting, drift, rotation, ... during the images acquisition\n- ``destriping`` to minimize artefacts like stripes that can appear in some image acquisition techniques\n- ``resampling`` to correct non uniform spatial steps\n\nAn 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.\n\n**Pystack3d** can be launched in scripting mode using `.toml` configuration files (see documentation), or through a dedicated GUI designed with [Napari](https://napari.org/).\n\n<p align=\"center\" width=\"100%\">\n <img align=\"center\" width=80%\" src=https://cea-metrocarac.github.io/pystack3d/pystack3d.png> <br>\n <em>a) Synthetic case illustrating the defects to be removed by <b>PyStack3D</b>. b) Corrected stack. c) Ground truth.</em>\n</p>\n\n<p align=\"center\" width=\"100%\">\n <img align=\"center\" width=100%\" src=https://cea-metrocarac.github.io/pystack3d/process_steps_real.png> <br>\n <em>Illustration of a FIB-SEM image correction using some of the <b>PyStack3D</b> process steps.</em>\n</p>\n\n<p align=\"center\">\n <img src=\"https://cea-metrocarac.github.io/pystack3d/pystack3d_napari.gif\" width=\"100%\">\n</p>\n\n## Installation\n\n**For a simple install (execution by scripts):**\n\n```\npip install pystack3d\n```\n\n**For a GUI install and execution:**\n\n```\npip install pystack3d[gui]\npip install PyQt5 # or PyQt6, PySide2, PySide6, if no Qt backend have been already installed in your env.\npystack3d\n```\n\n(The GUI install required ~900MB free space on disk)\n\n**For a GPU acceleration during the destriping process:**\n\n```\npython -m pyvsnr.install_cupy\n```\n\nRefer to [pyvsnr](https://github.com/CEA-MetroCarac/pyvsnr?tab=readme-ov-file#gpu-acceleration) for more details.\n\n## Tests and examples execution\n\nFor tests and examples execution, the full ``pystack3d`` project has to be installed via ``git``:\n\n```\n git clone https://github.com/CEA-MetroCarac/pystack3d.git\n cd [path_to_your_pystack3d_project]\n```\n\nOnce the project has been cloned, the python environment has to be created and completed with the ``pytest`` package (for testing):\n\n```\n pip install .\n pip install pytest\n```\n\nThen the tests and the examples can be executed as follows:\n\n```\n pytest\n cd examples\n python ex_synthetic_stack.py\n python ex_real_stack.py\n```\n\n## Usage\n\nRefer to the [PyStack3D documentation](https://cea-metrocarac.github.io/pystack3d/getting_started.html).\n\n## Contributing / Reporting an issue\n\nContributions and issue reporting are more than welcome!\nPlease read through [our Developers notes](https://cea-metrocarac.github.io/pystack3d/dev_notes.html).\n\n## Acknowledgements\n\nThis work, carried out on the CEA - Platform for Nanocharacterisation (PFNC), was supported by the \u201cRecherche Technologique de Base\u201d program of the French National Research Agency (ANR).\n\nWarm thanks to the [JOSS](https://joss.theoj.org/) reviewers ([@kasasxav](https://github.com/kasasxav), [@sklumpe](https://github.com/sklumpe) and [@xiuliren](https://github.com/xiuliren)) and editor ([@mstimberg](https://github.com/mstimberg)) for their contributions to enhancing PyStack3D.\n\n## Citations\n\nIn case you use the results of this code in an article, please cite:\n\n- Qu\u00e9m\u00e9r\u00e9 P., David T. (2024). PyStack3D: A Python package for fast image stack correction. *Journal of Open Source Software.* https://joss.theoj.org/papers/10.21105/joss.07079. *(See the About section)*.\n\nadditional citations for the <b>destriping</b>:\n\n- Pavy K., Qu\u00e9m\u00e9r\u00e9 P. (2024). Pyvsnr 2.0.0. Zenodo. https://doi.org/10.5281/zenodo.10623640.\n\n- 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.*\n\nadditional citation for the <b>registration</b>:\n\n- Th\u00e9venaz 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.*\n",
"bugtrack_url": null,
"license": "GPL v3",
"summary": "Pystack3D: A Python package for fast image stack correction",
"version": "2025.3",
"project_urls": {
"Documentation": "https://cea-metrocarac.github.io/pystack3d/index.html",
"Homepage": "https://github.dev/CEA-MetroCarac/pystack3d"
},
"split_keywords": [
"pystack3d",
" stack",
" images",
" fib-sem",
" processing",
" correction",
" cropping",
" background removal",
" registration",
" intensity rescaling",
" destriping",
" curtains",
" resampling",
" multithreading",
" multiprocessing"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "b5c9dd3774d86b62904ada460e7bc7502a7937a8c717ed8478fb80b1153bdafe",
"md5": "d8d434b592708724da09e05f9cfd7961",
"sha256": "77d77747ba3daeb15ed989bdf40166a98419b876e81ace3d403a1e6c36c5028a"
},
"downloads": -1,
"filename": "pystack3d-2025.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d8d434b592708724da09e05f9cfd7961",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 53632,
"upload_time": "2025-08-27T09:27:04",
"upload_time_iso_8601": "2025-08-27T09:27:04.057545Z",
"url": "https://files.pythonhosted.org/packages/b5/c9/dd3774d86b62904ada460e7bc7502a7937a8c717ed8478fb80b1153bdafe/pystack3d-2025.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "c20d5947356ef03e384c91f8d92ffa17a8d9ebe28a184b3cb65a3ce09006aebc",
"md5": "42463998a83b30d6b584c09361b0542f",
"sha256": "735ac565cf9ba6a0bf52897b3d017ac7360e5166a902631600daf053069347ce"
},
"downloads": -1,
"filename": "pystack3d-2025.3.tar.gz",
"has_sig": false,
"md5_digest": "42463998a83b30d6b584c09361b0542f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 47255,
"upload_time": "2025-08-27T09:27:05",
"upload_time_iso_8601": "2025-08-27T09:27:05.626304Z",
"url": "https://files.pythonhosted.org/packages/c2/0d/5947356ef03e384c91f8d92ffa17a8d9ebe28a184b3cb65a3ce09006aebc/pystack3d-2025.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-27 09:27:05",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "pystack3d"
}