Skip to content
Snippets Groups Projects
Commit 647683b8 authored by Christopher Randolph Rhodes's avatar Christopher Randolph Rhodes
Browse files

Move ilastik examples; auto-generate accessor

parent 30e33bad
No related branches found
No related tags found
No related merge requests found
......@@ -140,7 +140,9 @@ def write_accessor_data_to_file(fpath: Path, accessor: GenericImageDataAccessor)
def generate_file_accessor(fpath):
if str(fpath).upper().endswith('.CZI'):
if str(fpath).upper().endswith('.TIF') or str(fpath).upper().endswith('.TIFF'):
return TifSingleSeriesFileAccessor(fpath)
elif str(fpath).upper().endswith('.CZI'):
return CziImageFileAccessor(fpath)
else:
raise FileAccessorError(f'Could not match a file accessor with {fpath}')
......
......@@ -3,7 +3,7 @@ import unittest
import numpy as np
from conf.testing import czifile, output_path, tifffile
from model_server.accessors import CziImageFileAccessor, DataShapeError, InMemoryDataAccessor, write_accessor_data_to_file, TifSingleSeriesFileAccessor
from model_server.accessors import CziImageFileAccessor, DataShapeError, generate_file_accessor, InMemoryDataAccessor, write_accessor_data_to_file, TifSingleSeriesFileAccessor
class TestCziImageFileAccess(unittest.TestCase):
......@@ -11,7 +11,9 @@ class TestCziImageFileAccess(unittest.TestCase):
pass
def test_tiffile_is_correct_shape(self):
tf = TifSingleSeriesFileAccessor(tifffile['path'])
tf = generate_file_accessor(tifffile['path'])
self.assertIsInstance(tf, TifSingleSeriesFileAccessor)
self.assertEqual(tf.shape_dict['Y'], tifffile['h'])
self.assertEqual(tf.shape_dict['X'], tifffile['w'])
self.assertEqual(tf.chroma, tifffile['c'])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment