Purpose: Deep learning-based whole-heart segmentation in coronary computed tomography angiography (CCTA) allows the extraction of quantitative imaging measures for cardiovascular risk prediction. Automatic extraction of these measures in patients undergoing only non-contrast-enhanced CT (NCCT) scanning would be valuable, but defining a manual reference standard that would allow training a deep learning-based method for whole-heart segmentation in NCCT is challenging, if not impossible. In this work, we leverage dual-energy information provided by a dual-layer detector CT scanner to obtain a reference standard in virtual non-contrast (VNC) CT images mimicking NCCT images, and train a three-dimensional (3D) convolutional neural network (CNN) for the segmentation of VNC as well as NCCT images. Methods: Eighteen patients were scanned with and without contrast enhancement on a dual-layer detector CT scanner. Contrast-enhanced acquisitions were reconstructed into a CCTA and a perfectly aligned VNC image. In each CCTA image, manual reference segmentations of the left ventricular (LV) myocardium, LV cavity, right ventricle, left atrium, right atrium, ascending aorta, and pulmonary artery trunk were obtained and propagated to the corresponding VNC image. These VNC images and reference segmentations were used to train 3D CNNs in a sixfold cross-validation for automatic segmentation in either VNC images or NCCT images reconstructed from the non-contrastenhanced acquisition. Automatic segmentation in VNC images was evaluated using the Dice similarity coefficient (DSC) and average symmetric surface distance (ASSD). Automatically determined volumes of the cardiac chambers and LV myocardium in NCCT were compared to reference volumes of the same patient in CCTA by Bland-Altman analysis. An additional independent multivendor multicenter set of single-energy NCCT images from 290 patients was used for qualitative analysis, in which two observers graded segmentations on a five-point scale. Results: Automatic segmentations in VNC images showed good agreement with reference segmentations, with an average DSC of 0.897 AE 0.034 and an average ASSD of 1.42 AE 0.45 mm. Volume differences [95% confidence interval] between automatic NCCT and reference CCTA segmentations were À19 [À67; 30] mL for LV myocardium, À25 [À78; 29] mL for LV cavity, À29 [À73; 14] mL for right ventricle, À20 [À62; 21] mL for left atrium, and À19 [À73; 34] mL for right atrium, respectively. In 214 (74%) NCCT images from the independent multivendor multicenter set, both observers agreed that the automatic segmentation was mostly accurate (grade 3) or better. Conclusion: Our automatic method produced accurate whole-heart segmentations in NCCT images using a CNN trained with VNC images from a dual-layer detector CT scanner. This method might enable quantification of additional cardiac measures from NCCT images for improved cardiovascular risk prediction.