imaging-server-kit 0.0.6__tar.gz → 0.0.8__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. imaging_server_kit-0.0.8/.github/workflows/deploy.yml +39 -0
  2. {imaging_server_kit-0.0.6 → imaging_server_kit-0.0.8}/.gitignore +2 -1
  3. imaging_server_kit-0.0.8/PKG-INFO +111 -0
  4. imaging_server_kit-0.0.8/README.md +36 -0
  5. imaging_server_kit-0.0.8/docs/_config.yml +23 -0
  6. imaging_server_kit-0.0.8/docs/_toc.yml +11 -0
  7. imaging_server_kit-0.0.8/docs/assets/screenshot_napari_threshold.png +0 -0
  8. imaging_server_kit-0.0.8/docs/assets/screenshot_running_server.png +0 -0
  9. imaging_server_kit-0.0.8/docs/index.md +54 -0
  10. imaging_server_kit-0.0.8/docs/logo.ico +0 -0
  11. imaging_server_kit-0.0.8/docs/sections/algorithm_server.md +170 -0
  12. imaging_server_kit-0.0.8/docs/sections/api_endpoints.md +14 -0
  13. imaging_server_kit-0.0.8/docs/sections/authentication.md +11 -0
  14. imaging_server_kit-0.0.8/docs/sections/client_apps.md +30 -0
  15. imaging_server_kit-0.0.8/docs/sections/docker.md +38 -0
  16. imaging_server_kit-0.0.8/docs/sections/examples.md +12 -0
  17. imaging_server_kit-0.0.8/docs/sections/getting_started.md +65 -0
  18. imaging_server_kit-0.0.8/docs/sections/multi_algo_server.md +40 -0
  19. imaging_server_kit-0.0.8/examples/basic/auto_threshold.py +38 -0
  20. imaging_server_kit-0.0.8/examples/basic/multi_algo.py +13 -0
  21. imaging_server_kit-0.0.8/examples/basic/sample_images/blobs.tif +0 -0
  22. imaging_server_kit-0.0.8/examples/basic/threshold.py +37 -0
  23. imaging_server_kit-0.0.8/examples/servers/docker-compose.yml +14 -0
  24. imaging_server_kit-0.0.8/examples/servers/serverkit-cellpose/Dockerfile +15 -0
  25. imaging_server_kit-0.0.8/examples/servers/serverkit-cellpose/README.md +89 -0
  26. imaging_server_kit-0.0.8/examples/servers/serverkit-cellpose/docker-compose.yml +6 -0
  27. imaging_server_kit-0.0.8/examples/servers/serverkit-cellpose/main.py +100 -0
  28. imaging_server_kit-0.0.8/examples/servers/serverkit-cellpose/requirements.txt +6 -0
  29. imaging_server_kit-0.0.8/examples/servers/serverkit-cellpose/sample_images/nuclei_2d.tif +0 -0
  30. imaging_server_kit-0.0.8/examples/servers/serverkit-orientationpy/Dockerfile +15 -0
  31. imaging_server_kit-0.0.8/examples/servers/serverkit-orientationpy/README.md +50 -0
  32. imaging_server_kit-0.0.8/examples/servers/serverkit-orientationpy/docker-compose.yml +6 -0
  33. imaging_server_kit-0.0.8/examples/servers/serverkit-orientationpy/main.py +133 -0
  34. imaging_server_kit-0.0.8/examples/servers/serverkit-orientationpy/requirements.txt +4 -0
  35. imaging_server_kit-0.0.8/examples/servers/serverkit-orientationpy/sample_images/image1_from_OrientationJ.tif +0 -0
  36. imaging_server_kit-0.0.8/examples/servers/serverkit-rembg/Dockerfile +15 -0
  37. imaging_server_kit-0.0.8/examples/servers/serverkit-rembg/README.md +51 -0
  38. imaging_server_kit-0.0.8/examples/servers/serverkit-rembg/docker-compose.yml +6 -0
  39. imaging_server_kit-0.0.8/examples/servers/serverkit-rembg/main.py +83 -0
  40. imaging_server_kit-0.0.8/examples/servers/serverkit-rembg/requirements.txt +4 -0
  41. imaging_server_kit-0.0.8/examples/servers/serverkit-rembg/sample_images/astronaut.tif +0 -0
  42. imaging_server_kit-0.0.8/examples/servers/serverkit-skimage-log/Dockerfile +15 -0
  43. imaging_server_kit-0.0.8/examples/servers/serverkit-skimage-log/README.md +51 -0
  44. imaging_server_kit-0.0.8/examples/servers/serverkit-skimage-log/docker-compose.yml +6 -0
  45. imaging_server_kit-0.0.8/examples/servers/serverkit-skimage-log/main.py +136 -0
  46. imaging_server_kit-0.0.8/examples/servers/serverkit-skimage-log/requirements.txt +2 -0
  47. imaging_server_kit-0.0.8/examples/servers/serverkit-skimage-log/sample_images/blobs.tif +0 -0
  48. imaging_server_kit-0.0.8/examples/servers/serverkit-skimage-log/sample_images/tracks.tif +0 -0
  49. imaging_server_kit-0.0.8/examples/servers/serverkit-stardist/Dockerfile +15 -0
  50. imaging_server_kit-0.0.8/examples/servers/serverkit-stardist/README.md +89 -0
  51. imaging_server_kit-0.0.8/examples/servers/serverkit-stardist/docker-compose.yml +6 -0
  52. imaging_server_kit-0.0.8/examples/servers/serverkit-stardist/main.py +103 -0
  53. imaging_server_kit-0.0.8/examples/servers/serverkit-stardist/requirements.txt +4 -0
  54. imaging_server_kit-0.0.8/examples/servers/serverkit-stardist/sample_images/nuclei_2d.tif +0 -0
  55. imaging_server_kit-0.0.8/examples/servers/serverkit-trackpy/Dockerfile +15 -0
  56. imaging_server_kit-0.0.8/examples/servers/serverkit-trackpy/README.md +82 -0
  57. imaging_server_kit-0.0.8/examples/servers/serverkit-trackpy/docker-compose.yml +6 -0
  58. imaging_server_kit-0.0.8/examples/servers/serverkit-trackpy/main.py +63 -0
  59. imaging_server_kit-0.0.8/examples/servers/serverkit-trackpy/requirements.txt +3 -0
  60. imaging_server_kit-0.0.8/examples/servers/serverkit-trackpy/sample_images/tracks.tif +0 -0
  61. imaging_server_kit-0.0.8/main.py +9 -0
  62. {imaging_server_kit-0.0.6 → imaging_server_kit-0.0.8}/pyproject.toml +22 -10
  63. imaging_server_kit-0.0.8/src/imaging_server_kit/__init__.py +29 -0
  64. {imaging_server_kit-0.0.6 → imaging_server_kit-0.0.8}/src/imaging_server_kit/_version.py +2 -2
  65. imaging_server_kit-0.0.8/src/imaging_server_kit/auth/__init__.py +5 -0
  66. imaging_server_kit-0.0.8/src/imaging_server_kit/auth/authenticated_server.py +86 -0
  67. imaging_server_kit-0.0.8/src/imaging_server_kit/auth/static/css/login.css +33 -0
  68. imaging_server_kit-0.0.8/src/imaging_server_kit/auth/static/css/register.css +33 -0
  69. {imaging_server_kit-0.0.6/src/imaging_server_kit → imaging_server_kit-0.0.8/src/imaging_server_kit/auth}/templates/login.html +1 -7
  70. {imaging_server_kit-0.0.6/src/imaging_server_kit → imaging_server_kit-0.0.8/src/imaging_server_kit/auth}/templates/register.html +1 -7
  71. imaging_server_kit-0.0.8/src/imaging_server_kit/auth/utils/__init__.py +3 -0
  72. {imaging_server_kit-0.0.6/src/imaging_server_kit/users_utils → imaging_server_kit-0.0.8/src/imaging_server_kit/auth/utils}/users.py +1 -1
  73. imaging_server_kit-0.0.8/src/imaging_server_kit/cli.py +39 -0
  74. imaging_server_kit-0.0.8/src/imaging_server_kit/client/__init__.py +5 -0
  75. {imaging_server_kit-0.0.6/src/imaging_server_kit → imaging_server_kit-0.0.8/src/imaging_server_kit/client}/client.py +10 -8
  76. imaging_server_kit-0.0.8/src/imaging_server_kit/core/__init__.py +97 -0
  77. imaging_server_kit-0.0.8/src/imaging_server_kit/core/decorator.py +146 -0
  78. {imaging_server_kit-0.0.6/src/imaging_server_kit → imaging_server_kit-0.0.8/src/imaging_server_kit/core}/encoding.py +17 -0
  79. {imaging_server_kit-0.0.6/src/imaging_server_kit → imaging_server_kit-0.0.8/src/imaging_server_kit/core}/serialization.py +44 -31
  80. imaging_server_kit-0.0.8/src/imaging_server_kit/core/server.py +276 -0
  81. {imaging_server_kit-0.0.6/src/imaging_server_kit → imaging_server_kit-0.0.8/src/imaging_server_kit/core}/static/css/info.css +3 -3
  82. {imaging_server_kit-0.0.6/src/imaging_server_kit → imaging_server_kit-0.0.8/src/imaging_server_kit/core}/templates/info.html +0 -6
  83. imaging_server_kit-0.0.8/src/imaging_server_kit/core/ui_library.py +160 -0
  84. imaging_server_kit-0.0.8/src/imaging_server_kit/demo/__init__.py +1 -0
  85. imaging_server_kit-0.0.8/src/imaging_server_kit/demo/sample_images/blobs.tif +0 -0
  86. imaging_server_kit-0.0.8/src/imaging_server_kit/demo/threshold.py +37 -0
  87. imaging_server_kit-0.0.8/src/imaging_server_kit/hub/__init__.py +6 -0
  88. {imaging_server_kit-0.0.6/src/imaging_server_kit → imaging_server_kit-0.0.8/src/imaging_server_kit/hub}/algorithm_hub.py +2 -7
  89. imaging_server_kit-0.0.8/src/imaging_server_kit/hub/multialgo_server.py +234 -0
  90. imaging_server_kit-0.0.8/src/imaging_server_kit/template/cookiecutter.json +6 -0
  91. imaging_server_kit-0.0.8/src/imaging_server_kit/template/serverkit-{{ cookiecutter.project_slug }}/.dockerignore +1 -0
  92. imaging_server_kit-0.0.8/src/imaging_server_kit/template/serverkit-{{ cookiecutter.project_slug }}/.gitignore +26 -0
  93. imaging_server_kit-0.0.8/src/imaging_server_kit/template/serverkit-{{ cookiecutter.project_slug }}/Dockerfile +15 -0
  94. imaging_server_kit-0.0.8/src/imaging_server_kit/template/serverkit-{{ cookiecutter.project_slug }}/README.md +50 -0
  95. imaging_server_kit-0.0.8/src/imaging_server_kit/template/serverkit-{{ cookiecutter.project_slug }}/docker-compose.yml +6 -0
  96. imaging_server_kit-0.0.8/src/imaging_server_kit/template/serverkit-{{ cookiecutter.project_slug }}/main.py +56 -0
  97. imaging_server_kit-0.0.8/src/imaging_server_kit/template/serverkit-{{ cookiecutter.project_slug }}/requirements.txt +1 -0
  98. imaging_server_kit-0.0.8/src/imaging_server_kit/template/serverkit-{{ cookiecutter.project_slug }}/sample_images/blobs.tif +0 -0
  99. imaging_server_kit-0.0.8/src/imaging_server_kit.egg-info/PKG-INFO +111 -0
  100. imaging_server_kit-0.0.8/src/imaging_server_kit.egg-info/SOURCES.txt +125 -0
  101. imaging_server_kit-0.0.8/src/imaging_server_kit.egg-info/entry_points.txt +2 -0
  102. {imaging_server_kit-0.0.6 → imaging_server_kit-0.0.8}/src/imaging_server_kit.egg-info/requires.txt +17 -7
  103. {imaging_server_kit-0.0.6 → imaging_server_kit-0.0.8}/start_algorithm_hub.py +1 -2
  104. imaging_server_kit-0.0.8/tests/test_error_paths.py +75 -0
  105. imaging_server_kit-0.0.8/tests/test_import.py +41 -0
  106. imaging_server_kit-0.0.8/tests/test_multialgo_server.py +91 -0
  107. imaging_server_kit-0.0.8/tests/test_parameter_schema.py +101 -0
  108. imaging_server_kit-0.0.8/tests/test_simple_server.py +59 -0
  109. imaging_server_kit-0.0.6/PKG-INFO +0 -195
  110. imaging_server_kit-0.0.6/README.md +0 -127
  111. imaging_server_kit-0.0.6/examples/.gitkeep +0 -0
  112. imaging_server_kit-0.0.6/main.py +0 -10
  113. imaging_server_kit-0.0.6/src/imaging_server_kit/__init__.py +0 -32
  114. imaging_server_kit-0.0.6/src/imaging_server_kit/assets/style.css +0 -108
  115. imaging_server_kit-0.0.6/src/imaging_server_kit/authenticated_server.py +0 -249
  116. imaging_server_kit-0.0.6/src/imaging_server_kit/server.py +0 -209
  117. imaging_server_kit-0.0.6/src/imaging_server_kit/users_utils/__init__.py +0 -3
  118. imaging_server_kit-0.0.6/src/imaging_server_kit/web_demo.py +0 -393
  119. imaging_server_kit-0.0.6/src/imaging_server_kit.egg-info/PKG-INFO +0 -195
  120. imaging_server_kit-0.0.6/src/imaging_server_kit.egg-info/SOURCES.txt +0 -43
  121. {imaging_server_kit-0.0.6 → imaging_server_kit-0.0.8}/.dockerignore +0 -0
  122. {imaging_server_kit-0.0.6 → imaging_server_kit-0.0.8}/.gitattributes +0 -0
  123. {imaging_server_kit-0.0.6 → imaging_server_kit-0.0.8}/.github/workflows/publish.yml +0 -0
  124. {imaging_server_kit-0.0.6 → imaging_server_kit-0.0.8}/Dockerfile +0 -0
  125. {imaging_server_kit-0.0.6 → imaging_server_kit-0.0.8}/Dockerfile-GPU +0 -0
  126. {imaging_server_kit-0.0.6 → imaging_server_kit-0.0.8}/LICENSE +0 -0
  127. {imaging_server_kit-0.0.6 → imaging_server_kit-0.0.8}/MANIFEST.in +0 -0
  128. {imaging_server_kit-0.0.6 → imaging_server_kit-0.0.8}/build.sh +0 -0
  129. {imaging_server_kit-0.0.6 → imaging_server_kit-0.0.8}/setup.cfg +0 -0
  130. {imaging_server_kit-0.0.6/src/imaging_server_kit → imaging_server_kit-0.0.8/src/imaging_server_kit/auth}/static/js/login_script.js +0 -0
  131. {imaging_server_kit-0.0.6/src/imaging_server_kit → imaging_server_kit-0.0.8/src/imaging_server_kit/auth}/static/js/register_script.js +0 -0
  132. {imaging_server_kit-0.0.6/src/imaging_server_kit/users_utils → imaging_server_kit-0.0.8/src/imaging_server_kit/auth/utils}/db.py +0 -0
  133. {imaging_server_kit-0.0.6/src/imaging_server_kit/users_utils → imaging_server_kit-0.0.8/src/imaging_server_kit/auth/utils}/schemas.py +0 -0
  134. {imaging_server_kit-0.0.6/src/imaging_server_kit → imaging_server_kit-0.0.8/src/imaging_server_kit/core}/errors.py +0 -0
  135. {imaging_server_kit-0.0.6/src/imaging_server_kit → imaging_server_kit-0.0.8/src/imaging_server_kit/core}/geometry.py +0 -0
  136. {imaging_server_kit-0.0.6/src/imaging_server_kit → imaging_server_kit-0.0.8/src/imaging_server_kit/core}/static/css/index.css +0 -0
  137. {imaging_server_kit-0.0.6/src/imaging_server_kit → imaging_server_kit-0.0.8/src/imaging_server_kit/core}/templates/index.html +0 -0
  138. {imaging_server_kit-0.0.6 → imaging_server_kit-0.0.8}/src/imaging_server_kit.egg-info/dependency_links.txt +0 -0
  139. {imaging_server_kit-0.0.6 → imaging_server_kit-0.0.8}/src/imaging_server_kit.egg-info/top_level.txt +0 -0
