Latencies of motor evoked potentials (MEP) can provide insights into the motor neuronal pathways activated by transcranial magnetic stimulation (TMS). Notwithstanding its clinical relevance, accurate, unbiased methods to automatize latency detection are still missing.
We present a novel open-source algorithm suitable for MEP onset/latency detection during resting state that only requires the post-stimulus electromyography signal and exploits the approximation of the first derivative of this signal to find the time point of initial deflection of the MEP.
The algorithm has been benchmarked, using intra-class coefficient (ICC) and effect sizes, to manual detection of latencies done by three researchers independently on a dataset comprising almost 6500 MEP trials from healthy participants (n=18) and stroke patients (n=31) acquired during rest. The performance was further compared to currently available automatized methods, some of which created for active contraction protocols.
The unstandardized effect size between the human raters and the present method is smaller than the sampling period for both healthy and pathological MEPs. Moreover, the ICC increases when the algorithm is added as a rater.
The present algorithm is comparable to human expert decision and outperforms currently available methods. It provides a promising method for automated MEP latency detection under physiological and pathophysiological conditions.

Creative Commons Attribution license.