1. A device for localizing and imaging sources of gamma or X-rays, the device comprising: a) a detector assembly comprising: at least two gamma or X-ray detectors, namely first and second detectors sensitive to position, each of the first and second detectors being suitable for providing an electric pulse on receiving a photon of radiation, the electric pulse being representative of the energy of said photon and of the position of its impact on the detector that receives it; and a coded mask made of a material that is opaque to the radiation and that is pierced by apertures in a predefined pattern, the coded mask being placed in front of the first detector, which first detector lies between the coded mask and the second detector, this relative positioning enabling first and second shadows to be obtained from a source that is to be localized, the shadows being cast on the first and second detectors that then generate respective first and second images in electrical form of said first and second cast shadows; and b) electronic means for processing the electric pulses delivered by the first and second detectors in order to localize the source and form a two- or three-dimensional image; wherein the electronic processor means are designed: (α) to select from amongst the electric pulses that are delivered respectively by the first and second detectors, those pulses that are in time coincidence and that are therefore for representing a Compton diffusion event of a gamma or X-ray photon on one of the detectors followed by absorption on the other detector; (β) to use Compton imaging to determine a preliminary estimates of the angular position and of the angular distribution of the source of gamma or X-rays, assuming that the source is at an infinite distance from the detector assembly; (γ) to select electric pulses in time coincidence that, from said preliminary estimates of the angular position of the angular distribution of the source of gamma or X-rays, are for representing photons coming from said source; and (δ) to deconvolute the first image or the second image or the first and second images relative to the pattern of the coded mask on the selected electric pulses so as to obtain first estimates of the angular position and the angular distribution of the source of gamma or X-rays, thereby constituting a two-dimensional image of said source.