Skip to content

Commit

Permalink
fixing bug with multiplane registration
Browse files Browse the repository at this point in the history
  • Loading branch information
carsen-stringer committed Feb 6, 2024
1 parent 193e7f1 commit 361421f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion suite2p/io/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ def init_ops(ops):
ops["save_path"] = os.path.join(ops["save_path0"], "suite2p", "plane%d" % j)

if ("fast_disk" not in ops) or len(ops["fast_disk"]) == 0:
ops["fast_disk"] = ops["save_path0"].copy()
ops["fast_disk"] = ops["save_path0"]
fast_disk = os.path.join(ops["fast_disk"], "suite2p", "plane%d" % j)
ops["ops_path"] = os.path.join(ops["save_path"], "ops.npy")
ops["reg_file"] = os.path.join(fast_disk, "data.bin")
Expand Down
9 changes: 7 additions & 2 deletions suite2p/registration/register.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,11 @@ def register_frames(refAndMasks, frames, rmin=-np.inf, rmax=np.inf, bidiphase=0,
else:
for output, output_best in zip(outputs[:-1], outputs_best):
output_best[i] = output[0]
frames, ymax, xmax, cmax, ymax1, xmax1, cmax1 = outputs_best
if len(outputs_best)==7:
frames, ymax, xmax, cmax, ymax1, xmax1, cmax1 = outputs_best
else:
frames, ymax, xmax, cmax = outputs_best
ymax1, xmax1, cmax1 = None, None, None
return frames, ymax, xmax, cmax, ymax1, xmax1, cmax1, (zpos_best, cmax_all)
else:
if len(refAndMasks) == 7 or not isinstance(refAndMasks, np.ndarray):
Expand Down Expand Up @@ -306,7 +310,7 @@ def register_frames(refAndMasks, frames, rmin=-np.inf, rmax=np.inf, bidiphase=0,
maxregshift=ops["maxregshift"],
smooth_sigma_time=ops["smooth_sigma_time"],
)

for frame, dy, dx in zip(frames, ymax, xmax):
frame[:] = rigid.shift_frame(frame=frame, dy=dy, dx=dx)

Expand Down Expand Up @@ -638,6 +642,7 @@ def registration_wrapper(f_reg, f_raw=None, f_reg_chan2=None, f_raw_chan2=None,
else:
nchannels = 1


outputs = compute_reference_and_register_frames(f_align_in, f_align_out=f_align_out,
refImg=refImg, ops=ops)
refImg, rmin, rmax, mean_img, rigid_offsets, nonrigid_offsets, zest = outputs
Expand Down

0 comments on commit 361421f

Please sign in to comment.