Introduction

Resting-state functional magnetic resonance imaging (rs-fMRI) most recently has proved to open a measureless window on functional neurodevelopment in utero.

Connectivity analysis of fetal brain using rs-fMRI has revealed the existence of intra- and inter-regional functional connectivity (Schöpf et al., 2012; Jakab et al., 2014; Thomason et al., 2013, 2018; Turk et al., 2019; Canini et al., 2020; De Asis-Cruz et al., 2020; and see Jakab, 2019 for a comprehensive review). The most commonly used approaches to measure functional connectivity rely upon the cross-correlation of time-series in regions or voxels in the brain, however, the degree of temporal correlation between signal fluctuations throughout the fetal brain can be heavily influenced by: 1) fetal-specific motion effects on the time-series 2) the accuracy of time-series spatial normalization to a standardized gestational-week specific fetal template space in order to grant time-series extraction from the relevant fetal brain structures from which BOLD signal arises with high tissue probabilities.

Fetal rs-fMRI studies are growing in interest, however, there are still significant limitations with regard to how to accommodate motion in a fetal rs-fMRI time-series (Ferrazzi et al., 2014; Van den Heuvel et al., 2018; Thomason et al., 2018; Van Dijk et al., 2012) and on spatial normalization of the functional time-series to standardized gestational-age specific fetal template spaces (Gholipour et al., 2017; Makropoulos et al., 2018; Rutherford et al., 2021; Turk et al., 2019). There is currently still no consensus on a standardized and generalizable image processing protocol (Jakab et al., 2015; Rutherford et al., 2021; Sobotka et al., 2019; Thomason et al., 2014, 2015, 2017; Tourbier et al., 2017; Wheelock et al., 2019), thus hampering the spread of fetal rs-fMRI investigations and its potential to unravel in a systematic way the early fingerprints of functional neurodevelopment.

A more pragmatic reason for the limited use of resting-state fMRI in fetal imaging in research settings is the lack of fetal rs-fMRI preprocessing routines integrated and complementary to a major fMRI analysis suite, such as SPM (Ashburner & Friston, 2000) (http://www.fil.ion.ucl.ac.uk), the most commonly used MATLAB-based software package for preprocessing and analysis of fMRI data.

In order to face the fetal rs-fMRI data preprocessing endeavor, most researchers are currently forced to build in-house routines or to collate pieces of code extracted from different existing packages (i.e., SPM; FSL, Jenkinson et al., 2012, (https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/); AFNI, Cox, 1996, (https://afni.nimh.nih.gov); CONN, Whitfield-Gabrieli & Nieto-Castanon, 2012 (https://web.conn-toolbox.org); GIFT, Rachakonda et al., 2007 (https://trendscenter.org/software/gift/)) running in multiple software environments in order to cope with the specific characteristics of the fetal rs-fMRI time-series and run through each necessary preprocessing step before moving on to functional connectivity analysis. While customized routines (Seshamani et al., 2016; Rutherford et al., 2021; Thomason et al., 2013; Jakab et al., 2014) can undoubtedly reach the goal, high expertise in programming skills may limit their usability. Furthermore, currently-used customized routines do not seamlessly integrate into the preprocessing workflow of a major fMRI analysis suite such as SPM, weighing down on the replicability of a standardized pipeline generalizable to both single-subject and group-based fetal functional imaging investigations.

Aims

The objective of the present work was to implement a validated fetal rs-fMRI preprocessing pipeline (Canini et al., 2020) as an easy-to-use package for the SPM software. The methodological grounding of each module and usability provided by the package are demonstrated in a quality assurance analysis and a group-based functional connectivity analysis assessing the Default Mode Network (i.e., DMN) on fetal rs-fMRI data.

Aim 1: Movement in Fetal rs-fMRI Time-series

Motion estimation and signal intensity changes in fetal rs-fMRI time-series pose a compelling fMRI image preprocessing challenge (De Blasi et al., 2020; Van Dijk et al., 2012). First, fetal brain rotations and translations are characterized by a large range of motion. Second, fetal rs-fMRI volumes include considerable sources of signal heterogeneity coming from tissue (i.e., maternal abdominal and placental) surrounding the fetal brain. Standard realignment procedures are dependent upon the degree of spatial correspondence between voxels located in univocal structural landmarks in adult brain images over the rs-fMRI time-series (Friston et al., 1996; Power et al., 2015). The fetal brain represents a minimum portion of the whole rs-fMRI image, thus spatial alignment between fetal brain rs-fMRI volumes likely lies upon signal intensities in other maternal structural landmark reference points, which may also resemble BOLD signal intensities arising in the fetal brain hampering, in turn, accurate fetal brain extraction from maternal tissue through segmentation algorithms. Third, the Signal-to-Noise Ratio (SNR) in a fetal rs-fMRI time-series is lower due to larger motion-induced intensity artifacts considerably affecting image quality consistency between different frames in the time-series (Jakab et al., 2015).

Therefore, it is of utmost importance to conceive a specific fetal rs-fMRI time-series preprocessing pipeline able to tailor and deal with specific motion estimation and signal intensity changes to generate clean and valid rs-fMRI datasets for input into single-subject or group-level spatiotemporal analysis of fetal functional brain connectivity.

We present a two-step pass realignment, motion estimation, and scrubbing procedure for rs-fMRI fetal time-series within-session (WS) and between-sessions (BS) which introduces: 1) removal of maternal abdominal tissue through the application of a fetal brain mask that resembles the anatomy and morphology of the fetal brains between 21 and 37 gestational-weeks (GWs) coregistered and reoriented in single-subject native anatomy space. 2) a weighting mask for realignment in order to select only portions of the fMRI volume which include fetal brain structures for optimization of the motion parameter estimation during realignment dealing only with movement between slices and frames relative to the fetal brain and excluding motion and signal induced inconsistencies relative to maternal abdominal tissue. 3) WS fetal brain weighted realignment of all fetal brain-masked functional volumes to a session-specific fetal brain-masked functional reference image and a 1st-pass scrubbing procedure aimed at identifying smaller, derivative movements occurring slowly over time by means of frame-to-mean displacement analyses considering both motion estimation parameters and signal intensity variations.

