A method, including inserting a catheter having atleast one electrode into a chamber of a body organ of apatient and recording at a sequence of times respectivesets of currents between the at least one electrode and aplurality of patches positioned on skin of the patient.The method further includes, while recording the sets ofcurrents, acquiring x-ray images of the at least oneelectrode, and determining locations of the catheter fromthe images. A relation is derived between the locationsand the respective sets of currents based on the sets ofcurrents and the images. The method also includesrecording subsequent sets of currents between the atleast one electrode and the patches, and determining,based on the relation, subsequent locations of thecatheter in response to the subsequent set of currents.