The goal of our study was to develop a computational framework for reconstruction of four-dimensional computed tomography (4D-CT) images during treatment time using electronic portal imaging device (EPID) images based on a dynamic 2D/3D registration. The 4D-CT images during treatment time ("treatment" 4D-CT images) were reconstructed by performing an affine transformation-based dynamic 2D/3D registration between dynamic clinical portal dose images (PDIs) derived from the EPID images with planning CT images through planning PDIs for all frames. Elements of the affine transformation matrices (transformation parameters) were optimized using a Levenberg-Marquardt (LM) algorithm so that the planning PDIs could be similar to the dynamic clinical PDIs for all frames. Initial transformation parameters in each frame should be determined for finding optimum transformation parameters in the LM algorithm. In this study, the optimum transformation parameters in a frame employed as the initial transformation parameters for optimizing the transformation parameter in the consecutive frame. Gamma pass rates (3 mm/3%) were calculated for evaluating a similarity of the dose distributions between the dynamic clinical PDIs and "treatment" PDIs, which were calculated from "treatment" 4D-CT images, for all frames. The framework was applied to eight lung cancer patients who were treated with stereotactic body radiation therapy (SBRT). A mean of the average gamma pass rates between the dynamic clinical PDIs and the "treatment" PDIs for all frames was 98.3±1.2% for eight cases. In conclusion, the proposed framework makes it possible to dynamically monitor patients' movement during treatment time.