Skip to content

Faster quasiraw pipeline + mask interpolation fix#60

Open
Duplums wants to merge 1 commit into
brainprepdesk:mainfrom
Duplums:fast-quasiraw
Open

Faster quasiraw pipeline + mask interpolation fix#60
Duplums wants to merge 1 commit into
brainprepdesk:mainfrom
Duplums:fast-quasiraw

Conversation

@Duplums

@Duplums Duplums commented Jul 22, 2026

Copy link
Copy Markdown

This PR:

  1. 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.

  2. 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.

  3. 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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant