Skip to content

Faster quasiraw pipeline + mask interpolation fix - #60

Merged
AGrigis merged 17 commits into
brainprepdesk:devfrom
Duplums:fast-quasiraw
Aug 7, 2026
Merged

Faster quasiraw pipeline + mask interpolation fix#60
AGrigis merged 17 commits into
brainprepdesk:devfrom
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).

@AGrigis
AGrigis changed the base branch from main to dev August 3, 2026 11:29
@AGrigis

AGrigis commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

+ use a 2mm space to speed the process.

@AGrigis

AGrigis commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

+ add T2w and FLAIR support.

@AGrigis
AGrigis merged commit 988a688 into brainprepdesk:dev Aug 7, 2026
6 checks passed
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.

2 participants