{"name":"napari-pystackreg","display_name":"napari pystackreg","visibility":"public","icon":"","categories":[],"schema_version":"0.2.0","on_activate":null,"on_deactivate":null,"contributions":{"commands":[{"id":"napari-pystackreg.pystackreg","title":"pystackreg","python_name":"napari_pystackreg._widget:PystackregWidget","short_title":null,"category":null,"icon":null,"enablement":null},{"id":"napari-pystackreg.load_sample_data","title":"Load PC12 cell example","python_name":"napari_pystackreg._sample_data:load_sample_data","short_title":null,"category":null,"icon":null,"enablement":null}],"readers":null,"writers":null,"widgets":[{"command":"napari-pystackreg.pystackreg","display_name":"pystackreg","autogenerate":false}],"sample_data":[{"command":"napari-pystackreg.load_sample_data","key":"pc12","display_name":"PC12 moving example"}],"themes":null,"menus":{},"submenus":null,"keybindings":null,"configuration":[]},"package_metadata":{"metadata_version":"2.1","name":"napari-pystackreg","version":"0.1.4","dynamic":null,"platform":null,"supported_platform":null,"summary":"Robust image registration for napari","description":"# napari-pystackreg\n\n[![License](https://img.shields.io/pypi/l/napari-pystackreg.svg?color=green)](https://github.com/glichtner/napari-pystackreg/raw/main/LICENSE)\n[![PyPI](https://img.shields.io/pypi/v/napari-pystackreg.svg?color=green)](https://pypi.org/project/napari-pystackreg)\n[![Python Version](https://img.shields.io/pypi/pyversions/napari-pystackreg.svg?color=green)](https://python.org)\n[![tests](https://github.com/glichtner/napari-pystackreg/workflows/tests/badge.svg)](https://github.com/glichtner/napari-pystackreg/actions)\n[![codecov](https://codecov.io/gh/glichtner/napari-pystackreg/branch/main/graph/badge.svg)](https://codecov.io/gh/glichtner/napari-pystackreg)\n[![napari hub](https://img.shields.io/endpoint?url=https://api.napari-hub.org/shields/napari-pystackreg)](https://napari-hub.org/plugins/napari-pystackreg)\n\nRobust image registration for napari.\n\n## Summary\nnapari-pystackreg offers the image registration capabilities of the python package\n[pystackreg](https://github.com/glichtner/pystackreg) for napari.\n\n![](https://github.com/glichtner/napari-pystackreg/raw/main/docs/napari-pystackreg.gif)\n\n## Description\n\npyStackReg is used to align (register) one or more images to a common reference image, as is required usually in\ntime-resolved fluorescence or wide-field microscopy.\nIt is directly ported from the source code of the ImageJ plugin ``TurboReg`` and provides additionally the\nfunctionality of the ImageJ plugin ``StackReg``, both of which were written by Philippe Thevenaz/EPFL\n(available at http://bigwww.epfl.ch/thevenaz/turboreg/).\n\npyStackReg provides the following five types of distortion:\n\n- Translation\n- Rigid body (translation + rotation)\n- Scaled rotation (translation + rotation + scaling)\n- Affine (translation + rotation + scaling + shearing)\n- Bilinear (non-linear transformation; does not preserve straight lines)\n\npyStackReg supports the full functionality of StackReg plus some additional options, e.g., using different reference\nimages and having access to the actual transformation matrices (please see the examples below). Note that pyStackReg\nuses the high quality (i.e. high accuracy) mode of TurboReg that uses cubic spline interpolation for transformation.\n\nPlease note: The bilinear transformation cannot be propagated, as a combination of bilinear transformations does not\ngenerally result in a bilinear transformation. Therefore, stack registration/transform functions won't work with\nbilinear transformation when using \"previous\" image as reference image. You can either use another reference (\n\"first\" or \"mean\" for first or mean image, respectively), or try to register/transform each image of the stack\nseparately to its respective previous image (and use the already transformed previous image as reference for the\nnext image).\n\n## Installation\n\nYou can install ``napari-pystackreg`` via [pip](https://pypi.org/project/pip/) from [PyPI](https://pypi.org/):\n\n pip install napari-pystackreg\n\nYou can also install ``napari-pystackreg`` via [conda](https://docs.conda.io/en/latest/):\n\n conda install -c conda-forge napari-pystackreg\n\nOr install it via napari's plugin installer.\n\n Plugins > Install/Uninstall Plugins... > Filter for \"napari-pystackreg\" > Install\n\nTo install latest development version:\n\n pip install git+https://github.com/glichtner/napari-pystackreg.git\n\n## Usage\n\n\n### Open Plugin User Interface\n\nStart up napari, e.g. from the command line:\n\n napari\n\nThen, load an image stack (e.g. via ``File > Open Image...``) that you want to register. You can also use the example\nstack provided by the pluging (``File > Open Sample > napari-pystackreg: PC12 moving example``).\nThen, select the ``napari-pystackreg`` plugin from the ``Plugins > napari-pystackreg: pystackreg`` menu.\n\n![](https://github.com/glichtner/napari-pystackreg/raw/main/docs/ui-initial.png)\n\n### User Interface Options\nA variety of options are available to control the registration process:\n\n* `Image Stack`: The image layer that should be registered/transformed.\n* `Transformation`: The type of transformation that should be applied.\n - `Translation`: translation\n - `Rigid body`: translation + rotation\n - `Scaled rotation`: translation + rotation + scaling\n - `Affine`: translation + rotation + scaling + shearing\n - `Bilinear`: non-linear transformation; does not preserve straight lines\n* `Reference frame:` The reference image for registration.\n - `Previous frame`: Aligns each frame (image) to its previous frame in the stack\n - `Mean (all frames)`: Aligns each frame (image) to the average of all images in the stack\n - `Mean (first n frames)`: Aligns each frame (image) to the mean of the first n frames in the stack. n is a tuneable parameter.\n* `Moving-average stack before register`: Apply a moving average to the stack before registration. This can be useful to\n reduce noise in the stack (if the signal-to-noise ratio is very low). The moving average is applied to the stack only\n for determining the transformation matrices, but not for the actual transforming of the stack.\n* `Transformation matrix file`: Transformation matrices can be saved to or loaded from a file for permanent storage.\n\n### Reference frame\nThe reference frame is the frame to which the other frames are aligned. The default option is to use the\n`Previous frame`, which will register each frame to its respective previous frame in the stack. Alternatively, the\nreference frame can be set to the mean of all frames in the stack (`Mean (all frames)`) or the mean of the first n\nframes in the stack (`Mean (first n frames)`). The latter option can be useful if the first frames in the stack are more\nstable than the later frames (e.g. if the first frames are taken before the sample is moved). When selecting the\n`Mean (first n frames)` option, the number of frames to use for the mean can be set via the spinbox below the option.\n\n![](https://github.com/glichtner/napari-pystackreg/raw/main/docs/ui-reference-mean-n.png)\n\n### Moving average before registration\nTo increase registration performance with low signal-to-noise ratio stacks, a moving average can be applied to the\nstack before registration. The moving average is applied to the stack only for determining the\ntransformation matrices, but not for the actual transforming of the stack. That means that the transformed stack will\nstill contain the original frames (however registered), but not the averaged frames.\n\nWhen selecting the `Moving-average stack before register` option, the number of frames to use for the moving average can\nbe set via the spinbox below the option.\n\n![](https://github.com/glichtner/napari-pystackreg/raw/main/docs/ui-moving-average.png)\n\n### Transformation matrix file\nThe transformation matrices can be saved to or loaded from a file for permanent storage. This can be useful if you want\nto apply the same transformation to another stack (e.g. a different channel of the same sample). The transformation\nmatrices are saved as a numpy array in a binary file (``.npy``). The file can be loaded via the `Load` button and saved\nvia the `Save` button.\n\n![](https://github.com/glichtner/napari-pystackreg/raw/main/docs/ui-register-tmat.png)\n\n### Register/Transform\nTo perform the actual registration and transformation steps, click the `Register` and `Transform` buttons, respectively.\n\nThe `Register` button will register the stack to the reference by determining the appropriate transformation matrices,\nwithout actually transforming the stack. The transformation matrices can be saved to a file via the `Save` button in the\n`Transformation matrix file` section.\n\n![](https://github.com/glichtner/napari-pystackreg/raw/main/docs/ui-registered.png)\n\nThe `Transform` button (1) will transform the stack to the reference by applying the transformation matrices that are\ncurrently loaded to the stack selected in `Image Stack`. For the button to become active, either the transformation\nmatrices have to be loaded from a file via the `Load` button in the `Transformation matrix file` section, or the\n`Register` button has to be clicked first to determine the transformation matrices.\n\nThe `Transform` button will also add a new image layer to the napari viewer (2) with the transformed stack. The name of the\nnew layer will be the name of the original stack with the prefix `Registered`.\n\n![](https://github.com/glichtner/napari-pystackreg/raw/main/docs/ui-transformed.png)\n\nFinally, the `Register & Transform` button will perform both the registration and transformation steps in one go.\n\n----------------------------------\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 [Apache Software License 2.0] license,\n\"napari-pystackreg\" 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## Acknowledgments\n\nThis [napari] plugin was generated with [Cookiecutter] using [@napari]'s [cookiecutter-napari-plugin] template.\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/glichtner/napari-pystackreg/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","description_content_type":"text/markdown","keywords":null,"home_page":"https://github.com/glichtner/napari-pystackreg","download_url":null,"author":"Gregor Lichtner","author_email":"gregor.lichtner@med.uni-greifswald.de","maintainer":null,"maintainer_email":null,"license":"Apache-2.0","classifier":["Development Status :: 4 - Beta","Framework :: napari","Intended Audience :: Developers","License :: OSI Approved :: Apache Software License","Operating System :: OS Independent","Programming Language :: Python","Programming Language :: Python :: 3","Programming Language :: Python :: 3 :: Only","Programming Language :: Python :: 3.8","Programming Language :: Python :: 3.9","Programming Language :: Python :: 3.10","Topic :: Software Development :: Testing"],"requires_dist":["magicgui","numpy","pystackreg (>=0.2.6)","qtpy","napari ; extra == 'testing'","pyqt5 ; extra == 'testing'","pytest ; extra == 'testing'","pytest-cov ; extra == 'testing'","pytest-qt ; extra == 'testing'","tox ; extra == 'testing'"],"requires_python":">=3.8","requires_external":null,"project_url":["Bug Tracker, https://github.com/glichtner/napari-pystackreg/issues","Documentation, https://github.com/glichtner/napari-pystackreg#README.md","Source Code, https://github.com/glichtner/napari-pystackreg","User Support, https://github.com/glichtner/napari-pystackreg/issues"],"provides_extra":["testing"],"provides_dist":null,"obsoletes_dist":null},"npe1_shim":false}