Imaging polar and dipolar sources of geophysical anomalies by probability tomography. Part I: theory and synthetic examples