Thank you for contacting JustAnswer.
I am sorry to hear about the problems you are experiencing in your relationship. You may find the book, After the Affair http://www.amazon.com/After-Affair-Healing-Rebuilding-Unfaithful/dp/0060928174
to be helpful in coping with this.
You may want to try thought stopping. When one of these thoughts enters your mind, you can tell yourself "STOP", then replace the thought with a more positive thought that is rational and reasonable such as "My marriage is improving". Then get up and do something to "change the channel" in your brain; such as exercising, getting involved in a project, talking to someone . . . . The more you work on the thought stopping, the more it will become normal for you to think more positively
You may want to vent some of your feelings through letter writing, in which you write letters to your spouse or the woman that he had the affair with and then shred them. This helps to release your feelings in a safe way that doesn't harm anyone or negatively affect your relationship.
Rather than focusing on the negative thoughts and images of the affair, focus on the positives in the marriage now and what has been improved. If you feel it could be helpful, you may want to consider either couples or individual therapy to address some of these issues. I'm glad to hear that you are using exercise to help. Be sure to take care of yourself through healthy eating, rest and reaching out to supportive people in your life. I hope this answer is helpful. Please let me know if I can clarify further.