A system for performing image-guided surgery includes an instrument having a first portion configured to define a trajectory into the body of a patient, a marker device and a user-interface component. A sensing device receives electromagnetic signals that are reflected or emitted from the marker device, and a processing system, coupled to the sensing device, includes at least one processor configured with processor-executable instructions to perform operations that include tracking the position and orientation of the instrument relative to the patient based on the signals received at the sensing device, receiving a signal from the user-interface component of the instrument indicating a user-input event, and saving the trajectory into the body of the patient defined by the first portion of the instrument in response to receiving the signal.