Skip to content

Commit

Permalink
expand testing
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzocerrone committed Nov 13, 2024
1 parent e65c5fa commit 75b9eec
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 2 deletions.
6 changes: 5 additions & 1 deletion tests/core/test_image_handler.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
from pathlib import Path


class TestImageHandler:
def test_ngff_image(self, ome_zarr_image_v04_path):
def test_ngff_image(self, ome_zarr_image_v04_path: Path) -> None:
import numpy as np

from ngio.core.image_handler import Image

image_handler = Image(store=ome_zarr_image_v04_path, path="0")
image_handler.__repr__()

assert image_handler.array_path == f"{ome_zarr_image_v04_path}/0"
assert image_handler.channel_labels == ["DAPI", "nanog", "Lamin B1"]
Expand Down
1 change: 1 addition & 0 deletions tests/core/test_label_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ def test_label_image(self, ome_zarr_image_v04_path: Path) -> None:
ngff_image = NgffImage(ome_zarr_image_v04_path)
image_handler = ngff_image.get_image(path="0")
label_handler = ngff_image.label.derive(name="label")
label_handler.__repr__()

assert label_handler.array_path == f"{ome_zarr_image_v04_path}/labels/label/0"
assert ngff_image.label.list() == ["label"]
Expand Down
5 changes: 4 additions & 1 deletion tests/tables/test_table_group.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
from pathlib import Path


class TestTableGroup:
def test_table_group(self, ome_zarr_image_v04_path):
def test_table_group(self, ome_zarr_image_v04_path: Path) -> None:
from ngio.core.ngff_image import NgffImage

ngff_image = NgffImage(ome_zarr_image_v04_path)
Expand Down
55 changes: 55 additions & 0 deletions tests/tables/test_v1_tables.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
from pathlib import Path


class TestTables:
def test_roi_table(self, ome_zarr_image_v04_path: Path) -> None:
from ngio.core.ngff_image import NgffImage
from ngio.core.roi import WorldCooROI

ngff_image = NgffImage(ome_zarr_image_v04_path)

roi_table = ngff_image.table.new(
name="roi_table",
table_type="roi_table",
overwrite=False,
)
roi_table.__repr__()
roi_table.set_rois(
[
WorldCooROI(
x=0,
y=0,
z=0,
x_length=10,
y_length=10,
z_length=10,
infos={"FieldIndex": "FOV1"},
)
]
)

def test_masking_roi_table(self, ome_zarr_image_v04_path: Path) -> None:
from ngio.core.ngff_image import NgffImage

ngff_image = NgffImage(ome_zarr_image_v04_path)

masking_roi_table = ngff_image.table.new(
name="masking_roi_table",
table_type="masking_roi_table",
label_image="region",
overwrite=False,
)
masking_roi_table.__repr__()

def test_feature_table(self, ome_zarr_image_v04_path: Path) -> None:
from ngio.core.ngff_image import NgffImage

ngff_image = NgffImage(ome_zarr_image_v04_path)

feature_table = ngff_image.table.new(
name="feat_table",
table_type="feature_table",
label_image="region",
overwrite=True,
)
feature_table.__repr__()

0 comments on commit 75b9eec

Please sign in to comment.