Method, device and readable storage medium for calculating offset between fields of view when generating DICOM images by fluorescence scanning slides

Through improved template matching process and GPU accelerated optimization, combined with confidence judgment and sample rate screening, the reliability and efficiency of calculation of inter-field offset when generating DICOM images by fluorescence scanning slides are solved, and high-precision image stitching is achieved.

CN120089304BActive Publication Date: 2025-07-22SHENZHEN SHENGQIANG TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510566213.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-04-30
Publication Date
2025-07-22
Estimated Expiration
2045-04-30

AI Technical Summary

Technical Problem

In the digital scanning of fluorescent biological tissues and cells, the template matching reliability is low and the calculation efficiency is insufficient, resulting in unreliable offset calculation and affecting the accuracy of image stitching.

Method used

The improved template matching calculation process is used to combine GPU accelerated optimization, and a confidence judgment and sample rate screening mechanism is introduced. Reliable image matching results are filtered out through square deviation matching formula, frequency domain convolution operation and reliability score.

Benefits of technology

It improves the reliability and efficiency of image offset calculation, reduces the fragmentation of stitched images, and is suitable for fluorescence scenes with low sample density or high background noise, providing high integrity DICOM data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120089304B_ABST
    Figure CN120089304B_ABST
Patent Text Reader

Abstract

The present invention proposes a method, device and readable storage medium for calculating the offset between fields of view when generating DICOM images from fluorescence scanning glass slides, including obtaining the ROI to be matched and the template area of the overlapping area of adjacent fields of view, calculating the matching result based on the sum of squared differences matching algorithm combined with GPU acceleration, improving the calculation efficiency by performing cross-correlation convolution operation on the image converted to the frequency domain and optimizing the video memory access rule; introducing a credibility judgment mechanism, counting the proportion of the matching results below the preset threshold to exclude untrustworthy results; calculating the proportion of non-zero pixels in the template area through Otsu threshold method combined with false peak construction, Gamma correction and Renyi entropy binarization, and screening abnormal results caused by too few samples or uneven illumination. The present invention significantly improves the reliability and efficiency of offset calculation through a multi-dimensional evaluation mechanism and GPU acceleration strategy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of medical image processing, and particularly to a method, device and readable storage medium for calculating the offset amount between fields of view when generating DICOM images from fluorescence-scanned glass slides. Background Art

[0002] During the digital scanning of fluorescent biological tissues and cells, the scanner needs to calculate the offset amount between adjacent fields of view through the overlapping area of multi-field images for stitching. The traditional method uses cross-correlation normalization scoring for template matching, but there are the following problems:

[0003] 1. Low matching reliability: Sparse samples or smooth background areas are prone to false matching, and the accumulation of incorrect offset amounts causes the stitched image to be fragmented;

[0004] 2. Insufficient calculation efficiency: When relying on the GPU acceleration implementation of a general library (such as OpenCV), due to problems such as frequent application and release of video memory and unaligned memory access, the hardware performance is not fully released, making it difficult to meet the real-time requirements.

[0005] Therefore, there is an urgent need for a method, device and readable storage medium for calculating the offset amount between fields of view when generating DICOM images from fluorescence-scanned glass slides to solve the problems existing in the prior art. Summary of the Invention

[0006] Embodiments of the present invention provide a method, device and readable storage medium for calculating the offset amount between fields of view when generating DICOM images from fluorescence-scanned glass slides, aiming at the problems existing in the current technology that the existing template matching technology lacks a reliable credibility evaluation mechanism and sample rate screening mechanism, and the matching speed is slow, resulting in unreliable calculation of the image offset amount and affecting the accuracy of subsequent applications such as image stitching.

[0007] The core technology of the present invention mainly optimizes the template matching calculation process (based on the mean square error matching formula), combines GPU acceleration (reducing video memory access conflicts and improving calculation efficiency), and introduces a credibility judgment (such as match_confidence) and sample rate screening (such as non_zero_rate) mechanism to comprehensively obtain a reliable image matching result.

[0008] In the first aspect, the present invention provides a method for calculating the offset amount between fields of view when generating DICOM images from fluorescence-scanned glass slides, and the method includes the following steps:

[0009] S1. Initialize the template matching class according to the width and height of the original image;

[0010] S2. Convert the image to be matched and the template image to the frequency domain. Implement the cross-correlation convolution through the convolution theorem by transforming it into the product in the frequency domain through Fourier transform, and then convert the complex domain to the real domain to complete the cross-correlation calculation to obtain the first result;

[0011] S3. Calculate the integral square sum image of the image to be matched. By setting the data structure, each time a data unit is taken to meet the requirements of the GPU, reducing bank conflicts, and performing reduction calculations to obtain the second result;

[0012] S4. Obtain the matching result by synthesizing the first result and the second result;

