[ENH] Add native FLAIR Support to MRIQC#1438
Open
cooper-sharp wants to merge 6 commits intonipreps:masterfrom
Open
[ENH] Add native FLAIR Support to MRIQC#1438cooper-sharp wants to merge 6 commits intonipreps:masterfrom
cooper-sharp wants to merge 6 commits intonipreps:masterfrom
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.
Overview
This PR adds native FLAIR support to MRIQC, allowing
_FLAIRBIDS-named files to be processed directly. FLAIR images are routed through the existing anatomical QC workflow and produce the same reports and IQMs as T1w and T2w.Related Issue
Requirements
These instructions assume Docker is already installed on your system. See https://docs.docker.com/get-docker/ for installation guidance.
Building the Docker image
After cloning this branch, build the development image from the repo root:
docker build --no-cache -f Dockerfile_devel -t mriqc_devel --build-arg VERSION=24.0.2 .Usage
No additional environment variables are required.
Files Changed
mriqc/config.py'FLAIR'toSUPPORTED_SUFFIXES; updated BIDS ignore regex; added'FLAIR'toIMTYPESinutils/misc.pymriqc/cli/parser.pymriqc/workflows/core.py'flair'toANATOMICAL_KEYSmriqc/workflows/anatomical/base.py'flair'to dataset/metadata/entities collection; added_get_norm_modto map FLAIR → T2w for ANTs spatial normalization; wiredmodalityintoStructuralQCnodemriqc/interfaces/anatomical.pymodalityinput toStructuralQCInputSpec; replacedMRIQC_ALLOW_EMPTY_N4env var check with modality-aware N4 fallbackmriqc/utils/misc.py'flair'tovolmaxcheck; added'FLAIR'toIMTYPESKey Implementation Details
N4 bias correction fallback
FLAIR images frequently cause N4 to converge to a near-empty output due to the inverted CSF contrast. When
modality == 'FLAIR'and the N4-corrected image is effectively empty, the pipeline substitutes the original uncorrected image and logsa warning. For all other modalities (T1w, T2w) the original
RuntimeErroris raised as before. This fallback is strictly FLAIR-only.Spatial normalization
ANTs
RobustMNINormalizationdoes not accept'FLAIR'as a validreferencevalue. FLAIR is mapped to'T2w'for the purposes of normalization only, via_get_norm_mod. The modality label remains'FLAIR'everywhere else in the pipeline (datasink, provenance, IQM output).Testing
The following steps reproduce a minimal end-to-end test using a single subject from
OpenNeuro dataset [ds007486](https://openneuro.org/datasets/ds007486), which contains FLAIR acquisitions.
1. Download the dataset
If you have DataLad installed:
datalad clone https://github.com/OpenNeuroDatasets/ds007486.git /path/to/ds007486 cd /path/to/ds007486 datalad get sub-10562/anat/If you do not have DataLad, use the AWS CLI instead (no credentials required):
2. Create output directory
3. Run MRIQC
Replace
/path/to/ds007486with the actual path on your system.4. Expected output
On success you should see a FLAIR IQM JSON file and visual report at: