1. A method for measuring the attenuation of a radiation by generating an image of an object, comprising: irradiating the object with a radiation source; detecting with a direct conversion spectrometer that includes a detector, radiation emitted from the radiation source after it has passed through the object, said detection being carried out in a plurality N k of energy channels of the detector, actual attenuation of the material constituting the object being resolved according to a characteristic base of the attenuation in the material, μ n , n=1,. .. , N with N≥2; said direct conversion spectrometer being characterized by a response matrix Ψ giving, for the plurality N k of energy channels of the detector, the probability that a photon emitted in an energy bin h=1,. .. , N h is detected in an energy channel, said method including estimating a vector M lin , called an equivalent linear attenuation vector, giving for each energy channel an attenuation linearly depending on the thickness of the material through which the radiation passes, said method comprising an initialization step wherein M lin is estimated by a vector M d giving an attenuation of the radiation in the plurality of energy channels, and a succession of iterations, each iteration j providing an estimate {circumflex over (M)} lin (j) and comprising: (a) a step of projecting the estimate {circumflex over (M)} lin (j−1) of M lin obtained at a previous iteration onto an image base Ψμ n , n=1,. .. , N, image by said response matrix Ψ of said characteristic base of the attenuation of the material, the projection of {circumflex over (M)} lin (j−1) onto the image base Ψμ n , n=1,. .. , N being performed by determining components ĉ 1 ,. .. , ĉ N such that: M ^ lin ⁡ ( j - 1 ) = ∑ n = 1 N ⁢ c ^ n ⁡ ( j ) ⁢ Ψ ⁢ ⁢ μ n = A μ ⁢ c ^ ⁡ ( j ) ; (b) a step of determining an energy non linear deformation, T, of the components of the estimate {circumflex over (M)} lin (j−1) for obtaining a corresponding attenuation M r d (j) in different energy channels, in accordance with a non linear model of the spectrometer; (c) a step of reverse deformation of the components of M d to provide a new estimate {circumflex over (M)} lin (j) of the equivalent linear attenuation M lin of said attenuation measurement, or of the components ĉ 1 ,. .. , ĉ N of said equivalent linear attenuation M lin in said image base, wherein the estimate of the equivalent linear attenuation M lin of said attenuation measurement, or the estimate of the components thereof, are provided as attenuation measurements, and the method includes generating the image of the object based on at least the detected radiation and on the new estimate {circumflex over (M)} lin (j) of the equivalent linear attenuation M lin of said attenuation measurement.