Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions siffpy/core/utils/registration_tools/suite2p/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,26 +108,26 @@ def register(self,
frames = siffio.get_frames(
frames = self.im_params.flatten_by_timepoints(color_channel=alignment_color_channel),
registration = {}, # guarantee the raw frames
).astype(np.float32).reshape(-1, *self.im_params.volume_one_color)
).reshape(-1, *self.im_params.volume_one_color)

registered_frames = np.zeros_like(frames)

# Each list element is a tuple:
# reference image, _, _, _, offsets (y, x), _, _
reg_rets = [ # hee hee
register.registration_wrapper(
registered_frames[: , k, :, :].squeeze(),
# scale f_raw by 100 since suite2p averages and THEN casts to uint16,
# this keeps the values from being truncated to 0
f_raw = 100*frames[:, k, :, :].squeeze(),
ops = {
**default_ops(),
**kwargs,
}
)
for k in range(self.im_params.num_slices)
]

reg_rets=[]
for k in range(self.im_params.num_slices):
reg_res=register.registration_wrapper(
np.zeros(frames[:, k, :, :].squeeze().shape,dtype=np.float32),
# scale f_raw by 100 since suite2p averages and THEN casts to uint16,
# this keeps the values from being truncated to 0
f_raw = 100*frames[:, k, :, :].squeeze().astype(np.float32),
ops = {
**default_ops(),
**kwargs,
}
)
reg_rets.append(reg_res)
self.reference_frames = np.array(
[reg_ret[0] for reg_ret in reg_rets]
).astype(np.float32)/100
Expand Down