Generally, there is a right to defend oneself in any situation but the force used must be reasonable under the circumstances.
Contact your local Bar Association for a referral to a criminal defense lawyer.
The law school exam answer to your question is yes. NOW, we're not in law school, we are in the real world. In the real world your chances of avoiding being charged with murder charges, (if the officer has died), or assault with intent to murder charges, (if he has survived), are so small as to be mathematically insignificant. You will be charged, becasue prosecutors/dist. atty's. don't usually keep their jobs very long if they go around angering the police departments and their officers. Your chances of being offered some type of plea bargain go up, but only slightly; it will frankly depend on how outrageous the officer's conduct with you may have been, (in the real world your unsubstantiated version of the events will probably not sway the the prosecuting official). Your chances of an acquittal, (being found not guilty by a jury), not very good either. It will all come down to how much of your version of the events and how the officer behaved can be substantiated by someone other than yourself. Most jury pools are made up of people whose only contact with the police may have been to receive a speeding ticket, so they are not likely to be prepated to accept and believe that an officer would unlawfully try to kill a citizen.
As a colleague of mine has noted, the 70's are over; no one cares about the why someone did something, only did they do it or not. Here in Michigan, for example a citizen does NOT have the right to resist an unlawful arrest; they have to acquiesce to the arrest and sort things out later.
So, yes you could shoot and kill a police officer in lawful self-defense. However, I would not expect to get a fair and reasonable shake from law enforcement or the prosecutors.