Write channel 2 registered tiffs to reg_tif_chan2 - #1261
Open
adityasingh2400 wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When a two-channel recording is registered with both
reg_tifandreg_tif_chan2enabled, the second channel's tiffs are written into the first channel's directory and overwrite it. Thereg_tif_chan2folder is created but stays empty, and the tiffs left inreg_tifcontain channel 2 data.assign_reg_ioalready computes two separate tiff directories,tif_root_alignfor the alignment channel andtif_root_altfor the alternate one, and picks the right folder for each depending onalign_by_chan2.registration_wrapperpassestif_root_aligntoregister_frames, which is correct, but then passestif_root_alignagain to theshift_frames_and_writecall that handles the alternate channel. Both channels therefore writefile 0000.tifinto the same folder, and since the alternate channel is written second it wins.tif_root_altwas computed and never used.The fix passes
tif_root_altto the alternate channel write. This also repairs the case where onlyreg_tif_chan2is set, wheretif_root_alignisNoneand the alternate channel silently wrote no tiffs at all. The bug is symmetric underalign_by_chan2, since the roles of the two folders swap but the wrong variable is used either way.Tested with a new parametrised case in
tests/test_registration.py. It runsregistration_wrapperon an 8 frame 64 by 64 synthetic pair whose two channels differ by an order of magnitude in mean intensity, so the mean of a written tiff identifies which channel produced it, and asserts that each directory holds its own channel. Both parameter values fail on main, one becausereg_tif_chan2is empty and the other becausereg_tifholds the wrong channel, and both pass with this change. The rest of the file still passes, 5 passed in total.Fixes #1208