Skip to content

Commit

Permalink
updated bfio dependency and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hamshkhawar committed Sep 30, 2024
1 parent dcdb6b1 commit dc3f634
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 12 deletions.
2 changes: 1 addition & 1 deletion formats/ome-converter-tool/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM polusai/bfio:2.4.3
FROM polusai/bfio:2.4.4

# environment variables defined in polusai/bfio
ENV EXEC_DIR="/opt/executables"
Expand Down
2 changes: 1 addition & 1 deletion formats/ome-converter-tool/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ packages = [{include = "polus", from = "src"}]

[tool.poetry.dependencies]
python = ">=3.9,<3.12"
bfio = {version = "^2.4.3", extras = ["all"]}
bfio = {version = "^2.4.4", extras = ["all"]}
filepattern = "^2.0.4"
typer = "^0.7.0"
tqdm = "^4.64.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@


def write_image(
br: BioReader,
c: int,
image: np.ndarray,
out_path: pathlib.Path,
max_workers: int,
Expand All @@ -40,8 +42,8 @@ def write_image(
and manages channel names based on the provided BioReader.
Args:
c: The index of the channel in the image.
br: An instance of BioReader containing metadata for the image.
c: The index of the channel in the image.
image: The image data to be written.
out_path: Path to an output image.
max_workers: The maximum number of worker threads to use for writing.
Expand All @@ -54,7 +56,8 @@ def write_image(
max_workers,
) as bw:
# Handling of parsing channels when channels names are not provided.
# if bw.channel_names != [None]:
if bw.channel_names != [None]:
bw.channel_names = [br.channel_names[c]]
bw.C = 1
bw.T = 1
bw.Z = 1
Expand Down Expand Up @@ -126,6 +129,8 @@ def convert_image(
t,
]
write_image(
br=br,
c=c,
image=image,
out_path=out_path,
max_workers=NUM_THREADS,
Expand Down
18 changes: 10 additions & 8 deletions formats/ome-converter-tool/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import pytest
import requests
import skimage.data
import skimage.io
import skimage.measure


Expand Down Expand Up @@ -52,15 +51,18 @@ def synthetic_images(
size, extension = get_params

syn_dir = pathlib.Path(tempfile.mkdtemp(suffix="_syn_data"))

images: list[numpy.ndarray] = []
for i in range(5):
# Create images
blobs: numpy.ndarray = skimage.data.binary_blobs(
length=size,
volume_fraction=0.05,
blob_size_fraction=0.05,
# Create a random number generator
rng = numpy.random.default_rng()

for i in range(3):
syn_img: numpy.ndarray = rng.integers(
low=0,
high=256,
size=(size, size),
dtype=numpy.uint8,
)
syn_img: numpy.ndarray = skimage.measure.label(blobs)
outname = f"syn_image_{i}{extension}"

# Save image
Expand Down

0 comments on commit dc3f634

Please sign in to comment.