imaging-server-kit 0.1.2__tar.gz → 0.1.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.1.2 → imaging_server_kit-0.1.3}/PKG-INFO +1 -1
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/_version.py +3 -3
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/core/algorithm.py +14 -4
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/core/app.py +11 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/core/client.py +7 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/core/errors.py +5 -2
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/core/multialgo.py +5 -1
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/core/runner.py +8 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/demo/examples.py +36 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/types/_mask.py +1 -1
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit.egg-info/PKG-INFO +1 -1
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/.dockerignore +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/.gitattributes +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/.github/workflows/deploy.yml +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/.github/workflows/publish.yml +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/.gitignore +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/CITATION.cff +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/Dockerfile +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/Dockerfile-GPU +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/LICENSE +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/MANIFEST.in +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/README.md +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/build.sh +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/docs/_config.yml +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/docs/_static/oripy_threshold.mp4 +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/docs/_static/progressive_threshold.mp4 +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/docs/_static/server_napari.mp4 +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/docs/_static/stardist_blobs.mp4 +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/docs/_static/tiles.mp4 +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/docs/_static/tiling2.mp4 +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/docs/_static/yolo-stream.mp4 +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/docs/_toc.yml +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/docs/assets/demo_napari_screenshot.png +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/docs/assets/gaussian_result.png +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/docs/assets/meta_sc.png +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/docs/assets/samples_sc.png +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/docs/assets/screenshot_napari_threshold.png +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/docs/assets/screenshot_server.png +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/docs/assets/server_running.png +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/docs/assets/threshold_qupath.png +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/docs/index.md +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/docs/logo.ico +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/docs/sections/00_getting_started.md +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/docs/sections/01_algorithm.ipynb +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/docs/sections/02_samples.ipynb +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/docs/sections/03_metadata.ipynb +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/docs/sections/04_multialgo.ipynb +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/docs/sections/05_streams.ipynb +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/docs/sections/06_tiled.ipynb +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/docs/sections/07_server.md +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/docs/sections/08_python.ipynb +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/docs/sections/09_docker.md +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/docs/sections/10_types.md +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/docs/sections/11_examples.md +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/examples/readme.md +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/pyproject.toml +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/setup.cfg +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/__init__.py +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/cli.py +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/core/__init__.py +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/core/_etc.py +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/core/encoding.py +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/core/results.py +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/core/serialization.py +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/core/static/css/index.css +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/core/static/css/info.css +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/core/templates/index.html +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/core/templates/info.html +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/core/tiling.py +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/demo/__init__.py +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/demo/sample_images/blobs.tif +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/demo/sample_images/tracks.tif +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/template/cookiecutter.json +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/template/serverkit-{{cookiecutter.name}}/.dockerignore +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/template/serverkit-{{cookiecutter.name}}/.gitignore +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/template/serverkit-{{cookiecutter.name}}/Dockerfile +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/template/serverkit-{{cookiecutter.name}}/README.md +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/template/serverkit-{{cookiecutter.name}}/docker-compose.yml +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/template/serverkit-{{cookiecutter.name}}/main.py +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/template/serverkit-{{cookiecutter.name}}/requirements.txt +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/template/serverkit-{{cookiecutter.name}}/samples/blobs.tif +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/types/__init__.py +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/types/_bool.py +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/types/_boxes.py +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/types/_choice.py +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/types/_float.py +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/types/_image.py +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/types/_integer.py +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/types/_notification.py +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/types/_null.py +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/types/_paths.py +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/types/_points.py +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/types/_string.py +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/types/_tracks.py +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/types/_vectors.py +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/types/common.py +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/types/data_layer.py +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit.egg-info/SOURCES.txt +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit.egg-info/dependency_links.txt +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit.egg-info/entry_points.txt +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit.egg-info/requires.txt +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit.egg-info/top_level.txt +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/tests/sample_images/blobs.tif +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/tests/test_basic.py +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/tests/test_multialgo.py +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/tests/test_results.py +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/tests/test_streaming.py +0 -0
- {imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/tests/test_tiling.py +0 -0
|
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
|
|
|
28
28
|
commit_id: COMMIT_ID
|
|
29
29
|
__commit_id__: COMMIT_ID
|
|
30
30
|
|
|
31
|
-
__version__ = version = '0.1.
|
|
32
|
-
__version_tuple__ = version_tuple = (0, 1,
|
|
31
|
+
__version__ = version = '0.1.3'
|
|
32
|
+
__version_tuple__ = version_tuple = (0, 1, 3)
|
|
33
33
|
|
|
34
|
-
__commit_id__ = commit_id = '
|
|
34
|
+
__commit_id__ = commit_id = 'gcb94cd5b1'
|
{imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/core/algorithm.py
RENAMED
|
@@ -241,6 +241,7 @@ class Algorithm(AlgorithmRunner):
|
|
|
241
241
|
project_url: str = "https://github.com/Imaging-Server-Kit/imaging-server-kit",
|
|
242
242
|
metadata_file: str = "metadata.yaml",
|
|
243
243
|
samples: Optional[List[Dict[str, Any]]] = None,
|
|
244
|
+
tileable: bool = True,
|
|
244
245
|
):
|
|
245
246
|
# Initialize mutables
|
|
246
247
|
if tags is None:
|
|
@@ -261,6 +262,9 @@ class Algorithm(AlgorithmRunner):
|
|
|
261
262
|
|
|
262
263
|
# Samples
|
|
263
264
|
self.samples = samples
|
|
265
|
+
|
|
266
|
+
# Tileability
|
|
267
|
+
self.tileable = tileable
|
|
264
268
|
|
|
265
269
|
# Resolve the Pydantic parameters model
|
|
266
270
|
self.parameters_model = _parse_pydantic_params_schema(
|
|
@@ -277,7 +281,7 @@ class Algorithm(AlgorithmRunner):
|
|
|
277
281
|
@property
|
|
278
282
|
def algorithms(self) -> Iterable[str]:
|
|
279
283
|
return self._algorithms
|
|
280
|
-
|
|
284
|
+
|
|
281
285
|
@algorithms.setter
|
|
282
286
|
def algorithms(self, algorithms: Iterable[str]):
|
|
283
287
|
self._algorithms = algorithms
|
|
@@ -340,7 +344,7 @@ class Algorithm(AlgorithmRunner):
|
|
|
340
344
|
sample_results = Results()
|
|
341
345
|
for param_name, param_value in resolved_params.items():
|
|
342
346
|
kind = algo_params_defs.get(param_name).get("param_type")
|
|
343
|
-
if (kind
|
|
347
|
+
if (kind in ["image", "mask"]) & (not isinstance(param_value, np.ndarray)):
|
|
344
348
|
param_value = skimage.io.imread(param_value)
|
|
345
349
|
sample_results.create(kind, param_value, param_name)
|
|
346
350
|
return sample_results
|
|
@@ -348,6 +352,9 @@ class Algorithm(AlgorithmRunner):
|
|
|
348
352
|
def get_n_samples(self, algorithm=None):
|
|
349
353
|
return len(self.samples)
|
|
350
354
|
|
|
355
|
+
def is_tileable(self, algorithm=None):
|
|
356
|
+
return self.tileable
|
|
357
|
+
|
|
351
358
|
@validate_algorithm
|
|
352
359
|
def get_signature_params(self, algorithm=None) -> List[str]:
|
|
353
360
|
"""List parameter names of the algo run function."""
|
|
@@ -413,7 +420,8 @@ def algorithm(
|
|
|
413
420
|
project_url: str = "https://github.com/Imaging-Server-Kit/imaging-server-kit",
|
|
414
421
|
metadata_file: str = "metadata.yaml",
|
|
415
422
|
samples: Optional[List[Dict[str, Any]]] = None,
|
|
416
|
-
|
|
423
|
+
tileable: bool = True,
|
|
424
|
+
) -> Algorithm:
|
|
417
425
|
"""Convert a Python function into an algorithm instance (sk.Algorithm).
|
|
418
426
|
|
|
419
427
|
Parameters
|
|
@@ -426,7 +434,8 @@ def algorithm(
|
|
|
426
434
|
project_url: A link to a related, or the original project (gets displayed on the algo doc page).
|
|
427
435
|
metadata_file: A path to a metadata.yaml file with algorithm metadata.
|
|
428
436
|
samples: A list of sample parameters for the algorithm, each represented as a dictionary mapping parameter_name to example_value. Sample images can be a Numpy array, a URL, or a local path to a file readable by `skimag.io.imread`.
|
|
429
|
-
|
|
437
|
+
tileable: Whether to allow running the algorithm tile-by-tile. Can be set to False to explicitely disable that functionality.
|
|
438
|
+
|
|
430
439
|
Returns
|
|
431
440
|
-------
|
|
432
441
|
An algorithm instance (sk.Algorithm).
|
|
@@ -442,6 +451,7 @@ def algorithm(
|
|
|
442
451
|
project_url=project_url,
|
|
443
452
|
metadata_file=metadata_file,
|
|
444
453
|
samples=samples,
|
|
454
|
+
tileable=tileable,
|
|
445
455
|
)
|
|
446
456
|
|
|
447
457
|
if func is not None and callable(func):
|
|
@@ -252,6 +252,17 @@ class AlgorithmApp:
|
|
|
252
252
|
algorithm = find_algorithm(algorithm_name, self.algorithms_dict)
|
|
253
253
|
n_samples = algorithm.get_n_samples(algorithm=algorithm_name)
|
|
254
254
|
return {"n_samples": n_samples}
|
|
255
|
+
|
|
256
|
+
@self.app.get(
|
|
257
|
+
"/{algorithm_name}/tileable",
|
|
258
|
+
response_model=dict,
|
|
259
|
+
summary="Whether the algorithm is tileable.",
|
|
260
|
+
tags=["algorithm"],
|
|
261
|
+
)
|
|
262
|
+
def is_tileable(algorithm_name: str):
|
|
263
|
+
algorithm = find_algorithm(algorithm_name, self.algorithms_dict)
|
|
264
|
+
tileable = algorithm.is_tileable(algorithm=algorithm_name)
|
|
265
|
+
return {"tileable": tileable}
|
|
255
266
|
|
|
256
267
|
@self.app.get("/{algorithm_name}/signature", tags=["algorithm"])
|
|
257
268
|
def get_signature(algorithm_name: str):
|
|
@@ -103,6 +103,13 @@ class Client(AlgorithmRunner):
|
|
|
103
103
|
json_response = self._access_algo_get_endpoint(endpoint)
|
|
104
104
|
n_samples = json_response.get("n_samples")
|
|
105
105
|
return n_samples
|
|
106
|
+
|
|
107
|
+
@validate_algorithm
|
|
108
|
+
def is_tileable(self, algorithm=None) -> bool:
|
|
109
|
+
endpoint = f"{self.server_url}/{algorithm}/tileable"
|
|
110
|
+
json_response = self._access_algo_get_endpoint(endpoint)
|
|
111
|
+
is_tileable = json_response.get("tileable")
|
|
112
|
+
return is_tileable
|
|
106
113
|
|
|
107
114
|
@validate_algorithm
|
|
108
115
|
def get_signature_params(self, algorithm: str) -> List[str]:
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import importlib.util
|
|
2
|
+
from typing import Optional
|
|
2
3
|
|
|
3
4
|
class AlgorithmNotFoundError(Exception):
|
|
4
5
|
"""Exception raised when a specified algorithm is not found."""
|
|
@@ -83,10 +84,12 @@ class AlgorithmRuntimeError(Exception):
|
|
|
83
84
|
def __init__(
|
|
84
85
|
self,
|
|
85
86
|
algorithm: str,
|
|
86
|
-
error: Exception,
|
|
87
|
+
error: Optional[Exception] = None,
|
|
87
88
|
message="Algorithm did not run successfully. ",
|
|
88
89
|
):
|
|
89
|
-
self.message = message + f"{algorithm=}
|
|
90
|
+
self.message = message + f"{algorithm=}"
|
|
91
|
+
if error is not None:
|
|
92
|
+
self.message = self.message + ", Error: {error}"
|
|
90
93
|
super().__init__(self.message)
|
|
91
94
|
|
|
92
95
|
|
{imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/core/multialgo.py
RENAMED
|
@@ -23,7 +23,7 @@ class MultiAlgorithm(AlgorithmRunner):
|
|
|
23
23
|
@property
|
|
24
24
|
def algorithms(self) -> List[str]:
|
|
25
25
|
return list(self.algorithms_dict.keys())
|
|
26
|
-
|
|
26
|
+
|
|
27
27
|
@validate_algorithm
|
|
28
28
|
def info(self, algorithm: str):
|
|
29
29
|
return self.algorithms_dict[algorithm].info(algorithm)
|
|
@@ -39,6 +39,10 @@ class MultiAlgorithm(AlgorithmRunner):
|
|
|
39
39
|
@validate_algorithm
|
|
40
40
|
def get_n_samples(self, algorithm: str) -> int:
|
|
41
41
|
return self.algorithms_dict[algorithm].get_n_samples(algorithm)
|
|
42
|
+
|
|
43
|
+
@validate_algorithm
|
|
44
|
+
def is_tileable(self, algorithm: str) -> bool:
|
|
45
|
+
return self.algorithms_dict[algorithm].is_tileable(algorithm)
|
|
42
46
|
|
|
43
47
|
@validate_algorithm
|
|
44
48
|
def get_signature_params(self, algorithm: str) -> List[str]:
|
|
@@ -83,6 +83,9 @@ class AlgorithmRunner(ABC):
|
|
|
83
83
|
|
|
84
84
|
@abstractmethod
|
|
85
85
|
def get_n_samples(self, algorithm: str) -> int: ...
|
|
86
|
+
|
|
87
|
+
@abstractmethod
|
|
88
|
+
def is_tileable(self, algorithm: str) -> bool: ...
|
|
86
89
|
|
|
87
90
|
@abstractmethod
|
|
88
91
|
def get_signature_params(self, algorithm: str) -> List[str]: ...
|
|
@@ -175,6 +178,11 @@ class AlgorithmRunner(ABC):
|
|
|
175
178
|
stream = self._is_stream(algorithm)
|
|
176
179
|
|
|
177
180
|
if tiled:
|
|
181
|
+
if self.tileable is False:
|
|
182
|
+
raise AlgorithmRuntimeError(
|
|
183
|
+
algorithm,
|
|
184
|
+
message="Algorithm cannot be run in tiled mode.",
|
|
185
|
+
)
|
|
178
186
|
if stream:
|
|
179
187
|
raise AlgorithmStreamError(
|
|
180
188
|
algorithm,
|
{imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/demo/examples.py
RENAMED
|
@@ -517,3 +517,39 @@ def project(image, method, axis: str):
|
|
|
517
517
|
name=f"Projection",
|
|
518
518
|
meta={"contrast_limits": [proj.min(), proj.max()], "colormap": "viridis"},
|
|
519
519
|
)
|
|
520
|
+
|
|
521
|
+
|
|
522
|
+
## Conway's game of life (inspired by: https://www.geeksforgeeks.org/dsa/conways-game-life-python-implementation/)
|
|
523
|
+
@sk.algorithm(
|
|
524
|
+
name="Game of Life",
|
|
525
|
+
description="Conway's game of life.",
|
|
526
|
+
project_url="https://www.geeksforgeeks.org/dsa/conways-game-life-python-implementation/",
|
|
527
|
+
)
|
|
528
|
+
def conway_algo(max_iter=200, delay=0.1):
|
|
529
|
+
min_val = 0
|
|
530
|
+
max_val = 255
|
|
531
|
+
|
|
532
|
+
N=100 # Size of the grid
|
|
533
|
+
|
|
534
|
+
def update(grid: np.ndarray, N: int) -> np.ndarray:
|
|
535
|
+
newGrid = grid.copy()
|
|
536
|
+
for i in range(N):
|
|
537
|
+
for j in range(N):
|
|
538
|
+
total = int((grid[i, (j-1)%N] + grid[i, (j+1)%N] +
|
|
539
|
+
grid[(i-1)%N, j] + grid[(i+1)%N, j] +
|
|
540
|
+
grid[(i-1)%N, (j-1)%N] + grid[(i-1)%N, (j+1)%N] +
|
|
541
|
+
grid[(i+1)%N, (j-1)%N] + grid[(i+1)%N, (j+1)%N]))
|
|
542
|
+
total = total / max_val
|
|
543
|
+
if grid[i, j] == max_val:
|
|
544
|
+
if (total < 2) or (total > 3):
|
|
545
|
+
newGrid[i, j] = min_val
|
|
546
|
+
else:
|
|
547
|
+
if total == 3:
|
|
548
|
+
newGrid[i, j] = max_val
|
|
549
|
+
return newGrid
|
|
550
|
+
|
|
551
|
+
grid = np.random.choice([min_val, max_val], N*N, p=[0.5, 0.5]).reshape(N, N)
|
|
552
|
+
for k in range(max_iter):
|
|
553
|
+
grid = update(grid, N)
|
|
554
|
+
time.sleep(delay)
|
|
555
|
+
yield sk.Mask(grid), f"Iterations: {k} / {max_iter}"
|
|
@@ -150,7 +150,7 @@ def features2instance_mask_3d(features, image_shape):
|
|
|
150
150
|
_, ry, rx = image_shape
|
|
151
151
|
for feature in features:
|
|
152
152
|
feature_xy_coordinates = np.array(feature["geometry"]["coordinates"])
|
|
153
|
-
|
|
153
|
+
feature_xy_coordinates = feature_xy_coordinates[0, :, :] # Remove an extra dimension
|
|
154
154
|
feature_xy_coordinates = feature_xy_coordinates[:, ::-1] # Invert XY
|
|
155
155
|
feature_mask = polygon2mask((ry, rx), feature_xy_coordinates)
|
|
156
156
|
feature_z_idx = feature["properties"]["z_idx"]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/docs/_static/progressive_threshold.mp4
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/docs/assets/demo_napari_screenshot.png
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/docs/assets/screenshot_napari_threshold.png
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/core/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/core/encoding.py
RENAMED
|
File without changes
|
{imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/core/results.py
RENAMED
|
File without changes
|
{imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/core/serialization.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/demo/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/types/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/types/_boxes.py
RENAMED
|
File without changes
|
{imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/types/_choice.py
RENAMED
|
File without changes
|
{imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/types/_float.py
RENAMED
|
File without changes
|
{imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/types/_image.py
RENAMED
|
File without changes
|
{imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/types/_integer.py
RENAMED
|
File without changes
|
{imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/types/_notification.py
RENAMED
|
File without changes
|
|
File without changes
|
{imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/types/_paths.py
RENAMED
|
File without changes
|
{imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/types/_points.py
RENAMED
|
File without changes
|
{imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/types/_string.py
RENAMED
|
File without changes
|
{imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/types/_tracks.py
RENAMED
|
File without changes
|
{imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/types/_vectors.py
RENAMED
|
File without changes
|
{imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/types/common.py
RENAMED
|
File without changes
|
{imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit/types/data_layer.py
RENAMED
|
File without changes
|
{imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit.egg-info/requires.txt
RENAMED
|
File without changes
|
{imaging_server_kit-0.1.2 → imaging_server_kit-0.1.3}/src/imaging_server_kit.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|