imaging-server-kit 0.0.1__tar.gz → 0.0.3__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.
- imaging_server_kit-0.0.3/.dockerignore +2 -0
- imaging_server_kit-0.0.3/.gitattributes +35 -0
- imaging_server_kit-0.0.3/.gitignore +28 -0
- {imaging_server_kit-0.0.1 → imaging_server_kit-0.0.3}/Dockerfile +6 -2
- {imaging_server_kit-0.0.1 → imaging_server_kit-0.0.3}/Dockerfile-GPU +4 -1
- imaging_server_kit-0.0.3/Dockerfile-registry +5 -0
- imaging_server_kit-0.0.3/PKG-INFO +184 -0
- imaging_server_kit-0.0.3/README.md +121 -0
- imaging_server_kit-0.0.3/build.sh +14 -0
- imaging_server_kit-0.0.3/examples/.gitkeep +0 -0
- {imaging_server_kit-0.0.1 → imaging_server_kit-0.0.3}/pyproject.toml +12 -2
- imaging_server_kit-0.0.3/src/imaging_server_kit/__init__.py +24 -0
- {imaging_server_kit-0.0.1 → imaging_server_kit-0.0.3}/src/imaging_server_kit/_version.py +2 -2
- imaging_server_kit-0.0.3/src/imaging_server_kit/assets/style.css +108 -0
- imaging_server_kit-0.0.3/src/imaging_server_kit/client.py +131 -0
- imaging_server_kit-0.0.3/src/imaging_server_kit/errors.py +41 -0
- imaging_server_kit-0.0.3/src/imaging_server_kit/geometry.py +148 -0
- imaging_server_kit-0.0.3/src/imaging_server_kit/registry.py +100 -0
- imaging_server_kit-0.0.3/src/imaging_server_kit/serialization.py +135 -0
- imaging_server_kit-0.0.3/src/imaging_server_kit/server.py +157 -0
- imaging_server_kit-0.0.3/src/imaging_server_kit/static/index.css +47 -0
- imaging_server_kit-0.0.3/src/imaging_server_kit/static/info.css +124 -0
- imaging_server_kit-0.0.3/src/imaging_server_kit/templates/index.html +33 -0
- imaging_server_kit-0.0.3/src/imaging_server_kit/templates/info.html +78 -0
- imaging_server_kit-0.0.3/src/imaging_server_kit/web_demo.py +393 -0
- imaging_server_kit-0.0.3/src/imaging_server_kit.egg-info/PKG-INFO +184 -0
- imaging_server_kit-0.0.3/src/imaging_server_kit.egg-info/SOURCES.txt +35 -0
- {imaging_server_kit-0.0.1 → imaging_server_kit-0.0.3}/src/imaging_server_kit.egg-info/requires.txt +7 -0
- imaging_server_kit-0.0.1/.dockerignore +0 -4
- imaging_server_kit-0.0.1/.gitignore +0 -87
- imaging_server_kit-0.0.1/Dockerfile-3.10 +0 -11
- imaging_server_kit-0.0.1/PKG-INFO +0 -144
- imaging_server_kit-0.0.1/README.md +0 -91
- imaging_server_kit-0.0.1/examples/example.py +0 -35
- imaging_server_kit-0.0.1/reference_deployment/LICENSE +0 -27
- imaging_server_kit-0.0.1/reference_deployment/README.md +0 -48
- imaging_server_kit-0.0.1/reference_deployment/cookiecutter_template/README.md +0 -2
- imaging_server_kit-0.0.1/reference_deployment/cookiecutter_template/cookiecutter.json +0 -5
- imaging_server_kit-0.0.1/reference_deployment/cookiecutter_template/requirements.txt +0 -1
- imaging_server_kit-0.0.1/reference_deployment/cookiecutter_template/serverkit-{{ cookiecutter.package }}/Dockerfile +0 -5
- imaging_server_kit-0.0.1/reference_deployment/cookiecutter_template/serverkit-{{ cookiecutter.package }}/README.md +0 -6
- imaging_server_kit-0.0.1/reference_deployment/cookiecutter_template/serverkit-{{ cookiecutter.package }}/main.py +0 -72
- imaging_server_kit-0.0.1/reference_deployment/cookiecutter_template/serverkit-{{ cookiecutter.package }}/requirements.txt +0 -1
- imaging_server_kit-0.0.1/reference_deployment/cookiecutter_template/serverkit-{{ cookiecutter.package }}/sample_images/blobs.tif +0 -0
- imaging_server_kit-0.0.1/reference_deployment/docker-compose.yml +0 -14
- imaging_server_kit-0.0.1/reference_deployment/registry/Dockerfile +0 -3
- imaging_server_kit-0.0.1/reference_deployment/servers/serverkit-skimage/Dockerfile +0 -5
- imaging_server_kit-0.0.1/reference_deployment/servers/serverkit-skimage/README.md +0 -6
- imaging_server_kit-0.0.1/reference_deployment/servers/serverkit-skimage/main.py +0 -141
- imaging_server_kit-0.0.1/reference_deployment/servers/serverkit-skimage/requirements.txt +0 -1
- imaging_server_kit-0.0.1/reference_deployment/servers/serverkit-skimage/sample_images/blobs.tif +0 -0
- imaging_server_kit-0.0.1/reference_deployment/servers/serverkit-skimage/tests/test_skimage.py +0 -26
- imaging_server_kit-0.0.1/src/imaging_server_kit/__init__.py +0 -8
- imaging_server_kit-0.0.1/src/imaging_server_kit/client.py +0 -116
- imaging_server_kit-0.0.1/src/imaging_server_kit/registry.py +0 -73
- imaging_server_kit-0.0.1/src/imaging_server_kit/serialization.py +0 -49
- imaging_server_kit-0.0.1/src/imaging_server_kit/server.py +0 -97
- imaging_server_kit-0.0.1/src/imaging_server_kit.egg-info/PKG-INFO +0 -144
- imaging_server_kit-0.0.1/src/imaging_server_kit.egg-info/SOURCES.txt +0 -43
- {imaging_server_kit-0.0.1 → imaging_server_kit-0.0.3}/.github/workflows/publish.yml +0 -0
- {imaging_server_kit-0.0.1 → imaging_server_kit-0.0.3}/LICENSE +0 -0
- {imaging_server_kit-0.0.1 → imaging_server_kit-0.0.3}/MANIFEST.in +0 -0
- {imaging_server_kit-0.0.1 → imaging_server_kit-0.0.3}/main.py +0 -0
- {imaging_server_kit-0.0.1 → imaging_server_kit-0.0.3}/setup.cfg +0 -0
- {imaging_server_kit-0.0.1 → imaging_server_kit-0.0.3}/src/imaging_server_kit/encoding.py +0 -0
- {imaging_server_kit-0.0.1 → imaging_server_kit-0.0.3}/src/imaging_server_kit.egg-info/dependency_links.txt +0 -0
- {imaging_server_kit-0.0.1 → imaging_server_kit-0.0.3}/src/imaging_server_kit.egg-info/top_level.txt +0 -0
- /imaging_server_kit-0.0.1/reference_deployment/registry/main.py → /imaging_server_kit-0.0.3/start_registry.py +0 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
|
2
|
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
|
3
|
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
|
4
|
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
|
5
|
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
|
6
|
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
|
7
|
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
|
8
|
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
|
9
|
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
|
10
|
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
|
11
|
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
|
12
|
+
*.model filter=lfs diff=lfs merge=lfs -text
|
|
13
|
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
|
14
|
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
|
15
|
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
|
16
|
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
|
17
|
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
|
18
|
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
|
19
|
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
|
20
|
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
|
21
|
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
|
22
|
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
|
23
|
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
|
24
|
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
|
25
|
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
|
26
|
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
27
|
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
|
28
|
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
|
29
|
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
|
30
|
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
|
31
|
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
|
32
|
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
|
33
|
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
|
34
|
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
|
35
|
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
__pycache__/
|
|
2
|
+
*.py[cod]
|
|
3
|
+
*$py.class
|
|
4
|
+
old/
|
|
5
|
+
data/
|
|
6
|
+
env/
|
|
7
|
+
build/
|
|
8
|
+
dist/
|
|
9
|
+
downloads/
|
|
10
|
+
eggs/
|
|
11
|
+
.eggs/
|
|
12
|
+
*.egg-info/
|
|
13
|
+
.installed.cfg
|
|
14
|
+
*.egg
|
|
15
|
+
.tox/
|
|
16
|
+
.coverage
|
|
17
|
+
.coverage.*
|
|
18
|
+
.cache
|
|
19
|
+
docs/_build/
|
|
20
|
+
.idea/
|
|
21
|
+
venv/
|
|
22
|
+
.vscode/
|
|
23
|
+
.ipynb_checkpoints
|
|
24
|
+
.python-version
|
|
25
|
+
.DS_Store
|
|
26
|
+
**/_version.py
|
|
27
|
+
|
|
28
|
+
push.sh
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
# Doc: https://github.com/conda-forge/miniforge-images
|
|
1
2
|
FROM condaforge/miniforge3:latest
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
ARG PYTHON_VERSION=3.9
|
|
5
|
+
RUN conda install python=$PYTHON_VERSION -y
|
|
6
|
+
|
|
7
|
+
WORKDIR /app
|
|
4
8
|
|
|
5
9
|
COPY . .
|
|
6
10
|
|
|
@@ -8,4 +12,4 @@ RUN python -m pip install -e .
|
|
|
8
12
|
|
|
9
13
|
EXPOSE 8000
|
|
10
14
|
|
|
11
|
-
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"
|
|
15
|
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
# Doc: https://github.com/iot-salzburg/gpu-jupyter
|
|
1
2
|
FROM cschranz/gpu-jupyter:v1.6_cuda-12.0_ubuntu-22.04_python-only
|
|
3
|
+
|
|
2
4
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
5
|
+
|
|
3
6
|
USER root
|
|
4
7
|
|
|
5
8
|
COPY . .
|
|
@@ -8,4 +11,4 @@ RUN python -m pip install -e .
|
|
|
8
11
|
|
|
9
12
|
EXPOSE 8000
|
|
10
13
|
|
|
11
|
-
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"
|
|
14
|
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: imaging-server-kit
|
|
3
|
+
Version: 0.0.3
|
|
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://gitlab.com/epfl-center-for-imaging/imaging-server-kit
|
|
35
|
+
Project-URL: repository, https://gitlab.com/epfl-center-for-imaging/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: Topic :: Scientific/Engineering :: Image Processing
|
|
47
|
+
Requires-Python: >=3.9
|
|
48
|
+
Description-Content-Type: text/markdown
|
|
49
|
+
License-File: LICENSE
|
|
50
|
+
Requires-Dist: fastapi
|
|
51
|
+
Requires-Dist: uvicorn[standard]
|
|
52
|
+
Requires-Dist: python-multipart
|
|
53
|
+
Requires-Dist: tifffile
|
|
54
|
+
Requires-Dist: numpy
|
|
55
|
+
Requires-Dist: scikit-image
|
|
56
|
+
Requires-Dist: geojson
|
|
57
|
+
Requires-Dist: jinja2
|
|
58
|
+
Requires-Dist: pyyaml
|
|
59
|
+
Requires-Dist: dash
|
|
60
|
+
Requires-Dist: dash-bootstrap-components
|
|
61
|
+
Requires-Dist: a2wsgi
|
|
62
|
+
Requires-Dist: pytest
|
|
63
|
+
|
|
64
|
+

