Apparatus for generating an organ timing signal relating to an inspected organwithin the body of a patient, including a medical positioning system, and aprocessor coupled with the medical positioning system, the medical positioningsystem including at least one reference electromagnetic transducer placed at areference location, at least one inner electromagnetic transducer attached toa surgical tool inserted in a blood vessel in the vicinity of the inspectedorgan, and a medical positioning system processor coupled with the referenceelectromagnetic transducer and the inner electromagnetic transducer, themedical positioning system processor determining the three-dimensionalposition of the inner electromagnetic transducer, by processing transmittedelectromagnetic signals transmitted from one of the reference electromagnetictransducer and the inner electromagnetic transducer with detectedelectromagnetic signals detected by the other of the reference electromagnetictransducer and the inner electromagnetic transducer, the medical positioningsystem processor further generating medical positioning system data sets, eachof the medical positioning system data sets including a collection of three-dimensional position coordinate readings demonstrating the motion trajectoryof the surgical tool over time, the processor generating the organ timingsignal from the medical positioning system data sets by detecting andidentifying periodic motion frequencies in the medical positioning system datasets, and filtering the periodic motion frequencies from the medicalpositioning system data sets.