A methodology for 3D image reconstruction from retrospectively gated cone-beam CT projection data has been developed. A mobile x-ray cone-beam device consisting of an isocentric C-arm equipped with a flat panel detector was used to image a moving phantom. Frames for reconstruction were retrospectively selected from complete datasets based on the known rotation of the C-arm and a signal from a respiratory monitor. Different sizes of gating windows were tested. A numerical criterion for blur on the reconstructed image was suggested. The criterion is based on minimization of an Ising energy function, similar to approaches used in image segmentation or restoration. It is shown that this criterion can be used for the determination of the optimal gating window size. Images reconstructed from the retrospectively gated projection sequences using the optimal gating window data showed a significant improvement compared to images reconstructed from the complete projection datasets.