Repository navigation
Conversation
`process_relative_term` compared the tract and region bounding boxes with `>` for `anterior` and `inferior` and `<` otherwise. In RAS+ coordinates the `superior` side is the maximum z, so `superior_of(X)` selected tracts whose top lies below the top of X, and `inferior_of(X)` tracts whose bottom lies above the bottom of X. Use `>` for `superior` (like `anterior`) and `<` for `inferior` (like `posterior`). Add tests for the direction of the four antero-posterior and supero-inferior terms on a synthetic atlas; the superior/inferior cases fail before this change. Closes #141. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
process_relative_termcompares the tract bounding boxes with the region's using>foranteriorandinferiorand<otherwise. In RAS+ coordinatessuperioris the maximum z, sosuperior_of(X)selected tracts whose top is below the top of X, andinferior_of(X)tracts whose bottom is above the bottom of X (#141; also what #35 reported in 2017).On the test data,
superior_of(ins.left)(left insula, label 1035) returned 2,715 tracts, none of which reaches above the insula, andinferior_of(ins.left)4,646 tracts, none of which reaches below it;anterior_of/posterior_ofare correct (100% in front / behind).Change
One line:
>forsuperior(likeanterior),<forinferior(likeposterior).medial_of/lateral_ofare unchanged.New
tract_querier/tests/test_relative_terms.py: a synthetic atlas (one region in the centre of a 20 mm cube) with one tract above, below, in front of and behind it; checks that each ofsuperior_of,inferior_of,anterior_of,posterior_ofreturns exactly the expected tract. The superior/inferior cases fail on master.Behaviour change
User queries that use
superior_of/inferior_ofnow select the opposite (correct) side. No query file bundled intract_querier/datauses these terms, so the bundled tract definitions are unchanged. Anyone who applied the #35 workaround (flipping z with--bounding_box_affine_transform) should drop it.Testing
Merge order
Touches the same function as #133 (relative-term argument checks) a few lines apart; whichever merges second may need a trivial rebase.
Closes #141.
🤖 Generated with Claude Code