[0013] During the process of obtaining the matching result, a credibility judgment mechanism and a sample rate screening mechanism are introduced. The credibility judgment mechanism is used to compare the ratio of each value in the matching result to the maximum value with a preset threshold, count the proportion of the number of valid ratios, and judge the result credibility. The sample rate screening mechanism is used to calculate the proportion of non-zero elements in the image to screen abnormal results.

[0014] Furthermore, in step S1, when initializing the template matching class, create a handle from the real domain to the complex domain and a handle from the complex domain to the real domain, pre-apply the video memory of the image to be matched and the template image required for the Fourier transform, and perform the processing operations of the image to be matched in the video memory, including converting the image to be matched to the frequency domain, converting the template image to the frequency domain, and the product result of the complex frequency domain.

[0015] Furthermore, in step S4, the credibility judgment mechanism is specifically as follows: count the proportion of the ratio of each value in the matching result to the maximum value that is lower than the preset threshold. If this proportion exceeds the set credibility threshold, it is determined as an untrustworthy result.

[0016] Furthermore, in step S4, the sample rate screening mechanism specifically includes: performing Otsu threshold processing, false peak construction, and Gamma correction on the image, and then calculating the proportion of non-zero elements. According to this proportion, filter out abnormal results caused by too few samples or uneven illumination.

[0017] Furthermore, in step S3, the specific method of taking each data unit by setting the data structure to meet the requirements of the GPU is as follows:

[0018] Reasonably organize the data, including data alignment, layout optimization, conflict avoidance, and combined access, to ensure that the data access meets the memory access rules of the GPU.

[0019] Furthermore, in step S4, the preset threshold is 0.12, and the set credibility threshold is 0.12.

[0020] Furthermore, in step S4, the false peak construction is specifically as follows: add a false peak of the mean plus three times the standard deviation to the template area histogram, adjust the histogram distribution, and then perform binarization using the Otsu threshold method.

[0021] In a second aspect, the present invention provides a device for calculating the offset between fields of view when a fluorescence scanning glass slide generates a DICOM image, including:

[0022] A region acquisition module configured to acquire the overlapping region of two adjacent fields of view and determine the ROI of the image to be matched and the template region;

[0023] A matching calculation module configured to calculate the matching result based on the sum of squared differences matching algorithm, including:

[0024] An initialization unit for initializing the template matching class according to the width and height of the original image, creating a Fourier transform handle and applying for video memory;

[0025] A frequency domain processing unit for converting the image to the frequency domain and performing cross-correlation convolution calculation;

[0026] A data optimization unit for calculating the integral sum of squares graph and performing GPU data access optimization;

[0027] A confidence judgment module configured to compare the ratio of each value in the matching result to the maximum value with a preset threshold, count the proportion of the number of valid ratios and judge the result confidence;

[0028] A sample rate screening module configured to calculate the proportion of non-zero pixels in the template region by combining Otsu thresholding with false peak construction, Gamma correction and Renyi entropy binarization to judge the sample validity.

[0029] In a third aspect, the present invention provides an electronic device including a memory and a processor. A computer program is stored in the memory, and the processor is set to run the computer program to execute the method for calculating the offset between fields of view when a fluorescence scanning glass slide generates a DICOM image as described above.

[0030] In a fourth aspect, the present invention provides a readable storage medium in which a computer program is stored. The computer program includes program codes for controlling a process to execute the process, and the process includes the method for calculating the offset between fields of view when a fluorescence scanning glass slide generates a DICOM image as described above.

[0031] The main contributions and innovations of the present invention are as follows:

[0032] 1. Improved reliability:

[0033] Introduce a multi-dimensional judgment mechanism (matching significance score match_confidence, sample proportion non_zero_rate) to effectively exclude incorrect offset amounts in sparse samples or blank regions;

[0034] Enhance the robustness of binarization under complex fluorescence backgrounds by adjusting the histogram distribution with false peaks and Renyi entropy segmentation.

[0035] 2. Optimization of Computational Efficiency:

[0036] CUDA self-implemented template matching is used to avoid redundant operations of general libraries. Bank conflicts are reduced through shared memory and coalesced memory access, improving the GPU computing efficiency.

[0037] The engineering ROI selection design (such as formulaic sourcerect / templaterect) supports fast parallel computing of horizontal / vertical offsets.

[0038] 3. Application Effects:

[0039] Reduce the splitting of stitched images and provide highly complete DICOM data for pathological analysis.

[0040] Suitable for fluorescence scenarios with low sample density or high background noise, and compatible with supplementary solutions such as feature point registration.

[0041] Details of one or more embodiments of the present invention are set forth in the following drawings and description to make other features, objects, and advantages of the present invention more concise and understandable. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of the present invention. The schematic embodiments and descriptions thereof are used to explain the present invention and do not unduly limit the present invention. In the drawings:

[0043] Figure 1 is a flowchart of a method for calculating the offset between fields of view when generating a DICOM image from a fluorescence scanning slide according to an embodiment of the present invention;

[0044] Figure 2 is a selection scheme diagram of the roi of the image to be matched and the templ_roi of the template area according to an embodiment of the present invention;

[0045] Figure 3 is a schematic hardware structure diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0046] Exemplary embodiments will be described in detail herein, and examples thereof are shown in the drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with one or more embodiments of this specification. On the contrary, they are merely examples of devices and methods consistent with some aspects of one or more embodiments as detailed in the appended claims.

[0047] It should be noted that: In other embodiments, the steps of the corresponding method are not necessarily executed in the order shown and described in this specification. In some other embodiments, the steps included in the method may be more or less than those described in this specification. In addition, a single step described in this specification may be decomposed into multiple steps for description in other embodiments; and multiple steps described in this specification may also be combined into a single step for description in other embodiments.

[0048] The existing offset calculation method in fluorescence slide scanning is prone to incorrect matching results due to sparse samples or hardware errors, and lacks multi-dimensional credibility judgment and efficient GPU optimization solutions, resulting in fragmented stitching images and low calculation efficiency.

[0049] Based on this, the present invention solves the problems existing in the prior art based on the square difference matching combined with credibility scoring.

[0050] Embodiment 1

[0051] The present invention aims to propose a method for calculating the offset between fields of view when generating DICOM images from fluorescence scanned slides, and realizes high-precision and high-reliability calculation of the offset between fields of view through square difference matching combined with credibility scoring (such as matching significance statistics and sample area ratio analysis) and GPU memory access optimization (shared memory and aligned access).

[0052] Specifically, the embodiment of the present invention provides a method for calculating the offset between fields of view when generating DICOM images from fluorescence scanned slides. Specifically, referring to Figure 1 , the method includes the following steps:

[0053] Step 1: Obtain the overlapping area of two adjacent fields of view, and determine the ROI of the image to be matched and the template area;

[0054] Step 2: Calculate the matching result of the ROI of the image to be matched and the template area based on the square difference matching algorithm, and the matching result is obtained through the following methods:

[0055] a. Initialize the template matching class according to the width and height of the original image, create a handle for the transformation from the real number domain to the complex number domain and a handle for the transformation from the complex number domain to the real number domain, and pre-apply the video memory of the image to be matched and the template image required for the Fourier transform; (corresponding to step S1: Initialize the template matching class according to the width and height of the original image).

[0056] b. Convert the image to be matched and the template image to the frequency domain, perform cross-correlation convolution calculation through frequency domain product operation, and then convert back to the real number domain to obtain the cross-correlation matrix (i.e., the first result); (corresponding to step S2: Convert the image to be matched and the template image to the frequency domain, realize the cross-correlation convolution through the Fourier transform of the product in the frequency domain according to the convolution theorem, and then convert the complex number domain to the real number domain to complete the cross-correlation calculation to obtain the first result).

[0057] c. Calculate the sum of squared integral image (abbreviated as squared image) of the image to be matched. Calculate the sum of squared integral of the template image through the GPU data access optimization method (i.e., the second result, including the sum of squared integral image of the image to be matched and the sum of squared integral of the template image), and calculate the final matching result based on the cross - correlation matrix, the sum of squared integral image of the image to be matched, and the sum of squared integral of the template image; (corresponding to step S3: Calculate the sum of squared integral image of the image to be matched. By setting the data structure, each time a data unit is taken to meet the requirements of the GPU, reduce bank conflicts, and perform reduction calculation to obtain the second result).

[0058] In this embodiment, the specific steps are as follows:

[0059] A1. During the scanning process, there is a certain overlapping area between two adjacent fields of view. Obtain the overlapping area of two adjacent fields of view, the roi of the image to be matched and the templ_roi of the template area;

[0060] A2. Perform squared - difference matching on the roi area obtained in the previous step to obtain the result (implemented by cuda itself):

[0061] match_result( )

[0062] This is the squared - difference matching formula, which can be decomposed into , the image energy part and the cross - correlation part, is the pixel value of the template image (templ_roi) at the coordinate (x', y'); is the pixel value of the image to be matched (roi) at the coordinate (x + x', y + y'), where (x, y) is the offset of the template in the image to be matched; R(x, y) represents the sum of squared pixel differences in the overlapping area between the template and the image to be matched when the offset is (x, y). R(x, y) measures the pixel difference between the template and the image to be matched at different offsets. The smaller the value, the higher the matching degree between the template and the area. Therefore, the (x, y) corresponding to the minimum R(x, y) is the optimal offset.

[0063] In this way, the squared - difference matching provides a basis for offset calculation by quantifying the pixel difference between the template and the image to be matched. The decomposition of the formula in the present invention not only reveals the core mechanism of the matching (the cross - correlation term dominates the difference), but also provides a theoretical support for subsequent GPU acceleration optimization and reliability evaluation through the separation of the energy term and the cross - correlation term, and finally realizes high - precision and high - robustness offset calculation.

