Skip to content

Commit

Permalink
Support additional parameters for imaging wrapper classes to support … (
Browse files Browse the repository at this point in the history
#313)

* Support additional parameters for imaging wrapper classes to support spatialBeta view.

* Lint

* Fix tests
  • Loading branch information
keller-mark authored Jan 24, 2024
1 parent 4f251b4 commit 4fb4fab
Show file tree
Hide file tree
Showing 3 changed files with 454 additions and 0 deletions.
68 changes: 68 additions & 0 deletions tests/test_wrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
AnnDataWrapper,
CsvWrapper,
MultivecZarrWrapper,
ImageOmeTiffWrapper,
ObsSegmentationsOmeTiffWrapper,
ImageOmeZarrWrapper,
ObsSegmentationsOmeZarrWrapper,
)

from vitessce.wrappers import file_path_to_url_path
Expand Down Expand Up @@ -139,6 +143,70 @@ def test_ome_zarr_with_base_dir(self):
'url': 'http://localhost:8000/test.ome.zarr'
})

def test_image_ome_tiff(self):
w = ImageOmeTiffWrapper(img_path=data_path / 'test.ome.tif')
w.local_img_uid = 'test.ome.tif'
w.local_offsets_uid = 'test.offsets.json'

file_def_creator = w.make_raster_file_def_creator(
"A",
"0"
)
file_def = file_def_creator('http://localhost:8000')
self.assertEqual(file_def, {
'fileType': 'image.ome-tiff',
'url': 'http://localhost:8000/A/0/test.ome.tif',
'options': {
'offsetsUrl': 'http://localhost:8000/A/0/test.offsets.json'
}
})

def test_image_ome_zarr(self):
w = ImageOmeZarrWrapper(img_path=data_path / 'test.ome.zarr')
w.local_dir_uid = 'test.ome.zarr'

file_def_creator = w.make_image_file_def_creator(
"A",
"0"
)
file_def = file_def_creator('http://localhost:8000')
self.assertEqual(file_def, {
'fileType': 'image.ome-zarr',
'url': 'http://localhost:8000/A/0/test.ome.zarr'
})

def test_obs_segmentations_ome_tiff(self):
w = ObsSegmentationsOmeTiffWrapper(img_path=data_path / 'test.ome.tif')
w.local_img_uid = 'test.ome.tif'
w.local_offsets_uid = 'test.offsets.json'

file_def_creator = w.make_raster_file_def_creator(
"A",
"0"
)
file_def = file_def_creator('http://localhost:8000')
self.assertEqual(file_def, {
'fileType': 'obsSegmentations.ome-tiff',
'url': 'http://localhost:8000/A/0/test.ome.tif',
'options': {
'offsetsUrl': 'http://localhost:8000/A/0/test.offsets.json'
}
})

def test_obs_segmentations_ome_zarr(self):
w = ObsSegmentationsOmeZarrWrapper(img_path=data_path / 'test.ome.zarr')
w.local_dir_uid = 'test.ome.zarr'

file_def_creator = w.make_image_file_def_creator(
"A",
"0"
)
file_def = file_def_creator('http://localhost:8000')
self.assertEqual(file_def, {
'fileType': 'obsSegmentations.ome-zarr',
'url': 'http://localhost:8000/A/0/test.ome.zarr'
})

def test_anndata(self):
adata_path = data_path / 'test.h5ad.zarr'
w = AnnDataWrapper(adata_path,
Expand Down
4 changes: 4 additions & 0 deletions vitessce/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@
CsvWrapper,
AnnDataWrapper,
MultivecZarrWrapper,
ImageOmeTiffWrapper,
ObsSegmentationsOmeTiffWrapper,
ImageOmeZarrWrapper,
ObsSegmentationsOmeZarrWrapper,
)
except ModuleNotFoundError as e: # pragma: no cover
warn(f'Extra installs are necessary to use wrappers: {e}')
Expand Down
Loading

0 comments on commit 4fb4fab

Please sign in to comment.