nanopyx
NanoPyx
Nanoscopy Python library (NanoPyx, the successor to NanoJ) - focused on light microscopy and super-resolution imaging
What is the NanoPyx π¬ Library?
NanoPyx is a library specialized in the analysis of light microscopy and super-resolution data. It is a successor to NanoJ, which is a Java library for the analysis of super-resolution microscopy data.
NanoPyx focuses on performance, by using the Liquid Engine at its core. It implements methods for the bioimage analysis field, with a special emphasis on those developed by the Henriques Laboratory. It will be distributed as a Python Library and also as Codeless Jupyter Notebooks, that can be run locally or on Google Colab, and as a napari plugin.
You can read more about NanoPyx in our [publication].
Currently it implements the following approaches:
- A reimplementation of the NanoJ image registration, SRRF and Super Resolution metrics
- eSRRF
- Non-local means denoising
- More to come soonβ’
if you found this work useful, please cite: [publication]
Short Video Tutorials
What is NanoPyx? | How to use NanoPyx in Google Colab? |
---|---|
![]() |
![]() |
How to use NanoPyx locally? | How to implement your own Liquid Engine? |
---|---|
![]() |
![]() |
How to Create a Python Package with the Liquid Engine? | How to Build your Liquid Engine Class in 1 minute |
---|---|
![]() |
![]() |
How to Benchmark your Implementations with the Liquid Engine in 1 minute | |
---|---|
![]() |
Codeless jupyter notebooks available:
Workshop Notebooks
Event | Contents | Notebook | Colab Link | Solutions |
---|---|---|---|---|
I2K 2024 | NanoPyx and Liquid Engine basic usage |
napari plugin
NanoPyx is also available as a napari plugin, which can be installed via pip:
pip install napari-nanopyx
Installation
NanoPyx
is compatible and tested with Python 3.9, 3.10, 3.11 and 3.12 in MacOS, Windows and Linux. Installation time depends on your hardware and internet connection, but should take around 5 minutes.
You can install NanoPyx
via [pip]:
pip install nanopyx
If you want to install with support for Jupyter notebooks:
pip install nanopyx[jupyter]
or if you want to install with all optional dependencies:
pip install nanopyx[all]
if you want access to the cupy implementation of 2D convolution you need to install the package version corresponding to your local CUDA installation. Please check the official documentation of cupy for further details. As an example if you wanted to install cupy for CUDA v12.X
pip install cupy-cuda12x
To install latest development version:
pip install git+https://github.com/HenriquesLab/NanoPyx.git
Notes for Mac users
If you wish to compile the NanoPyx library from source, you will need to install the following dependencies:
- Homebrew from https://brew.sh/
- gcc, llvm and libomp from Homebrew through the command:
brew install gcc llvm libomp
Run in jupyterlab within a docker container
docker run --name nanopyx1 -p 8888:8888 henriqueslab/nanopyx:latest
Usage
Depending on your preferences and coding proficiency you might be using NanoPyx differently.
- If you are using Jupyter Notebooks or Google Colab notebooks check out our video tutorial here and here
- If you are using our napari plugin check out the official napari tutorial and stay tuned for more!
- If you prefer to use the Python library and take full advantage of the Liquid Engine flexibility check out our wiki, our cookiecutter and our video tutorials here and here.
- Liquid engine template files for a simple example:
Wiki
If you want more in depth instructions on how to use nanopyx and its Liquid Engine please refer to our wiki. In the wiki you can find step by step tutorials describing how each methods works and how to implement your own Liquid Engine methods.
Contributing
Contributions are very welcome. Please read our Contribution Guidelines to know how to proceed.
License
Distributed under the terms of the [CC-By v4.0] license, "NanoPyx" is free and open source software
Issues
If you encounter any problems, please [file an issue] along with a detailed description.
1""" 2.. include:: ../../README.md 3""" 4 5import os 6import pkg_resources # part of setuptools 7 8__version__ = pkg_resources.require("NanoPyx")[0].version 9 10from . import core, data, methods # noqa: F401 11 12# Get the user's home folder 13__home_folder__ = os.path.expanduser("~") 14__config_folder__ = os.path.join(__home_folder__, ".nanopyx") 15if not os.path.exists(__config_folder__): 16 os.makedirs(__config_folder__) 17 18from .__agent__ import Agent # noqa: E402 19 20 21# TODO: allow benchmarking of only specific implementations 22# TODO: provide parallelized batch processing 23 24from .__njit__ import njit_works 25from .__opencl__ import cl, cl_array, opencl_works, print_opencl_info, devices 26 27from .core.utils.benchmark import benchmark_all_le_methods as benchmark 28 29__all__ = [ 30 "core", 31 "data", 32 "methods", 33 "__liquid_engine__", 34 "__agent__", 35 "__cuda__", 36 "__dask__", 37 "__njit__", 38 "__transonic__", 39 "__opencl__", 40] 41 42# Section for imports of high-level functions 43from .core.utils.benchmark import benchmark_all_le_methods as benchmark 44from .methods import non_local_means_denoising 45from .methods import eSRRF, run_esrrf_parameter_sweep 46from .methods import SRRF 47from .methods import calculate_frc, calculate_decorr_analysis 48from .methods import calculate_error_map 49from .methods import estimate_drift_alignment, apply_drift_alignment 50from .methods import estimate_channel_registration, apply_channel_registration