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

Added method to cast patch as YXCZ array

parent 3dff7010
No related branches found
No related tags found
No related merge requests found
......@@ -44,6 +44,9 @@ class MonoPatchStack(InMemoryDataAccessor):
def iat(self, i):
return self.data[:, :, 0, i]
def iat_yxcz(self, i):
return np.expand_dims(self.iat(i), (2, 3))
def get_list(self):
n = self.nz
return [self.data[:, :, 0, zi] for zi in range(0, n)]
......
......@@ -43,4 +43,11 @@ class TestCziImageFileAccess(unittest.TestCase):
def test_raises_filenotfound(self):
from extensions.chaeo.accessors import FileNotFoundError
with self.assertRaises(FileNotFoundError):
acc = MonoPatchStackFromFile('c:/fake/file/name.tif')
\ No newline at end of file
acc = MonoPatchStackFromFile('c:/fake/file/name.tif')
def test_patch_as_yxcz_array(self):
w = 256
h = 512
n = 4
acc = MonoPatchStack([np.random.rand(h, w) for _ in range(0, 4)])
self.assertEqual(acc.iat_yxcz(0).shape, (h, w, 1, 1))
\ No newline at end of file
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