{"name":"napari-sim-processor","display_name":"napari SIM processor","visibility":"public","icon":"","categories":[],"schema_version":"0.2.0","on_activate":null,"on_deactivate":null,"contributions":{"commands":[{"id":"napari-sim-processor.make_sim_widget","title":"SIM processor","python_name":"napari_sim_processor._sim_widget:SimAnalysis","short_title":null,"category":null,"icon":null,"enablement":null},{"id":"napari-sim-processor.make_reshape_widget","title":"Reshape stack","python_name":"napari_sim_processor._sim_widget:reshape","short_title":null,"category":null,"icon":null,"enablement":null}],"readers":null,"writers":null,"widgets":[{"command":"napari-sim-processor.make_sim_widget","display_name":"SIM processor","autogenerate":false},{"command":"napari-sim-processor.make_reshape_widget","display_name":"Reshape stack to 5D (angles,phases,z,y,x)","autogenerate":false}],"sample_data":null,"themes":null,"menus":{},"submenus":null,"keybindings":null,"configuration":[]},"package_metadata":{"metadata_version":"2.1","name":"napari-sim-processor","version":"0.1.1","dynamic":null,"platform":null,"supported_platform":null,"summary":"A plugin to process Structured Illumination Microscopy data with gpu acceleration","description":"# napari-sim-processor\n\n[![License](https://img.shields.io/pypi/l/napari-sim-processor.svg?color=green)](https://github.com/andreabassi78/napari-sim-processor/raw/main/LICENSE)\n[![PyPI](https://img.shields.io/pypi/v/napari-sim-processor.svg?color=green)](https://pypi.org/project/napari-sim-processor)\n[![Python Version](https://img.shields.io/pypi/pyversions/napari-sim-processor.svg?color=green)](https://python.org)\n[![tests](https://github.com/andreabassi78/napari-sim-processor/workflows/tests/badge.svg)](https://github.com/andreabassi78/napari-sim-processor/actions)\n[![codecov](https://codecov.io/gh/andreabassi78/napari-sim-processor/branch/main/graph/badge.svg)](https://codecov.io/gh/andreabassi78/napari-sim-processor)\n[![napari hub](https://img.shields.io/endpoint?url=https://api.napari-hub.org/shields/napari-sim-processor)](https://napari-hub.org/plugins/napari-sim-processor)\n\nA Napari plugin for the reconstruction of Structured Illumination Microscopy (SIM) with GPU acceleration (pytorch/cupy if installed).\nCurrently supports: \n - conventional SIM data with a generic number of angles and phases (typically, 3 angles and 3 phases are used for resolution improvement in 2D, but any combination can be processed by the widget)\n - hexagonal SIM data with 7 phases, as used in [this] publication.\n - 3D SIM, for resolution enhancement in three dimensions. This is available in the [3dSIM] branch \n\nThe SIM processing widget accepts image stacks organized in 5D (`angle`,`phase`,`z`,`y`,`x`).\n\nThe reshape widget can be used to easily reshape the data if they are not organized as 5D (angle,phase,z,y,x).\n\nFor 3D stacks (raw images) with multiple z-frames, a batch reconstruction method is available, as described [here].\n\nSyntetic raw-image stacks of Structured Illumination Microscopy can be easily simulated using the napari [SIMulator] pluging.\n\t \n----------------------------------\n\nThis [napari] plugin was generated with [Cookiecutter] using [@napari]'s [cookiecutter-napari-plugin] template.\n\n\n\n## Installation\n\nYou can install `napari-sim-processor` via [pip]:\n\n pip install napari-sim-processor\n\n\nTo install latest development version :\n\n pip install git+https://github.com/andreabassi78/napari-sim-processor.git\n\n\n## Usage\n\n1) Open napari. \n\n2) Launch the reshape and sim-processor widgets.\n\n3) Open your raw image stack (using the napari built-in or your own file opener).\n\n![raw](https://github.com/andreabassi78/napari-sim-processor/raw/main/images/Picture1.png)\n\n4) If your image is ordered as a 5D stack (angle, phase, z-frame, y, x) go to point 6. \n\n5) In the reshape widget, select the actual number of acquired angles, phases, and frames (red arrow) and press `Reshape Stack`.\n Note that the label axis of the viewer will be updated (green arrow).\n\n![raw](https://github.com/andreabassi78/napari-sim-processor/raw/main/images/Picture1b.png)\n\n6) In the sim-reconstruction widget press the Select image layer button. Note that the number of phases and angles will be updated (blue arrow). \n\n7) Choose the correct parameters of the SIM acquisition (`NA`, `pixelsize`, `M`, etc.) and processing parameters (`alpha`, `beta`, w, `eta`, `group`):\n - `w`: parameter of the Weiner filter.\n - `eta`: constant used for calibration. It should be slightly smaller than the carrier frequency (in pupil radius units).\n - `group`: for stacks with multiple z-frames, it is the number of frames that are used together for the calibration process.\n\t\nFor details on the other parameters see [here].\n\n8) Calibrate the SIM processor, pressing the `Calibrate` button. This will find the carrier frequencies (red circles if the `Show Carrier` checkbox is selected), the modulation amplitude and the phase, using cross correlation analysis.\n\n9) Click on the checkboxes to show the power spectrum of the raw image (`Show power spectrum`) or the cross-correlation (`Show Xcorr`), to see if the found carrier frequency is correct.\n\n![raw](https://github.com/andreabassi78/napari-sim-processor/raw/main/images/Picture2b.png)\n**Napari viewer showing the power spectrum of the raw stack. The pupil circle is in blue. A circle corresponding to `eta` is shown in green.**\n\n![raw](https://github.com/andreabassi78/napari-sim-processor/raw/main/images/Picture2.png)\n**Napari viewer showing the cross-correlation of the raw stack. The red circles indicate the found carrier frequencies**\n\n10) Run the reconstruction of a single plane (`SIM reconstruction`) or of a stack (`Stack reconstruction`). After execution, a new image_layer will be added to the napari viewer. Click on the `Batch reconstruction` checkbox in order to process an entire stack in one shot. Click on the pytorch checkbox for gpu acceleration.\n\n![raw](https://github.com/andreabassi78/napari-sim-processor/raw/main/images/Picture3b.png)\n**Napari viewer with widgets showing a pseudo-widefield reconstruction**\n\n![raw](https://github.com/andreabassi78/napari-sim-processor/raw/main/images/Picture3.png)\n**Napari viewer with widgets showing a SIM reconstruction**\n\n## GPU processing\n\nThe underlying processing classes will use numpy (and FFTW if available) for \nits calculations. For GPU accelerated processing you need to have either the \nPyTorch (tested with torch v1.11.0+cu113) or the CuPy (tested with cupy-cuda113 \nv10.4.0) package installed. Make sure to match the package cuda version to the CUDA library \ninstalled on your system otherwise PyTorch will default to CPU and CuPy will not work at all. \n\nBoth packages give significant speedup on even relatively modest CUDA GPUs compared \nto Numpy, and PyTorch running on the CPU only can show improvements relative to numpy \nand FFTW. Selection of which processing package to use is via a ComboBox in the \nnapari_sim_processor widget. Only available packages are shown. \n\nOther than requiring a CUDA GPU it is advisable to have significant GPU memory \navailable, particularly when processing large datasets. Batch processing is the \nmost memory hungry of the methods, but can process 280x512x512 datasets on a 4GB GPU.\n\n## Contributing\n\nContributions are very welcome. Tests can be run with [tox], please ensure\nthe coverage at least stays the same before you submit a pull request.\n\n## License\n\nDistributed under the terms of the [BSD-3] license,\n\"napari-sim-processor\" is free and open source software\n\n## Issues\n\nIf you encounter any problems, please [file an issue] along with a detailed description.\n\n[napari]: https://github.com/napari/napari\n[Cookiecutter]: https://github.com/audreyr/cookiecutter\n[@napari]: https://github.com/napari\n[MIT]: http://opensource.org/licenses/MIT\n[BSD-3]: http://opensource.org/licenses/BSD-3-Clause\n[GNU GPL v3.0]: http://www.gnu.org/licenses/gpl-3.0.txt\n[GNU LGPL v3.0]: http://www.gnu.org/licenses/lgpl-3.0.txt\n[Apache Software License 2.0]: http://www.apache.org/licenses/LICENSE-2.0\n[Mozilla Public License 2.0]: https://www.mozilla.org/media/MPL/2.0/index.txt\n[cookiecutter-napari-plugin]: https://github.com/napari/cookiecutter-napari-plugin\n\n[file an issue]: https://github.com/andreabassi78/napari-sim-processor/issues\n\n[napari]: https://github.com/napari/napari\n[tox]: https://tox.readthedocs.io/en/latest/\n[pip]: https://pypi.org/project/pip/\n[PyPI]: https://pypi.org/\n\n[here]: https://doi.org/10.1098/rsta.2020.0162\n[this]: https://doi.org/10.1364/OE.466225\n[3dSIM]: https://github.com/andreabassi78/napari-sim-processor/tree/3dSIM\n[SIMulator]: https://www.napari-hub.org/plugins/napari-generic-SIMulator\n","description_content_type":"text/markdown","keywords":null,"home_page":"https://github.com/andreabassi78/napari-sim-processor","download_url":null,"author":"Andrea Bassi and Mark Neil","author_email":"andrea1.bassi@polimi.it","maintainer":null,"maintainer_email":null,"license":"BSD-3-Clause","classifier":["Development Status :: 2 - Pre-Alpha","Intended Audience :: Developers","Framework :: napari","Topic :: Software Development :: Testing","Programming Language :: Python","Programming Language :: Python :: 3","Programming Language :: Python :: 3.8","Programming Language :: Python :: 3.9","Programming Language :: Python :: 3.10","Operating System :: OS Independent","License :: OSI Approved :: BSD License"],"requires_dist":["numpy","scipy","magicgui","qtpy","matplotlib","superqt >=0.3.2","tox ; extra == 'testing'","pytest ; extra == 'testing'","pytest-cov ; extra == 'testing'","pytest-qt ; extra == 'testing'","napari ; extra == 'testing'","pyqt5 ; extra == 'testing'","matplotlib ; extra == 'testing'","numpy ; extra == 'testing'","scipy ; extra == 'testing'","superqt ; extra == 'testing'"],"requires_python":">=3.8","requires_external":null,"project_url":["Bug Tracker, https://github.com/andreabassi78/napari-sim-processor/issues","Documentation, https://github.com/andreabassi78/napari-sim-processor#README.md","Source Code, https://github.com/andreabassi78/napari-sim-processor","User Support, https://github.com/andreabassi78/napari-sim-processor/issues"],"provides_extra":["testing"],"provides_dist":null,"obsoletes_dist":null},"npe1_shim":false}