[0064] A3. Calculate match_result under this formula. In match_result, The coordinates where the minimum value minVal is located are the offset values within the template area. The offset between fields of view is calculated using this value; the minimum value minVal and the maximum value maxVal in the result image match_result are obtained, and the matching is roughly simplified by calculation the scoring score, where is an extremely small constant (such as 10 -8 ), which is used to avoid numerical errors with a zero denominator and ensure calculation stability. score ∈ [0, 1]. The smaller the value, the more reliable the matching result; the larger the value, the less reliable the matching result.

[0065] In this way, effective matching points are quickly identified through "the relative relationship between the minimum difference and the maximum difference", combined with subsequent statistical analysis (such as the proportion of the credible region) and sample rate screening, forming a multi-dimensional reliability judgment mechanism, fundamentally solving the misjudgment problem of traditional template matching in low-information regions, and providing reliable technical support for high-precision scenarios such as medical slide scanning.

[0066] Preferably, the selection scheme for the image roi to be matched and the template area templ_roi is as follows:

[0067] As Figure 2 shown, in the ideal state, there is no offset between two adjacent fields of view. sourcerect: the ROI area of the source image ( Figure 2 the area corresponding to the pink frame), templaterect: the ROI area of the template image ( Figure 2 the area corresponding to the yellow frame), and the middle black frame is the corresponding calculation formula for the roi corresponding to the overlapping part of two adjacent fields of view.

[0068] For the purpose of facilitating the engineering implementation of the project, in order to calculate the offset in the horizontal and vertical directions of each field of view with fixed and repeatable code implementation, from Figure 2 the overlapping areas sourcerect and templaterect can be configured as:

[0069] The implementation of the vertical sourcerect and templaterect corresponding roi:

[0070]

[0071]

[0072] Similarly, the implementation of the horizontal sourcerect and templaterect corresponding roi:

[0073]

[0074]

[0075] Among them, Width: the width of the image.

[0076] Height: the height of the image.

[0077] matchW_X_Dim, matchH_X_Dim: the width and height of the matching area for the X direction.

[0078] matchW_Y_Dim, matchH_Y_Dim: the width and height of the matching area for the Y direction.

[0079] CutX, CutY: the image cropping amount. Ideally, the overlapping area is twice the cropping amount.

[0080] corrangeXDir_X, corrangeYDir_X: the margins of the offset amounts preset in the X direction and Y direction.

[0081] matchdevide: the coefficient used to divide the matching area in sourcerect and templaterect, that is, the number of parts into which the pink and yellow frames in the figure are divided to improve the calculation speed.

[0082] m: represents the current matching area index, which is used to loop among multiple matching areas. The number of loops is matchdevide. If the result of the first calculation of m already meets the condition of offset amount calculation, the current offset amount calculation will end.

[0083] Solve through cuda self - implementation to reduce operations that require frequent resource application and release in the opencv cuda sum of squared differences matching interface such as Fourier transform. At the same time, adjust the merged memory access of grayscale images and the use of cuda shared memory to maximize the cache hit rate and improve the running speed. (The values of grayscale images are in the range of 0 - 255. Only 8 - bit representation is required for computer expression, while the synchronization mechanism of cuda is 32 - bit, with 128 bytes in a bank. If the number of bytes accessed each time is too small, it is easy to cause unaligned memory access, resulting in bank conflict and resource waste, and will also increase the number of memory access instructions, which is not conducive to giving full play to the computing advantages of the GPU).

[0084] Step 3: Judge the credibility of the matching result: Compare the ratio of each value in the matching result to the maximum value with a preset threshold, and count the proportion of the number of results whose ratio is less than the preset threshold in the total number. If this proportion is zero or exceeds the set credibility threshold, it is determined that the matching result is not credible; (corresponding to step S4, obtaining the first half of the matching result by integrating the first result and the second result, that is, comparing the ratio of each value in the matching result to the maximum value with a preset threshold, counting the proportion of valid ratio numbers and judging the result credibility).

[0085] In this embodiment, the specific steps are as follows:

[0086] Since there are few samples in the overlapping region of two adjacent fields of view, the value at each position in the entire match_result is close to the minimum value. Directly selecting may lead to completely wrong offset selection. Under this condition, the minimum value point is particularly important for judging whether the result is reliable enough in the result:

[0087] B1. The ratio obtained by dividing each result value of match_result by maxVal in step A3 is denoted as ratio. Set a threshold thresh_ratio (take about 0.12), and loop to count the value of ratio. When ratio is less than the threshold, count the number of results count that meet the threshold;

[0088] B2. Divide count by the number of all values in match_result to obtain the confidence score, denoted as:

[0089]

