Skip to content

Commit

Permalink
enh: add background mosaic
Browse files Browse the repository at this point in the history
  • Loading branch information
oesteban committed May 23, 2023
1 parent 05203d3 commit 1c1fc72
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 48 deletions.
46 changes: 1 addition & 45 deletions mriqc/data/bootstrap-dwi.yml
Expand Up @@ -31,11 +31,6 @@ sections:
- name: Summary
reportlets:
- bids: {datatype: figures, desc: summary, extension: [.html]}
- bids: {datatype: figures, desc: background}
caption: This panel shows a mosaic enhancing the background around the head.
Artifacts usually unveil themselves in the air surrounding the head, where no signal
sources are present.
subtitle: View of the background of the voxel-wise average of the DWI orientations
- name: DWI shells
ordering: bval
reportlets:
Expand All @@ -51,50 +46,11 @@ sections:
such as those intrinsic to SMS parallelization.
subtitle: Voxel-wise standard deviation calculated across volumes in this <em>DWI shell</em>,
zoomed-in covering just the brain
- name: Extended visual report
reportlets:
- bids: {datatype: figures, desc: background}
caption: This panel shows a mosaic enhancing the background around the head.
Artifacts usually unveil themselves in the air surrounding the head, where no signal
sources are present.
subtitle: View of the background of the voxel-wise average of the BOLD timeseries
- bids: {datatype: figures, desc: mean}
subtitle: Average signal through time
caption: The average signal calculated across the last axis (time).
- bids: {datatype: figures, desc: airmask}
caption: The <em>hat</em>-mask calculated internally by MRIQC. Some metrics will use this
mask, for instance, to find out artifacts and estimate the spread of gaussian noise
added to the signal. This mask leaves out the air around the face to avoid measuring
noise sourcing from the eyeballs and their movement.
subtitle: '&laquo;Hat&raquo;-mask'
- bids: {datatype: figures, desc: noisefit}
caption: The noise fit internally estimated by MRIQC to calculate the QI<sub>1</sub> index
proposed by <a href="https://doi.org/10.1002/mrm.21992" target="_blank">Mortamet et al. (2009)</a>.
subtitle: Distribution of the noise within the <em>hat</em> mask
style:
max-width: 450px
- bids: {datatype: figures, desc: artifacts}
caption: Mask of artifactual intensities identified within the <em>hat</em>-mask.
subtitle: Artifactual intensities on the background
- bids: {datatype: figures, desc: brainmask}
caption: Brain mask as internally extracted by MRIQC. Defects on the brainmask could
indicate problematic aspects of the image quality-wise.
subtitle: Brain extraction performance
- bids: {datatype: figures, desc: head}
caption: A mask of the head calculated internally by MRIQC.
subtitle: Head mask
- bids: {datatype: figures, desc: segmentation}
caption: Brain tissue segmentation, as internally extracted by MRIQC.
Defects on this segmentation, as well as noisy tissue labels could
indicate problematic aspects of the image quality-wise.
subtitle: Brain tissue segmentation
- bids: {datatype: figures, desc: norm}
caption: This panel shows a <em>quick-and-dirty</em> nonlinear registration into
the <code>MNI152NLin2009cAsym</code> template accessed with
<a href="https://templateflow.org/browse" target="_blank"><em>TemplateFlow</em></a>.
subtitle: Spatial normalization of the anatomical image
static: false

subtitle: View of the background of the voxel-wise average of this <em>DWI shell</em>

- name: About
nested: true
Expand Down
2 changes: 1 addition & 1 deletion mriqc/reports/individual.py
Expand Up @@ -78,7 +78,7 @@ def _single_report(in_file):
prov["Versions_TemplateFlow"] = config.environment.templateflow_version

bids_meta = config.execution.layout.get_file(in_file).get_metadata()
bids_meta.pop("global")
bids_meta.pop("global", None)

robj = Report(
config.execution.output_dir,
Expand Down
21 changes: 19 additions & 2 deletions mriqc/workflows/diffusion/output.py
Expand Up @@ -96,12 +96,13 @@ def init_dwi_report_wf(name="dwi_report_wf"):
iterfield=["in_file"],
)

mosaic_noise = pe.Node(
mosaic_noise = pe.MapNode(
PlotMosaic(
only_noise=True,
cmap="viridis_r",
),
name="PlotMosaicNoise",
name="mosaic_noise",
iterfield=["in_file"],
)

if config.workflow.species.lower() in ("rat", "mouse"):
Expand Down Expand Up @@ -134,6 +135,18 @@ def init_dwi_report_wf(name="dwi_report_wf"):
iterfield=["in_file", "bval"],
)

ds_report_noise = pe.MapNode(
DerivativesDataSink(
base_directory=reportlets_dir,
desc="background",
datatype="figures",
allowed_entities=("bval",),
),
name="ds_report_noise",
run_without_submitting=True,
iterfield=["in_file", "bval"],
)

def _gen_entity(inlist):
return ["00000"] + [f"{int(round(bval, 0)):05d}" for bval in inlist]

Expand All @@ -143,12 +156,16 @@ def _gen_entity(inlist):
("brainmask", "bbox_mask_file")]),
(inputnode, mosaic_stddev, [("in_stdmap", "in_file"),
("brainmask", "bbox_mask_file")]),
(inputnode, mosaic_noise, [("in_avgmap", "in_file")]),
(inputnode, ds_report_mean, [("name_source", "source_file"),
(("in_shells", _gen_entity), "bval")]),
(inputnode, ds_report_stdev, [("name_source", "source_file"),
(("in_shells", _gen_entity), "bval")]),
(inputnode, ds_report_noise, [("name_source", "source_file"),
(("in_shells", _gen_entity), "bval")]),
(mosaic_mean, ds_report_mean, [("out_file", "in_file")]),
(mosaic_stddev, ds_report_stdev, [("out_file", "in_file")]),
(mosaic_noise, ds_report_noise, [("out_file", "in_file")]),
])
# fmt: on

Expand Down

0 comments on commit 1c1fc72

Please sign in to comment.