Faster quasiraw pipeline + mask interpolation fix#60
Open
Duplums 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.
This PR:
Fixed mask interpolation (quasiraw.py:175)
The quasiraw pipeline scales the brain mask alongside the anatomical image (interfaces.scale). Previously both calls used FSL flirt's default trilinear interpolation, which produces non-binary values when applied to a binary mask. The mask scaling call now explicitly passes interp="nearestneighbour" so mask voxels stay binary after resampling.
Added interp parameter to scale() (fsl.py:201-224)
New optional parameter forwarded to flirt -interp, defaulting to None (flirt's own default, trilinear) — needed to support the fix above without hardcoding it for every caller.
Speed optimizations in affine() and biasfield() (fsl.py:305-56, ants.py:74)
affine(): restricts the flirt rotation search range to ±30° on all three axes (-searchrx/ry/rz -30 30) instead of FSL's much wider default, cutting registration search time.
biasfield(): increases N4BiasFieldCorrection's shrink factor (-s) from 1 to 4, which downsamples the image before estimating the bias field — a common speed/accuracy tradeoff for large-scale batch processing.
Together these make the quasiraw preprocessing step noticeably faster for batch runs while correcting a real bug (binary mask corruption from trilinear resampling).