[0090] If match_confidence is 0 or greater than a certain value (such as 0.12, indicating that more than 12% of the point values are close to the result value of the minimum point, then it is considered that the result of the minimum value point is not significant enough. This is a soft tolerance during the program execution process. At the same time, within this threshold range, it reflects the significance of the result from one aspect, which is conducive to judging the result). The results are all untrustworthy; (The purpose of this operation is equivalent to creating a soft confidence score. If match_result is relatively small, it means that each value can be used as a relatively close offset. In a sense, the probability of having samples in this area is smaller or the overall is relatively smooth, and the information volume is too small and the credibility is low, which can be used as a basis for excluding the calculation result of this offset, providing a label of trustworthy and untrustworthy).

[0091] Step Four: Screen the sample rate of the template area: Binarize the template area by combining Otsu's method with false peak construction, and calculate the proportion of non-zero pixels; if the proportion is lower than the preset sample rate threshold, after performing Gamma correction and background subtraction on the image, recalculate the proportion of non-zero pixels by binarization with Renyi entropy, and judge the sample validity based on the proportion. (Corresponding to step S4, the second half of obtaining the matching result by combining the first result and the second result, that is, the sample rate screening mechanism is used to calculate the proportion of non-zero elements in the image to screen abnormal results).

[0092] Among them, the simplified mathematical expression of Otsu's Method is:

[0093]

[0094] Among them, is the segmentation threshold to be solved (the gray value range is usually 0 ≤ ≤ L - 1, where L is the total number of gray levels); p(i) is the probability (normalized frequency) of the occurrence of gray level i, satisfying ; is the threshold The average gray value of the following pixels (background class); is the threshold The average gray value of the pixels above (foreground class). Through the threshold segmentation of this formula, the present invention realizes the automatic distinction between the image background and the foreground, providing key data support for subsequent reliability evaluation.

[0095] In this embodiment, the sample ratio of the templ_roi region of the image to be matched, denoted as image_template, is judged. If the image_template sample is small but shows a relatively significant result, and the offset calculation is an abnormal result as a whole, it is necessary to provide the basis for excluding such abnormal results to facilitate offset calibration by other means:

[0096] C1. Perform an Otsu threshold inversion process on the entire image to generate a binary image. Calculate the background mean mean and standard deviation stddev for the binary image region. If the background gray value is too high, perform mean truncation processing (because the background gray levels of different fluorescence channels may be inconsistent). Since the probability of a single peak in the histogram distribution is relatively high in the case of fluorescence, this approach obtains the binary image of the image from a global range, making a rough estimate of the image background to facilitate the design of the background false peak value later. Artificially creating a double peak is more likely to be segmented by the Otsu threshold.

[0097] C2. Perform a more detailed threshold processing on the image processed in C1:

[0098] a) Under fluorescence conditions, the histogram of the captured image often concentrates in certain background gray levels. The effect of simple triangular threshold segmentation is either too large or too small;

[0099] b) Artificially create a false peak with a value of mean + 3stddev in the histogram to adjust the overall distribution of the histogram, and perform block binarization through the Otsu threshold idea.

[0100] c) For the binarized image, only take the non-zero values in the templ_roi and divide by the area of the templ_roi to obtain the proportion of possible samples in the templ_roi region, denoted as non_zero_rate.

[0101] C3. When the non_zero_rate in C2 is less than 0.1, it may be due to uneven illumination that too many pixels in this area are set to 0 during the binarization process. Perform the following operations:

[0102] a) Perform 0.5 gamma correction to make the sample more visible;

[0103] b) Make a rough background for the corrected image through mean filtering, perform background subtraction, and obtain the sample image denoted as foreground;

[0104] c) Perform binary segmentation on the foreground through Renyi entropy, and recalculate the non-zero ratio of the templ_roi area, denoted as non_zero_rate;

[0105] Comprehensively judge whether the calculated result value is credible based on score, match_confidence, and non_zero_rate.

[0106] For easy understanding, the following is a supplementary description of the professional terms and algorithms not detailedly explained in the present invention, and their principles and functions are elaborated in combination with the invention scenario:

[0107] I. Terms and Algorithms Related to Image Processing

[0108] 1. Sum of Squared Differences (SSD)

[0109] Principle: By calculating the sum of the squared differences of the pixel values in the overlapping area between the template image and the image to be matched, the similarity between the two is measured. The smaller the difference value, the higher the matching degree.

[0110] 2. Otsu's Method

[0111] Principle: Based on the image histogram, the binarization threshold is automatically determined by maximizing the between-class variance (or minimizing the within-class variance), and the image is divided into foreground (sample) and background.

[0112] 3. Gamma Correction Principle: Through the non-linear transformation I' = I γ Adjust the gray distribution of the image to improve the details in areas with uneven illumination or low contrast. γ < 1 enhances the details in the dark part, and γ > 1 suppresses the bright part.

