Patient body motion limits the delivery accuracy of radiotherapy and creates blurring artefacts on positron emission tomography (PET) images. Those adverse effects can be mitigated by tracking the patient body motion and using the information appropriately. A technique that can track the three-dimensional motion of low-activity positron-emitting fiducial markers was developed. The application of this tracking technique, called PeTrack, for respiratory-gated radiotherapy and for motion-compensated PET imaging was evaluated.The feasibility of respiratory-gated radiotherapy using PeTrack was assessed. A respiratory gating interface was developed in LabVIEW to communicate with an Elekta Precise research linear accelerator and toggle the delivery of the beam. Radiochromic films were placed in a rod insert of an anthropomorphic dynamic thorax phantom to evaluate the dose distribution of the gated and non-gated delivery of a small square beam. A single low-activity source was used to track the motion of the phantom. Real patient breathing data were used as the basis of the motion of the phantom. Visual and quantitative assessments of the films confirmed that respiratory-gated radiotherapy using real-time tracking based on positron-emitting fiducial markers is achievable. The blurring of the dose distribution due to motion was greatly reduced on the gated deliveries compared to the non-gated cases.A modified version of the tracking algorithm was developed to track fiducial markers when high physiological tracer activity from a patient undergoing PET imaging ii is present. Monte Carlo and phantom studies demonstrated that the tracking can achieve submillimetre accuracy and precision. The motion traces from the tracking were used to generated respiratory-gated cardiac PET images. The performance of PeTrack-based gating was compared to the Varian RPM system. PeTrack-based gating captured more motion of the patient and performed similarly to the RPM system.The feasibility of event-by-event motion correction of the raw PET data based on the tracking from PeTrack was also evaluated. Motion-corrected reconstructed images showed reduced motion blurring.The potential for respiratory-gated radiotherapy and motion-compensated PET imaging using PeTrack was demonstrated.iii To Jezamine, my love, my light.