Catheterization is carried out by inserting a sheath into a human patient and moving a catheter having an electrode through the sheath lumen. A variation between a first threshold value and a second threshold value in electrical current through the electrode is identified. Responsively to the variation, it is reported that a portion of the catheter has transitioned between an in-sheath condition and an out-of-sheath condition. The sheath is defined and identified by the historical data of the readings of the magnetic sensor during its movements.