Repository navigation
Choose the annotation trial by movie data, not file size - #55
Merged
Merged
Conversation
getAnnotationImage annotates on a path's longest valid trial and used the registered movie's file size as its length. Compressed h5 movies (saveTif=false, and GIAnT-Python's default) have file sizes that depend on content as well, so it could pick a shorter or a different equal trial than the TIFF movies of the same data. h5 movies are now sized by their dataset, as localizationTrialBytes does; TIFF movies are still sized by their file, so TIFF runs pick the same trial as before. Ties still go to the first trial. Without meanIM in the alignment file, the mean image of an h5 movie is now read with h5read instead of the TIFF reader. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the HDF5 trial-selection and mean-image fallback changes.
No open issues 🎉
What changed in this PR
Updates annotation-image selection to choose HDF5 trials by movie data size rather than compressed file size, while preserving existing TIFF selection behavior.
Changes:
- Sizes HDF5 movies by dataset dimensions, preserving first-trial tie handling and zero sizing for missing movies.
- Reads HDF5 movie data when the alignment file lacks
meanIM. - Adds six unit tests covering trial selection, exclusions, missing movies, TIFF behavior, and the HDF5 fallback.
| File | Description |
|---|---|
| tests/unit/dependencies/TestGetAnnotationImage.m | Adds regression tests for trial selection and mean-image fallback. |
| dependencies/io/getAnnotationImage.m | Uses dataset-based HDF5 sizing and adds an HDF5 mean-image fallback. |
Review effort: Balanced
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.
getAnnotationImageannotates ROIs on the mean image of a path's longest valid trial, and it measured trial length by the file size of the registered movie. That works for TIFF movies, whose size grows with the number of frames. HDF5 movies (saveTif=false, and the default in GIAnT-Python since AllenNeuralDynamics/GIAnT-Python#14) are deflate-compressed, so their size also depends on content. For example, among the equal-length trials of a continuous recording, the noisiest trial has the largest file, and a long trial with many empty pixels can look shorter than a short one. TIFF and HDF5 registrations of the same data could therefore annotate on different trials.HDF5 movies are now sized by their dataset (frames × frame size, as single), as
localizationTrialBytesalready does when it sizes SILo's pool. TIFF movies are still sized by their file, so TIFF runs pick the same trial as before. Ties still go to the first trial, and a missing movie still counts as 0. When the alignment file has nomeanIM, the mean image of an HDF5 movie is now read withh5read; previously this path always used the TIFF reader. Both GIAnT-MATLAB and GIAnT-Python writemeanIM, so this fallback is rarely used.tests/unit/dependencies/TestGetAnnotationImage.madds six tests:meanIM;On main, the three HDF5 tests fail and the other three pass. With this change, the full unit suite passes locally (198 of 198, R2024b).
🤖 Generated with Claude Code