A way of quantifying the shape of an ECG waveform is disclosed by detecting the JT segment using two Hidden Markov Models and calculating the analytic signal of the JT segment. Parameters calculated from the analytic signal are used as shape descriptors for the JT segment. The shape descriptors may be displayed in a dimensionality-reduced mapping. Templates representing characteristic shapes can be produced by finding cluster centers in the shape descriptor space, and the novelty of new waveforms can be quantified by comparing the position in shape descriptor space of new shape descriptors to a predefined normal training set or to previously encountered waveforms. Novel shape descriptors can be used to retrieve the corresponding waveforms, and templates of such novel shapes can be created by averaging such waveforms, using dynamic time warping to allow for variations in heart rate. The templates can be manually segmented and the manual segmentation propagated back into other waveforms having similar shape descriptors.