  Despite advances in data augmentation and transfer learning, convolutional
neural networks (CNNs) difficultly generalise to unseen domains. When
segmenting brain scans, CNNs are highly sensitive to changes in resolution and
contrast: even within the same MRI modality, performance can decrease across
datasets. Here we introduce SynthSeg, the first segmentation CNN robust against
changes in contrast and resolution. SynthSeg is trained with synthetic data
sampled from a generative model conditioned on segmentations. Crucially, we
adopt a domain randomisation strategy where we fully randomise the contrast and
resolution of the synthetic training data. Consequently, SynthSeg can segment
real scans from a wide range of target domains without retraining or
fine-tuning, which enables straightforward analysis of huge amounts of
heterogeneous clinical data. Because SynthSeg only requires segmentations to be
trained (no images), it can learn from labels obtained by automated methods on
diverse populations (e.g., ageing and diseased), thus achieving robustness to a
wide range of morphological variability. We demonstrate SynthSeg on 5,000 scans
of six modalities (including CT) and ten resolutions, where it exhibits
unparalleled generalisation compared with supervised CNNs, state-of-the-art
domain adaptation, and Bayesian segmentation. Finally, we demonstrate the
generalisability of SynthSeg by applying it to cardiac MRI and CT scans.