Frame-to-mean displacement is estimated using the artifact detection toolbox (ART) (https://www.nitrc.org/projects/artifact_detect) with volumes considered outliers if showing a global signal intensity variation exceeding 1.5 STD (with respect to mean global intensity) and/or if showing motion greater than 4 mm in any direction. Outlier volumes at the WS level are automatically 1st-pass scrubbed from the dataset and visual inspection of excluded volumes allows to assess high- or low-order motion displacement and signal intensity variations in order to inspect signal homogeneity in functional time-frames including contiguous volumes (Rutherford et al., 2021). 4) Session-specific fetal inner-brain masks computed directly through segmentation of session-specific functional reference volumes and applied to all functional volumes within each fMRI session in order to refine session-specific fetal brain masking based on information derived from an a priori probability map of GW-specific fetal inner brain space. 5) WS Session-specific masked functional reference volumes realignment and computation of a between-session mean functional masked reference volume in order to create a between-session representative “template” functional volume following within-session specific motion estimation, scrubbing and masking refinement procedures. 6) BS realignment of all session-specific masked functional volumes to the between-session representative “template'' functional volume and a 2nd-pass scrubbing procedure aimed at identifying both (i) smaller, derivative movements occurring slowly over time (best detected by frame-to-mean displacement analyses using the artifact detection toolbox (ART) (see above 1st-pass scrubbing procedure) and also (ii) larger movements occurring suddenly detected by frame-to-frame displacement analyses using frame-to-frame estimates of motion (FD, Power et al., 2012, 2014) and signal intensity (DVARS, Power et al., 2012). BS-realigned session-specific masked functional volumes are deemed between-session outliers if falling over the 75th percentile (plus 1.5 times the interquartile range) of one or both parameters (i.e. FD and DVARS) distributions. Output from the 2nd-pass scrubbing procedure combines multiple motion and signal intensity estimation parameters of fast and slow changes induced by fetal movements across different rs-fMRI time-series in a frame-to-mean/frame-to-frame index based on which outliers are scrubbed between time-series.

This two-step pass realignment, motion estimation, and the scrubbing procedure are optimized for the acquisition of multiple fetal rs-fMRI time-series aimed at reducing the spin “history” effect caused by a significant number of potential changes in the fetal head’s position within each fMRI session and thus limiting the disruption of tissue’s steady-state magnetization and propagation to a minimum number of volumes within each fMRI time-series.

Aim 2: Normalization to Standard Fetal Brain Space and Signal Quality Assurance of Fetal rs-fmri Time-series

Functional connectivity investigations of the fetal brain rely majorly upon the computation of cross-correlation matrices between BOLD signals throughout the fetal brain in order to establish short- (Schöpf et al., 2012) or long- range (Thomason et al., 2013) connectivity strength between pairs of regions of interest (i.e., ROIs).

A key premise to characterize fetal functional networks through solid connectivity metrics is the accuracy of the normalization of single-subject fetal rs-fMRI time-series (i.e., in native anatomy space) to a standard template space in order to allow for juxtaposition of each functional volume and ROI images in a common space. Furthermore, fetal rs-fMRI time-series normalization to a predefined template permits 2nd -level image analysis (i.e., SPM, FSL, AFNI) directly on normalized and smoothed rs-fMRI volumes to derive whole-brain contrast maps of mean rs-functional fetal brain activity allowing for group-level inference on BOLD activation significance or assessment of motion artifact induced effects in terms of displayed brain activation patterns.

Two burdensome features of fMRI fetal brain normalization procedure reside in 1) the rapid structural changes occurring at each successive gestational week (i.e., GW) before at-term birth and thus the need for different fetal GW-specific templates and 2) the extreme difficulty to achieve sufficiently accurate coregistration between rs-fMRI volumes and reconstructed 3D structural images due to consistent resolution discrepancies and spatial deformations in the fetal rs-fMRI images leading to inaccurate estimation and calculation of deformation parameters to warp rs-fMRI images to standard template space after segmentation of a fetal structural image.

We present a “structural-free” SPM-based functional normalization pipeline for rs-fMRI fetal time-series which introduces direct segmentation through SPMs unified segmentation–normalization algorithm (Ashburner & Friston, 2005) of a subject-specific representative “template” functional volume (i.e., M5) using fetal brain CRH MRI atlases (Gholipour et al., 2017) representative of fetal normo-typical anatomy at all key gestational ages. Fetal brain tissue and structure maps in the GW range of 21 to 37 weeks are used as a reference for registration and spatial normalization in order to find the optimal spatial transformation to warp individual subject-specific fetal rs-fMRI time-series (i.e., M6) to GW-specific or group-wise atlas space. Fetal tissue and structure CRH priors are modality-independent probability maps adding great flexibility to the SPM Unified Segmentation approach for the segmentation task of a subject-specific representative “template” functional volume, acquired with a substantially different contrast, targeted at accurate spatial normalization of all rs-fMRI fetal brain images in the time-series.

Materials and Methods

Six Module Pipeline Implementation: M1 to M6

The Resting-State Fetal functional MRI (RS-FetMRI) preprocessing pipeline was developed in MATLAB (version 2013b, The MathWorks Inc., Natick, MA, US) and is based on and designed to work as an extension for Statistical Parametric Mapping (SPM), Version 12 (SPM12). RS-FetMRI is divided into 6 inter-dependent preprocessing modules (i.e., M1 to M6); The RS-FetMRI module layout is illustrated in Fig. 1. Figures S1-S5 show screenshots illustrating the main steps for each RSfetMRI module.

Fig. 1
figure 1

RS-FetMRI Module layout

M1

4D Nifti files containing an arbitrary number of 3D fetal rs-fMRI volumes by session are used as input for M1. 4D-Nifti volumes are then converted to 3D-Nifti volumes. The SPM check registration function is used to choose the “within-session” (WS) reference volume and to reorient the reference and all images pertaining to each session to SPM conventional orientation: 1) the user will select the WS reference volume among 6 volumes automatically chosen to cover and be equally spaced throughout the entire rs-fMRI session; 2) the user will reorient each plane of the volume by adjusting the roll (i.e., y-axis), pitch (i.e., z-axis) and yaw (i.e., x-axis) values in the SPM window until the WS reference volume displays in correct SPM orientation; 3) the user will set the origin on the Anterior Commissure (AC) and apply the transformation matrix, including previously set reorientation parameters and new origin coordinates to all WS rs-fMRI volumes (see Figs. 2 and S1).

Fig. 2
figure 2

Flowchart of M1-RS-FetMRI

M2

M2 initiates the creation of template masks using the ‘Creation_template.m’ custom-built MATLAB function. This function uses WS reference volumes and CRL Fetal Brain Atlas images (CRL-FBA) with GW from 21 to 37 weeks—as input. First, each CRL-FBA image origin is set on the AC and is co-registered iteratively and independently to each session WS reference volume for resampling to the same voxel space and matrix dimension of rs-fMRI volumes. Second, each resampled CRL-FBA image is binarized and smoothed with gaussian kernels ranging from 2 to 8 mms in order to create CRL-FBA binarized images with a 2 mm-smoothing step between atlas masks for each GW (i.e., sm-2, sm-4, sm-6, sm-8). Third, differences in x, y, and z origin coordinates between the WS reference volumes and each atlas mask are calculated in order to translate and rotate atlas mask images for achieving maximum alignment to WS reference volumes. Fourth, SPM check-registration function is prompted for each session displaying the WS reference volume in the top left corner for the current session and all GW sm-2 atlas masks. The user will be addressed to choose a sm-2 mask covering the portion of the WS reference volume including only the fetal brain leaving out abdominal maternal tissue and after selecting a fetal brain mask which resembles the anatomy and morphology of fetal brain, a new SPM window will display the WS reference volume of the current session, the sm-2, sm-4, sm-6, and sm-8 atlas masks in order to select the optimal mask after inspecting full fetal brain coverage brain morphology asymmetries in the x-, y- or z- planes. Session-specific masks will be then created and sequential visualization of each WS reference volume and chosen sm-n atlas mask is displayed.

Fifth, the user is asked to select a weighting mask for realignment among all GW atlas masks in order to constrain WS realignment only to fetal inner-brain voxels and increase the accuracy of motion estimates.

Translation and rotation parameters (i.e., rp files) are automatically read by the ‘art.m’ function (i.e., Artifact Detection Toolbox—ART) in order to scrub volumes showing a global signal intensity variation exceeding 2 STD and motion greater than 4 mm in any direction. A new SPM window will open displaying the reference volume in the top left corner and scrubbed volumes through each session in order to scrub/keep all scrubbed volumes or visually inspect and manually retain/exclude single volumes detected as outliers for each session. A session with less than 1/3 of the original volumes will be automatically removed from the time-series and will not undergo further preprocessing in the following modules (Figs. 3 and S2).

Fig. 3
figure 3

Flowchart of M2- RS-FetMRI

M3

M3 goal is to refine session-specific inner-brain masking. First, the user will be prompted to accurately check atlas mask brain coverage and confirm M2 masking or further select another atlas mask with the “best-fit” fetal brain coverage and rerun the masking procedure only on session-specific reference volume. Second, SPM will prompt for a specific GW value (i.e., a numerical value between 21 and 37) which should refer to the “best-fit” mask previously selected as input for the SPM Unified-Segmentation algorithm in order to derive session-specific inner-brain masks in subjects’ anatomy space based on information on registration with seven “best-fit” GW-specific brain fetal tissue and structure maps created using C1:C7 preprocessed tissue classes (i.e., 1—cortical plate and cerebellum, 2—white matter (WM), 3—cerebrospinal fluid (CSF), 4—deep grey matter (DGM), 5—hippocampus, 6—amygdala, 7—brainstem) generated from Fetal Brain Atlas tissue and regional segmentations (Gholipour et al., 2017), including inner and outer brain space, respectively C8 and C9.

Third, the ‘c9_mask,’ output from SPM segmentation for each session-specific WS reference volume will be inverted (i.e., zeroing all values outside the brain leaving 1 s only for voxels covering subject-specific anatomy within the WS reference) and smoothed with a 2 mm gaussian kernel (i.e., sc9_mask Fourth sequential visualization of each session-specific WS reference volume and relative sc9 mask are displayed in an SPM window and the user is prompted to apply session-specific sc9 masks to all specific volumes in each session. Masked rs-fMRI volumes will have an ‘m’ as a prefix. Fifth, masked session-specific reference volumes are automatically realigned in order to create a mean between-session representative “template” functional volume to be used as the first image for between-session realignment in M4. A final SPM display prompts checking registration between the mean between-session representative “template” functional volume and all reference volumes (Figs. 4 and S3).

Fig. 4
figure 4

Flowchart of M3- RS-FetMRI

M4

M4 starts by prompting choice for between-session (BS) realignment with the “reslicing” option for moving on to single-subject statistical analysis in subjects’ anatomy or without “reslicing” before proceeding to the next modules either for “subject-specific” or “group-based” spatial normalization of all volumes prior entering the group-level statistical analysis. First, the SPM Realign algorithm calculates between-session translation and rotation parameters (i.e., rp files) following realignment to the mean between-session representative “template” functional volume (i.e., Realign to First) and an SPM window will display the between-session realigned masked reference WS volume, representative between-session realigned volumes for each session and the mean between-session representative “template” functional volume for visual inspect and check-registration purposes.

Second, the ‘art.m’ function (i.e., Artifact Detection Toolbox—ART) is run with between-session rp.files in order to scrub volumes showing a global signal intensity variation exceeding 2 STD and motion greater than 5 mm in any direction between-sessions. Next, Frame-to-frame estimation of motion (FD) and signal intensity (DVARS) changes are calculated and concatenated with the ART output for outlier estimation during the 2nd-pass scrubbing procedure.

Third, a new SPM window will open displaying the mean between-session representative “template” functional volume in the top left corner and 2nd-pass between-session scrubbed volumes through each session in order to scrub/keep all scrubbed volumes or visually inspect and manually retain/exclude single volumes detected as outliers for each session. A session with less than 1/3 of the initial number of volumes will be further automatically removed from the time-series and will not undergo further preprocessing in the following modules (Figs. 5 and S4).

Fig. 5
figure 5

Flowchart of M4- RS-FetMRI

M5

M5 starts by prompting the choice for “GW subject-specific” or for “GW median-sample group-based” spatial normalization. First, for the GW subject-specific procedure, the user is asked to insert the specific GW value (i.e., a numerical value between 21 and 37) corresponding to the gestational week of the fetus at rs-fMRI time-series acquisition. For GW median-sample group-based procedure, the user is asked to insert the specific GW value (i.e., a numerical value between 21 and 37) corresponding to the median gestational week of the entire sample of fetuses at rs-fMRI time-series acquisition and considered for group-level statistical analysis.

Second, SPMs’ unified segmentation–normalization algorithm will 1) derive a between-session representative “template” functional mask with the same procedure outlined for M3; 2) calculate deformation parameters based on spatial registration with specific brain fetal tissue and structure maps created using C1:C7 preprocessed tissue classes (i.e., 1—cortical plate and cerebellum, 2—white matter (WM), 3—cerebrospinal fluid (CSF), 4—deep grey matter (DGM), 5—hippocampus, 6—amygdala, 7—brainstem) generated from Fetal Brain Atlas tissue and regional segmentations (Gholipour et al., 2017) and inner and outer brain space maps (i.e. C8 and C9) in order to find the optimal spatial transformation to warp the between-session representative “template” functional volume to GW subject-specific or median-sample group-based atlas space. The SPM check-registration function will prompt 1) the between-session representative “template” functional volume and corresponding ‘sc9_mask’ followed by 2) between-session representative “template” functional volume spatially normalized to GW subject-specific or median-sample group-based atlas space and the corresponding CRL Fetal Brain Atlas images (CRL-FBA) – GW 21 through 37 (Figs. 6 and S5).

Fig. 6
figure 6

Flowchart of M5- RS-FetMRI

M6

In M6, 1) the between-session representative “template” functional ‘sc9_mask’ is applied to all M4 output volumes through each session; 2) deformation parameters are applied to between-session masked functional volumes from 1) in order to warp all volumes in the rs-fMRI time-series to GW subject-specific or median-sample group-based atlas space; 3) normalized between-session masked volumes (i.e., w*. images) are smoothed (FWHM = 4) in order to compensate for imperfect registration residuals, inter-subject variability in fetal brain anatomy and to increase the signal-to-noise ratio in very limited structural space using a small filter size (i.e., 4 mm). At the end of module 6, a 4D-Nifti file is created by merging all normalized and smoothed volumes (i.e., sw*.nii images) from all sessions and the entire preprocessed rs-fMRI time-series is displayed in SPM movie mode (Figs. 7 and S5).

Fig. 7
figure 7

Flowchart of M6- RS-FetMRI

Subjects

A sample of 56 fetuses (GW median = 30.8, min GW = 21.3, max GW = 36.3) (see Fig. 8 below) consisting of 28 fetal scans acquired with a 1.5 T scanning system (median GW = 32.5; min GW = 26, max GW = 36.3) and 28 fetal scans acquired with a 3 T scanning system (min GW = 21.3, max GW = 33.9, median = 28.4) were included in this study (Fig. 8) (see Table S1 in Supplementary Material). All pregnant women were recruited at San Raffaele Hospital in Milan, Italy and none of them shows any sign of fetal neurodevelopmental abnormality. Sample inclusion criteria were: a) full coverage of gestational weeks (i.e. 21 to 36 GW) in the fetal period before 37 weeks of pregnancy are completed (i.e. premature birth) (World Health Organization – WHO) b) no sign of fetal neurodevelopmental abnormality nor brain parenchymal signal alterations acknowledged by a specialized neuroradiologist (CB) by means of structural MRI investigation c) cephalic presentation at scan. The study protocol was approved by the Ethics Committee of the San Raffaele Hospital and all women provided written informed consent prior to MRI examination. Furthermore 21 fetal scans pooled from the OpenNeuro.org open-source public dataset (https://openneuro.org/datasets/ds003090) were used for validation of automatic masking step output at the M3 module of the RS-fetMRI pipeline.

Fig. 8
figure 8

Scatter plot of all of the subjects (1.5 and 3 T) processed using the RS-FetMRI

Rs-fMRI Image Acquisition

1.5  T MRI

Fetal MR scanning was performed on a Philips Achieva 1.5 T scanner, using a 16-channels body coil. Functional scans (rs-fMRI) consisted of GE EPI scans (TR = 2000 ms, TE = 30 ms, acquisition voxel size 2.81 × 2.86 × 3 mm, # slices = 25, slice gap = 0). Each rs-fMRI scan consisted of 60 volumes lasting 2 s each, for a total scanning time of 2 min per scan. Four to 8 consecutive rs-fMRI sessions (i.e., 240–480 scans, covering from 8 to 16 min of continuous brain activity at rest) (Van Dijk et al., 2010) were acquired for each subject depending on the quality of the scans.

3 T MRI

Fetal MR scanning was performed on a Philips Intera 3 T scanner, using two 16-channel body coils forming an abdominal cage. Functional scans (rs-fMRI) consisted of GE EPI scans (TR = 2000 ms, TE = 30 ms, acquisition voxel size 2.25 × 2.25 × 3 mm, # slices = 28, slice gap = 0). Each rs-fMRI scan consisted of 60 volumes lasting 2 s each, for a total scanning time of 2 min per scan. Four to 8 consecutive rs-fMRI sessions (i.e., 240–480 scans, covering from 8 to 16 min of continuous brain activity at rest) (Van Dijk et al., 2010) were acquired for each subject depending on the quality of the scans.

Processing and Analysis

The RS-FetMRI preprocessing pipeline presented in this study and a RS-FetMRI-without preprocessing pipeline considered as a baseline fetal rs-fMRI preprocessing pipeline not including a) session-specific masking (WS-3); b) tissue-weighting mask during 1st-pass realignment (WS-4); c) automatic visual inspection and retention/exclusion of scrubbed volumes (WS-5); d) session-specific masking and segmentation of functional reference volumes (WS-6/7) at the Within-Session level (WS) and without e) realignment of session-specific masked functional reference scans and tissue-weighted masking (BS-1); f) between-session mean functional reference volume calculation on session-specific masked functional reference scans (BS-2); g) 2nd-pass realignment of all session-specific masked functional volumes (BS-3) h) automatic visual inspection and retention/exclusion of between-session scrubbed volumes (BS-4) at the Between-Session level (BS) were compared. Figure 9 summarises the two preprocessing pipelines.

Fig. 9
figure 9

Summary of the RS-FetMRI-without (top) and the RS-FetMRI (bottom) preprocessing pipelines. Arrows next to the rectangular boxes highlight specific steps introduced in the RS-FetMRI pipeline as compared to a basic preprocessing pipeline (i.e., RS-FetMRI-without)

The RS-FetMRI and RS-FetMRI-without were run on resting-state fetal fMRI time-series for all subjects (n = 56) across both samples (1.5 T MRI sample: n = 28; 3 T MRI sample: n = 28), using Matlab 13 and SPM 12 software (https://www.fil.ion.ucl.ac.uk/spm/). All statistical analyses were carried out using Statistical Package for Social Science (IBM SPSS Statistics 25) concerning pipeline performance on the metrics for movement and signal quality assurance.

Pipeline Performance Metrics for Movement (1.5 T MRI Sample)

  1. (i)

    To quantify rigid body correction of head motion (Jenkinson et al., 2002) for each pipeline at the WS level, the Root-Mean-Square (RMS) and the absolute value of the Euler Angle (EA) were computed for each session respectively from the translation and rotation parameters in the x (left/right), y (anterior/posterior), and z (superior/inferior) directions independently and averaged over sessions.

  2. (ii)

    To quantify the ability of each pipeline to remove motion artifacts at the BS level, DVARS (root mean square intensity difference of volumes N and N + 1) was calculated for every subject. The mean DVARS values were then computed for each subject and pipeline.

  3. (iii)

    To quantify the ability of each pipeline to remove motion outlier volumes from the time-series after the two-step pass realignment, motion estimation and scrubbing procedure the percentage of 1st-pass scrubbed volumes, 2nd–pass scrubbed volumes and the number of total survived volumes were calculated for every subject.

  4. (iv)

    To quantify the total rs-fMRI time-series duration of each final preprocessed dataset the number of final survived volumes was multiplied by TR duration (i.e., 2 secs). The total duration in seconds was then converted into minutes.

RSfetMRI masking procedure validation (OpenNeuro.org dataset)

In addition, the masking procedure implemented in the RSfetMRI pipeline through the masking steps included in M1, M2, and M3 modules was externally validated on a total of 117 fetal volumes (n = 21 subjects) by quantifying the degree of overlap between fetal inner-brain volume masks resulting from RSfetMRI pipeline masking procedure with inner-brain masks manually drawn on the volumes (OpenNeuro.org dataset https://openneuro.org/datasets/ds003090). For each of the 21 subjects masks were both a) manually coregistered to their reference volume and b) for each volume the RS-FetMRI pipeline was run through M1, M2, and M3 in order to semi-automatically generate volume-specific inner-brain masks. Sørensen Dice Similarity Coefficients were used to evaluate the degree of overlap between manually drawn and RSfetMRI-M3 binary masks for each volume, after application of M2 reorientation matrix parameters to manually drawn masks for juxtaposition in the same matrix space.

Pipeline Performance Metrics for Normalization and Signal Quality Assurance

Normalization (1.5 T and 3 T MRI Samples)

In order to quantify the spatial overlap between the normalized fetal functional brain volumes and fetal atlases following spatial normalization to a) single-subject GW-specific atlas space or b) to the median sample GW atlas space (i.e., 31 GW) (see Fig. 12) and the Sørensen-Dice Similarity Coefficient (S-DSC) was calculated.

Signal Quality Assurance: Temporal Signal-to-Noise Ratio (1.5 T MRI Sample)

Temporal Signal-to-Noise Ratio (TSNR) was computed for each pipeline and used as a metric of pipeline performance in terms of variability in the signal of interest, as data pre-processing should remove sources of noise, in turn, decreasing signal fluctuations around the mean (i.e., low values identify subjects with high head motion or data instability due to spatial normalization).

For each pipeline and corresponding single-subject final rs-fMRI dataset, TSNR values were voxel-wise calculated by dividing the mean signal over time by the SD over time from all normalized and smoothed volumes and extracted within whole-brain GM at the individual level in subject-specific GW template space using dbapi (Jakab et al., 2015, http://rfmri.org/content/dpabi) and within L and R Thalamus, L and R Subthalamic Nucleus, L and R Caudate Nucleus, L and R Lentiform Nucleus, L and R Hippocampus, L and R Amygdala, L and R Cortical Plate, L and R Cerebellum and Brainstem parcellations in the median sample GW space (i.e., 33 GW) (Canini et al., 2020; Gholipour et al., 2017) using marsbar (Brett et al., 2002, http://marsbar.sourceforge.net).

Single-Subject whole-brain TSNR Differential Maps (TSNR-DM) in subject-specific GW template space were calculated as the TSNR maps difference between the two pipelines (i.e., RS-FetMRI minus RS-FetMRI-without) and deformation parameters were applied to single-subject TSNR-DMs for spatial normalization to the median sample GW space (i.e., 33 GW). A median-sample normalized TSNR-DM average was then calculated for each pipeline and a normalized TSNR-DM whole-brain mean image was finally computed by subtracting normalized TSNR-DMs between the two pipelines (i.e., RS-FetMRI minus RS-FetMRI-without).

Default Mode Network “Group-based” Fetal Functional Connectivity (1.5 T and 3 T MRI Samples)

RS-FetMRI-pipeline group-normalized and smoothed rs-fMRI volumes only for all subjects were entered in the CONN functional connectivity toolbox (Whitfield-Gabrieli & Nieto Castanon, 2012) ver. 19.b in order to test the ability of the RS-FetMRI-pipeline to identify prototypical patterns of fetal posterior DMN seed-to-voxel connectivity using CONN.

At the first, single-subject level, the signal was extracted from a Posterior Cingulate Cortex (PCC) parcellation defined bilaterally on the median-sample 33 GW (1.5 T sample) and 28 GW (3 T sample) template images (Gholipour et al., 2017). Principal components of WM and CSF and whole-brain signal were estimated using the anatomical component correction (aCompCor) (Behzadi et al., 2007) and regressed out from 1st level analysis. Signal was temporally filtered to retain frequencies in the 0.01 to 0.08 Hz range, in which intrinsic functional connectivity has been previously reported to occur consistently (Van Dijk et al., 2010). Bivariate Pearson correlations were then calculated between the time-series (TS) extracted from the PCC seed and the TS of every other voxel in the brain. Furthermore, in order to exclude residual non-brain voxels, first-level connectivity maps investigation was spatially constrained using the 33 and 28 GW template image as an explicit, inclusive mask for 1.5 T and 3 T samples respectively. Connectivity maps between the PCC seed and the whole-brain of each subject were then entered into second-level, random-effects modeling for group comparisons. Maps were tested for positive unconstrained increases in connectivity. Results were deemed significant only if reaching significance at the p = 0.05 FWE (voxel-level).

Results

Pipeline Performance Metrics for Movement (1.5 T MRI Sample)

  1. (i)

    Table 1 shows RMS and EA mean and standard deviation values for the RS-FetMRI and RS-FetMRI-without pipelines at the WS level. Mean RMS and EA values were lower for RS-FetMRI-without. Statistical comparison, using the Wilcoxon signed-rank test for paired samples, showed a trend for RMS (P = 0.03) and a significant difference between EA values (P < 0.001).

  2. (ii)

    Table 1 shows DVARS mean and standard deviation values for the RS-FetMRI and RS-FetMRI-without pipelines at the BS level. The statistical comparison revealed lower DVARS values (Wilcoxon signed-rank test for paired samples, P = 0.179) for the RS-FetMRI pipeline.

  3. (iii)

    Fig. 10 displays a percentage of the 1st-pass scrubbed volumes, 2nd–pass scrubbed volumes and the number of survived functional volumes on the total number of volumes considered in input to each pipeline across all sessions after motion estimation and a collapsed bar graph summary with the mean and standard deviation of number of 1st-pass scrubbed volumes, 2.nd–pass scrubbed volumes and the number of survived functional volumes (see Table S2 in Supplementary Material). The number of volumes surviving after the two-step pass realignment, motion estimation, and scrubbing procedure was significantly different between the RS-FetMRI (mean number of volumes: 292.10 ± 62.64) and RS-FetMRI-without (mean number of volumes: 254.82 ± 61.21) pipelines (Wilcoxon signed-rank test for paired samples, P = 0.001)

  4. (iv)

    Total rs-fMRI time-series duration was significantly longer (Wilcoxon signed-rank test for paired samples, P = 0.001) for the RS-FetMRI (mean duration = 9.73 ± 2.08 min) compared to RS-FetMRI-without (mean duration = 8.49 ± 2.03 min). Mean percentages of N + 3 (63.3% ± 13.7%), N + 4 (54.7% ± 13.4), N + 5 (47.9% ± 14.0) contiguous volumes in the time-series for the RS-FetMRI were also computed showing that at least 66% of the functional time-frame contiguity exceeds criteria of minimum 3 consecutive volumes; at least 57% of the functional time-frame contiguity exceeds criteria of minimum 4 consecutive volumes; at least 50% of the functional time-frame contiguity exceeds criteria of minimum 5 consecutive volumes after the two-step pass realignment, motion estimation and scrubbing procedure. 

Table 1 RMS and EA mean and standard deviation values are reported at the WS level and DVARS mean and standard deviation values are reported at the BS level for the RS-FetMRI and RS-FetMRI-without pipelines
Fig. 10
figure 10

The graph on the left illustrates the percentage of survived volumes after the 1st-pass and 2nd-pass scrubbing procedures and the percentage of final volumes with respect to the initial number of volumes. The paired collapsed bar graphs show the number of survived volumes after the 1st-pass and 2nd-pass scrubbing procedures and the total number of final volumes for the RS-FetMRI (left-bar) and RS-FetMRI-without (right-bar)

RSfetMRI Masking Procedure Validation (OpenNeuro.org dataset)

A Sørensen Dice Similarity Coefficient of 88.0% ± 4.4% was obtained using 117 resting-state fetal volume masks between manually drawn and RSfetMRI-M3 binary masks (Fig. 11).

Fig. 11
figure 11

Visual comparison of RSfetMRI-M3 and Manual Mask for three fetuses. Fetal volumes represent the reference image for M3 input. Green (Manual Mask) and blue (Automatic Mask) masks represent the RSfetMRI-M3 and Manual Mask respectively while the last column shows the overlap between the two masks (light green)

Pipeline Performance Metrics for Normalization and Signal Quality Assurance

Normalization (1.5 T and 3 T MRI Samples)

Figure 12 displays the spatial overlap in axial view of the a) GW “subject-specific” atlas images overlaid on single-subject between-session representative “template” functional spatially normalized volumes to GW “subject-specific” atlas space for the min–max (i.e., 26–36 GW) and median (i.e., 33 GW) for 1.5 T sample and for the min–max (i.e., 21–34 GW) and median (i.e., 28 GW) of 3 T points of the GW sample distribution (i.e., upper panel) and b) the “group-based” GW atlas image for both of the sample (i.e., 28 and 33 GW) overlaid on single-subject between-session representative “template” functional spatially normalized volumes to “group-based” atlas space for min–max of both samples (i.e., 26–36 and 21–34 GW) points of the GW sample distribution (i.e., bottom panel, left–right) and corresponding slices of the median-sample GW atlas image (i.e., bottom panel, center) (Z coordinate, from top left to bottom right for the 1.5 T: -24, -18. -7, 2, 10, 21, 32, 38 and from top left to bottom right for the 3 T: -18. -8, -2, 3, 10, 15, 21, 32).

Sørensen Dice Similarity Coefficients of 0.91, 0.90 and 0.93 were obtained respectively for 1.5 T “subject-specific” spatial normalization of min (i.e., 21 GW), max (i.e., 36 GW) and median (i.e., 33 GW) and 0.87, 0.93 and 0.93 for 3 T “subject-specific” spatial normalization of min (i.e., 21 GW), max (i.e., 36 GW) and median (i.e., 33 GW) between the single-subject between-session representative “template” functional volumes to binarized GW-specific atlas images. An average S-DSC of 0.91 was obtained for “group-based” spatial normalization of single-subject between-session representative “template” functional volumes to the median 1.5 T sample GW and 3 T sample GW atlas image (i.e., 33 and 28 GW).

Fig. 12
figure 12

Normalization to subject-specific (upper row) and group (lower row) template space of a 26 (left), 33 (middle) and a 36 (right) GW scan (upper panel, 1.5 T MRI sample) and of a 21 (left), 28 (middle) and a 34 (right) GW scan (lower panel, 3 T MRI sample). Black contour lines highlight overlapping brain landmarks of between-session representative “template” functional brain volumes spatially warped to GW-subject specific and group-based atlases

Signal Quality Assurance: Temporal Signal-to-Noise Ratio (1.5 T MRI Sample)

A higher TSNR mean value was observed in whole-brain GM for the RS-FetMRI (9.73 ± 3.32) with respect to the RS-FetMRI-without (8.85 ± 2.73) pipeline for GW “subject-specific” spatial normalization.

Figure 13 displays instead “group-based” normalized TSNR-DM including voxel-wise differential values averaged over all subjects showing positive (i.e., hot color map) and negative (i.e., cold color map) TSNR differences in whole-brain GM between the two pipelines (i.e., RS-FetMRI minus RS-FetMRI-without). Parcellation-specific TSNR values extracted from “group-based” normalized TSNR maps were significantly different between the two pipelines (Wilcoxon signed-rank test for paired samples, P = 0.001), revealing an average TSNR increase for the RS-FetMRI pipeline across all parcellations. (See Supplementary Table S3 for parcellation-specific mean and standard deviation TSNR values).

Fig. 13
figure 13

TSNR Differential Map (i.e., RS-FetMRI minus RS-FetMRI-without). The color-scale ranges from -1.75 (negative max TSNR difference) to 3.61 (i.e., positive max TSNR difference)

DMN “Group-based” Fetal Functional Connectivity (1.5 T and 3 T MRI Samples)

DMN group-based PCC seed-to-voxel functional connectivity was observed throughout the posterior default-mode network extending to parietal cortices bilaterally and posteriorly (see Fig. 14) in both the 1.5 T MRI and 3 T MRI samples. For median GW templates specific to each sample (i.e. 28 and 33), right and left brain meshes were reconstructed from the original nifti template. Thresholded SPM-T group functional connectivity maps were superimposed on 3D rendered surfaces of median GW template meshes using BrainNet tool (https://www.nitrc.org/projects/bnv) and thresholded SPM-T group functional connectivity maps at FWE p = 0.05 voxel-wise correction displayed on sagittal fetal template slices (i.e., 33 GW for 1.5 T and 28 for 3 T) using bspmview(https://www.bobspunt.com/software/bspmview/) are shown in Fig. 14.

Fig. 14
figure 14

Thresholded SPM-T group functional connectivity maps superimposed on a 3D surface rendering of the median-sample GW atlas image (i.e., 33 GW for 1.5 T and 28 for 3 T) (i.e., upper row) and displayed on sagittal median-sample GW atlas slices (bottom row) for the 1.5 T MRI sample (i.e., upper panel) and the 3 T MRI sample (i.e. lower panel)

Discussion

Advances in fetal rs-fMRI have proved to open a measureless window on functional neurodevelopment in utero. Time-series analysis of fetal rs-fMRI has made it possible to measure spontaneous activity in the fetal brain and to cross-correlate functional signals to attain information about neural connectional architecture across human gestation. Although many studies have been developed in the area of fetal rs-fMRI there is currently no consensus on a standardized and generalizable processing pipeline. The lack of a standard and easy-to-use pipeline leads to i) non-standard statistical results making the studies comparison not fully reliable, ii) an obstacle for research groups in initiating studies in the area of fetal imaging.

To accomplish these points, we focused the RS-FetMRI preprocessing pipeline development on creating an effective and easy to use package completely integrated into SPM (Statistical Parametric Mapping) suitable for both single subject and group-based analyses and that can be used for both 1.5 T and 3 T scanners. The goal of RS-FetMRI preprocessing pipeline was twofold 1) detect and account for fetal-specific motion effects and signal intensity variations and 2) introduce a “structural-free” SPM-based functional normalization pipeline for spatial normalization of rs-fMRI fetal time-series to standardized gestational-week specific fetal template space with a high degree of spatial overlap.

Aim 1: Movement in Fetal rs-fMRI Time-series

The first objective of this study was to develop a specific fetal rs-fMRI processing pipeline able to deal with specific motion estimation and signal intensity changes due to fetal brain movement in a semi-automatic way. In the functional fetal scans the fetal brain represents a minimum portion of the rs-fMRI volume, thus spatial realignment between functional scans likely lies on signal intensities in other maternal structural landmarks.

To reach this goal, in M2 we introduce a 1st-pass masking step with a Gestational-Week session-specific mask in order to remove the majority of the maternal abdominal tissue, added with a binary tissue-weighting mask which binds motion estimation only to inner-brain portions of the fetal brain during the within-session realignment step. The usage of the binary tissue-weighting mask in the realignment algorithm showed a more sensitive and efficient method in detecting high and low-order fetal brain motion displacement entirely within the fetal brain, excluding neighboring motion-induced signal intensity variations residing in maternal abdominal tissue from calculation of motion estimation parameters. The combination of session-specific 1st-pass masking scans with tissue-weighting masking significantly increased the efficacy of the within session realignment step to estimate translations (i.e., higher RMS) and rotations (i.e., higher EA) due solely to fetal brain displacements which in turn transfers to M4 with lower DVARS values at the between-session level, following session-specific functional inner-brain mask refinement based on information derived from an a priori probability map of GW-specific fetal inner brain space, implemented in M3. Furthermore, the degree of overlap between manually drawn inner-brain masks and RSfetMRI-M3 binary masks computed from functional volumes included in the OpenNeuro.org dataset was substantial, providing further external validation to the RSfetMRI masking procedure performed through M2-M3 steps (see also Supplementary Figures S6S7 for M2-M3 masking procedure exemplar outputs).

