Repository navigation
Conversation
nd2_to_binary still used the 0.x settings-only signature and the stubbed utils.init_settings / find_files_open_binaries helpers, so selecting input_format="nd2" raised TypeError from run_s2p's files_to_binary dispatch. Follows the same pattern as the tiff/h5 readers: - read dbs[0]["file_list"], write to the opened reg_file handles, save each plane's db/settings and return dbs - read in batch_size chunks (counted as interleaved frames like the other readers) through the lazy dask view instead of asarray(), so multi-GB recordings are not loaded into memory at once - reorder any axis order to T x Z x C x Y x X and reject unsupported axes - convert uint16 by // 2 and uint8/int16 directly like tiff.py; int32 is halved only when the result fits int16, and other pixel dtypes raise a clear ValueError instead of wrapping - raise a clear ImportError when the nd2 package is missing (the ND2 flag was never checked before), and a ValueError when the file's Z/C counts disagree with nplanes/nchannels or more than two channels are requested Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SKRtLiLxWPAP8NPQquyp7Q
The GUI builds the "Input format" combo box by parsing the bracketed list in the input_format description string, which was never updated when the nd2 reader was registered in files_to_binary. Regression of MouseLand#951 introduced by the rungui refactor. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SKRtLiLxWPAP8NPQquyp7Q
The DCIMG flag was set on import failure but never checked, so a missing package surfaced as NameError deep inside the conversion loop. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SKRtLiLxWPAP8NPQquyp7Q
Drives nd2_to_binary through a fake ND2File with Z,T,C,Y,X axis order, two planes and two channels, and checks the plane-count, dtype and int32-range validation. The fake is installed with raising=False so the tests also run where the optional nd2 package is not installed. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SKRtLiLxWPAP8NPQquyp7Q
rysk-t
marked this pull request as ready for review
September 9, 2026 14:20
This branch has not been deployed
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.
Summary
nd2_to_binarystill had the 0.xreader(settings)signature and called the stubbedutils.init_settings/find_files_open_binaries, soinput_format="nd2"raisedTypeErrorfromrun_s2p'sfiles_to_binarydispatch. It is now ported to the(dbs, settings, reg_file, reg_file_chan2)contract used by the tiff/h5 readers: readsdbs[0]["file_list"], writes to the opened binaries, fillsLy/Lx/nframes/frames_per_file/frames_per_folder/meanImg(_chan2), saves each plane'sdb.npy/settings.npyand returnsdbs.batch_sizechunks through the lazyND2File.to_dask()view instead ofasarray(), so multi-GB recordings are not loaded into memory at once; any axis order is reordered to T×Z×C×Y×X.ValueErrorinstead of wrapping.ImportErrorwhen the optionalnd2package is missing (theND2flag was never checked),ValueErrorwhen the file's Z/C sizes disagree withnplanes/nchannels, when more than two channels are requested, or when the file has unsupported axes (e.g. multi-positionP).'nd2'to theinput_formatchoices inparameters.py(the GUI builds its dropdown from that list, so nd2 could not be selected — regression of FEATURE: Add .nd2 input format in the GUI #951 after the rungui refactor) and to the generateddocs/parameters.md.ImportErrorfromdcimg_to_binarywhen the optionaldcimgpackage is missing (previously aNameErrordeep in the conversion loop).