Skip to content

Commit

Permalink
step9 fix indexing
Browse files Browse the repository at this point in the history
  • Loading branch information
huygensCortex committed Aug 15, 2024
1 parent e77f9c8 commit 3c337fe
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions step9.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,12 @@ def resolve_h5py_reference(data, f):


for iv in range(int(mat['no_obj'][0, 0])):
# iv = 0
tp_mat_start = int(mat['cell_data'][0, iv]) # First appearance of mating event "iv"
M1 = MTrack[tp_mat_start-1] # Mat Track at tp_mat_start
for its in range(tp_mat_start - 2, int(mat['shock_period'][1, 0]), -1): # Loop through time from 1 tp before mating to one time point after shock
A1 = Mask3[its].astype(float)
for its in range(tp_mat_start - 1, int(mat['shock_period'][1, 0]), -1): # Loop through time from 1 tp before mating to one time point after shock
# its = 154
A1 = Mask3[its].astype(float).T


# plt.figure()
Expand All @@ -84,7 +86,7 @@ def resolve_h5py_reference(data, f):



M2 = (M1 == iv + 1).astype(float)
M2 = (M1 == iv + 1).astype(float).T

Im1 = (M2 > threshold_otsu(M2)).astype(float)
Im2 = thin(Im1, 10).astype(float)
Expand All @@ -111,15 +113,15 @@ def resolve_h5py_reference(data, f):
if (2/8) <= r <= (8/2): # 4/6 to 9/6
gamete[0, iv] = pix2[0]
gamete[1, iv] = pix2[1]
gamete[2, iv] = its + 1
gamete[2, iv] = its

for iv in range(int(mat['no_obj'][0, 0])):
if gamete[0, iv] == 0 and gamete[1, iv] == 0:
tp_mat_start = int(mat['cell_data'][iv, 0]) # First appearance of mating event "iv"
M1 = MTrack[tp_mat_start-1] # Mat Track at tp_mat_start
for its in range(tp_mat_start - 2, int(mat['shock_period'][1, 0]), -1): # Loop through time from 1 tp before mating to one time point after shock
A1 = Mask3[its].astype(float)
M2 = (M1 == iv + 1).astype(float)
for its in range(tp_mat_start - 1, int(mat['shock_period'][1, 0]), -1): # Loop through time from 1 tp before mating to one time point after shock
A1 = Mask3[its].astype(float).T
M2 = (M1 == iv + 1).astype(float).T

Im1 = (M2 > threshold_otsu(M2)).astype(float)
Im2 = thin(Im1, 10).astype(float)
Expand All @@ -134,6 +136,6 @@ def resolve_h5py_reference(data, f):

if pix2.size == 1: # captures ascus mating
gamete[0, iv] = pix2[0]
gamete[2, iv] = its + 1
gamete[2, iv] = its

sio.savemat(os.path.join(sav_path, f'{pos}_gametes.mat'), {"gamete": gamete}, do_compression=True)

0 comments on commit 3c337fe

Please sign in to comment.