Closed LStruber closed 1 year ago
For functional data I added a summary plot showing the slice-wise signal intensity at the extremes for the identification of spikes, the outliers metric, the DVARS, the FD and the carpetplot (as the one used in mriqc, I used the same function from niworkflow). I also added the temporal standard deviation map and average functional image with background enhancement
See https://github.com/populse/mia_processes/commit/ae5c851f553b89645caa44483daac983bb2cd92b
For anat data, I added the image with background enhancement and the brain mask / segmentation / head/ artifact contour.
I also added the qi2_plot, as I obtain the same plot as in mriqc.
For functional data, I added the brain mask contour.
(see (https://github.com/populse/mia_processes/pull/43) )
I think that we have now the same plot as in mriqc, I close this issue.
alej170316_functional_mriqcReport_2023_06_22_10_25_34_42.pdf
alej170316_anatomical_mriqcReport_2023_06_22_11_52_36_90.pdf
Great ! Thanks a lot @manuegrx !
There are several plots that could be drawn from mia MRIQC pipelines (mia_processes.pipelines.preprocess.anat_mriqc_pipeline and mia_processes.pipelines.preprocess.bold_mriqc_pipeline), so as to enhance reports. Those proposed below are taken from original MRIQC workflows of nipreps (https://mriqc.readthedocs.io/en/latest/reports.html#module-mriqc.reports):
General plots
Mosaic plots (axial slices of images)
plot_mosaic(img, out_file=None, ncols=8, title=None, overlay_mask=None, bbox_mask_file=None, only_plot_noise=False, annotate=True, vmin=None, vmax=None, cmap="Greys_r", plot_sagittal=True, fig=None, zmax=128)
https://github.com/nipreps/mriqc/blob/e021008da0a2ef1c48e882baf932139a673349f9/mriqc/viz/utils.py#L265 This should be used with a 3D input image, and with argument only_plot_noise=True for images with “background noise enhancement”example without background noise enhancement:
_example with background noise enhancement:
In the original pipelines these plots are used to present all *.nii images of interest that are not masks or segmentations (original anat, skullstripped anat, anat coregistered to MNI space, average EPI, coregistered EPI, ...)
Mosaic plot + mask contour (contours of masks)
plot_segmentation(anat_file, segmentation, out_file, **kwargs)
https://github.com/nipreps/mriqc/blob/f1c65246b7c2ca1b5f220a7e1c4929a786fe517c/mriqc/viz/utils.py#L550 This should be used with a 3D input image and a mask image or a segmentation image. Note that argument “anat_file” can be a averaged bold for example.example with mask and segmentation:
Anatomical pipeline plots
Histogram plot
plot_qi2(x_grid, ref_pdf, fit_pdf, ref_data, cutoff_idx, out_file=None)
which plots the qi2 histogram of the report. https://github.com/nipreps/mriqc/blob/f1c65246b7c2ca1b5f220a7e1c4929a786fe517c/mriqc/viz/misc.py#L33 This should be used with the histogram_qi2_x_grid, histogram_qi2_ref_pdf, histogram_qi2_fit_pdf, histogram_qi2_ref_data, histogram_qi2_cutoff_idx of the anatomical .json fileexample:
Functional pipeline plots
example:
Spikes plot
spikesplot(tsz, title=name, outer_gs=grid[grid_id], tr=self.tr, zscored=iszs)
which draws the slice-wise signal intensity at the extremes for the identification of spikes https://github.com/nipreps/niworkflows/blob/45ab13e1bf6fdbf5e29c90cef44055b0b9cf391b/niworkflows/viz/plots.py#L364 where tsz is the content of spike file, also stored in functional .json file as “vec_spikes_1”, “vec_spikes_2”, …, “vec_spikes_n”Confounds plot
confoundplot(tseries, grid[grid_id], tr=self.tr, color=palette[i], name=name, **kwargs)
which plot a simple 2D vector https://github.com/nipreps/niworkflows/blob/45ab13e1bf6fdbf5e29c90cef44055b0b9cf391b/niworkflows/viz/plots.py#L538 where tseries is a (counfound) time serie. Three confounds are stored in functional .json file (outliers in %, DVARS, and FD) with names “vec_outliers”, “vec_dvars”, “vec_fd”Voxels carpet plot
plot_carpet (data, segments=None, cmap=None, tr=None, detrend=True, subplot=None, title=None, output_file=None, size=(900, 1200), sort_rows="ward",drop_trs=0,legend=True)
which draws the carpet plot of the functional data https://github.com/nipreps/niworkflows/blob/45ab13e1bf6fdbf5e29c90cef44055b0b9cf391b/niworkflows/viz/plots.py#L141 where data is hmc_epi data (output image of hmc_pipeline.volreg brick) and segments is output of carpetparcellation brick.