Skip to content

Difference in INU behavior when providing precomputed mask #574

Description

@psadil

Describe the bug
In a typical run without a precomputed mask, INU is done on the whole-head image, with weights that can emphasize WM and the brainstem. In a run with a precomputed mask, INU appears to be done on the masked image, and the weights differ.

I think this happens in this branch:

# Run N4 if it hasn't been pre-run
if not have_t1w:
LOGGER.info('ANAT Skipping skull-strip, INU-correction only')
n4_only_wf = init_n4_only_wf(
omp_nthreads=omp_nthreads,
atropos_use_random_seed=not skull_strip_fixed_seed,
)

init_n4_only_wf doesn't have a way to pass wm_prior to init_atropos_wf https://github.com/nipreps/niworkflows/blob/d991644f3a769d7c84e7c8bb897ea30fb96885df/niworkflows/anat/ants.py#L961-L966

so wm_prior always takes the default value of False https://github.com/nipreps/niworkflows/blob/d991644f3a769d7c84e7c8bb897ea30fb96885df/niworkflows/anat/ants.py#L474

meaning that the wm_prior is not applied https://github.com/nipreps/niworkflows/blob/d991644f3a769d7c84e7c8bb897ea30fb96885df/niworkflows/anat/ants.py#L793-L822

I think this difference in use of weights is a bug, but you may disagree. At minimum, I think this is behavior that should be documented (here and in fmriprep).

Exact command line executed

❯ docker run --rm -it -v /Users/psadil/Desktop/mask-test:/Users/psadil/Desktop/mask-test nipreps/smriprep --fs-license-file=/Users/psadil/Desktop/mask-test/code/license.txt --derivatives=/Users/psadil/Desktop/mask-test/sourcedata/synthstrip $PWD/sourcedata/raw $PWD participant

# or
❯ docker run --rm -it -v /Users/psadil/Desktop/mask-test:/Users/psadil/Desktop/mask-test nipreps/smriprep --fs-license-file=/Users/psadil/Desktop/mask-test/code/license.txt $PWD/sourcedata/raw $PWD participant

Are you positive that the input dataset is BIDS-compliant?

  • I have used the online BIDS-Validator
  • I have run a local installation of the BIDS-Validator (please, note the version of the validator here).
  • I let sMRIPrep check it for me (in other words, I didn't set the --skip-bids-validation argument).
  • No, I haven't checked myself AND used the --skip-bids-validation argument.

sMRIPrep feedback information

Visual reports of sMRIPrep
This is unrelated to the main concern (differences in how INU is applied), but the resulting reports end up looking different; the outputs with a precomputed mask have the mask applied.

Without precomputed mask

Image

With precomputed mask

Image

Installation type (please complete the following information):

  • "Bare-metal"
  • Singularity
  • Docker

Additional context
Possibly related: nipreps/nibabies#397

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions