Acquire a synthetic block-design run with head motion, interleaved slice timing, scanner drift, thermal noise and spatially correlated physiological noise, then switch each preprocessing stage on and off and watch what it does to the statistics. Two activation foci are planted, one broad and one tight, because most preprocessing decisions are a trade between them. Every stage here is really computed: realignment parameters are estimated by minimising image difference, not read back from the simulation, so you can see how well registration actually recovers the motion you put in.
What each stage is for:
1. Motion Correction (Realignment): Each volume is registered back to the first by searching over rigid-body parameters (here 2 translations and 1 in-plane rotation; a real 3D pipeline estimates 6) for the transform that minimises the sum of squared intensity differences. The correction is then applied by resampling. Realignment is very good, but it is never perfect: interpolation blurs, and spin-history effects mean a moved voxel does not carry the magnetisation it would have had if it had stayed put. Watch the residual figure stay stubbornly non-zero.
2. Motion Regressors: Realignment repositions the images but leaves motion-linked intensity changes behind. Adding the six (here three) estimated parameters to the design matrix as nuisance covariates removes variance that tracks head position. With task-correlated motion this is a double-edged tool: the regressors are correlated with the task regressor, so they soak up real signal along with the artifact, and your peak t falls. There is no setting of this switch that gets you back what the motion destroyed, which is the entire argument for preventing motion at the scanner rather than fixing it afterwards.
3. Slice-Timing Correction: A volume is not an instant. Slices are acquired one at a time across the TR, usually interleaved to limit cross-slice excitation, so a voxel in the last-acquired slice is sampled nearly a whole TR later than one in the first. The GLM assumes every voxel in a volume was sampled at the same moment, so uncorrected slice timing puts a phase error into the design. Correction shifts each slice's time series back to a common reference time by temporal interpolation. This simulation folds the slice axis onto image rows so you can see it, which is a didactic stand-in: in a real acquisition the slice axis runs through-plane.
The choice of interpolator matters more than students expect, and this demo is deliberate about it. Shifting by linear interpolation is easy but it is also a crude temporal low-pass filter: it shrinks the noise variance, inflates tSNR by a quarter or more, and leaves autocorrelation behind, so the t-test that follows is no longer calibrated and false positives climb even though nothing was activated. This demo therefore shifts with a Hann-windowed sinc, the finite-length approximation to the ideal Fourier shift that SPM, FSL and AFNI perform, which leaves tSNR essentially where it found it. Note also that for a block design the payoff from correction is small, because a 20 s block is barely perturbed by a 2 s phase error. Slice timing bites hardest in rapid event-related designs and at long TRs.
4. Spatial Smoothing: Convolving each volume with a Gaussian kernel raises sensitivity when the kernel is matched to the size of the activation (the matched filter theorem), suppresses spatially uncorrelated noise, and makes the smoothness assumptions behind random field theory defensible. The reason this demo plants two foci, one about 18 mm across and one about 9 mm across, is that there is no single kernel that is right for both. Walk the FWHM slider up and watch the two peak-t readouts diverge: the tight focus peaks at roughly 6 mm and then declines, exactly where the matched filter theorem says it should, while the broad focus keeps gaining out to 14 mm and beyond. Whichever you choose, you have chosen against one of them.
Smoothing also costs spatial specificity, which the Foci Resolved readout makes concrete. Below about 8 mm the two foci survive thresholding as two separate clusters. By 12 mm they have fused into one, and the map now reports a single large activation where the truth is two distinct ones, with a peak that sits between them and corresponds to nothing. The false-positive count climbs the same way, from a couple of voxels to several dozen, because smoothing drags suprathreshold signal out into tissue that was never active. A bigger kernel does not create information, it redistributes it.
5. High-Pass Temporal Filtering: Scanner and physiological drift put most of their power below about 0.01 Hz. A discrete cosine basis up to the cutoff frequency is projected out of the data, and out of the design matrix, so that the model and the data are filtered identically. The trap is setting the cutoff too aggressively: drop the cutoff period below roughly twice the block period and the filter starts removing the task response itself. Take the cutoff down to 20 s with a 40 s block cycle and watch the peak t collapse.
6. The noise model: Thermal noise is spatially independent, but most of the noise in a real BOLD run is not: vascular pulsation, respiration-linked field shifts and unmodelled physiology are already spatially smooth before you apply any kernel. That distinction decides how much smoothing can buy you, so this simulation generates both. The structured noise slider adds a field pre-smoothed to about 5 mm FWHM. Set it to zero and the smoothing slider starts producing tSNR figures in the hundreds and t-values that no single run ever yields, which is a useful way to see that a simulation with only white noise will systematically flatter every spatial filter you test in it.
7. What this thresholding does not do: the t-map on the right is thresholded at p < 0.001 uncorrected, which is what makes the false-positive count non-zero even with a clean acquisition. Roughly 0.1% of the null voxels will pass by chance no matter how good your preprocessing is, because that is what a 0.001 threshold means. Correcting for that is a separate problem, taken up in the Whole-Brain Thresholding demo.