Incidental radiation exposure to the heart during lung cancer radiotherapy is associated with radiation-induced heart disease and increased rates of mortality. By considering the respiratory-induced motion of the heart it is possible to create a radiotherapy plan that results in a lower overall cardiac dose. This approach is challenging using current clinical practices: manual contouring of the heart is time consuming, and subject to inter- and intra-observer variability. In this work, we investigate the feasibility of our previously developed, atlas-based, automatic heart segmentation tool to delineate the heart in four-dimensional x-ray computed tomography (4D-CT) images. We used a dataset comprising 19 patients receiving radiotherapy for lung cancer, with 4D-CT imaging acquired at 10 respiratory phases and with a maximum intensity projection image generated from these. For each patient, one of four experienced radiation oncologists contoured the heart on each respiratory phase image and the maximum intensity image. Automatic segmentation of the heart on these same patient image sets was achieved using a leave-one-out approach, where for each patient the remaining 18 were used as an atlas set. The consistency of the automatic segmentation relative to manual contouring was evaluated using the Dice similarity coefficient (DSC) and mean absolute surface-to-surface distance (MASD). The DSC and MASD are comparable to inter-observer variability in clinically acceptable whole heart delineations (average DSC > 0.93 and average MASD < 2.0 mm in all the respiratory phases). The comparison between automatic and manual delineations on the maximum intensity images produced an overall mean DSC of 0.929 and a mean MASD of 2.07 mm. The automatic, atlas-based segmentation tool produces clinically consistent and robust heart delineations and is easy to implement in the routine care of lung cancer patients.