A friend of mine told me a story that happened with him. He is a a Sefardic man, a Ba'al Teshuvah, who was sitting and learning Torah for many years in Kollel. He has a very strong Emunah and humility about him. About 12 years ago he found a hidden Tzadik in Tel Aviv who was acting as the Gabai of a small Bet Knesset in the area. This hidden Tzadik used to bless people who came to him with Kabbalistic blessings, but he acted very simple and no one knew much about him. My friend became very close to him and recieved guidance and blessings from him on a daily basis. This Tzadik could see on my friend's face if his thoughts were clean or if he had sinned that day.
One time my friend was on the bus to come to his Rav, and an immodestly dressed woman passed by his feild of vision. He turned away from her but the image lingered in his mind for a bit, until he was able to dismiss it from his thoughts. As soon as he walked in to the Bet Knesset, his Rav wagged a finger at him. When he went though his day in his mind to try and find in what way he had sinned, he could not find anything that he had done that would cause the Rav to reprimand him. When he asked the Rav to enlighten him, the Rav told him that he (my friend) knew what it was. When he asked if it was the woman on the bus, the Rav answered in affirmative and told him that although he had not sinned by seeing the woman--since this was not his fault, however, since he had thought about her afterwards for a short time, these thoughts had created a Mazik (a damaging angel) that was hovering over him. Therefore, the moment he had walked into the Bet Knesset, the Rav had seen this angel and reprimanded him.
What amazed me the most about this story is not the lofty vision of his Rav, but the fact that every improper thought we have immediately creates a damaging angel that hovers over us. And it is not the sight of an immodest woman that creates this angel, but rather our subsequent thoughts that create it.
So when something immodest comes into your field of vision, don't let it get you down--because it's not your fault. But be careful to dismiss any thoughts about it from your mind and not dwell upon it, for such thoughts are what are considered a sin in G-d's eyes and are what create the damaging angels.