Skip to content

Commit

Permalink
add masking roi tables to table group
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzocerrone committed Oct 4, 2024
1 parent 44ea52d commit 7a811ab
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 13 deletions.
11 changes: 1 addition & 10 deletions src/ngio/tables/tables_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,7 @@

from ngio.io import StoreLike
from ngio.pydantic_utils import BaseWithExtraFields
from ngio.tables.v1 import FeatureTableV1, ROITableV1


class MaskingROITableV1:
"""Placeholder for Masking ROI Table V1."""

def __init__(self, group: zarr.Group) -> None:
"""Initialize the class from an existing group."""
raise NotImplementedError("Masking ROI Table V1 not implemented.")

from ngio.tables.v1 import FeatureTableV1, MaskingROITableV1, ROITableV1

ROITable = ROITableV1
IMPLEMENTED_ROI_TABLES = {"1": ROITableV1}
Expand Down
3 changes: 2 additions & 1 deletion src/ngio/tables/v1/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""This module contains the objects to handle the fractal tables V1."""

from ngio.tables.v1.feature_tables import FeatureTableV1
from ngio.tables.v1.masking_roi_tables import MaskingROITableV1
from ngio.tables.v1.roi_tables import ROITableV1

__all__ = ["ROITableV1", "FeatureTableV1"]
__all__ = ["ROITableV1", "FeatureTableV1", "MaskingROITableV1"]
2 changes: 1 addition & 1 deletion src/ngio/tables/v1/masking_roi_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class MaskingROITableV1Meta(BaseModel):
"""Metadata for the ROI table."""

fractal_table_version: Literal["1"] = "1"
type: Literal["roi_table"] = "masking_roi_table"
type: Literal["masking_roi_table"] = "masking_roi_table"
region: dict[Literal["path"], str]
instance_key: str = "label"

Expand Down
14 changes: 13 additions & 1 deletion tests/tables/test_table_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,18 @@ def test_table_group(self, ome_zarr_image_v04_path):
overwrite=False,
)

assert ngff_image.table.list() == ["feat_table", "roi_table"]
ngff_image.table.new(
name="masking_roi_table",
table_type="masking_roi_table",
label_image="region",
overwrite=False,
)

assert ngff_image.table.list() == [
"feat_table",
"roi_table",
"masking_roi_table",
]
assert ngff_image.table.list(type="roi_table") == ["roi_table"]
assert ngff_image.table.list(type="feature_table") == ["feat_table"]
assert ngff_image.table.list(type="masking_roi_table") == ["masking_roi_table"]

0 comments on commit 7a811ab

Please sign in to comment.