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

Added and tested method to get focus (z) axis in accessor

parent 5ccb314a
No related branches found
No related tags found
No related merge requests found
......@@ -73,6 +73,9 @@ class GenericImageDataAccessor(ABC):
def get_z_argmax(self):
return self.apply(lambda x: x.argmax(axis=self.get_axis('Z')))
def get_focus_vector(self):
return self.data.sum(axis=(0, 1, 2))
@property
def data_xy(self) -> np.ndarray:
if not self.chroma == 1 and self.nz == 1:
......
......@@ -72,6 +72,16 @@ class TestCziImageFileAccess(unittest.TestCase):
self.assertEqual(am.shape, (h, w, 1, 1))
self.assertTrue(np.all(am.unique()[0] == range(0, nz)))
def test_get_single_channel_z_series_from_zstack(self):
w = 256
h = 512
nc = 4
nz = 11
c = 3
cf = InMemoryDataAccessor(np.random.rand(h, w, nc, nz))
zs = cf.get_mono(c).get_focus_vector()
self.assertEqual(zs.shape, (nz, ))
def test_get_zi(self):
w = 256
h = 512
......
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