PTLens is just one application of PanoTools, a free image processing package written by Helmut Dersch, which does all sorts of wonders by applying mathematically defined geometric transformations (using better quality interpolation than most commercial programs). It is used extensively by panoramic photographers (self included) to do things like adjust perspective, straighten horizon lines, extract rectilinear views from fisheye images, correct chromatic aberration,..., as well for stitching multiple images. The most convenient way to use Panotools on individual images is as a set of Photoshop 5 compatible plugins (which also work with Paint Shop, the Gimp, and others). For stitching there are several good shareware applications such as Max Lyons's PTAssembler. You can get a complete PanoTools package from Max Lyons's web site at [a href=\"http://www.tawbaware.com/maxlyons/pano12ml.htm]http://www.tawbaware.com/maxlyons/pano12ml.htm[/url].
I have written some programs to adjust perspectives in my own ways, using the PanoTools interpolation kernels.
I don't think "distortion" is a very useful concept, except in astronomy, photogrammetry, and a few other technical areas. Virtually all pictorial photos are scientifically inaccurate representations, projected onto the print according to someone's sense of what looks right for the subject. A good architectural photo is generally a fabric of distortions, half-truths and downright lies, cunningly contructed to look like a building, ship, or whatever. I'd urge you to think in those terms about how to "correct" your own pictures. If you start with a decent view and plenty of well exposed pixels, you can do on a computer everything a view camera wizard could do (and more, because you are not limited to the projection space of a real physical lens).