[0113] 4. Renyi Entropy Binarization Principle: An image segmentation method based on Renyi entropy (a generalized information entropy), which determines the threshold by maximizing the sum of the Renyi entropies of the foreground and background of the image, and is more robust to low-contrast or noisy images.

[0114] II. Terms Related to GPU Acceleration

[0115] 1. CUDA (Compute Unified Device Architecture)

[0116] Definition: A general parallel computing architecture introduced by NVIDIA that allows the use of the parallel computing cores of GPUs to accelerate scientific computing and data processing.

[0117] Optimization points of the present invention:

[0118] Self-implemented Fourier transform process (avoiding the general overhead of the OpenCV library), reducing Bank conflicts and improving video memory access efficiency by merging memory access (continuous memory access), shared memory reuse, 128-byte alignment, etc.

[0119] 2. Bank conflict (Bank Conflict)

[0120] Principle: The GPU video memory consists of multiple Banks (memory banks). If multiple threads access different addresses of the same Bank simultaneously, it will lead to serialized access and reduce bandwidth utilization.

[0121] Countermeasures of the present invention:

[0122] Through data reorganization (such as transposing matrices and aligning storage by thread blocks), ensure that adjacent threads access different Bank addresses, avoid conflicts, and improve the utilization rate of computing cores (the core goal of "reasonable data organization").

[0123] 3. Definition of Integral Image: A preprocessing technique that stores the sum of pixels in any rectangular region of an image, reducing the time complexity of region sum calculation to O(1). Application of the present invention: In step A2, calculate the integral sum of squares image of the image to be matched (each point stores the sum of squares of pixels from this point to the upper left corner) to accelerate the calculation of the energy term E I (x,y) and avoid repeated pixel traversal.

[0124] III. Terms related to engineering implementation

[0125] 1. ROI (Region of Interest, region of interest)

[0126] Definition: A specific region extracted from an image for focusing on processing targets (such as overlapping regions).

[0127] 2. Fake Peak Construction

[0128] Objective: For the unimodal distribution of the fluorescence image histogram (dominated by the background), artificially add a peak (such as the mean + 3 times the standard deviation) to convert the unimodal into a bimodal, enabling Otsu's method to effectively segment the background and the sample.

[0129] IV. Reliability Evaluation Metrics

[0130] 1. match_confidence (matching confidence)

[0131] Calculation: Statistically calculate the proportion of points with a difference value lower than 12% of the maximum value (threshold thresh_ratio = 0.12) in the matching results.

[0132] 2. non_zero_rate (non-zero pixel rate)

[0133] Significance: The proportion of non-zero pixels (regarded as samples) after binarization in the template area to the total area, reflecting the richness of effective samples in the area.

[0134] V. Concepts Related to Frequency Domain Processing

[0135] 1. Fourier Transform

[0136] Function: Convert the image from the spatial domain to the frequency domain, enabling the convolution operation to be transformed into a frequency domain product (convolution theorem), significantly reducing the computational complexity (the original spatial domain convolution complexity is O(N 4 ), and the frequency domain is O(N 2 log N)).

[0137] Process of the present invention:

[0138] In step A2, the Fourier transform is implemented through CUDA (real domain → complex domain → real domain) to accelerate the calculation of the cross-correlation matrix, and the integral image (integral sum of squares image) technology is combined to efficiently solve the square difference matching.

[0139] 2. Cross-Correlation Convolution

[0140] Definition: Measure the similarity between the template and the image, which is essentially a convolution operation after the template is flipped.

[0141] Frequency domain implementation: Utilize the conjugate symmetry of the Fourier transform to convert the cross-correlation into a frequency domain product and then perform the inverse transform, avoiding the high complexity of direct convolution in the spatial domain.

[0142] Embodiment 2

[0143] Based on the same concept, the present invention also proposes a device for calculating the offset between fields of view when generating DICOM images from a fluorescence scanning glass slide, including:

[0144] An area acquisition module, configured to acquire an overlapping area of two adjacent fields of view, and determine a ROI of a to-be-matched image and a template area;

[0145] A matching calculation module, configured to calculate a matching result based on a sum of squared differences matching algorithm, including:

[0146] An initialization unit, for initializing a template matching class according to the width and height of an original image, creating a Fourier transform handle and applying for video memory;

[0147] A frequency domain processing unit, for converting an image to the frequency domain and performing cross-correlation convolution calculation;

[0148] A data optimization unit, for calculating an integral sum of squares graph and performing GPU data access optimization;

[0149] A credibility judgment module, configured to compare the ratio of each value in the matching result to the maximum value with a preset threshold, count the proportion of the number of valid ratios and judge the result credibility;

[0150] A sample rate screening module, configured to calculate the proportion of non-zero pixels in the template area by combining Otsu threshold with false peak construction, Gamma correction and Renyi entropy binarization, and judge the sample validity.

[0151] Embodiment III