|
|
65
|
+
# 🪐 Imaging Server Kit
|
|
66
|
+
|
|
67
|
+
Deploy image processing algorithms in FastAPI servers and easily run them in Napari, QuPath, and more.
|
|
68
|
+
|
|
69
|
+
## Usage
|
|
70
|
+
|
|
71
|
+
### Algorithm servers
|
|
72
|
+
|
|
73
|
+
Set up and run a server with one, or multiple algorithms from the Imaging Server Kit collection (or your own):
|
|
74
|
+
|
|
75
|
+
- [StarDist](https://github.com/Imaging-Server-Kit/serverkit-stardist)
|
|
76
|
+
- [CellPose](https://github.com/Imaging-Server-Kit/serverkit-cellpose)
|
|
77
|
+
- [Spotiflow](https://github.com/Imaging-Server-Kit/serverkit-spotiflow)
|
|
78
|
+
- [Rembg](https://github.com/Imaging-Server-Kit/serverkit-rembg)
|
|
79
|
+
- [Scikit-image LoG detector](https://github.com/Imaging-Server-Kit/serverkit-skimage-LoG)
|
|
80
|
+
- [Orientationpy](https://github.com/Imaging-Server-Kit/serverkit-orientationpy)
|
|
81
|
+
<!-- - [Tau Fibrils Detector](https://github.com/Imaging-Server-Kit/serverkit-tau-fibrils-yolo) -->
|
|
82
|
+
|
|
83
|
+
To do that, the recommended way is to edit a `docker-compose.yml` file and pull server images from `registry.rcp.epfl.ch` (EPFL users only):
|
|
84
|
+
|
|
85
|
+
```{docker-compose.yml}
|
|
86
|
+
services:
|
|
87
|
+
servers_registry:
|
|
88
|
+
image: mallorywittwerepfl/imaging-server-kit:registry
|
|
89
|
+
ports:
|
|
90
|
+
- "8000:8000"
|
|
91
|
+
rembg:
|
|
92
|
+
image: registry.rcp.epfl.ch/imaging-server-kit/serverkit-rembg:latest
|
|
93
|
+
depends_on:
|
|
94
|
+
- servers_registry
|
|
95
|
+
skimage-log:
|
|
96
|
+
image: registry.rcp.epfl.ch/imaging-server-kit/serverkit-skimage-log:latest
|
|
97
|
+
depends_on:
|
|
98
|
+
- servers_registry
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Start the server with
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
docker compose up
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
The server should be accessible at http://localhost:8000.
|
|
108
|
+
|
|
109
|
+
**Build the docker images yourself**
|
|
110
|
+
|
|
111
|
+
To build the algorithm server images yourself (e.g. if you are not from EPFL), see [Reference Deployment](https://github.com/Imaging-Server-Kit/serverkit-deploy-docker).
|
|
112
|
+
|
|
113
|
+
**Create a server for your project**
|
|
114
|
+
|
|
115
|
+
To learn how to create a server for your project, see [Algorithm Server Template](https://github.com/Imaging-Server-Kit/cookiecutter-serverkit).
|
|
116
|
+
|
|
117
|
+
### Python client
|
|
118
|
+
|
|
119
|
+
Once the server is running, connect to it and run algorithms from Python:
|
|
120
|
+
|
|
121
|
+
```python
|
|
122
|
+
from imaging_server_kit import Client
|
|
123
|
+
|
|
124
|
+
client = Client("http://localhost:8000")
|
|
125
|
+
|
|
126
|
+
print(client.algorithms)
|
|
127
|
+
# [`rembg`, `stardist`, `cellpose`]
|
|
128
|
+
|
|
129
|
+
algo_output = client.run_algorithm(
|
|
130
|
+
algorithm="rembg",
|
|
131
|
+
image=(...),
|
|
132
|
+
rembg_model_name="silueta",
|
|
133
|
+
)
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Napari plugin
|
|
137
|
+
|
|
138
|
+
Once the server is running, use the [Napari Server Kit](https://github.com/Imaging-Server-Kit/napari-serverkit) plugin to connect to it and run algorithms in Napari.
|
|
139
|
+
|
|
140
|
+
### QuPath extension
|
|
141
|
+
|
|
142
|
+
Once the server is running, use the [QuPath Extension Server Kit](https://github.com/Imaging-Server-Kit/qupath-extension-serverkit) to connect to it and run algorithms from within QuPath.
|
|
143
|
+
|
|
144
|
+
## Install locally
|
|
145
|
+
|
|
146
|
+
Install the `imaging-server-kit` package with `pip`:
|
|
147
|
+
|
|
148
|
+
```
|
|
149
|
+
pip install imaging-server-kit
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
or clone the project and install the development version:
|
|
153
|
+
|
|
154
|
+
```
|
|
155
|
+
git clone https://github.com/Imaging-Server-Kit/imaging-server-kit.git
|
|
156
|
+
cd imaging-server-kit
|
|
157
|
+
pip install -e .
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## Build with `docker`
|
|
161
|
+
|
|
162
|
+
Build the `imaging-server-kit` docker image for a specific Python version:
|
|
163
|
+
|
|
164
|
+
```
|
|
165
|
+
docker build --build-arg PYTHON_VERSION=3.9 -t imaging-server-kit:3.9 .
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Run [build.sh](./build.sh) to build docker images for Python 3.9, 3.10, 3.11, GPU and the server kit registry:
|
|
169
|
+
|
|
170
|
+
```
|
|
171
|
+
bash ./build.sh
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
## Contributing
|
|
175
|
+
|
|
176
|
+
Contributions are very welcome.
|
|
177
|
+
|
|
178
|
+
## License
|
|
179
|
+
|
|
180
|
+
This software is distributed under the terms of the [BSD-3](http://opensource.org/licenses/BSD-3-Clause) license.
|
|
181
|
+
|
|
182
|
+
## Issues
|
|
183
|
+
|
|
184
|
+
If you encounter any problems, please file an issue along with a detailed description.
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+

|
|
2
|
+
# 🪐 Imaging Server Kit
|
|
3
|
+
|
|
4
|
+
Deploy image processing algorithms in FastAPI servers and easily run them in Napari, QuPath, and more.
|
|
5
|
+
|
|
6
|
+
## Usage
|
|
7
|
+
|
|
8
|
+
### Algorithm servers
|
|
9
|
+
|
|
10
|
+
Set up and run a server with one, or multiple algorithms from the Imaging Server Kit collection (or your own):
|
|
11
|
+
|
|
12
|
+
- [StarDist](https://github.com/Imaging-Server-Kit/serverkit-stardist)
|
|
13
|
+
- [CellPose](https://github.com/Imaging-Server-Kit/serverkit-cellpose)
|
|
14
|
+
- [Spotiflow](https://github.com/Imaging-Server-Kit/serverkit-spotiflow)
|
|
15
|
+
- [Rembg](https://github.com/Imaging-Server-Kit/serverkit-rembg)
|
|
16
|
+
- [Scikit-image LoG detector](https://github.com/Imaging-Server-Kit/serverkit-skimage-LoG)
|
|
17
|
+
- [Orientationpy](https://github.com/Imaging-Server-Kit/serverkit-orientationpy)
|
|
18
|
+
<!-- - [Tau Fibrils Detector](https://github.com/Imaging-Server-Kit/serverkit-tau-fibrils-yolo) -->
|
|
19
|
+
|
|
20
|
+
To do that, the recommended way is to edit a `docker-compose.yml` file and pull server images from `registry.rcp.epfl.ch` (EPFL users only):
|
|
21
|
+
|
|
22
|
+
```{docker-compose.yml}
|
|
23
|
+
services:
|
|
24
|
+
servers_registry:
|
|
25
|
+
image: mallorywittwerepfl/imaging-server-kit:registry
|
|
26
|
+
ports:
|
|
27
|
+
- "8000:8000"
|
|
28
|
+
rembg:
|
|
29
|
+
image: registry.rcp.epfl.ch/imaging-server-kit/serverkit-rembg:latest
|
|
30
|
+
depends_on:
|
|
31
|
+
- servers_registry
|
|
32
|
+
skimage-log:
|
|
33
|
+
image: registry.rcp.epfl.ch/imaging-server-kit/serverkit-skimage-log:latest
|
|
34
|
+
depends_on:
|
|
35
|
+
- servers_registry
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Start the server with
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
docker compose up
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
The server should be accessible at http://localhost:8000.
|
|
45
|
+
|
|
46
|
+
**Build the docker images yourself**
|
|
47
|
+
|
|
48
|
+
To build the algorithm server images yourself (e.g. if you are not from EPFL), see [Reference Deployment](https://github.com/Imaging-Server-Kit/serverkit-deploy-docker).
|
|
49
|
+
|
|
50
|
+
**Create a server for your project**
|
|
51
|
+
|
|
52
|
+
To learn how to create a server for your project, see [Algorithm Server Template](https://github.com/Imaging-Server-Kit/cookiecutter-serverkit).
|
|
53
|
+
|
|
54
|
+
### Python client
|
|
55
|
+
|
|
56
|
+
Once the server is running, connect to it and run algorithms from Python:
|
|
57
|
+
|
|
58
|
+
```python
|
|
59
|
+
from imaging_server_kit import Client
|
|
60
|
+
|
|
61
|
+
client = Client("http://localhost:8000")
|
|
62
|
+
|
|
63
|
+
print(client.algorithms)
|
|
64
|
+
# [`rembg`, `stardist`, `cellpose`]
|
|
65
|
+
|
|
66
|
+
algo_output = client.run_algorithm(
|
|
67
|
+
algorithm="rembg",
|
|
68
|
+
image=(...),
|
|
69
|
+
rembg_model_name="silueta",
|
|
70
|
+
)
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Napari plugin
|
|
74
|
+
|
|
75
|
+
Once the server is running, use the [Napari Server Kit](https://github.com/Imaging-Server-Kit/napari-serverkit) plugin to connect to it and run algorithms in Napari.
|
|
76
|
+
|
|
77
|
+
### QuPath extension
|
|
78
|
+
|
|
79
|
+
Once the server is running, use the [QuPath Extension Server Kit](https://github.com/Imaging-Server-Kit/qupath-extension-serverkit) to connect to it and run algorithms from within QuPath.
|
|
80
|
+
|
|
81
|
+
## Install locally
|
|
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
|
+
## Build with `docker`
|
|
98
|
+
|
|
99
|
+
Build the `imaging-server-kit` docker image for a specific Python version:
|
|
100
|
+
|
|
101
|
+
```
|
|
102
|
+
docker build --build-arg PYTHON_VERSION=3.9 -t imaging-server-kit:3.9 .
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Run [build.sh](./build.sh) to build docker images for Python 3.9, 3.10, 3.11, GPU and the server kit registry:
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
bash ./build.sh
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Contributing
|
|
112
|
+
|
|
113
|
+
Contributions are very welcome.
|
|
114
|
+
|
|
115
|
+
## License
|
|
116
|
+
|
|
117
|
+
This software is distributed under the terms of the [BSD-3](http://opensource.org/licenses/BSD-3-Clause) license.
|
|
118
|
+
|
|
119
|
+
## Issues
|
|
120
|
+
|
|
121
|
+
If you encounter any problems, please file an issue along with a detailed description.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
PYTHON_VERSIONS=("3.9" "3.10" "3.11")
|
|
4
|
+
|
|
5
|
+
for version in "${PYTHON_VERSIONS[@]}"; do
|
|
6
|
+
echo "Building image for Python $version..."
|
|
7
|
+
docker build --build-arg PYTHON_VERSION=$version -t imaging-server-kit:$version .
|
|
8
|
+
done
|
|
9
|
+
|
|
10
|
+
# echo "Building image for Python 3.9, GPU-compatible..."
|
|
11
|
+
# docker build -t imaging-server-kit:gpu --file Dockerfile-GPU .
|
|
12
|
+
|
|
13
|
+
echo "Building image for Python 3.9, serverkit registry..."
|
|
14
|
+
docker build -t imaging-server-kit:registry --file Dockerfile-registry .
|
|
File without changes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "imaging-server-kit"
|
|
3
3
|
dynamic = ["version"]
|
|
4
|
-
description = "
|
|
4
|
+
description = "Deploy image processing algorithms in FastAPI servers. "
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.9"
|
|
7
7
|
license = { file = "LICENSE" }
|
|
@@ -9,12 +9,15 @@ authors = [{ name = "Mallory Wittwer", email = "mallory.wittwer@epfl.ch" }]
|
|
|
9
9
|
|
|
10
10
|
classifiers = [
|
|
11
11
|
"Development Status :: 2 - Pre-Alpha",
|
|
12
|
+
"Intended Audience :: Developers",
|
|
12
13
|
"License :: OSI Approved :: BSD License",
|
|
14
|
+
"Operating System :: OS Independent",
|
|
15
|
+
"Programming Language :: Python",
|
|
13
16
|
"Programming Language :: Python :: 3",
|
|
17
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
14
18
|
"Programming Language :: Python :: 3.9",
|
|
15
19
|
"Programming Language :: Python :: 3.10",
|
|
16
20
|
"Programming Language :: Python :: 3.11",
|
|
17
|
-
"Programming Language :: Python :: 3.12",
|
|
18
21
|
"Topic :: Scientific/Engineering :: Image Processing",
|
|
19
22
|
]
|
|
20
23
|
|
|
@@ -25,6 +28,13 @@ dependencies = [
|
|
|
25
28
|
"tifffile",
|
|
26
29
|
"numpy",
|
|
27
30
|
"scikit-image",
|
|
31
|
+
"geojson",
|
|
32
|
+
"jinja2", # For the /info route
|
|
33
|
+
"pyyaml", # For the /info route
|
|
34
|
+
"dash", # For the dash app
|
|
35
|
+
"dash-bootstrap-components", # For the dash app
|
|
36
|
+
"a2wsgi", # For the dash app
|
|
37
|
+
"pytest", # For testing
|
|
28
38
|
]
|
|
29
39
|
|
|
30
40
|
[project.urls]
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
from ._version import version as __version__
|
|
2
|
+
try:
|
|
3
|
+
from ._version import version as __version__
|
|
4
|
+
except ImportError:
|
|
5
|
+
__version__ = "unknown"
|
|
6
|
+
|
|
7
|
+
from imaging_server_kit.client import Client
|
|
8
|
+
from imaging_server_kit.server import Server, Parameters
|
|
9
|
+
from imaging_server_kit.registry import Registry
|
|
10
|
+
from imaging_server_kit.encoding import encode_contents, decode_contents
|
|
11
|
+
from imaging_server_kit.serialization import (
|
|
12
|
+
serialize_result_tuple,
|
|
13
|
+
deserialize_result_tuple,
|
|
14
|
+
)
|
|
15
|
+
from imaging_server_kit.geometry import (
|
|
16
|
+
mask2features,
|
|
17
|
+
features2mask,
|
|
18
|
+
boxes2features,
|
|
19
|
+
features2boxes,
|
|
20
|
+
points2features,
|
|
21
|
+
features2points,
|
|
22
|
+
vectors2features,
|
|
23
|
+
features2vectors,
|
|
24
|
+
)
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
body {
|
|
2
|
+
padding: 0;
|
|
3
|
+
margin: 0;
|
|
4
|
+
background-color: rgb(40, 40, 40);
|
|
5
|
+
color: white;
|
|
6
|
+
height: 100vh;
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.main-container {
|
|
12
|
+
height: 100vh;
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-direction: column;
|
|
15
|
+
/* background-color: orange; */
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
header {
|
|
19
|
+
margin: 10px 0px;
|
|
20
|
+
text-align: center;
|
|
21
|
+
height: 120px;
|
|
22
|
+
line-height: 120px;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
footer {
|
|
26
|
+
margin: 10px 0px;
|
|
27
|
+
text-align: center;
|
|
28
|
+
height: 120px;
|
|
29
|
+
line-height: 120px;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.main-row {
|
|
33
|
+
display: flex;
|
|
34
|
+
flex: 1 1;
|
|
35
|
+
overflow: auto;
|
|
36
|
+
width: 100%;
|
|
37
|
+
margin: 10px;
|
|
38
|
+
margin-left: 0px;
|
|
39
|
+
/* background-color: purple; */
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.col {
|
|
43
|
+
padding: 0;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.parameters-column,
|
|
47
|
+
.layer-column,
|
|
48
|
+
.graph-column {
|
|
49
|
+
margin: 0 !important;
|
|
50
|
+
padding: 15px;
|
|
51
|
+
background-color: rgb(50, 50, 50);
|
|
52
|
+
margin-bottom: 0px;
|
|
53
|
+
height: 100%;
|
|
54
|
+
overflow: auto;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.layer-column {
|
|
58
|
+
/* flex: 0 1 400px; */
|
|
59
|
+
/* background-color: blue; */
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.parameters-column {
|
|
63
|
+
/* flex: 0 1 400px; */
|
|
64
|
+
min-width: 400px;
|
|
65
|
+
/* background-color: green; */
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.graph-column {
|
|
69
|
+
padding: 0px;
|
|
70
|
+
margin: 0;
|
|
71
|
+
flex: 1;
|
|
72
|
+
min-width: 800px;
|
|
73
|
+
/* background-color: orange; */
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
.layer-column .btn-secondary,
|
|
78
|
+
.parameters-column .btn-primary {
|
|
79
|
+
width: 100%;
|
|
80
|
+
margin-top: 10px;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.dash-dropdown * {
|
|
84
|
+
background-color: rgb(70, 70, 70);
|
|
85
|
+
color: white;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.dash-dropdown .Select-value-label {
|
|
89
|
+
color: white !important;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.upload-data {
|
|
93
|
+
background-color: rgb(0, 0, 0);
|
|
94
|
+
border: 1px dashed rgb(240, 240, 240);
|
|
95
|
+
padding: 10px;
|
|
96
|
+
text-align: center;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.graph-container {
|
|
100
|
+
background-color: burlywood;
|
|
101
|
+
flex: 1;
|
|
102
|
+
height: 90%;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
#graph {
|
|
106
|
+
background-color: rgb(0, 0, 0);
|
|
107
|
+
height: 100%;
|
|
108
|
+
}
|