Skip to content

Commit

Permalink
Added example datasets and renamed EPIC image builder
Browse files Browse the repository at this point in the history
  • Loading branch information
tkakar committed Jan 13, 2025
1 parent d62f29b commit 53ca4aa
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/portal_visualization/builder_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
SeqFISHViewConfBuilder,
IMSViewConfBuilder,
ImagePyramidViewConfBuilder,
SegImagePyramidViewConfBuilder,
EpicSegImagePyramidViewConfBuilder,
KaggleSegImagePyramidViewConfBuilder,
NanoDESIViewConfBuilder,
)
Expand Down Expand Up @@ -77,7 +77,7 @@ def get_view_config_builder(entity, get_entity, parent=None, epic_uuid=None):
if parent is not None:
# TODO: For now epic (base image's) support datasets doesn't have any hints
if is_seg_mask and epic_uuid:
return SegImagePyramidViewConfBuilder
return EpicSegImagePyramidViewConfBuilder
elif is_seg_mask:
return KaggleSegImagePyramidViewConfBuilder

Expand Down
16 changes: 11 additions & 5 deletions src/portal_visualization/builders/imaging_builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def _add_segmentation_image(self, dataset):
found_images = get_found_images(self.seg_image_pyramid_regex, file_paths_found)
filtered_images = [img for img in found_images if SEGMENTATION_SUPPORT_IMAGE_SUBDIR not in img]

if not filtered_images: # pragma: no cover
if not filtered_images:
raise FileNotFoundError(f"Segmentation assay with uuid {self._uuid} has no matching files")

img_url, offsets_url = self._get_img_and_offset_url(filtered_images[0], self.seg_image_pyramid_regex)
Expand Down Expand Up @@ -182,10 +182,10 @@ def get_conf_cells(self, **kwargs):
return self.get_conf_cells_common(self._get_img_and_offset_url, **kwargs)


class SegImagePyramidViewConfBuilder(AbstractImagingViewConfBuilder):
"""Wrapper class for creating a standard view configuration for image pyramids for segmenation mask,
class EpicSegImagePyramidViewConfBuilder(AbstractImagingViewConfBuilder):
"""Wrapper class for creating a standard view configuration for image pyramids for EPIC segmentation mask,
i.e for high resolution viz-lifted imaging datasets like
https://portal.hubmapconsortium.org/browse/dataset/
https://portal.dev.hubmapconsortium.org/browse/dataset/df7cac7cb67a822f7007b57c4d8f5e7d
"""

def __init__(self, entity, groups_token, assets_endpoint, **kwargs):
Expand All @@ -198,7 +198,13 @@ def get_conf_cells(self, **kwargs):


class KaggleSegImagePyramidViewConfBuilder(AbstractImagingViewConfBuilder):
# The difference from EPIC segmentation is only the file path and transformations
"""Wrapper class for creating a standard view configuration for image pyramids for kaggle-2 datasets, that show,
segmentation mask layered over a base image-pyramid, however, the file structure is different than
EPIC segmentation masks (EpicSegImagePyramidViewConfBuilder)
i.e for high resolution viz-lifted imaging datasets like
https://portal.dev.hubmapconsortium.org/browse/dataset/534a590d7336aa99c7fc7afd41e995fc
"""

def __init__(self, entity, groups_token, assets_endpoint, **kwargs):
super().__init__(entity, groups_token, assets_endpoint, **kwargs)
self.image_pyramid_regex = f"{IMAGE_PYRAMID_DIR}/{SEGMENTATION_SUPPORT_IMAGE_SUBDIR}"
Expand Down

0 comments on commit 53ca4aa

Please sign in to comment.