[0152] This embodiment also provides an electronic device, refer to Figure 3 , including a memory 404 and a processor 402. A computer program is stored in the memory 404, and the processor 402 is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0153] Specifically, the above-mentioned processor 402 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC for short), or may be configured as one or more integrated circuits implementing the embodiments of the present invention.

[0154] Among them, the memory 404 may include a mass memory 404 for data or instructions. By way of example and not limitation, the memory 404 may include a hard disk drive (HDD), a floppy disk drive, a solid state drive (SSD), a flash memory, an optical disc, a magneto-optical disc, a magnetic tape, or a universal serial bus (USB) drive, or a combination of two or more of these. In suitable cases, the memory 404 may include removable or non-removable (or fixed) media. In suitable cases, the memory 404 may be internal or external to the data processing device. In a particular embodiment, the memory 404 is non-volatile memory. In a particular embodiment, the memory 404 includes a read-only memory (ROM) and a random access memory (RAM). In suitable cases, the ROM may be a mask-programmed ROM, a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (EEPROM), an electrically alterable ROM (EAROM), or a flash memory, or a combination of two or more of these. In suitable cases, the RAM may be a static random access memory (SRAM) or a dynamic random access memory (DRAM), where the DRAM may be a fast page mode dynamic random access memory (FPMDRAM), an extended data output dynamic random access memory (EDODRAM), a synchronous dynamic random access memory (SDRAM), etc.

[0155] The memory 404 can be used to store or cache various data files required for processing and / or communication, as well as possible computer program instructions executed by the processor 402.

[0156] By reading and executing the computer program instructions stored in the memory 404, the processor 402 implements the method for calculating the inter-field offset when generating DICOM images from a fluorescence-scanned glass slide in any of the above embodiments.

[0157] Optionally, the above electronic device may further include a transmission device 406 and an input / output device 408. Among them, the transmission device 406 is connected to the above processor 402, and the input / output device 408 is connected to the above processor 402.

[0158] The transmission device 406 can be used to receive or send data via a network. Specific examples of the above network may include wired or wireless networks provided by the communication provider of the electronic device. In one example, the transmission device includes a network adapter (Network Interface Controller, abbreviated as NIC), which can be connected to other network devices through a base station and thus communicate with the Internet. In one example, the transmission device 406 can be a radio frequency (Radio Frequency, abbreviated as RF) module, which is used to communicate with the Internet wirelessly.

[0159] The input / output device 408 is used to input or output information.

[0160] Embodiment 4

[0161] This embodiment also provides a readable storage medium, in which a computer program is stored. The computer program includes program code for controlling a process to execute the process. The process includes the method for calculating the inter-field offset when generating DICOM images from a fluorescence-scanned glass slide according to Embodiment 1.

[0162] It should be noted that the specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementation manners, and will not be elaborated here.

[0163] Generally, various embodiments can be implemented in hardware or dedicated circuits, software, logic, or any combination thereof. Some aspects of the present invention can be implemented in hardware, while other aspects can be implemented by firmware or software executed by a controller, microprocessor, or other computing device, but the present invention is not limited thereto. Although aspects of the present invention may be shown and described as block diagrams, flowcharts, or using some other graphical representation, it should be understood that, by way of non-limiting example, the blocks, devices, systems, techniques, or methods described herein can be implemented in hardware, software, firmware, dedicated circuits or logic, general hardware or a controller or other computing device, or some combination thereof.

[0164] Embodiments of the present invention can be implemented by computer software that is executable by a data processor of a mobile device, such as in a processor entity, or by hardware, or by a combination of software and hardware. A computer software or program (also referred to as a program product), including software routines, applets, and / or macros, can be stored in any device-readable data storage medium, and they include program instructions for performing specific tasks. The computer program product can include one or more computer-executable components that are configured to perform the embodiments when the program runs. One or more computer-executable components can be at least one software code or a part thereof. Additionally, in this regard, it should be noted that any block in the logical flow as shown in the figures can represent a program step, or interconnected logical circuits, blocks, and functions, or a combination of program steps and logical circuits, blocks, and functions. The software can be stored on physical media such as memory chips or storage blocks implemented within the processor, magnetic media such as hard disks or floppy disks, and optical media such as, for example, DVDs and their data variants, CDs. The physical media are non-transitory media.

[0165] Those skilled in the art should understand that the technical features of the above embodiments can be combined arbitrarily. For the sake of brevity of description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as falling within the scope described in this specification.

[0166] The above embodiments only represent several implementation manners of the present invention, and their descriptions are relatively specific and detailed, but they should not be construed as limiting the scope of the present invention. It should be pointed out that for those of ordinary skill in the art, without departing from the concept of the present invention, several modifications and improvements can still be made, and these all belong to the protection scope of the present invention. Therefore, the protection scope of the present invention should be subject to the appended claims.

Claims