The two-pass realignment procedure is mirrored by a 1st-pass scrubbing in M2 based on scan-to-scan global signal changes and scan-to-scan head-motion composite changes within each session detected through ART based on motion estimation during the realignment step followed by a 2nd-pass scrubbing in M4 integrating ART outlier information with a more robust measure of motion (i.e., FD and DVARS) able to detect larger between-session displacements likely resulting from rapid alternations (i.e., 1–2 min) between fetal movement and inactivity occurring throughout time-series acquisition.

The total number of volumes surviving after M2, M3 and M4 preprocessing steps was significantly higher and the total rs-fMRI time-series duration was significantly longer ensuring that the RS-FetMRI pipeline preserves data quantity by balancing an efficacious estimation of the degree of movement with an efficient motion censoring procedure maintaining high temporal continuity in fetal rs-fMRI time-series data, thus reducing the bias in functional connectivity results.

Aim 2: Normalization to Standard Fetal Brain Space and Signal Quality Assurance of Fetal rs-fMRI Time-series

The second aim of this study was to improve the functional rs-fMRI scans normalization to a standardized GW-specific fetal template space for both GW subject-specific and GW median-sample group spatial warping to atlas space. Normalization to a standard and specific template allows time-series extraction from the relevant fetal brain structures from which BOLD signal arises with high tissue probabilities and with a substantial degree of spatial overlap between specific fetal brain anatomy and standard fetal brain space for a specific gestational week. Although fetal rs-fMRI studies are advancing, there are still significant barriers to spatial normalization to standard fetal space and the majority of the studies normalize their rs-fMRI scans to a variety of standard templates (Van Den Heuvel et al., 2018; Thomason et al., 2013, 2014, 2015, 2017, 2018; Turk et al., 2019; Wheelock et al., 2019). The RS-FetMRI pipeline integrates information derived from the CRL Fetal Brain Atlas images – GW 21 through 37- (Gholipour et al., 2017; https://form.jotform.com/91364382958166) and lies upon GW-specific fetal tissue class probability maps and inner and outer brain space maps computed from each GW atlas image for spatial registration estimation between a “template” functional volume representative of the rs-fMRI time-series in M5 and for warping all functional volumes in the time-series to atlas space in M6, with a very high degree of spatial overlap as evidenced by S-DSC coefficients for both GW subject-specific and GW median-sample group-based spatial normalization procedure for both 1.5 T and 3 T samples (see Fig. 12). Furthermore, in most common preprocessing pipelines spatial normalization of functional rs-fMRI is accomplished through structural scans. Structural fetal information is usually acquired through multiple 2D scans. Volumetric reconstruction of single-plane 2D images into a 3D structural volume is complex to achieve due to maternal abdominal tissue surrounding the fetal brain and bias field inhomogeneities in fetal structural scans, requiring thus custom-built tool packages.

We have introduced here a “structural-free” SPM-based functional normalization pipeline that grants spatial overlap accuracy between rs-fMRI fetal volumes and standard fetal atlas images allowing to i) reduce the acquisition and processing time due to reconstruction and preprocessing of the structural image, ii) avoid co-registration between rs-fMRI reference volumes and the structural scan and further segmentation of the structural scan iii) to avoid warping failures due to the extreme inconsistencies and discrepancies between signal intensities in the structural fetal scan and the rs-fMRI functional images iv) to work exclusively on rs-fMRI scans.

As stated previously, TSNR can be regarded as an index of pipeline performance. Whole-brain GM TSNR resulted higher in the RS-FetMRI processing pipeline (Fig. 13) and the differential TSNR map highlights a substantial signal quality improvement following RS-FetMRI preprocessing throughout all brain areas mirrored by an average significant TSNR increase for the RS-FetMRI pipeline across the different brain parcellations. The significant improvement observed in the whole-brain and parcellation-specific TSNR pipeline performance analysis was mirrored by functional connectivity analysis showing a significant group DMN pattern of brain connectivity at a very stringent voxel-wise wise threshold in the 1.5 T MRI comparable to the posterior DMN functional connectivity pattern highlighted for the 3 T MRI sample with a lower median-sample GW.

Conclusions

Our results revealed the ability of the RS-FetMRI modular pipeline to deal with rs-fMRI fetal data movements and normalization process with high reproducibility and efficacy leading to elevated final volume number and TSNR with a time-saving approach. To our knowledge, the RS-FetMRI pipeline is 1) the first semi-automatic standardized processing pipeline completely integrated into MATLAB-SPM, 2) the first user-friendly and easy-to-use pipeline for processing fetal rs-fMRI data, allowing the user to start and finish the whole processing within the same environment without any dependencies on other different image processing packages and software (i.e., FSL, AFNI), thus drastically reducing fetal rs-fMRI time-series preprocessing time and enhancing ecology.

The RS-FetMRI preprocessing package is suitable for a large pool of users, from beginners to experts, although basic technical knowledge of fetal functional image processing is required. For each module visual inspection through the SPM display window is automatically prompted at key stages of processing, thus increasing usability. The RS-FetMRI package can process rs-fMRI fetal data images in Nifti format from any MR scanner manufacturer for both 1.5 T and 3 T without the need for a structural fetal scan. It can be used with single and multiple functional rs-fMRI sessions and for both single subjects as well as group-level statistical analysis.

In conclusion, we are strongly convinced that RS-FetMRI could remove entry barriers for new research groups in the field of rs-functional fetal MRI, by providing a practical, comprehensive, and standardized preprocessing tool fostering both group and single case studies. This, we believe, will provide a major contribution to encouraging research on prenatal normotypical and deviant neurodevelopment as well as in making future investigations more suitable for comparison.

Information Sharing Statement

RS-FetMRI package uses SPM-12 (http://www.fil.ion.ucl.ac.uk) and artifact detection toolbox (ART) (https://www.nitrc.org/projects/artifact_detect), within the Matlab2013 environment (https://it.mathworks.com). TSNR values were calculated using the dbapi package (http://rfmri.org/content/dpabi) and the marsbar package (http://marsbar.sourceforge.net). The CONN software (https://web.conn-toolbox.org) was used for functional connectivity analyses. The CRL Fetal Brain Atlas images – GW 21 through 37 – can be downloaded at http://crl.med.harvard.edu/research/fetal_brain_atlas/.