Skip to content

Commit

Permalink
raise proper error for atypical imaging order
Browse files Browse the repository at this point in the history
  • Loading branch information
MaartenBransen committed Sep 26, 2023
1 parent 8be62b0 commit 4b4df55
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion scm_confocal/sp8.py
Original file line number Diff line number Diff line change
Expand Up @@ -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= {}
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 4b4df55

Please sign in to comment.