1. Method for calculating offset between fields of view when a fluorescence scanning glass slide generates a DICOM image, characterized in that, It includes the following steps: S1. Initialize the template matching class according to the width and height of the original image; Among them, when initializing the template matching class, create handles from the real number domain to the complex number domain and from the complex number domain to the real number domain, pre-apply the video memory for the image to be matched and the template image required for the Fourier transform, and perform processing operations on the image to be matched in the video memory, including converting the image to be matched to the frequency domain, converting the template image to the frequency domain, and the product result in the complex frequency domain; S2. Convert the image to be matched and the template image to the frequency domain. Realize the cross-correlation convolution through the Fourier transform as the product in the frequency domain by the convolution theorem, and then convert from the complex number domain to the real number domain to complete the cross-correlation calculation to obtain the first result; S3. Calculate the integral sum of squares graph of the image to be matched. Each time, take data units by setting the data structure to meet the requirements of the GPU, reduce bank conflicts, and perform reduction calculation to obtain the second result; S4. Obtain the matching result by synthesizing the first result and the second result; During the process of obtaining the matching result, introduce a credibility judgment mechanism and a sample rate screening mechanism. The credibility judgment mechanism is used to compare the ratio of each value in the matching result to the maximum value with a preset threshold, count the proportion of the number of valid ratios, and judge the result credibility. The sample rate screening mechanism is used to calculate the proportion of non-zero elements in the image to screen abnormal results.

2. The method for calculating the offset amount between fields of view when generating a DICOM image from a fluorescence scanning glass slide according to claim 1, characterized in that, In step S4, the credibility judgment mechanism is specifically: count the proportion of the ratio of each value in the matching result to the maximum value that is lower than the preset threshold. If this proportion exceeds the set credibility threshold, it is determined as an untrustworthy result.

3. The method for calculating the offset between fields of view when generating DICOM images from a fluorescence scanning glass slide according to claim 1, characterized in that, In step S4, the sample rate screening mechanism specifically includes: perform Otsu threshold processing, false peak construction, and Gamma correction steps on the image, calculate the proportion of non-zero elements, and screen out abnormal results caused by too few samples or uneven illumination according to this proportion.

4. The method for calculating the offset between fields of view when generating DICOM images from a fluorescence scanning slide as claimed in claim 1, wherein In step S3, each time taking data units by setting the data structure to meet the requirements of the GPU specifically means: Reasonably organize the data, including data alignment, layout optimization, conflict avoidance, and combined access, to ensure that data access meets the memory access rules of the GPU.

5. The method for calculating the offset between fields of view when generating DICOM images from a fluorescence scanning glass slide according to claim 2, wherein In step S4, the preset threshold is 0.12, and the set credibility threshold is 0.

12.

6. The method for calculating the offset between fields of view when generating a DICOM image from a fluorescence-scanned glass slide according to claim 3, characterized in that In step S4, the false peak construction is specifically: add a false peak of the mean plus three times the standard deviation to the template area histogram, adjust the histogram distribution, and then perform binarization using the Otsu threshold method.

7. An offset calculation device between fields of view when a fluorescence scanning glass slide generates a DICOM image, characterized in that, It includes: A region acquisition module configured to acquire the overlapping region of two adjacent fields of view and determine the ROI of the image to be matched and the template region; A matching calculation module configured to calculate the matching result based on the sum of squared differences matching algorithm, including: An initialization unit for initializing the template matching class according to the width and height of the original image, creating a Fourier transform handle and applying for video memory; among them, when initializing the template matching class, create handles from the real number domain to the complex number domain and from the complex number domain to the real number domain, pre-apply the video memory for the image to be matched and the template image required for the Fourier transform, and perform processing operations on the image to be matched in the video memory, including converting the image to be matched to the frequency domain, converting the template image to the frequency domain, and the product result in the complex frequency domain; A frequency domain processing unit for converting the image to the frequency domain and performing cross-correlation convolution calculation; A data optimization unit for calculating the integral sum of squares graph and performing GPU data access optimization; The credibility judgment module is configured to compare the ratio of each value in the matching result to the maximum value with a preset threshold, count the proportion of the number of valid ratios, and judge the result credibility; The sample rate screening module is configured to calculate the proportion of non-zero pixels in the template area by combining Otsu thresholding with false peak construction, Gamma correction, and Renyi entropy binarization, and judge the sample validity.

8. An electronic device, comprising a memory and a processor, characterized in that, A computer program is stored in the memory, and the processor is set to run the computer program to execute the method for calculating the inter-field offset when generating a DICOM image from a fluorescence-scanned glass slide according to any one of claims 1 to 6.

9. A readable storage medium, characterized in that, A computer program is stored in the readable storage medium, and the computer program includes program codes for controlling a process to execute the process, and the process includes the method for calculating the inter-field offset when generating a DICOM image from a fluorescence-scanned glass slide according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • System and method for image processing

    CN118056221A

  • Image registration and template construction method and apparatus, electronic device, and storage medium

    WO2023246091A1