Apparatus for generating an organ timing signal relating to an inspected organ within the body of a patient, including a medical positioning system, and a processor The medical positioning system includes at least one reference electromagnetic transducer placed at a reference location, at least one inner electromagnetic transducer attached to a surgical tool inserted in a blood vessel in the vicinity of the inspected organ, and a medical positioning system processor coupled with the transducers. The medical positioning system processor generates medical positioning system data sets, each of which includes a collection of three-dimensional position coordinate readings demonstrating the motion trajectory of the surgical tool over time, the processor generating the organ timing signal from the data sets by detecting and identifying periodic motion frequencies in the data sets, and filtering the periodic motion frequencies from the data sets.