@@ -0,0 +1,39 @@
1
+ name: Deploy docs
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+
8
+ jobs:
9
+ deploy-book:
10
+ runs-on: ubuntu-latest
11
+ permissions:
12
+ pages: write
13
+ id-token: write
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+
17
+ - name: Set up Python 3.11
18
+ uses: actions/setup-python@v5
19
+ with:
20
+ python-version: '3.11'
21
+ cache: pip # Implicitly uses requirements.txt for cache key
22
+
23
+ - name: Install dependencies
24
+ run: pip install jupyter-book
25
+
26
+ - name: Build the book
27
+ run: |
28
+ jupyter-book build docs
29
+
30
+ # Upload the book's HTML as an artifact
31
+ - name: Upload artifact
32
+ uses: actions/upload-pages-artifact@v3
33
+ with:
34
+ path: "docs/_build/html"
35
+
36
+ # Deploy the book's HTML to GitHub Pages
37
+ - name: Deploy to GitHub Pages
38
+ id: deployment
39
+ uses: actions/deploy-pages@v4
@@ -25,4 +25,5 @@ venv/
25
25
  .DS_Store
26
26
  **/_version.py
27
27
 
28
- push.sh
28
+ push.sh
29
+ todo.txt
@@ -0,0 +1,111 @@
1
+ Metadata-Version: 2.4
2
+ Name: imaging-server-kit
3
+ Version: 0.0.8
4
+ Summary: Deploy image processing algorithms in FastAPI servers.
5
+ Author-email: Mallory Wittwer <mallory.wittwer@epfl.ch>
6
+ License: Copyright (c) 2024, EPFL
7
+ All rights reserved.
8
+
9
+ Redistribution and use in source and binary forms, with or without
10
+ modification, are permitted provided that the following conditions are met:
11
+
12
+ * Redistributions of source code must retain the above copyright notice, this
13
+ list of conditions and the following disclaimer.
14
+
15
+ * Redistributions in binary form must reproduce the above copyright notice,
16
+ this list of conditions and the following disclaimer in the documentation
17
+ and/or other materials provided with the distribution.
18
+
19
+ * Neither the name of copyright holder nor the names of its
20
+ contributors may be used to endorse or promote products derived from
21
+ this software without specific prior written permission.
22
+
23
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
27
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
29
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
31
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
+
34
+ Project-URL: homepage, https://imaging-server-kit.github.io/imaging-server-kit
35
+ Project-URL: repository, https://github.com/Imaging-Server-Kit/imaging-server-kit
36
+ Classifier: Development Status :: 2 - Pre-Alpha
37
+ Classifier: Intended Audience :: Developers
38
+ Classifier: License :: OSI Approved :: BSD License
39
+ Classifier: Operating System :: OS Independent
40
+ Classifier: Programming Language :: Python
41
+ Classifier: Programming Language :: Python :: 3
42
+ Classifier: Programming Language :: Python :: 3 :: Only
43
+ Classifier: Programming Language :: Python :: 3.9
44
+ Classifier: Programming Language :: Python :: 3.10
45
+ Classifier: Programming Language :: Python :: 3.11
46
+ Classifier: Programming Language :: Python :: 3.12
47
+ Classifier: Topic :: Scientific/Engineering :: Image Processing
48
+ Requires-Python: >=3.9
49
+ Description-Content-Type: text/markdown
50
+ License-File: LICENSE
51
+ Requires-Dist: fastapi
52
+ Requires-Dist: uvicorn[standard]
53
+ Requires-Dist: python-multipart
54
+ Requires-Dist: httpx
55
+ Requires-Dist: tifffile
56
+ Requires-Dist: numpy
57
+ Requires-Dist: scikit-image
58
+ Requires-Dist: imantics
59
+ Requires-Dist: geojson
60
+ Requires-Dist: jinja2
61
+ Requires-Dist: PyYAML
62
+ Requires-Dist: pydantic>=2.0
63
+ Requires-Dist: cookiecutter
64
+ Provides-Extra: docs
65
+ Requires-Dist: jupyter-book; extra == "docs"
66
+ Requires-Dist: jupytext; extra == "docs"
67
+ Provides-Extra: test
68
+ Requires-Dist: pytest; extra == "test"
69
+ Provides-Extra: users
70
+ Requires-Dist: fastapi-users[sqlalchemy]; extra == "users"
71
+ Requires-Dist: aiosqlite; extra == "users"
72
+ Provides-Extra: all
73
+ Requires-Dist: imaging-server-kit[docs,test,users]; extra == "all"
74
+ Dynamic: license-file
75
+
76
+ ![EPFL Center for Imaging logo](https://imaging.epfl.ch/resources/logo-for-gitlab.svg)
77
+ # 🪐 Imaging Server Kit
78
+
79
+ Deploy image processing algorithms in FastAPI servers and easily run them from Napari, QuPath, and more.
80
+
81
+ ## Installation
82
+
83
+ Install the `imaging-server-kit` package with `pip`:
84
+
85
+ ```
86
+ pip install imaging-server-kit
87
+ ```
88
+
89
+ or clone the project and install the development version:
90
+
91
+ ```
92
+ git clone https://github.com/Imaging-Server-Kit/imaging-server-kit.git
93
+ cd imaging-server-kit
94
+ pip install -e .
95
+ ```
96
+
97
+ ## Getting started
98
+
99
+ The documentation is available on [this page](https://imaging-server-kit.github.io/imaging-server-kit).
100
+
101
+ ## Contributing
102
+
103
+ Contributions are very welcome.
104
+
105
+ ## License
106
+
107
+ This software is distributed under the terms of the [BSD-3](http://opensource.org/licenses/BSD-3-Clause) license.
108
+
109
+ ## Issues
110
+
111
+ If you encounter any problems, please file an issue along with a detailed description.
@@ -0,0 +1,36 @@
1
+ ![EPFL Center for Imaging logo](https://imaging.epfl.ch/resources/logo-for-gitlab.svg)
2
+ # 🪐 Imaging Server Kit
3
+
4
+ Deploy image processing algorithms in FastAPI servers and easily run them from Napari, QuPath, and more.
5
+
6
+ ## Installation
7
+
8
+ Install the `imaging-server-kit` package with `pip`:
9
+
10
+ ```
11
+ pip install imaging-server-kit
12
+ ```
13
+
14
+ or clone the project and install the development version:
15
+
16
+ ```
17
+ git clone https://github.com/Imaging-Server-Kit/imaging-server-kit.git
18
+ cd imaging-server-kit
19
+ pip install -e .
20
+ ```
21
+
22
+ ## Getting started
23
+
24
+ The documentation is available on [this page](https://imaging-server-kit.github.io/imaging-server-kit).
25
+
26
+ ## Contributing
27
+
28
+ Contributions are very welcome.
29
+
30
+ ## License
31
+
32
+ This software is distributed under the terms of the [BSD-3](http://opensource.org/licenses/BSD-3-Clause) license.
33
+
34
+ ## Issues
35
+
36
+ If you encounter any problems, please file an issue along with a detailed description.
@@ -0,0 +1,23 @@
1
+ title: Imaging Server Kit
2
+ author: EPFL Center for Imaging
3
+ # logo: "logo.ico"
4
+ copyright: "2025"
5
+
6
+ only_build_toc_files: true
7
+
8
+ repository:
9
+ url: https://github.com/Imaging-Server-Kit/imaging-server-kit
10
+ branch: main
11
+ path_to_book: "docs"
12
+
13
+ html:
14
+ favicon: "logo.ico"
15
+ use_issues_button: true
16
+ use_repository_button: true
17
+ toc: true
18
+ toc_depth: 2
19
+
20
+ parse:
21
+ myst_enable_extensions:
22
+ - linkify
23
+ - html_admonition
@@ -0,0 +1,11 @@
1
+ format: jb-book
2
+ root: index
3
+ chapters:
4
+ - file: sections/getting_started
5
+ - file: sections/algorithm_server
6
+ - file: sections/multi_algo_server
7
+ # - file: sections/client_apps
8
+ # - file: sections/authentication
9
+ - file: sections/docker
10
+ - file: sections/examples
11
+ - file: sections/api_endpoints
@@ -0,0 +1,54 @@
1
+ # Welcome to the Imaging Server Kit's documentation!
2
+
3
+ The **Imaging Server Kit** is an open-source Python package for deploying image analysis algorithms as web services.
4
+
5
+ - Run computations remotely, while client applications remain focused on visualization.
6
+ - Connect to an algorithm server and run algorithms from [QuPath](https://github.com/Imaging-Server-Kit/qupath-extension-serverkit), [Napari](https://github.com/Imaging-Server-Kit/napari-serverkit), and Python.
7
+
8
+ ## Key Features
9
+
10
+ - Turn standard Python functions into fully-featured image processing web servers with minimal effort.
11
+
12
+ ```python
13
+ @algorithm_server({"image": ImageUI()})
14
+ def segmentation_server(image):
15
+ segmentation = # your code here
16
+ return [(segmentation, {}, "mask")]
17
+ ```
18
+
19
+ <!-- - Automatically generate UIs in Napari and QuPath to test your tools. -->
20
+
21
+ ## Supported image analysis tasks
22
+
23
+ | Task | Examples | Napari | QuPath |
24
+ |-------------------|---------------------------------| ------ | ------ |
25
+ | Segmentation | [StarDist](https://github.com/Imaging-Server-Kit/serverkit-stardist), [CellPose](https://github.com/Imaging-Server-Kit/serverkit-cellpose), [Rembg](https://github.com/Imaging-Server-Kit/serverkit-rembg), [SAM-2](https://github.com/Imaging-Server-Kit/serverkit-sam2), [InstanSeg](https://github.com/Imaging-Server-Kit/serverkit-instanseg) | ✅ | ✅ |
26
+ | Object detection | [Spotiflow](https://github.com/Imaging-Server-Kit/serverkit-spotiflow), [LoG detector](https://github.com/Imaging-Server-Kit/serverkit-skimage-LoG) | ✅ | ✅ |
27
+ | Vector fields | [Orientationpy](https://github.com/Imaging-Server-Kit/serverkit-orientationpy) | ✅ | ✅ |
28
+ | Object tracking | [Trackastra](https://github.com/Imaging-Server-Kit/serverkit-trackastra), [Trackpy](https://github.com/Imaging-Server-Kit/serverkit-trackpy) | ✅ | |
29
+ | Image-to-Image | [SPAM](https://github.com/Imaging-Server-Kit/serverkit-spam), [Noise2Void](https://github.com/Imaging-Server-Kit/serverkit-n2v) | ✅ | |
30
+ | Text-to-Image | [Stable Diffusion](https://github.com/Imaging-Server-Kit/serverkit-stable-diffusion) | ✅ | |
31
+ | Image-to-Text | [Image captioning](https://github.com/Imaging-Server-Kit/serverkit-blip-captioning) | ✅ | |
32
+ | Classification | [ResNet50](https://github.com/Imaging-Server-Kit/serverkit-resnet50) | ✅ | |
33
+
34
+ A gallery of example implementations for commonly used algorithms is available in the [repository](https://github.com/Imaging-Server-Kit/imaging-server-kit/tree/main/examples).
35
+
36
+ ## Installation
37
+
38
+ Install the `imaging-server-kit` package with `pip`:
39
+
40
+ ```
41
+ pip install imaging-server-kit
42
+ ```
43
+
44
+ or clone the project and install the development version:
45
+
46
+ ```
47
+ git clone https://github.com/Imaging-Server-Kit/imaging-server-kit.git
48
+ cd imaging-server-kit
49
+ pip install -e .
50
+ ```
51
+
52
+ ## License
53
+
54
+ This software is distributed under the terms of the [BSD-3](http://opensource.org/licenses/BSD-3-Clause) license.
Binary file
@@ -0,0 +1,170 @@
1
+ # Creating an algorithm server
2
+
3
+ In this tutorial, we'll re-implement the `serverkit demo` example of an intensity threshold algorithm step-by-step. The working principles and concepts extend to any other algorithm.
4
+
5
+ ## Overview
6
+
7
+ Implementing an algorithm server with the `imaging-server-kit` involves two main steps:
8
+
9
+ - Wrapping the image processing logic as a Python function that returns a **list of data tuples**
10
+ - Decorating the function with `@algorithm_server`
11
+
12
+ Let's consider this Python function as an example:
13
+
14
+ ```python
15
+ def threshold_algo_server(image: np.ndarray, threshold: float):
16
+ binary_mask = image > threshold
17
+ return binary_mask
18
+ ```
19
+
20
+ This function applies an intensity threshold to an image represented as a Numpy array and returns it as a segmentation mask (also a Numpy array).
21
+
22
+ To turn this function into to an algorithm server, we first need to modify the function to **make it return a list of data tuples**.
23
+
24
+ ## Make the function return a list of data tuples
25
+
26
+ The function should return a list of tuples ("data tuples"). Each tuple represents one distinct output of the algorithm.
27
+
28
+ Our threshold algorithm only has one output: the segmentation mask resulting from thresholding.
29
+
30
+ ```python
31
+ def threshold_algo_server(image: np.ndarray, threshold: float):
32
+ binary_mask = image > threshold
33
+ return [(binary_mask, {}, "mask")] # List of data tuples
34
+ ```
35
+
36
+ The data tuples are inspired from Napari's [LayerDataTuple](https://napari.org/0.4.15/guides/magicgui.html?highlight=layerdatatuple) model. They include three elements:
37
+
38
+ - The *first element* is the **data**, usually in the form of a Numpy array. The shape and interpretation of the axes depends on what the output represents (cf. table below).
39
+ - The *second element* is optional **metadata** associated with the output, represented as a Python dictionary. It can be empty (`{}`). These metadata are used to affect how the output is displayed in client apps.
40
+ - The *third element* is the output type: a string identifying what the output represents.
41
+
42
+ | Output type | Description |
43
+ | ----------------- | ----------------------------------------------------------------------------------------------------- |
44
+ | `"image"` | An image or image-like data (incl. 3D and RGB) as a nD array. |
45
+ | `"mask"` | A segmentation mask (2D, 3D) as integer nD array. Integers represent the **object class**. |
46
+ | `"instance_mask"` | A segmentation mask (2D, 3D) as integer nD array. Integers represent **object instances**. |
47
+ | `"points"` | A collection of point coordinates (array of shape (N, 2) or (N, 3)). |
48
+ | `"boxes"` | A collection of boxes (array of shape (N, 4) representing the top-left and bottom-right box corners). |
49
+ | `"vectors"` | Array of vectors in the Napari [Vectors](https://napari.org/stable/howtos/layers/vectors.html) format.|
50
+ | `"tracks"` | Array of tracks in the Napari [Tracks](https://napari.org/stable/howtos/layers/tracks.html) format. |
51
+ | `"class"` | A class label (for image classification). |
52
+ | `"text"` | A string of text (for example, for image captioning). |
53
+
54
+ The function can return an arbitrary number of outputs, following the pattern:
55
+
56
+ ```
57
+ # Body of the function
58
+ return [
59
+ (data1, {metadata1}, "type1"), # First output
60
+ (data2, {metadata2}, "type2"), # Second output
61
+ (...)
62
+ ]
63
+ ```
64
+
65
+ ```{admonition} Are there any other constraints on the Python function?
66
+ The function parameters can only be **numpy arrays**, **numeric values** (`int`, `float`), **booleans** or **strings**.
67
+ ```
68
+
69
+ ## Decorate the function with `@algorithm_server`
70
+
71
+ This serves several purposes:
72
+
73
+ - It converts the python function to a FastAPI server with predefined routes (cf. [API Endpoints](api_endpoints)).
74
+ - It enables the server to validate algorithm parameters when receiving requests.
75
+ - Optional info about the algorithm server can be added to populate its `info` page.
76
+
77
+ Below is our decorated threshold algorithm function:
78
+
79
+ ```python
80
+ from imaging_server_kit import algorithm_server, ImageUI, FloatSpinBoxUI
81
+
82
+ @algorithm_server(
83
+ algorithm_name="threshold",
84
+ parameters={
85
+ "image": ImageUI(),
86
+ "threshold": FloatSpinBoxUI(
87
+ default=0.5,
88
+ min=0.0,
89
+ max=1.0,
90
+ step=0.1,
91
+ title="Threshold",
92
+ description="Intensity threshold.",
93
+ ),
94
+ },
95
+ )
96
+ def threshold_algo_server(image: np.ndarray, threshold: float):
97
+ binary_mask = image > threshold
98
+ return [(binary_mask, {}, "mask")]
99
+
100
+ if __name__ == "__main__":
101
+ import uvicorn
102
+ uvicorn.run(threshold_algo_server.app, host="0.0.0.0", port=8000)
103
+ ```
104
+
105
+ You can check that running this file as a script will spin up a threshold algorithm server that you can connect to from Napari, QuPath, or Python, just like in the [Getting started](getting_started) guide.
106
+
107
+ Most importantly, we have specified the `parameters` field of `@algorithm_server`. This enables parameters to be validated by the server before processing. Upon receiving requests with invalid algorithm parameters, the server will reply with a `403` error and an informative message is displayed to the user.
108
+
109
+ The keys of the `parameters` dictionary should match the parameters of the Python function (in our example: `image` and `threshold`). The values are *parameter UI* elements. There is a UI element for each kind of parameters:
110
+
111
+ | UI element | Use case |
112
+ | -------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
113
+ | `ImageUI` | Input image. Validates array dimensionality (by default, accepts `2D` and `3D` arrays). |
114
+ | `MaskUI` | Segmentation mask. Validates array dimensionality (by default, accepts `2D` and `3D` arrays). |
115
+ | `DropDownUI` | A dropdown selector. `items` is used to specify a list of available choices. |
116
+ | `FloatSpinBoxUI` | Numeric parameter (floating point). Validates `min` and `max` values. `step` can be used to specify a suitable incremental step. |
117
+ | `IntSpinBoxUI` | Numeric parameter (integer). Validates `min` and `max` values. `step` can be used to specify a suitable incremental step. |
118
+ | `BoolUI` | Boolean parameter, represented as a checkbox. |
119
+ | `StringUI` | String parameter. |
120
+ | `PointsUI` | Points parameter. |
121
+ | `VectorsUI` | Vectors parameter. |
122
+ | `ShapesUI` | Shapes parameter. |
123
+ | `TracksUI` | Tracks parameter. |
124
+
125
+ In our example, the input image array is well-represented by the `ImageUI` element, and the threshold parameter as a `FloatSpinBoxUI`. The parameter defaults and limits (min, max, step) are specified, as well as a title and description of the parameter, which will appear on the algorithm's `info` page.
126
+
127
+ Moreover, the `@algorithm_server` decorator accepts a variety of optional parameters to enable downloading a sample image, linking to a project page, and providing information on the intended usage of the algorithm server. For details, take a look at the complete [demo example](https://github.com/Imaging-Server-Kit/imaging-server-kit/blob/main/src/imaging_server_kit/demo/threshold.py). The available fields include:
128
+
129
+ | Key | Description |
130
+ | ---------------- | -------------------------------------------------------------------------------------------------------------------------------- |
131
+ | `algorithm_name` | A short name for the algorithm server, in URL-friendly format (no spaces or special characters) |
132
+ | `title` | A name or complete title for the algorithm server. |
133
+ | `description` | A brief description of the algorithm server. |
134
+ | `used_for` | A list of tags from: `Segmentation`, `Registration`, `Filtering`, `Tracking`, `Restoration`, `Points detection`, `Box detection` |
135
+ | `tags` | Tags used to categorize the algorithm server, for example `Deep learning`, `EPFL`, `Cell biology`, `Digital pathology`. |
136
+ | `project_url` | A URL string to the project's homepage. |
137
+ | `sample_images` | A list of paths to sample images (`.tif`, `.png`, `.jpg`). |
138
+
139
+ If you provide sample images, the license terms under which the images are distributed should be respected. For example, for images under [CC-BY](https://creativecommons.org/licenses/by/2.0/deed.en) license, proper attribution should be included.
140
+
141
+ ## Starting from a template
142
+
143
+ It is also possible to create a new algorithm server from a template. Specify an output directory and run the command:
144
+
145
+ ```
146
+ serverkit new <output_directory>
147
+ ```
148
+
149
+ Running this command will generate the following file structure in the selected output directory:
150
+
151
+ ```
152
+ serverkit-project-slug
153
+ ├── sample_images # Sample images
154
+ │ ├──blobs.tif
155
+ └── .gitignore
156
+ └── docker-compose.yml # For deployment with `docker compose up`
157
+ └── Dockerfile
158
+ └── main.py # Implementation of the algorithm server
159
+ └── README.md
160
+ └── requirements.txt
161
+ ```
162
+
163
+ You'll be asked to provide:
164
+
165
+ - **project_name**: The name of the algorithm or project (e.g. StarDist)
166
+ - **project_slug**: A lowercase, URL-friendly name for your project (e.g. stardist)
167
+ - **project_url**: A URL to the original project homepage
168
+ - **python_version**: The Python version to use (default: `3.9`)
169
+
170
+ After generating the project structure, you should edit the files to implement the functionality of your algorithm server. You'll have to edit the `main.py` file which implements the algorithm server, as well as the `requirements.txt`. If needed, consider editing the `Dockerfile` and `README.md` to match your use case.
@@ -0,0 +1,14 @@
1
+ # API Endpoints
2
+
3
+ When the server is running, an OpenAPI documentation of the endpoints is automatically generated on the `/docs` route (e.g. http://localhost:8000/docs).
4
+
5
+ The algorithm servers implement a REST API with a common set of endpoints for processing and retreiving data. The main endpoints are listed in the table below.
6
+
7
+ | Type | Endpoint | Description |
8
+ | ---- | ---------------------------- | ------------------------------------------- |
9
+ | GET | `/` | Algorithm index or info page |
10
+ | GET | `/services` | List available algorithms |
11
+ | GET | `/<algorithm>/info` | Algorithm info page |
12
+ | POST | `/<algorithm>/process` | Run the algorithm |
13
+ | GET | `/<algorithm>/parameters` | Get algorithm parameters |
14
+ | GET | `/<algorithm>/sample_images` | Get samples images |
@@ -0,0 +1,11 @@
1
+ # Authentication
2
+
3
+ We provide an `AuthenticatedAlgorithmServer` which is a drop-in replacement for `AlgorithmServer`. It extends the functionality of the base class by implementing a simple user model and token-based authentication for a server, based on [fastapi-users](https://github.com/fastapi-users/fastapi-users). Only authenticated users can access the `/process` route.
4
+
5
+ ```python
6
+ from imaging_server_kit import AuthenticatedAlgorithmServer
7
+ ```
8
+
9
+ ```{note}
10
+ This feature is still experimental.
11
+ ```
@@ -0,0 +1,30 @@
1
+ # Client apps
2
+
3
+ Once an algorithm server is running, you can connect to it and run algorithms from Python, Napari, and QuPath.
4
+
5
+ ## Python client
6
+
7
+ Use a `Client` instance. For example:
8
+
9
+ ```python
10
+ from imaging_server_kit import Client
11
+
12
+ client = Client("http://localhost:8000")
13
+
14
+ print(client.algorithms)
15
+ # [`rembg`, `stardist`, `cellpose`]
16
+
17
+ algo_output = client.run_algorithm(
18
+ algorithm="rembg",
19
+ image=(...),
20
+ rembg_model_name="silueta",
21
+ )
22
+ ```
23
+
24
+ # Napari plugin
25
+
26
+ Install and use the [Napari Server Kit](https://github.com/Imaging-Server-Kit/napari-serverkit) plugin to connect to algorithm servers and run algorithms in Napari.
27
+
28
+ # QuPath extension
29
+
30
+ Install and use the [QuPath Extension Server Kit](https://github.com/Imaging-Server-Kit/qupath-extension-serverkit) to connect to algorithm servers and run algorithms from within QuPath.
@@ -0,0 +1,38 @@
1
+ ## Using Docker
2
+
3
+ The Imaging Server Kit provides an **algorithm hub** to serve multiple algorithms in separate docker containers.
4
+
5
+ To set up an algorithm hub, the easiest is to use a `docker-compose.yml` file.
6
+
7
+ Here is the [example from the respository](https://github.com/Imaging-Server-Kit/imaging-server-kit/blob/main/examples/servers/docker-compose.yml):
8
+
9
+ ```
10
+ services:
11
+ algorithm_hub:
12
+ build: ../..
13
+ ports:
14
+ - "8000:8000"
15
+ command: python3 start_algorithm_hub.py
16
+ cellpose:
17
+ build: ./serverkit-cellpose
18
+ depends_on:
19
+ - algorithm_hub
20
+ stardist:
21
+ build: ./serverkit-stardist
22
+ depends_on:
23
+ - algorithm_hub
24
+ ```
25
+
26
+ Build the algorithm hub server with
27
+
28
+ ```sh
29
+ docker compose build
30
+ ```
31
+
32
+ Start the algorithm hub server with
33
+
34
+ ```sh
35
+ docker compose up
36
+ ```
37
+
38
+ The server will be listening on http://localhost:8000. It behaves exactly like a [Multi-algorithm server](multi_algo_server), however each algorithm runs in a separate docker container.
@@ -0,0 +1,12 @@
1
+ ## Examples
2
+
3
+ Take a look at the algorithm server examples from the repository, which include
4
+
5
+ - [StarDist](https://github.com/Imaging-Server-Kit/imaging-server-kit/tree/main/examples/servers/serverkit-stardist): Object detection with star-convex shapes.
6
+ - [CellPose](https://github.com/Imaging-Server-Kit/imaging-server-kit/tree/main/examples/servers/serverkit-cellpose): A generalist algorithm for cellular segmentation.
7
+ - [Rembg](https://github.com/Imaging-Server-Kit/imaging-server-kit/tree/main/examples/servers/serverkit-rembg): A tool to remove images background.
8
+ - [Orientationpy](https://github.com/Imaging-Server-Kit/imaging-server-kit/tree/main/examples/servers/serverkit-orientationpy): Measurement of greyscale orientations.
9
+ - [LoG detector](https://github.com/Imaging-Server-Kit/imaging-server-kit/tree/main/examples/servers/serverkit-skimage-log): Laplacian of Gaussian filter.
10
+ - [Trackpy](https://github.com/Imaging-Server-Kit/imaging-server-kit/tree/main/examples/servers/serverkit-trackpy): Object tracking.
11
+
12
+ You can also take a look at the [complete list of examples](https://github.com/orgs/Imaging-Server-Kit/repositories).
@@ -0,0 +1,65 @@
1
+ # Getting started
2
+
3
+ ## Run your first algorithm server
4
+
5
+ With the `imaging-server-kit` package installed, run:
6
+
7
+ ```
8
+ serverkit demo
9
+ ```
10
+
11
+ This will start a demo web server for a simple intensity threshold algorithm.
12
+
13
+ The server will be running on http://localhost:8000. Open your web browser and navigate to this page to check that the server is running. You should see a web page displaying information about the running threshold algorithm server.
14
+
15
+ ![screenshot](../assets/screenshot_running_server.png)
16
+
17
+ ## Usage from Napari
18
+
19
+ Now that the server is running, you can interact with it from different client apps. For usage in [Napari](https://github.com/Imaging-Server-Kit/napari-serverkit), you need to install napari and the `napari-serverkit` plugin.
20
+
21
+ You can install the `napari-serverkit` plugin with `pip`:
22
+
23
+ ```sh
24
+ pip install napari-serverkit
25
+ ```
26
+
27
+ Then, start Napari with the plugin:
28
+
29
+ ```
30
+ napari -w napari-serverkit
31
+ ```
32
+
33
+ or open the plugin from `Plugins > Server Kit (Napari Server Kit)` in Napari.
34
+
35
+ With your server still running on http://localhost:8000, you should be able to connect to it, load a sample image, run the threshold algorithm on it, and have the results displayed in the viewer.
36
+
37
+ ![screenshot](../assets/screenshot_napari_threshold.png)
38
+
39
+ ## Usage from QuPath
40
+
41
+ You can also interact with the algorithm server via QuPath. To try it out, you need to install the [qupath-extension-serverkit](https://github.com/Imaging-Server-Kit/qupath-extension-serverkit).
42
+
43
+ ## Usage from Python
44
+
45
+ It is also possible to connect to an algorithm server and run computation from Python directly:
46
+
47
+ ```python
48
+ from imaging_server_kit import Client
49
+
50
+ # Connect to the server
51
+ client = Client("http://localhost:8000")
52
+
53
+ # run_algorithm returns a list of data tuples
54
+ results = client.run_algorithm(
55
+ algorithm="intensity-threshold",
56
+ image=image,
57
+ threshold=0.5,
58
+ )
59
+
60
+ # Unpack the first result data tuple
61
+ mask, result_metadata, result_type = results[0]
62
+
63
+ # Segmentaiton mask
64
+ print(mask.shape)
65
+ ```