Skip to content

Commit 4fb4fab

Browse files
authored
Support additional parameters for imaging wrapper classes to support … (#313)
* Support additional parameters for imaging wrapper classes to support spatialBeta view. * Lint * Fix tests
1 parent 4f251b4 commit 4fb4fab

File tree

3 files changed

+454
-0
lines changed

3 files changed

+454
-0
lines changed

tests/test_wrappers.py

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
AnnDataWrapper,
1717
CsvWrapper,
1818
MultivecZarrWrapper,
19+
ImageOmeTiffWrapper,
20+
ObsSegmentationsOmeTiffWrapper,
21+
ImageOmeZarrWrapper,
22+
ObsSegmentationsOmeZarrWrapper,
1923
)
2024

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

146+
def test_image_ome_tiff(self):
147+
w = ImageOmeTiffWrapper(img_path=data_path / 'test.ome.tif')
148+
w.local_img_uid = 'test.ome.tif'
149+
w.local_offsets_uid = 'test.offsets.json'
150+
151+
file_def_creator = w.make_raster_file_def_creator(
152+
"A",
153+
"0"
154+
)
155+
file_def = file_def_creator('http://localhost:8000')
156+
self.assertEqual(file_def, {
157+
'fileType': 'image.ome-tiff',
158+
'url': 'http://localhost:8000/A/0/test.ome.tif',
159+
'options': {
160+
'offsetsUrl': 'http://localhost:8000/A/0/test.offsets.json'
161+
}
162+
})
163+
164+
def test_image_ome_zarr(self):
165+
w = ImageOmeZarrWrapper(img_path=data_path / 'test.ome.zarr')
166+
w.local_dir_uid = 'test.ome.zarr'
167+
168+
file_def_creator = w.make_image_file_def_creator(
169+
"A",
170+
"0"
171+
)
172+
file_def = file_def_creator('http://localhost:8000')
173+
self.assertEqual(file_def, {
174+
'fileType': 'image.ome-zarr',
175+
'url': 'http://localhost:8000/A/0/test.ome.zarr'
176+
})
177+
178+
def test_obs_segmentations_ome_tiff(self):
179+
w = ObsSegmentationsOmeTiffWrapper(img_path=data_path / 'test.ome.tif')
180+
w.local_img_uid = 'test.ome.tif'
181+
w.local_offsets_uid = 'test.offsets.json'
182+
183+
file_def_creator = w.make_raster_file_def_creator(
184+
"A",
185+
"0"
186+
)
187+
file_def = file_def_creator('http://localhost:8000')
188+
self.assertEqual(file_def, {
189+
'fileType': 'obsSegmentations.ome-tiff',
190+
'url': 'http://localhost:8000/A/0/test.ome.tif',
191+
'options': {
192+
'offsetsUrl': 'http://localhost:8000/A/0/test.offsets.json'
193+
}
194+
})
195+
196+
def test_obs_segmentations_ome_zarr(self):
197+
w = ObsSegmentationsOmeZarrWrapper(img_path=data_path / 'test.ome.zarr')
198+
w.local_dir_uid = 'test.ome.zarr'
199+
200+
file_def_creator = w.make_image_file_def_creator(
201+
"A",
202+
"0"
203+
)
204+
file_def = file_def_creator('http://localhost:8000')
205+
self.assertEqual(file_def, {
206+
'fileType': 'obsSegmentations.ome-zarr',
207+
'url': 'http://localhost:8000/A/0/test.ome.zarr'
208+
})
209+
142210
def test_anndata(self):
143211
adata_path = data_path / 'test.h5ad.zarr'
144212
w = AnnDataWrapper(adata_path,

vitessce/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@
4444
CsvWrapper,
4545
AnnDataWrapper,
4646
MultivecZarrWrapper,
47+
ImageOmeTiffWrapper,
48+
ObsSegmentationsOmeTiffWrapper,
49+
ImageOmeZarrWrapper,
50+
ObsSegmentationsOmeZarrWrapper,
4751
)
4852
except ModuleNotFoundError as e: # pragma: no cover
4953
warn(f'Extra installs are necessary to use wrappers: {e}')

0 commit comments

Comments
 (0)