From 4b4df5520a4389bec2c5dd078cc531ea1c71984d Mon Sep 17 00:00:00 2001 From: Maarten <54527765+MaartenBransen@users.noreply.github.com> Date: Tue, 26 Sep 2023 10:24:22 +0200 Subject: [PATCH] raise proper error for atypical imaging order --- scm_confocal/sp8.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scm_confocal/sp8.py b/scm_confocal/sp8.py index f1dae18..0063d76 100644 --- a/scm_confocal/sp8.py +++ b/scm_confocal/sp8.py @@ -715,6 +715,13 @@ def load_stack(self,dim_range=None,dtype=None): dataorder = ['channel']+dataorder order = ['channel','mosaic','time','z-axis','y-axis','x-axis'] + #check for imaging order + if not (dataorder[-1]=='x-axis' and dataorder[-2]=='y-axis'): + raise NotImplementedError('load_stack is only implemented for ' + '(x-axis, y-axis) imaging but data has ' + f'({dataorder[-1]}, {dataorder[-2]}) ' + 'imaging order') + #default dim range (as None to prevent mutable default arg) if dim_range is None: dim_range= {} @@ -772,13 +779,14 @@ def load_stack(self,dim_range=None,dtype=None): data = np.empty(newshape, dtype=np.uint8 if self.lifimage.bit_depth[0] == 8 else np.uint16) - + #loop over indices and load for i,c in enumerate(channels): for j,m in enumerate(msteps): for k,t in enumerate(times): for l,z in enumerate(zsteps): data[i,j,k,l,:,:] = self.lifimage.get_frame(z,t,c,m) + #if ranges for x or y are chosen, remove those from the array now, #account (top to bottom) for trimming x ánd y, only x, or only y.