T wave analyis and extraction using discrete wavelets
First, this is not an easy task to automate. An algorithm that works great on clean ECGs can fail miserably on noisy ones. That said, I would suggest you look at the approach used to identify the ST segments in the Long Term ST Database. It is one of, if not the, largest ST segment database publicly available. They describe the approach they used, which includes automatic segmentation followed by expert review.

Also, take a look at the PhysioToolkit from PhysioNet. I'm pretty sure the have some automatic ECG annotation tools. I looked, but couldn't find them. Still, I think they are there somewhere.