ngio 0.2.6__py3-none-any.whl → 0.2.8__py3-none-any.whl
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.
- ngio/hcs/plate.py +9 -19
- ngio/ome_zarr_meta/ngio_specs/_channels.py +28 -2
- {ngio-0.2.6.dist-info → ngio-0.2.8.dist-info}/METADATA +1 -1
- {ngio-0.2.6.dist-info → ngio-0.2.8.dist-info}/RECORD +6 -6
- {ngio-0.2.6.dist-info → ngio-0.2.8.dist-info}/WHEEL +0 -0
- {ngio-0.2.6.dist-info → ngio-0.2.8.dist-info}/licenses/LICENSE +0 -0
ngio/hcs/plate.py
CHANGED
|
@@ -399,7 +399,7 @@ class OmeZarrPlate:
|
|
|
399
399
|
acquisition_id: int | None = None,
|
|
400
400
|
acquisition_name: str | None = None,
|
|
401
401
|
atomic: bool = False,
|
|
402
|
-
) ->
|
|
402
|
+
) -> str:
|
|
403
403
|
"""Add an image to an ome-zarr plate."""
|
|
404
404
|
if image_path is not None:
|
|
405
405
|
image_path = path_in_well_validation(path=image_path)
|
|
@@ -450,8 +450,8 @@ class OmeZarrPlate:
|
|
|
450
450
|
meta_handler._group_handler.clean_cache()
|
|
451
451
|
|
|
452
452
|
if image_path is not None:
|
|
453
|
-
return
|
|
454
|
-
return
|
|
453
|
+
return f"{well_path}/{image_path}"
|
|
454
|
+
return well_path
|
|
455
455
|
|
|
456
456
|
def atomic_add_image(
|
|
457
457
|
self,
|
|
@@ -460,14 +460,14 @@ class OmeZarrPlate:
|
|
|
460
460
|
image_path: str,
|
|
461
461
|
acquisition_id: int | None = None,
|
|
462
462
|
acquisition_name: str | None = None,
|
|
463
|
-
) ->
|
|
463
|
+
) -> str:
|
|
464
464
|
"""Parallel safe version of add_image."""
|
|
465
465
|
if image_path is None:
|
|
466
466
|
raise ValueError(
|
|
467
467
|
"Image path cannot be None for atomic add_image. "
|
|
468
468
|
"If your intent is to add a well, use add_well instead."
|
|
469
469
|
)
|
|
470
|
-
|
|
470
|
+
path = self._add_image(
|
|
471
471
|
row=row,
|
|
472
472
|
column=column,
|
|
473
473
|
image_path=image_path,
|
|
@@ -475,12 +475,7 @@ class OmeZarrPlate:
|
|
|
475
475
|
acquisition_name=acquisition_name,
|
|
476
476
|
atomic=True,
|
|
477
477
|
)
|
|
478
|
-
|
|
479
|
-
raise ValueError(
|
|
480
|
-
f"Some error occurred while adding image {image_path} "
|
|
481
|
-
f"to well {row}{column}."
|
|
482
|
-
)
|
|
483
|
-
return group
|
|
478
|
+
return path
|
|
484
479
|
|
|
485
480
|
def add_image(
|
|
486
481
|
self,
|
|
@@ -489,14 +484,14 @@ class OmeZarrPlate:
|
|
|
489
484
|
image_path: str,
|
|
490
485
|
acquisition_id: int | None = None,
|
|
491
486
|
acquisition_name: str | None = None,
|
|
492
|
-
) ->
|
|
487
|
+
) -> str:
|
|
493
488
|
"""Add an image to an ome-zarr plate."""
|
|
494
489
|
if image_path is None:
|
|
495
490
|
raise ValueError(
|
|
496
491
|
"Image path cannot be None for atomic add_image. "
|
|
497
492
|
"If your intent is to add a well, use add_well instead."
|
|
498
493
|
)
|
|
499
|
-
|
|
494
|
+
path = self._add_image(
|
|
500
495
|
row=row,
|
|
501
496
|
column=column,
|
|
502
497
|
image_path=image_path,
|
|
@@ -504,12 +499,7 @@ class OmeZarrPlate:
|
|
|
504
499
|
acquisition_name=acquisition_name,
|
|
505
500
|
atomic=False,
|
|
506
501
|
)
|
|
507
|
-
|
|
508
|
-
raise ValueError(
|
|
509
|
-
f"Some error occurred while adding image {image_path} "
|
|
510
|
-
f"to well {row}{column}."
|
|
511
|
-
)
|
|
512
|
-
return group
|
|
502
|
+
return path
|
|
513
503
|
|
|
514
504
|
def add_well(
|
|
515
505
|
self,
|
|
@@ -9,7 +9,7 @@ from enum import Enum
|
|
|
9
9
|
from typing import Any, TypeVar
|
|
10
10
|
|
|
11
11
|
import numpy as np
|
|
12
|
-
from pydantic import BaseModel, ConfigDict, Field, field_validator
|
|
12
|
+
from pydantic import BaseModel, ConfigDict, Field, field_validator, model_validator
|
|
13
13
|
|
|
14
14
|
from ngio.utils import NgioValidationError, NgioValueError
|
|
15
15
|
|
|
@@ -124,7 +124,6 @@ class ChannelVisualisation(BaseModel):
|
|
|
124
124
|
model_config = ConfigDict(extra="allow", frozen=True)
|
|
125
125
|
|
|
126
126
|
@field_validator("color", mode="after")
|
|
127
|
-
@classmethod
|
|
128
127
|
def validate_color(cls, value: str | NgioColors) -> str:
|
|
129
128
|
"""Color validator.
|
|
130
129
|
|
|
@@ -145,6 +144,33 @@ class ChannelVisualisation(BaseModel):
|
|
|
145
144
|
else:
|
|
146
145
|
raise NgioValueError(f"Invalid color {value}.")
|
|
147
146
|
|
|
147
|
+
@model_validator(mode="before")
|
|
148
|
+
def check_start_end(cls, data):
|
|
149
|
+
"""Check that the start and end values are valid.
|
|
150
|
+
|
|
151
|
+
If the start and end values are equal, set the end value to start + 1
|
|
152
|
+
"""
|
|
153
|
+
start = data.get("start", None)
|
|
154
|
+
end = data.get("end", None)
|
|
155
|
+
if start is None or end is None:
|
|
156
|
+
return data
|
|
157
|
+
if abs(end - start) < 1e-6:
|
|
158
|
+
data["end"] = start + 1
|
|
159
|
+
return data
|
|
160
|
+
|
|
161
|
+
@model_validator(mode="after")
|
|
162
|
+
def check_model(self) -> "ChannelVisualisation":
|
|
163
|
+
"""Check that the start and end values are within the min and max values."""
|
|
164
|
+
if self.start < self.min or self.start > self.max:
|
|
165
|
+
raise NgioValidationError(
|
|
166
|
+
f"Start value {self.start} is out of range [{self.min}, {self.max}]"
|
|
167
|
+
)
|
|
168
|
+
if self.end < self.min or self.end > self.max:
|
|
169
|
+
raise NgioValidationError(
|
|
170
|
+
f"End value {self.end} is out of range [{self.min}, {self.max}]"
|
|
171
|
+
)
|
|
172
|
+
return self
|
|
173
|
+
|
|
148
174
|
@classmethod
|
|
149
175
|
def default_init(
|
|
150
176
|
cls,
|
|
@@ -10,7 +10,7 @@ ngio/common/_roi.py,sha256=dq1iVT8-G_zWuxcYWJeHfviBSbPgsyKUcDL3Vg6jx6I,5122
|
|
|
10
10
|
ngio/common/_slicer.py,sha256=AKpwXRncOmF9nhjKYma0C_41WqAgSv860beKGx-aw-0,3075
|
|
11
11
|
ngio/common/_zoom.py,sha256=KsURa5VuixmpbAAY5-6obmuQV8vfiHKZqBxZDXvchpM,5473
|
|
12
12
|
ngio/hcs/__init__.py,sha256=5oAYT_454WGhms97kxo8gS4_rKHtFf_x-9uu8M_VeVM,356
|
|
13
|
-
ngio/hcs/plate.py,sha256=
|
|
13
|
+
ngio/hcs/plate.py,sha256=WmUw8qZgWUPBBTqtV8lh_7T0vtRzMkAmduM8b969Ni4,30082
|
|
14
14
|
ngio/images/__init__.py,sha256=DYbXAdBgPxyjBRdJrWvU0UnBRI0gUMmx9KaJ-Bucvz4,533
|
|
15
15
|
ngio/images/abstract_image.py,sha256=8PNQPZjiDz-pcTFXSJAVw7nUr4yL_iRwqDEUTKkAnp0,10266
|
|
16
16
|
ngio/images/create.py,sha256=XYn30m_2OSZeHHASYHc3eK9u_gZIYy9wo6mGdRGaq5c,9473
|
|
@@ -22,7 +22,7 @@ ngio/ome_zarr_meta/__init__.py,sha256=oZ8PEsWM7U0KwzpsnvVfX9k4UfuTz5sZ8B6B9eY5hy
|
|
|
22
22
|
ngio/ome_zarr_meta/_meta_handlers.py,sha256=BLvYt5PONYrWkEb2XgEiAXR_OX9rfeX_C0eEqen0jQA,25549
|
|
23
23
|
ngio/ome_zarr_meta/ngio_specs/__init__.py,sha256=05NQukZG0nNvjzf8AKWGu7PhjhQcImGSAOK3D3Bg-Js,1786
|
|
24
24
|
ngio/ome_zarr_meta/ngio_specs/_axes.py,sha256=Kqe9T7LWa_9o3UWS5uzALyyNluIhXxWhDGxWY4-GIo8,16707
|
|
25
|
-
ngio/ome_zarr_meta/ngio_specs/_channels.py,sha256=
|
|
25
|
+
ngio/ome_zarr_meta/ngio_specs/_channels.py,sha256=2L-HM9K1Xu4qRI2MiXPqgCuHdCBRydEW1StThcqEuvY,15120
|
|
26
26
|
ngio/ome_zarr_meta/ngio_specs/_dataset.py,sha256=hY8ogPPxvCgVg6k02t3zUr24lasYrvnxBd1iPEigdG4,5892
|
|
27
27
|
ngio/ome_zarr_meta/ngio_specs/_ngio_hcs.py,sha256=uh345KQmEQtslIyMmLK9sB-NbjPYxi0Y9FuYIFhd3Rc,17465
|
|
28
28
|
ngio/ome_zarr_meta/ngio_specs/_ngio_image.py,sha256=8E38Mgw-l0Ff1nkmCJIzo64G_paAVhM8xktUS_V5egY,17960
|
|
@@ -51,7 +51,7 @@ ngio/utils/_errors.py,sha256=pKQ12LUjQLYE1nUawemA5h7HsgznjaSvV1n2PQU33N0,759
|
|
|
51
51
|
ngio/utils/_fractal_fsspec_store.py,sha256=7qoGLiLi8JQFh9Ej_z5WNwQQuWrujb0f6p9nj8ocsS8,548
|
|
52
52
|
ngio/utils/_logger.py,sha256=HIuqD_2ShfFGDswBddcouStbKfL0Vz_ah8cAIFGhbS8,888
|
|
53
53
|
ngio/utils/_zarr_utils.py,sha256=qOI-HL2HsfFLCj_yxsTR-aq4oHpSqS9KR13aEIvhGDY,13593
|
|
54
|
-
ngio-0.2.
|
|
55
|
-
ngio-0.2.
|
|
56
|
-
ngio-0.2.
|
|
57
|
-
ngio-0.2.
|
|
54
|
+
ngio-0.2.8.dist-info/METADATA,sha256=Rf7imDRysf67wo02l22A8DX2TjeWQLndDdzPp48YncY,5215
|
|
55
|
+
ngio-0.2.8.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
56
|
+
ngio-0.2.8.dist-info/licenses/LICENSE,sha256=UgN_a1QCeNh9rZWfz-wORQFxE3elQzLWPQaoK6N6fxQ,1502
|
|
57
|
+
ngio-0.2.8.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|