Skip to content

Commit

Permalink
Merge pull request #1225 from nipreps/enh/fa-masks-iqms
Browse files Browse the repository at this point in the history
ENH: Add FA-based IQMs (nans percentage and degenerate percentage)
  • Loading branch information
oesteban committed Apr 2, 2024
2 parents bb4deb0 + 3fb6046 commit 2c61618
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 7 deletions.
15 changes: 13 additions & 2 deletions mriqc/interfaces/diffusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ class _DiffusionQCInputSpec(_BaseInterfaceInputSpec):
class _DiffusionQCOutputSpec(TraitedSpec):
cc_snr = traits.Dict
efc = traits.Dict
fa_degenerate = traits.Float
fa_nans = traits.Float
fber = traits.Dict
fd = traits.Dict
spikes_ppm = traits.Dict
Expand Down Expand Up @@ -205,7 +207,7 @@ def _run_interface(self, runtime):
# Summary stats
rois = {
'fg': mskdata,
'bg': ~mskdata,
'bg': 1.0 - mskdata,
'cc': ccdata,
'wm': wmdata,
}
Expand All @@ -220,7 +222,16 @@ def _run_interface(self, runtime):
b_vectors=self.inputs.in_bvec,
)

# Get cc mask data
fa_nans_mask = np.asanyarray(nb.load(self.inputs.in_fa_nans).dataobj) > 0.0
self._results['fa_nans'] = np.round(float(fa_nans_mask[mskdata > 0.5].mean()), 8) * 1e6

fa_degenerate_mask = np.asanyarray(nb.load(self.inputs.in_fa_degenerate).dataobj) > 0.0
self._results['fa_degenerate'] = np.round(
float(fa_degenerate_mask[mskdata > 0.5].mean()),
8,
) * 1e6

# Get spikes-mask data
spmask = np.asanyarray(nb.load(self.inputs.spikes_mask).dataobj) > 0.0
self._results['spikes_ppm'] = dqc.spike_ppm(spmask)

Expand Down
21 changes: 16 additions & 5 deletions mriqc/qc/diffusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,27 @@
SNR estimated in the Corpus Callosum (``cc_snr``)
Worst-case and best-case signal-to-noise ratio (SNR) within the corpus callosum.
.. _iqms_fa_nans:
Number of not-a-number (NaN) values in the FA map (``fa_nan``)
Fraction of NaNs within the brain mask, in ppm.
.. _iqms_fa_degenerate:
Number of degenerate modeled voxels in the FA map (``fa_degenerate``)
Fraction of invalid FA values (i.e., outside the [0, 1] closed range) within
the brain mask, in ppm.
IQMs relating artifacts and other
---------------------------------
IQMs targeting artifacts that are specific of DWI images.
.. _iqms_spike_percentage:
.. _iqms_spike_ppm:
Global and slice-wise spike percentages (``spike_perc``)
Voxels classified as spikes. The spikes mask is calculated by identifying
voxels with signal intensities exceeding a threshold based on standard
deviations above the mean.
Global and slice-wise spike fractions (``spikes_ppm``)
Fractions of voxels classified as spikes (in parts-per-million, ppm).
The spikes mask is calculated by identifying voxels with signal intensities
exceeding a threshold based on standard deviations above the mean.
"""
from __future__ import annotations
Expand Down

0 comments on commit 2c61618

Please sign in to comment.