bfio 2.4.0__tar.gz → 2.4.1__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.
- {bfio-2.4.0/src/bfio.egg-info → bfio-2.4.1}/PKG-INFO +6 -6
- {bfio-2.4.0 → bfio-2.4.1}/README.md +4 -4
- {bfio-2.4.0 → bfio-2.4.1}/pyproject.toml +3 -3
- bfio-2.4.1/src/bfio/VERSION +1 -0
- {bfio-2.4.0 → bfio-2.4.1}/src/bfio/bfio.py +11 -0
- {bfio-2.4.0 → bfio-2.4.1}/src/bfio/ts_backends.py +20 -1
- {bfio-2.4.0 → bfio-2.4.1/src/bfio.egg-info}/PKG-INFO +6 -6
- {bfio-2.4.0 → bfio-2.4.1}/src/bfio.egg-info/requires.txt +1 -1
- {bfio-2.4.0 → bfio-2.4.1}/tests/test_write.py +30 -6
- bfio-2.4.0/src/bfio/VERSION +0 -1
- {bfio-2.4.0 → bfio-2.4.1}/LICENSE +0 -0
- {bfio-2.4.0 → bfio-2.4.1}/setup.cfg +0 -0
- {bfio-2.4.0 → bfio-2.4.1}/src/bfio/__init__.py +0 -0
- {bfio-2.4.0 → bfio-2.4.1}/src/bfio/backends.py +0 -0
- {bfio-2.4.0 → bfio-2.4.1}/src/bfio/base_classes.py +0 -0
- {bfio-2.4.0 → bfio-2.4.1}/src/bfio/utils.py +0 -0
- {bfio-2.4.0 → bfio-2.4.1}/src/bfio.egg-info/SOURCES.txt +0 -0
- {bfio-2.4.0 → bfio-2.4.1}/src/bfio.egg-info/dependency_links.txt +0 -0
- {bfio-2.4.0 → bfio-2.4.1}/src/bfio.egg-info/top_level.txt +0 -0
- {bfio-2.4.0 → bfio-2.4.1}/tests/test_read.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: bfio
|
|
3
|
-
Version: 2.4.
|
|
3
|
+
Version: 2.4.1
|
|
4
4
|
Summary: Simple reading and writing classes for tiled tiffs using Bio-Formats.
|
|
5
5
|
Author-email: Nick Schaub <nick.schaub@nih.gov>, Sameeul Bashir Samee <sameeul.samee@axleinfo.com>
|
|
6
6
|
Maintainer-email: Sameeul Bashir Samee <sameeul.samee@axleinfo.com>
|
|
@@ -36,7 +36,7 @@ Requires-Python: >=3.8
|
|
|
36
36
|
Description-Content-Type: text/markdown
|
|
37
37
|
License-File: LICENSE
|
|
38
38
|
Requires-Dist: imagecodecs>=2021.2.26
|
|
39
|
-
Requires-Dist: numpy
|
|
39
|
+
Requires-Dist: numpy
|
|
40
40
|
Requires-Dist: ome-types>=0.4.2
|
|
41
41
|
Requires-Dist: zarr>=2.6.1
|
|
42
42
|
Requires-Dist: scyjava
|
|
@@ -47,7 +47,7 @@ Provides-Extra: dev
|
|
|
47
47
|
Requires-Dist: ome_zarr; extra == "dev"
|
|
48
48
|
Requires-Dist: requests>=2.26.0; extra == "dev"
|
|
49
49
|
|
|
50
|
-
# **B**io**F**ormats **I**nput/**O**utput utility (bfio 2.4.
|
|
50
|
+
# **B**io**F**ormats **I**nput/**O**utput utility (bfio 2.4.1)
|
|
51
51
|
|
|
52
52
|
[](https://bfio.readthedocs.io/en/latest/?badge=latest)
|
|
53
53
|
[](https://pypi.org/project/bfio/)
|
|
@@ -99,15 +99,15 @@ be installed using pip:
|
|
|
99
99
|
|
|
100
100
|
## Docker
|
|
101
101
|
|
|
102
|
-
### polusai/bfio:2.4.
|
|
102
|
+
### polusai/bfio:2.4.1
|
|
103
103
|
|
|
104
104
|
Ubuntu based container with bfio and all dependencies (including Java).
|
|
105
105
|
|
|
106
|
-
### polusai/bfio:2.4.
|
|
106
|
+
### polusai/bfio:2.4.1-imagej
|
|
107
107
|
|
|
108
108
|
Same as above, except comes with ImageJ and PyImageJ.
|
|
109
109
|
|
|
110
|
-
### polusai/bfio:2.4.
|
|
110
|
+
### polusai/bfio:2.4.1-tensorflow
|
|
111
111
|
|
|
112
112
|
Tensorflow container with bfio installed.
|
|
113
113
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# **B**io**F**ormats **I**nput/**O**utput utility (bfio 2.4.
|
|
1
|
+
# **B**io**F**ormats **I**nput/**O**utput utility (bfio 2.4.1)
|
|
2
2
|
|
|
3
3
|
[](https://bfio.readthedocs.io/en/latest/?badge=latest)
|
|
4
4
|
[](https://pypi.org/project/bfio/)
|
|
@@ -50,15 +50,15 @@ be installed using pip:
|
|
|
50
50
|
|
|
51
51
|
## Docker
|
|
52
52
|
|
|
53
|
-
### polusai/bfio:2.4.
|
|
53
|
+
### polusai/bfio:2.4.1
|
|
54
54
|
|
|
55
55
|
Ubuntu based container with bfio and all dependencies (including Java).
|
|
56
56
|
|
|
57
|
-
### polusai/bfio:2.4.
|
|
57
|
+
### polusai/bfio:2.4.1-imagej
|
|
58
58
|
|
|
59
59
|
Same as above, except comes with ImageJ and PyImageJ.
|
|
60
60
|
|
|
61
|
-
### polusai/bfio:2.4.
|
|
61
|
+
### polusai/bfio:2.4.1-tensorflow
|
|
62
62
|
|
|
63
63
|
Tensorflow container with bfio installed.
|
|
64
64
|
|
|
@@ -5,7 +5,7 @@ requires = [
|
|
|
5
5
|
"setuptools",
|
|
6
6
|
"wheel",
|
|
7
7
|
"imagecodecs>=2021.2.26",
|
|
8
|
-
"numpy
|
|
8
|
+
"numpy",
|
|
9
9
|
"ome-types>=0.4.2",
|
|
10
10
|
"zarr>=2.6.1",
|
|
11
11
|
"scyjava",
|
|
@@ -21,7 +21,7 @@ name = "bfio"
|
|
|
21
21
|
dynamic = ["version"]
|
|
22
22
|
dependencies = [
|
|
23
23
|
"imagecodecs>=2021.2.26",
|
|
24
|
-
"numpy
|
|
24
|
+
"numpy",
|
|
25
25
|
"ome-types>=0.4.2",
|
|
26
26
|
"zarr>=2.6.1",
|
|
27
27
|
"scyjava",
|
|
@@ -86,7 +86,7 @@ namespaces = false
|
|
|
86
86
|
|
|
87
87
|
|
|
88
88
|
[tool.bumpversion]
|
|
89
|
-
current_version = "2.4.
|
|
89
|
+
current_version = "2.4.1"
|
|
90
90
|
commit = true
|
|
91
91
|
tag = true
|
|
92
92
|
commit_args = "--no-verify"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
2.4.1
|
|
@@ -1042,6 +1042,17 @@ class BioWriter(BioBase):
|
|
|
1042
1042
|
self._metadata.images[0].pixels.dimension_order = (
|
|
1043
1043
|
ome_types.model.Pixels_DimensionOrder.XYZCT
|
|
1044
1044
|
)
|
|
1045
|
+
# overwrite values in metadata if explicitly specified in the constructor
|
|
1046
|
+
if kwargs:
|
|
1047
|
+
for k, v in kwargs.items():
|
|
1048
|
+
setattr(self, k, v)
|
|
1049
|
+
if k in ("YXZCT"):
|
|
1050
|
+
setattr(
|
|
1051
|
+
self._metadata.images[0].pixels,
|
|
1052
|
+
"size_{}".format(k.lower()),
|
|
1053
|
+
v,
|
|
1054
|
+
)
|
|
1055
|
+
|
|
1045
1056
|
else:
|
|
1046
1057
|
self._metadata = self._minimal_xml()
|
|
1047
1058
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
2
|
# import core packages
|
|
3
|
+
import json
|
|
3
4
|
import logging
|
|
4
5
|
from pathlib import Path
|
|
5
6
|
from typing import Dict
|
|
@@ -317,13 +318,15 @@ class TensorstoreWriter(bfio.base_classes.TSAbstractWriter):
|
|
|
317
318
|
)
|
|
318
319
|
|
|
319
320
|
self._writer = TSWriter(
|
|
320
|
-
str(self.frontend._file_path.resolve()),
|
|
321
|
+
str(self.frontend._file_path.joinpath("0").resolve()),
|
|
321
322
|
shape,
|
|
322
323
|
(1, 1, 1, self.frontend._TILE_SIZE, self.frontend._TILE_SIZE),
|
|
323
324
|
self.frontend.dtype,
|
|
324
325
|
"TCZYX",
|
|
325
326
|
)
|
|
326
327
|
|
|
328
|
+
self.write_metadata()
|
|
329
|
+
|
|
327
330
|
def write_metadata(self):
|
|
328
331
|
|
|
329
332
|
# Create the metadata
|
|
@@ -336,6 +339,22 @@ class TensorstoreWriter(bfio.base_classes.TSAbstractWriter):
|
|
|
336
339
|
with open(metadata_path, "w") as fw:
|
|
337
340
|
fw.write(str(self.frontend._metadata.to_xml()))
|
|
338
341
|
|
|
342
|
+
with open(self.frontend._file_path.joinpath(".zgroup"), "w") as f:
|
|
343
|
+
f.write('{\n\t"zarr_format": 2\n}')
|
|
344
|
+
|
|
345
|
+
zarr_attrs = {
|
|
346
|
+
"multiscales": [
|
|
347
|
+
{
|
|
348
|
+
"version": "0.1",
|
|
349
|
+
"name": self.frontend._file_path.name,
|
|
350
|
+
"datasets": [{"path": "0"}],
|
|
351
|
+
"metadata": {"method": "mean"},
|
|
352
|
+
}
|
|
353
|
+
]
|
|
354
|
+
}
|
|
355
|
+
with open(self.frontend._file_path.joinpath(".zattrs"), "w") as f:
|
|
356
|
+
json.dump(zarr_attrs, f, indent=4)
|
|
357
|
+
|
|
339
358
|
# This is recommended to do for cloud storage to increase read/write
|
|
340
359
|
# speed, but it also increases write speed locally when threading.
|
|
341
360
|
zarr.consolidate_metadata(str(self.frontend._file_path.resolve()))
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: bfio
|
|
3
|
-
Version: 2.4.
|
|
3
|
+
Version: 2.4.1
|
|
4
4
|
Summary: Simple reading and writing classes for tiled tiffs using Bio-Formats.
|
|
5
5
|
Author-email: Nick Schaub <nick.schaub@nih.gov>, Sameeul Bashir Samee <sameeul.samee@axleinfo.com>
|
|
6
6
|
Maintainer-email: Sameeul Bashir Samee <sameeul.samee@axleinfo.com>
|
|
@@ -36,7 +36,7 @@ Requires-Python: >=3.8
|
|
|
36
36
|
Description-Content-Type: text/markdown
|
|
37
37
|
License-File: LICENSE
|
|
38
38
|
Requires-Dist: imagecodecs>=2021.2.26
|
|
39
|
-
Requires-Dist: numpy
|
|
39
|
+
Requires-Dist: numpy
|
|
40
40
|
Requires-Dist: ome-types>=0.4.2
|
|
41
41
|
Requires-Dist: zarr>=2.6.1
|
|
42
42
|
Requires-Dist: scyjava
|
|
@@ -47,7 +47,7 @@ Provides-Extra: dev
|
|
|
47
47
|
Requires-Dist: ome_zarr; extra == "dev"
|
|
48
48
|
Requires-Dist: requests>=2.26.0; extra == "dev"
|
|
49
49
|
|
|
50
|
-
# **B**io**F**ormats **I**nput/**O**utput utility (bfio 2.4.
|
|
50
|
+
# **B**io**F**ormats **I**nput/**O**utput utility (bfio 2.4.1)
|
|
51
51
|
|
|
52
52
|
[](https://bfio.readthedocs.io/en/latest/?badge=latest)
|
|
53
53
|
[](https://pypi.org/project/bfio/)
|
|
@@ -99,15 +99,15 @@ be installed using pip:
|
|
|
99
99
|
|
|
100
100
|
## Docker
|
|
101
101
|
|
|
102
|
-
### polusai/bfio:2.4.
|
|
102
|
+
### polusai/bfio:2.4.1
|
|
103
103
|
|
|
104
104
|
Ubuntu based container with bfio and all dependencies (including Java).
|
|
105
105
|
|
|
106
|
-
### polusai/bfio:2.4.
|
|
106
|
+
### polusai/bfio:2.4.1-imagej
|
|
107
107
|
|
|
108
108
|
Same as above, except comes with ImageJ and PyImageJ.
|
|
109
109
|
|
|
110
|
-
### polusai/bfio:2.4.
|
|
110
|
+
### polusai/bfio:2.4.1-tensorflow
|
|
111
111
|
|
|
112
112
|
Tensorflow container with bfio installed.
|
|
113
113
|
|
|
@@ -9,6 +9,7 @@ from ome_zarr.utils import download as zarr_download
|
|
|
9
9
|
TEST_IMAGES = {
|
|
10
10
|
"Plate1-Blue-A-12-Scene-3-P3-F2-03.czi": "https://downloads.openmicroscopy.org/images/Zeiss-CZI/idr0011/Plate1-Blue-A_TS-Stinger/Plate1-Blue-A-12-Scene-3-P3-F2-03.czi",
|
|
11
11
|
"5025551.zarr": "https://uk1s3.embassy.ebi.ac.uk/idr/zarr/v0.4/idr0054A/5025551.zarr",
|
|
12
|
+
"0.tif": "https://osf.io/j6aer/download",
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
TEST_DIR = pathlib.Path(__file__).with_name("data")
|
|
@@ -43,12 +44,14 @@ def setUpModule():
|
|
|
43
44
|
shutil.rmtree(TEST_DIR.joinpath(file))
|
|
44
45
|
zarr_download(url, str(TEST_DIR))
|
|
45
46
|
|
|
47
|
+
|
|
46
48
|
def tearDownModule():
|
|
47
49
|
"""Remove test images"""
|
|
48
50
|
|
|
49
51
|
logger.info("teardown - Removing test images...")
|
|
50
52
|
shutil.rmtree(TEST_DIR)
|
|
51
53
|
|
|
54
|
+
|
|
52
55
|
class TestOmeTiffWrite(unittest.TestCase):
|
|
53
56
|
@classmethod
|
|
54
57
|
def setUpClass(self):
|
|
@@ -110,25 +113,46 @@ class TestOmeZarrWriter(unittest.TestCase):
|
|
|
110
113
|
|
|
111
114
|
actual_shape = br.shape
|
|
112
115
|
actual_dtype = br.dtype
|
|
113
|
-
|
|
114
116
|
actual_image = br[:]
|
|
115
|
-
|
|
116
117
|
actual_mdata = br.metadata
|
|
117
|
-
|
|
118
118
|
with tempfile.TemporaryDirectory() as dir:
|
|
119
119
|
|
|
120
120
|
# Use the temporary directory
|
|
121
|
-
test_file_path = os.path.join(dir,
|
|
121
|
+
test_file_path = os.path.join(dir, "out/test.ome.zarr")
|
|
122
122
|
|
|
123
|
-
with bfio.BioWriter(
|
|
123
|
+
with bfio.BioWriter(
|
|
124
|
+
test_file_path, metadata=actual_mdata, backend="tensorstore"
|
|
125
|
+
) as bw:
|
|
124
126
|
|
|
125
127
|
expanded = np.expand_dims(actual_image, axis=-1)
|
|
126
128
|
bw[:] = expanded
|
|
127
129
|
|
|
128
130
|
with bfio.BioReader(test_file_path) as br:
|
|
129
131
|
|
|
130
|
-
|
|
131
132
|
assert br.shape == actual_shape
|
|
132
133
|
assert br.dtype == actual_dtype
|
|
133
134
|
|
|
134
135
|
assert br[:].sum() == actual_image.sum()
|
|
136
|
+
|
|
137
|
+
def test_overwrite_metadata(self):
|
|
138
|
+
|
|
139
|
+
with bfio.BioReader(str(TEST_DIR.joinpath("0.tif"))) as br:
|
|
140
|
+
with tempfile.TemporaryDirectory() as dir:
|
|
141
|
+
|
|
142
|
+
# Use the temporary directory
|
|
143
|
+
test_file_path = os.path.join(dir, "out/0.ome.zarr")
|
|
144
|
+
|
|
145
|
+
with bfio.BioWriter(
|
|
146
|
+
test_file_path,
|
|
147
|
+
metadata=br.metadata,
|
|
148
|
+
backend="tensorstore",
|
|
149
|
+
Z=br.Z * 2,
|
|
150
|
+
) as bw:
|
|
151
|
+
|
|
152
|
+
bw[:, :, 0, :, :] = br[:]
|
|
153
|
+
bw[:, :, 1, :, :] = br[:]
|
|
154
|
+
|
|
155
|
+
bw_z_dim = bw.Z
|
|
156
|
+
|
|
157
|
+
with bfio.BioReader(test_file_path) as br2:
|
|
158
|
+
assert br2.Z == bw_z_dim
|
bfio-2.4.0/src/bfio/VERSION
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
2.4.0
|
|
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
|