X-ray grating image processing method, device and equipment and readable storage medium
By constructing a generative adversarial network model and using the image data of X-rays passing through objects and gratings, the problem of low phase recovery accuracy in traditional X-ray phase contrast imaging is solved, and the efficiency and accuracy of image phase recovery are improved.
Patent Information
- Application Number
- CN202411008624.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-25
- Publication Date
- 2024-10-18
AI Technical Summary
Traditional X-ray phase contrast imaging methods require multiple exposures to adjust the grating position, resulting in reduced accuracy of phase recovery.
By acquiring object stripe images, grating stripe images and label phase contrast images of X-rays passing through objects and gratings, a generative adversarial network model is constructed. The generative adversarial network model does not need to adjust the grating position and improves the efficiency and accuracy of image phase recovery.
This improves the efficiency and accuracy of image phase recovery, reduces the need for grating position adjustment, and improves the stability and quality of image processing.
Smart Images

Figure CN118799211A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing, and in particular to an X-ray grating image processing method, device, equipment and readable storage medium. Background Art
[0002] In traditional X-ray phase contrast imaging technology, the method using gratings is particularly prominent. The position of the grating relative to the detector is changed by phase stepping to perform multiple exposures, and different images are captured by changing the phase of the grating after each exposure. Grating phase contrast imaging precisely controls the spacing and alignment between gratings, and can effectively convert the phase changes of X-rays into measurable intensity changes, allowing details that were originally difficult to observe to be clearly displayed, revealing more internal structural details of the sample and providing richer image information.
[0003] However, this method requires multiple exposures, each time the grating position needs to be adjusted. The inconsistency in step size affects the inconsistency in converting phase changes into measurable intensity changes, resulting in reduced accuracy of phase retrieval. Summary of the invention
[0004] In order to solve the above technical problems, the embodiments of the present application provide an X-ray grating image processing method, device, equipment and readable storage medium.
[0005] In a first aspect, an embodiment of the present application provides an X-ray grating image processing method, the method comprising:
[0006] Acquire an object fringe image obtained when X-rays pass through the object and the grating, and a grating fringe image obtained when X-rays only pass through the grating;
[0007] Obtain a label phase contrast image obtained by X-rays passing through the object and the grating;
[0008] Inputting the object fringe image, the grating fringe image and the label phase contrast image into a generative adversarial network for training to obtain a generative adversarial network model;
[0009] The fringe image of the object to be processed is processed according to the generative adversarial network model to obtain a predicted phase contrast image of the object to be processed.
[0010] In one embodiment, the step of acquiring an object fringe image obtained when X-rays pass through the object and the grating, and a grating fringe image obtained when X-rays pass through only the grating, comprises:
[0011] Acquire the first fringe information data generated by X-rays passing through the object and the grating;
[0012] Acquire the second fringe information data generated by X-rays passing only through the grating;
[0013] Calculating the pixel intensity of each pixel point according to the first fringe information data to obtain the fringe image of the object;
[0014] The pixel intensity of each pixel is calculated according to the second fringe information data to obtain the grating fringe image.
[0015] In one embodiment, the first fringe information data or the second fringe information data includes an average value, an amplitude, a period, and a phase of fringe intensity, and the step of calculating the pixel intensity of each pixel point according to the first fringe information data or the second fringe information data includes:
[0016] By formula (1), the pixel intensity of each pixel is calculated according to the average value, amplitude, period and phase of the fringe intensity, wherein the average value, amplitude, period and phase of the fringe intensity correspond to the first stripe information data and the second stripe information data;
[0017] Formula (1):
[0018] Where (x, y) is the coordinate of any pixel point on the grating fringe image or object fringe image, I is the pixel intensity, a is the average fringe intensity, b is the fringe intensity amplitude, p is the pixel intensity, and m is the period of the fringe, and φ is the phase of the fringe.
[0019] In one embodiment, acquiring a label phase contrast image obtained by X-rays passing through an object and a grating includes:
[0020] Calculate phase deflection distribution parameters according to the first fringe information data and the second fringe information data;
[0021] A phase scaling factor is set, and the label phase contrast image is generated according to the phase derivative distribution parameter and the phase scaling factor.
[0022] In one embodiment, the calculating of the phase derivative distribution parameter according to the first fringe information data and the second fringe information data includes:
[0023] Calculate the phase derivative distribution parameter according to formula (2);
[0024] Formula (2):
[0025] in, is the phase derivative distribution parameter, φ s (x, y) is the phase of the fringe in the first fringe information data, φ r (x, y) is the phase of the fringe in the second fringe information data, λ is the wavelength of the X-ray, P2 is the period of the grating, and d is the distance between the object and the grating;
[0026] The step of setting the phase scaling factor and generating the label phase contrast image according to the phase derivative distribution parameter and the phase scaling factor comprises:
[0027] Scaling the phase derivative distribution parameters according to formula (3) to obtain a label phase contrast image;
[0028] Formula (3):
[0029] Where M is the phase scaling factor and ΔΦ(x,y) is the label phase contrast image.
[0030] In one embodiment, the object fringe image, the grating fringe image and the label phase contrast image are input into a generative adversarial network for training to obtain a generative adversarial network model, including:
[0031] Generate a predicted phase contrast image from the grating fringe image and the object fringe image through a generator of the generative adversarial network;
[0032] Fitting the predicted phase contrast image and the labeled phase contrast image through the discriminator of the generative adversarial network to obtain model parameters;
[0033] The generative adversarial network model is generated according to the model parameters.
[0034] In one embodiment, fitting the predicted phase contrast image and the label phase contrast image through the discriminator of the generative adversarial network to obtain model parameters includes:
[0035] Get adversarial loss;
[0036] Using a PSNR evaluation index to evaluate the first loss of the predicted phase contrast image and the label phase contrast image;
[0037] Using the SSIM evaluation index to evaluate the second loss of the predicted phase contrast image and the label phase contrast image;
[0038] Calculate the training parameters that minimize the sum of the adversarial loss, the first loss, and the second loss, and use the training parameters as the model parameters.
[0039] In a second aspect, an embodiment of the present application provides an X-ray grating image processing device, the X-ray grating image processing device comprising:
[0040] A first acquisition module is used to respectively acquire an object fringe image obtained when the X-ray passes through the object and the grating, and a grating fringe image obtained when the X-ray passes only through the grating;
[0041] A second acquisition module is used to acquire a label phase contrast image obtained by X-rays passing through the object and the grating;
[0042] A training module, used for inputting the object fringe image, the grating fringe image and the label phase contrast image into a generative adversarial network for training to obtain a generative adversarial network model;
[0043] The processing module is used to process the fringe image of the object to be processed according to the generative adversarial network model to obtain a predicted phase contrast image of the object to be processed.
[0044] In a third aspect, an embodiment of the present application provides an electronic device, comprising a memory and a processor, wherein the memory is used to store a computer program, and when the computer program is run by the processor, the X-ray grating image processing method provided in the first aspect is executed.
[0045] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium storing a computer program, which, when executed on a processor, executes the X-ray grating image processing method provided in the first aspect.
[0046] The X-ray grating image processing method provided by the above application separately obtains the object fringe image obtained by the X-ray passing through the object and the grating, and the grating fringe image obtained by the X-ray passing only through the grating; obtains the label phase contrast image obtained by the X-ray passing through the object and the grating; inputs the object fringe image, the grating fringe image and the label phase contrast image into the generative adversarial network for training to obtain a generative adversarial network model; processes the fringe image of the object to be processed according to the generative adversarial network model to obtain the predicted phase contrast image of the object to be processed. The application obtains the generative adversarial network model by constructing the grating fringe image, the object fringe image and the label phase contrast image. The generative adversarial network model does not need to adjust the grating position, thereby improving the efficiency and accuracy of image phase recovery. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] In order to more clearly illustrate the technical solution of the present application, the following is a brief introduction to the drawings required for use in the embodiments. It should be understood that the following drawings only illustrate certain embodiments of the present application and should not be regarded as limiting the scope of protection of the present application. In each of the drawings, similar components are numbered similarly.
[0048] Figure 1 A schematic diagram of a process of an X-ray grating image processing method provided in an embodiment of the present application is shown;
[0049] Figure 2 Another schematic diagram of the process of the X-ray grating image processing method provided by the embodiment of the present application is shown;
[0050] Figure 3Another schematic diagram of the process of the X-ray grating image processing method provided in the embodiment of the present application is shown;
[0051] Figure 4 Another schematic diagram of the process of the X-ray grating image processing method provided in the embodiment of the present application is shown;
[0052] Figure 5 The input and output schematic diagram of the X-ray grating image processing method provided in the embodiment of the present application is shown;
[0053] Figure 6 A structural schematic diagram of an X-ray grating image processing device provided in an embodiment of the present application is shown.
[0054] Icons: 600 - X-ray grating image processing device, 601 - first acquisition module, 602 - second acquisition module, 603 - training module, 604 - processing module. DETAILED DESCRIPTION
[0055] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments.
[0056] The components of the embodiments of the present application generally described and shown in the drawings herein may be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.
[0057] Hereinafter, the terms "including", "having" and their cognates, which may be used in various embodiments of the present application, are intended only to indicate specific features, numbers, steps, operations, elements, components, or combinations of the foregoing items, and should not be understood as first excluding the existence of one or more other features, numbers, steps, operations, elements, components, or combinations of the foregoing items or adding the possibility of one or more features, numbers, steps, operations, elements, components, or combinations of the foregoing items.
[0058] Furthermore, the terms “first”, “second”, “third”, etc. are merely used for distinguishing descriptions and are not to be understood as indicating or implying relative importance.
[0059] Unless otherwise defined, all terms (including technical terms and scientific terms) used herein have the same meanings as those generally understood by those skilled in the art to which the various embodiments of the present application belong. The terms (such as those defined in generally used dictionaries) will be interpreted as having the same meanings as the contextual meanings in the relevant technical field and will not be interpreted as having idealized meanings or overly formal meanings unless clearly defined in the various embodiments of the present application.
[0060] Example 1
[0061] An embodiment of the present application provides an X-ray grating image processing method.
[0062] See also Figure 1 The X-ray grating image processing method includes steps S101 to S104:
[0063] S101: Acquire an object fringe image obtained when X-rays pass through the object and the grating, and a grating fringe image obtained when X-rays only pass through the grating.
[0064] In this embodiment, before acquiring the fringe image, it is necessary to ensure that the X-ray source, object, grating and detector (such as CCD camera) are properly installed and calibrated. The grating should be placed between the object and the detector to modulate the X-rays passing through the object. First, the X-ray source is started to irradiate the object. After the X-ray passes through the object, its wavefront is affected by the object (such as absorption, phase shift, etc.), and then further modulated by the grating. The detector records the X-ray intensity distribution after the object and grating modulation to form the object fringe image. It should be noted that there is noise in the environment for acquiring the object fringe image or the grating fringe image. For example, the electronic components inside the detector (such as CCD camera) will generate noise when working, resulting in random bright spots or dark spots in the fringe image, as well as background non-uniformity. In addition, because the X-ray source itself may have certain instability, the intensity and energy distribution of the emitted X-rays will change, affecting the accuracy and repeatability of the fringe image finally acquired. Through the above method, the fringe images of multiple objects are captured from multiple angles, and multiple object fringe images are acquired.
[0065] Optionally, the object is removed from the X-ray path, leaving only the grating and the detector, and the X-ray source is started again to directly illuminate the grating. The detector records the X-ray intensity distribution after only the grating modulation to form a grating fringe image. The grating fringe image obtained without the object can be regarded as the "background" of the imaging system, reflecting the modulation effect of the grating on the X-ray wavefront.
[0066] Optionally, by training the model to distinguish between fringe images with objects and grating fringe images without objects, the generative adversarial network model can learn to extract the unique modulation features of the object on the X-ray wavefront and ignore the features caused by the grating system itself that do not change with the object. In this way, in practical applications, the model can more accurately recover the internal structure information of the object from the fringe image.
[0067] See also Figure 2 In one embodiment, step S101 includes steps S1011-S1013:
[0068] S1011: Acquire the first fringe information data generated by X-rays passing through the object and the grating.
[0069] In this embodiment, the X-ray beam passes through an object, and different parts of the object will produce different absorption, scattering and phase shift effects on the X-rays. The X-ray wavefront modulated by the object then enters the grating, and the grating further modulates the X-ray wavefront to form a specific fringe pattern. The detector records the intensity distribution of the X-rays after being modulated by the object and the grating. The recorded information is the first fringe information data, which includes the average value, amplitude, period and phase of the fringe intensity.
[0070] S1012: Acquire second fringe information data generated when X-rays only pass through the grating.
[0071] In this embodiment, the X-ray source is started again to emit a stable X-ray beam. This time, the X-ray beam directly passes through the grating without the modulation effect of the object. The grating modulates the X-ray wavefront to form a fringe pattern generated only by the grating itself. The detector records the X-ray intensity distribution modulated only by the grating, and this record is the second fringe information data. Similarly, the second fringe information data also includes the average value, amplitude, period and phase of the fringe intensity.
[0072] S1013: Calculate the pixel intensity of each pixel point according to the first fringe information data to obtain the object fringe image. Calculate the pixel intensity of each pixel point according to the second fringe information data to obtain the grating fringe image.
[0073] In this embodiment, the fringe information data includes the average value, amplitude, period and phase of the fringe intensity, and for each pixel (x, y) in the image, the pixel intensity I(x, y) is calculated. Since the first fringe information data and the second fringe information data are respectively the results of measurement when an object is placed and when no object is placed, the fringe information data are different, and the pixel intensities I(x, y) are also different.
[0074] In one embodiment, the first fringe information data or the second fringe information data includes an average value, amplitude, period and phase of fringe intensity, and the calculating the pixel intensity of each pixel point according to the first fringe information data or the second fringe information data includes: calculating the pixel intensity of each pixel point according to the average value, amplitude, period and phase of the fringe intensity by formula (1), wherein the average value, amplitude, period and phase of the fringe intensity correspond to the first fringe information data and the second fringe information data; formula (1): Where (x, y) is the coordinate of any pixel point on the grating fringe image or object fringe image, I is the pixel intensity, a is the average fringe intensity, b is the fringe intensity amplitude, p is the pixel intensity, and m is the period of the fringe, and φ is the phase of the fringe.
[0075] In this embodiment, the stripe information data includes the average value a(x, y) of the stripe intensity at each pixel, which represents the benchmark of the overall brightness or intensity level of the stripe pattern at the pixel position, and b(x, y) is the stripe intensity amplitude at each pixel, which represents the brightness and darkness variation of the stripe. By adjusting the contrast of the stripes, the stripe image of the object has a better visual effect and the details in the stripe image are more clearly discernible. is a term related to the periodicity of the fringes, where p m is the period of the stripes, which determines the spacing of the stripes. φ(x,y) is the phase of the stripes, which reflects the specific position or offset of the stripes in the image.
[0076] Optionally, after obtaining the stripe information data, the above data needs to be converted into a stripe image under this exposure, that is, the pixel intensity of each pixel point is calculated using formula (1), and the calculated intensity value I(x, y) of each pixel is assigned to the pixel at the corresponding position to generate a complete stripe image.
[0077] S102: Acquire a label phase contrast image obtained by X-rays passing through the object and the grating.
[0078] In this embodiment, the phase φ under two conditions of placing an object and not placing an object is s (x,y) and φ r (x, y), as well as the wavelength of the X-ray, the period of the grating and the distance between the object and the grating to calculate the phase derivative distribution parameters, scale the phase derivative distribution parameters, and finally calculate the pixel intensity of each pixel in the label phase contrast image to obtain the label phase contrast. The label phase contrast image is to force the model to learn how to map from the object fringe information to the label phase contrast image, so that the image (including the object fringe information) input into the model in the future can directly generate the object's phase contrast image.
[0079] See also Figure 3 In one embodiment, S102 includes steps S1021-S1022:
[0080] S1021: Calculate phase derivative distribution parameters according to the first fringe information data and the second fringe information data.
[0081] In this embodiment, under the same experimental conditions, the sample is placed in front of the grating, and the measurement data is recorded. This measurement will include the absorption and scattering of the sample on the X-ray and the phase modulation effect of the grating, and the obtained first fringe information data is marked as label s. Optionally, in the absence of a sample, only the grating is placed in the path of the X-ray beam, and the corresponding fringe information data is recorded, that is, the second fringe information data is marked as label r, and the phase derivative distribution parameter is calculated based on the fringe phase in the first fringe information data and the fringe phase in the second fringe information data.
[0082] In one embodiment, the calculating of the phase partial derivative distribution parameter according to the first fringe information data and the second fringe information data includes: calculating the phase partial derivative distribution parameter according to formula (2); formula (2): in, is the phase derivative distribution parameter, φ s (x, y) is the phase of the fringe in the first fringe information data, φ r (x, y) is the phase of the stripes in the second stripe information data, λ is the wavelength of the X-ray, P2 is the period of the grating, and d is the distance between the object and the grating.
[0083] In this embodiment, when the sample is placed in front of the grating, the fringe phase information φ generated by the sample and the grating is s (x, y). When there is no sample or the sample is removed, only the fringe phase information generated by the grating is obtained, and the phase information φ of the second fringe information data is obtained. r (x, y), the partial derivative of the phase φ in the x direction is calculated according to the above formula (2), which represents the change of the phase in the x direction, which reflects the gradient distribution of the phase in space due to the internal structure of the sample or other factors.
[0084] S1022: Setting a phase scaling factor, and generating the label phase contrast image according to the phase derivative distribution parameter and the phase scaling factor.
[0085] In this embodiment, the phase scaling factor is an adjustable parameter used to adjust the phase derivative distribution parameters calculated from the phase of the object fringe image and the phase of the grating fringe image. By introducing phase modulation through the grating, the subtle structural changes inside the object can be reflected in the phase information. s (x,y) and the phase φ of the grating fringe image r The difference between (x,y) contains important information about the internal structure of the object.
[0086] For example, by calculating the phase derivative distribution parameters, the change in the phase difference in the x-direction after the X-ray is absorbed by the object is quantified, and the change reflects the spatial distribution and characteristics of the internal structure of the object. However, the original phase derivative distribution parameters do not directly correspond to the image features that you want to emphasize, and you need to set the scaling factor M, adjust the value of M, and enlarge or reduce the phase derivative distribution parameters, thereby changing the phase of the final generated label phase contrast image.
[0087] In one embodiment, the setting of the phase scaling factor to generate the label phase contrast image according to the phase derivative distribution parameter and the phase scaling factor includes: scaling the phase derivative distribution parameter according to formula (3) to obtain the label phase contrast image; formula (3): Where M is the phase scaling factor and ΔΦ(x,y) is the label phase contrast image.
[0088] In this embodiment, the phase derivative distribution parameter The phase derivative distribution parameter (i.e., the partial derivative of the phase in the x direction) is scaled by the phase scaling factor M to obtain the label phase contrast image ΔΦ(x,y). It should be noted that after the adjustment of the phase scaling factor M, the details (such as edges, textures, etc.) in the label phase contrast image will be enhanced or suppressed, depending on the value of M. A larger M value will enhance the details, but may also cause an increase in noise in the image.
[0089] S103: Inputting the object fringe image, the grating fringe image and the label phase contrast image into a generative adversarial network for training to obtain a generative adversarial network model.
[0090] In this embodiment, a pair of object fringe images, grating fringe images and corresponding label phase contrast images are input into the GAN, the generator receives the object fringe images and the grating fringe images, generates a predicted phase contrast image, the discriminator receives the predicted phase contrast image and the label phase contrast image, and calculates the adversarial loss according to the judgment result of the discriminator on the predicted phase contrast image. The adversarial loss encourages the generator to generate images that can deceive the discriminator.
[0091] Optionally, PSNR and SSIM are used to calculate the difference between the predicted phase contrast image and the labeled phase contrast image to obtain the content loss, and the adversarial loss and content loss are combined into a total loss function to guide the training of the generator and the discriminator.
[0092] See also Figure 4 In one embodiment, step S103 includes steps S1031-S1033:
[0093] S1031: Generate a predicted phase contrast image from the grating fringe image and the object fringe image through the generator of the generative adversarial network.
[0094] In this embodiment, the generator of the Generative Adversarial Networks (GAN) receives a grating fringe image and an object fringe image as input, and the generator extracts, fuses and transforms the input images through its internal neural network structure (such as convolutional layer, activation layer, pooling layer, etc.), and finally outputs a predicted phase contrast image.
[0095] S1032: Fitting the predicted phase contrast image and the label phase contrast image through the discriminator of the generative adversarial network to obtain model parameters.
[0096] In this embodiment, the discriminator of GAN receives two inputs, one is the predicted phase contrast image generated by the generator, and the other is the real label phase contrast image. The discriminator distinguishes these two inputs, that is, it determines whether an image is generated by the generator (fake image) or a real label phase contrast image (real image). The discriminator optimizes its distinguishing ability by minimizing a loss function (such as cross entropy loss).
[0097] Optionally, during the training process, the discriminator and the generator are trained alternately. First, the parameters of the generator are fixed, and the discriminator is trained to better distinguish between true and false images; then, the parameters of the discriminator are fixed, and the generator is trained to generate false images that are more difficult for the discriminator to distinguish. This process updates the model parameters through the back-propagation algorithm, that is, the weights and biases of the generator and the discriminator are adjusted according to the feedback of the discriminator. Through multiple iterations of this process, the generator gradually learns to generate predicted phase contrast images that are closer and closer to the real label phase contrast images, while the discriminator becomes increasingly difficult to distinguish the difference between them.
[0098] In one embodiment, fitting the predicted phase contrast image and the labeled phase contrast image through the discriminator of the generative adversarial network to obtain model parameters includes: obtaining adversarial loss; using the PSNR evaluation index to evaluate the first loss of the predicted phase contrast image and the labeled phase contrast image; using the SSIM evaluation index to evaluate the second loss of the predicted phase contrast image and the labeled phase contrast image; calculating the training parameters with the minimum sum of the adversarial loss, the first loss and the second loss, and using the training parameters as the model parameters.
[0099] In this embodiment, the adversarial loss is that the discriminator attempts to distinguish whether the input image comes from the label dataset or from the generator, using negative log likelihood as the loss function, and ultimately makes the output probability value of the discriminator (that is, the probability that the discriminator believes that this image is real) close to 1, at which time the adversarial loss is minimized.
[0100] During the training process of the Generative Adversarial Network (GAN), the discriminator is used to fit the predicted phase contrast image and the labeled phase contrast image, and the Peak Signal-to-Noise Ratio (PSNR) and the Structural Similarity Index Measure (SSIM) are used as evaluation indicators to evaluate the difference between the predicted image and the labeled image, and the loss function is calculated accordingly. The higher the PSNR value, the better the image quality, that is, the closer the predicted image is to the real image. In the context of GAN, PSNR is used as a measure of the difference between the predicted phase contrast image and the labeled phase contrast image, thus forming the first loss.
[0101] Optionally, SSIM is a measure of the visual similarity between two images that takes into account the structural information of the images, such as brightness, contrast, and structure, rather than just the difference in pixel values. The value of SSIM ranges from -1 to 1, where 1 means that the two images are exactly the same. In the training of GAN, SSIM can also be used as a second loss to evaluate the structural similarity between the predicted phase-contrast image and the labeled phase-contrast image.
[0102] Optionally, the adversarial loss, PSNR loss, and SSIM loss are combined into a total loss, which is the goal to be minimized during the GAN optimization process. In each iteration, GAN updates the model parameters of the generator and the discriminator based on the discriminator's loss on the predicted phase contrast image and the labeled phase contrast image. The purpose of the parameter update is to enable the generator to generate predicted images that are closer to the real image, while enabling the discriminator to distinguish between the real image and the predicted image more accurately. Through multiple iterative training, when the generator can generate sufficiently realistic predicted phase contrast images and the discriminator can no longer significantly improve its distinguishing ability, the GAN model is considered to have been trained. At this point, the obtained training parameters (i.e., the weights and biases of the generator and the discriminator) are the optimal model parameters.
[0103] S1033: Generate the generative adversarial network model according to the model parameters.
[0104] In this embodiment, after the above-mentioned discriminator and generator have been in game with each other and after sufficient training iterations, when the generator can generate sufficiently realistic predicted phase contrast images and the discriminator can no longer significantly improve its distinguishing ability, it is considered that the GAN model has been trained. At this point, according to the model parameters obtained during the training process (including the weights and biases of the generator and the discriminator), the final generative adversarial network model can be generated.
[0105] S104: Processing the fringe image of the object to be processed according to the generative adversarial network model to obtain a predicted phase contrast image of the object to be processed.
[0106] In this embodiment, see Figure 5 , from left to right are the object stripe image of the object to be tested, the label phase contrast image, and the predicted phase contrast image obtained by GAN.
[0107] Optionally, the experimental model of this application has a training set of 800 object fringe images and grating fringe images, and a test set of 200 fringe images of the object to be tested. When the PSNR evaluation index is used to generate the predicted phase contrast image evaluation, the average value is 29.58 decibels. According to statistics, there are 103 data above the average value and 97 data below the average value. The lowest value of the decibel range is about 11.19 and the highest value is about 40.46. The fluctuation of PSNR indicates that the image quality varies at different stages of image processing, but the highest value shows that the image restoration effect is very good in some cases.
[0108] Optionally, when the SSIM evaluation index is used to generate the predicted phase contrast image evaluation, its average value is 0.924. The closer the SSIM value is to 1, the more similar the two images are; conversely, the smaller the SSIM value is, the greater the difference between the two images is. Through experiments, there are 113 data above the average value, 87 data below the average value, the lowest value is about 0.707, and the highest value is about 0.981. The overall high value of SSIM indicates that the image maintains a high structural similarity with the original image, especially in the recovery of details and textures.
[0109] The X-ray grating image processing method provided in this embodiment respectively obtains the object fringe image obtained by the X-ray passing through the object and the grating, and the grating fringe image obtained by the X-ray passing only through the grating; obtains the label phase contrast image obtained by the X-ray passing through the object and the grating; inputs the object fringe image, the grating fringe image and the label phase contrast image into the generative adversarial network for training to obtain a generative adversarial network model; processes the fringe image of the object to be processed according to the generative adversarial network model to obtain the predicted phase contrast image of the object to be processed. The present application obtains the generative adversarial network model by constructing the grating fringe image, the object fringe image and the label phase contrast image. The generative adversarial network model does not need to adjust the grating position, thereby improving the efficiency and accuracy of image phase recovery.
[0110] Example 2
[0111] In addition, an embodiment of the present application provides an X-ray grating image processing device, which is applied to electronic equipment.
[0112] like Figure 6 As shown, the X-ray grating image processing device 600 includes:
[0113] A first acquisition module 601 is used to respectively acquire an object fringe image obtained when the X-ray passes through the object and the grating, and a grating fringe image obtained when the X-ray passes only through the grating;
[0114] The second acquisition module 602 is used to acquire a label phase contrast image obtained by X-rays passing through the object and the grating;
[0115] A training module 603 is used to input the object fringe image, the grating fringe image and the label phase contrast image into a generative adversarial network for training to obtain a generative adversarial network model;
[0116] The processing module 604 is used to process the fringe image of the object to be processed according to the generative adversarial network model to obtain a predicted phase contrast image of the object to be processed.
[0117] Optionally, the first acquisition module 601 shown is also used to acquire first fringe information data generated by X-rays passing through an object and a grating; acquire second fringe information data generated by X-rays passing through only a grating; calculate the pixel intensity of each pixel point based on the first fringe information data to obtain the object fringe image; calculate the pixel intensity of each pixel point based on the second fringe information data to obtain the grating fringe image.
[0118] Optionally, the first acquisition module 601 is further used to calculate the pixel intensity of each pixel point according to the average value, amplitude, period and phase of the fringe intensity through formula (1), wherein the average value, amplitude, period and phase of the fringe intensity correspond to the first stripe information data and the second stripe information data; formula (1): Where (x, y) is the coordinate of any pixel point on the grating fringe image or object fringe image, I is the pixel intensity, a is the average fringe intensity, b is the fringe intensity amplitude, p is the pixel intensity, and m is the period of the fringe, and φ is the phase of the fringe.
[0119] Optionally, the second acquisition module 602 is further used to calculate phase derivative distribution parameters based on the first fringe information data and the second fringe information data; set a phase scaling factor, and generate the label phase contrast image based on the phase derivative distribution parameters and the phase scaling factor.
[0120] Optionally, the second acquisition module 602 is further used to calculate the phase derivative distribution parameter according to formula (2); formula (2): in, is the phase derivative distribution parameter, φ s (x, y) is the phase of the fringe in the first fringe information data, φ r (x, y) is the phase of the fringe in the second fringe information data, λ is the wavelength of the X-ray, P2 is the period of the grating, and d is the distance between the object and the grating; the phase derivative distribution parameters are scaled according to formula (3) to obtain a label phase contrast image; formula (3): Where M is the phase scaling factor and ΔΦ(x,y) is the label phase contrast image.
[0121] Optionally, the training module 603 is also used to generate a predicted phase contrast image from the grating fringe image and the object fringe image through the generator of the generative adversarial network; fit the predicted phase contrast image and the label phase contrast image through the discriminator of the generative adversarial network to obtain model parameters; and generate the generative adversarial network model according to the model parameters.
[0122] Optionally, the training module 603 is also used to obtain an adversarial loss; use a PSNR evaluation index to evaluate a first loss between the predicted phase contrast image and the label phase contrast image; use an SSIM evaluation index to evaluate a second loss between the predicted phase contrast image and the label phase contrast image; calculate a training parameter with the smallest sum of the adversarial loss, the first loss, and the second loss, and use the training parameter as the model parameter.
[0123] The X-ray grating image processing device 600 provided in this embodiment can implement the X-ray grating image processing method provided in Embodiment 1, and will not be described again here to avoid repetition.
[0124] The X-ray grating image processing device provided in this embodiment obtains the object fringe image obtained by the X-ray passing through the object and the grating, and the grating fringe image obtained by the X-ray passing only through the grating; obtains the label phase contrast image obtained by the X-ray passing through the object and the grating; inputs the object fringe image, the grating fringe image and the label phase contrast image into the generative adversarial network for training to obtain a generative adversarial network model; processes the fringe image of the object to be processed according to the generative adversarial network model to obtain the predicted phase contrast image of the object to be processed. The present application obtains the generative adversarial network model by constructing the grating fringe image, the object fringe image and the label phase contrast image. The generative adversarial network model does not need to adjust the grating position, thereby improving the efficiency and accuracy of image phase recovery.
[0125] Example 3
[0126] In addition, an embodiment of the present application provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and when the computer program runs on the processor, the X-ray grating image processing method provided in Example 1 is executed.
[0127] The electronic device provided in the embodiment of the present invention can execute the steps of the X-ray grating image processing method provided in the above method embodiment 1, which will not be described again here to avoid repetition.
[0128] Example 4
[0129] The present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the X-ray grating image processing method provided in Example 1 is implemented.
[0130] In this embodiment, the computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0131] The computer-readable storage medium provided in this embodiment can implement the X-ray grating image processing method provided in Embodiment 1, and will not be described again here to avoid repetition.
[0132] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or terminal including the element.
[0133] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0134] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. A method for processing an X-ray grating image, characterized in that: The method comprises: Acquire an object fringe image obtained when X-rays pass through the object and the grating, and a grating fringe image obtained when X-rays only pass through the grating; Obtain a label phase contrast image obtained by X-rays passing through the object and the grating; Inputting the object fringe image, the grating fringe image and the label phase contrast image into a generative adversarial network for training to obtain a generative adversarial network model; The fringe image of the object to be processed is processed according to the generative adversarial network model to obtain a predicted phase contrast image of the object to be processed.
2. The method according to claim 1, characterized in that The method of acquiring an object fringe image obtained by X-rays passing through the object and the grating, and a grating fringe image obtained by X-rays passing through only the grating, comprises: Acquire the first fringe information data generated by X-rays passing through the object and the grating; Acquire the second fringe information data generated by X-rays passing only through the grating; Calculating the pixel intensity of each pixel point according to the first fringe information data to obtain the fringe image of the object; The pixel intensity of each pixel is calculated according to the second fringe information data to obtain the grating fringe image.
3. The method according to claim 2, characterized in that The first fringe information data or the second fringe information data includes an average value, an amplitude, a period, and a phase of fringe intensity, and the step of calculating the pixel intensity of each pixel point according to the first fringe information data or the second fringe information data includes: By formula (1), the pixel intensity of each pixel is calculated according to the first fringe information data or the second fringe information data including the average value, amplitude, period and phase of the fringe intensity; Formula (1): Where I is the pixel intensity, (x, y) is the coordinate of any pixel point on the grating fringe image or object fringe image, a is the average fringe intensity, b is the fringe intensity amplitude, p is the average fringe intensity amplitude, and p is the average fringe intensity amplitude. m is the period of the fringe, and φ is the phase of the fringe.
4. The method according to claim 3, characterized in that The step of acquiring a label phase contrast image obtained by X-rays passing through an object and a grating comprises: Calculate phase deflection distribution parameters according to the first fringe information data and the second fringe information data; A phase scaling factor is set, and the label phase contrast image is generated according to the phase derivative distribution parameter and the phase scaling factor.
5. The method according to claim 4, characterized in that The calculating of the phase deflection distribution parameter according to the first fringe information data and the second fringe information data comprises: Calculate the phase derivative distribution parameter according to formula (2); Formula (2): in, is the phase derivative distribution parameter, φ s (x, y) is the phase of the fringe in the first fringe information data, φ r (x, y) is the phase of the fringe in the second fringe information data, λ is the wavelength of the X-ray, P2 is the period of the grating, and d is the distance between the object and the grating; The step of setting the phase scaling factor and generating the label phase contrast image according to the phase derivative distribution parameter and the phase scaling factor comprises: Scaling the phase derivative distribution parameters according to formula (3) to obtain a label phase contrast image; Formula (3): Where M is the phase scaling factor and ΔΦ(x, y) is the label phase contrast image.
6. The method according to claim 1, characterized in that The step of inputting the object fringe image, the grating fringe image and the label phase contrast image into a generative adversarial network for training to obtain a generative adversarial network model comprises: Generate a predicted phase contrast image from the grating fringe image and the object fringe image through a generator of the generative adversarial network; Fitting the predicted phase contrast image and the labeled phase contrast image through the discriminator of the generative adversarial network to obtain model parameters; The generative adversarial network model is generated according to the model parameters.
7. The method according to claim 6, characterized in that The step of fitting the predicted phase contrast image and the label phase contrast image through the discriminator of the generative adversarial network to obtain model parameters includes: Get adversarial loss; Using a PSNR evaluation index to evaluate the first loss of the predicted phase contrast image and the label phase contrast image; Using the SSIM evaluation index to evaluate the second loss of the predicted phase contrast image and the label phase contrast image; Calculate the training parameters that minimize the sum of the adversarial loss, the first loss, and the second loss, and use the training parameters as the model parameters.
8. An X-ray grating image processing device, characterized in that: The device comprises: A first acquisition module is used to respectively acquire an object fringe image obtained when the X-ray passes through the object and the grating, and a grating fringe image obtained when the X-ray passes only through the grating; A second acquisition module is used to acquire a label phase contrast image obtained by X-rays passing through the object and the grating; A training module, used for inputting the object fringe image, the grating fringe image and the label phase contrast image into a generative adversarial network for training to obtain a generative adversarial network model; The processing module is used to process the fringe image of the object to be processed according to the generative adversarial network model to obtain a predicted phase contrast image of the object to be processed.
9. An electronic device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the X-ray grating image processing method according to any one of claims 1 to 7 is executed.
10. A computer-readable storage medium, characterized in that: The computer program stores a computer program, which executes the X-ray grating image processing method according to any one of claims 1 to 7 when running on a processor.
