Pathological image preprocessing and feature extraction method
By using RGB and HSV dual color spaces to remove contaminants, segment and diced the images, and extracted features using the visual converter model, and standardized staining, the problem of slide pollution and staining inconsistency is solved, and image quality and analysis accuracy are significantly improved.
Patent Information
- Application Number
- CN202510036207.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-09
- Publication Date
- 2025-05-09
- Estimated Expiration
- 2045-01-09
AI Technical Summary
The prior art ignores slide contamination and staining inconsistencies in pathological image analysis, resulting in a decline in image quality and the impact of the performance of automatic image analysis algorithms.
The double color space of RGB and HSV is used to remove pollutants, and the pathological images are segmented and diced through open source tools, and feature extraction is used for pre-trained visual converter models, and staining is standardized at the same time.
It significantly improves the quality of pathological images, reduces noise interference on feature extraction and diagnostic results, and improves the accuracy and reliability of image analysis.
Smart Images

Figure CN119964154A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of pathological image processing, and in particular to a method for preprocessing and feature extraction of pathological images. Background Art
[0002] Pathology image analysis is a key area in modern medical diagnosis and research, especially in cancer diagnosis, pathology research, and drug development. Pathology images, especially whole slide images (WSI), provide rich information about cell and tissue structures, which is essential for understanding the nature and development of diseases. However, the analysis of pathology images faces multiple challenges; first, whole slide images are usually very large, often containing billions of pixels, which not only places high demands on storage devices, but also greatly increases the computational burden of image processing and analysis. In addition, pathology images may introduce various contaminants such as dust, scratches, or other impurities during the scanning process, which may cover or distort key tissue areas related to disease diagnosis in the image, thereby affecting the accuracy and reliability of diagnosis. Another important issue is the inconsistency of the staining process. The staining process of pathology sections relies on a variety of chemical reagents and operating conditions, which may vary in different laboratories or at different times, resulting in significant visual differences in images of the same tissue. This staining inconsistency not only affects the diagnosis of the human eye, but also obscures or distorts histological features, greatly interfering with the performance of automatic image analysis algorithms, as most algorithms rely on the consistency of color and texture to identify and classify pathological features. In order to solve these problems, it is an essential step to preprocess the pathological images before the image analysis algorithm. The preprocessing process needs to effectively remove contaminants in the image, and then the image is cut into pieces to reduce the storage burden and computational complexity, which is conducive to subsequent in-depth analysis. In addition, the standardization of staining is also a key step to ensure the accuracy of image analysis. It can reduce the differences between images from different batches and sources and improve the generalization ability of the algorithm.
[0003] Disadvantages of existing technologies: (1) Ignoring the phenomenon of glass slide contamination: Existing technologies often do not fully consider the possible contamination of glass slides in actual situations. Contaminants can cause obvious interference on the image, affecting the quality of the image and subsequent image analysis. If effective decontamination treatment is not performed, these contaminants may cause the image recognition algorithm to mistakenly identify false positive or false negative results, thereby affecting the accuracy of the diagnosis. (2) Staining inconsistency is not resolved: Different pathology departments may use different staining protocols, which will lead to staining inconsistency, and images under the same pathological conditions will have significant differences in color; existing technologies often lack effective staining standardization methods, and cannot ensure that images from different sources have consistent staining levels during feature extraction and analysis, which limits the generalization ability and application scope of the algorithm. (3) Pathological images are not fully preprocessed, and the quality and availability of the extracted features are greatly limited, which will directly affect the feature learning in the subsequent image analysis algorithm and the accuracy of downstream tasks.
[0004] Prior art 1, application number: CN202410700444.X discloses a multimodal breast tumor risk prediction method and system based on pathological images, including obtaining pathological image data and gene sequence data; preprocessing the pathological image data and gene sequence data; building a multimodal breast tumor risk prediction model; using the multimodal breast tumor risk prediction model to extract features from the preprocessed data, and perform feature fusion on the extracted features. Although it can efficiently integrate pathological images and genomic data to achieve accurate prediction of the survival risk of breast cancer patients; however, it is too dependent on data and lacks preprocessing of source data, which affects the accuracy of the model output results to a certain extent.
[0005] Prior art 2, application number: CN202411697291.4 discloses an immunohistochemical digital pathology image processing method, including obtaining immunohistochemical stained pathology images and preprocessing them; dividing the preprocessed pathology images into regions, extracting and fusing features for each sub-region, and generating a multidimensional feature vector; optimizing the pathology images based on the multidimensional feature vectors using a regional growing and merging algorithm; detecting the staining intensity of the optimized pathology images, and classifying the staining regions using a K-means clustering algorithm; and performing quantitative analysis based on the classification results and generating an immunohistochemical image analysis report. Although accurate segmentation and classification analysis of immunohistochemical staining regions are achieved through preprocessing, feature extraction and fusion, combined with regional growing and merging algorithms, the automation and recognition accuracy of image processing are improved; however, the slide contamination phenomenon is ignored, which affects the image quality and subsequent image analysis.
[0006] Prior art three, application number: CN 202411087165.7 discloses a method for evaluating the imaging quality of pathological images, which uses the collected pathological images captured by an optical microscope at multiple defocused planes to construct a pathological image defocused dataset; preprocesses the defocused pathological image dataset; establishes a pathological image quality evaluation network based on frequency domain features; uses a combined loss function to optimize the training to obtain an optimized deep neural network model for pathological image quality evaluation based on frequency domain features; uses the optimized pathological image quality evaluation network to output the pathological image quality grade. Although an end-to-end deep learning model is adopted, a frequency convolution module is proposed to extract the frequency features of pathological images, improve the performance of pathological image quality evaluation, and has good robustness and strong adaptability; however, there is a lack of effective staining standardization methods, and it is impossible to ensure that images from different sources have consistent staining levels during feature extraction and analysis, which limits the generalization ability and application scope of the algorithm.
[0007] At present, the existing technologies 1, 2 and 3 have the problems of ignoring the phenomenon of glass slide contamination, not solving the inconsistency of staining, and not fully performing preprocessing operations on pathological images. Therefore, the present invention provides a method for preprocessing and feature extraction of pathological images. Summary of the invention
[0008] In order to solve the above technical problems, the present invention provides a method for pathological image preprocessing and feature extraction, comprising the following steps:
[0009] Full-slice images were obtained for thumbnail extraction, and contaminants were removed using dual color spaces of RGB and HSV;
[0010] Use open source tools to segment pathological images, separate pathological tissue from background, and perform block processing;
[0011] The pre-trained visual transformer model is used to extract features from the pre-processed whole-slice images to capture the complex features and subtle differences in the standardized whole-slice images.
[0012] Optionally, the process of pollutant removal using dual color spaces of RGB and HSV includes the following steps:
[0013] In the RGB color space, the image is decomposed into three independent channels: red, green, and blue;
[0014] After preliminary filtering in the RGB domain, the image is converted to the HSV color space. In the HSV space, dynamic threshold ranges are set for hue, saturation, and brightness to locate and remove interference information in the complex background while retaining the detailed features of the pathological tissue;
[0015] According to the specific characteristics of the whole slice image, the weight ratio of RGB and HSV domains is automatically adjusted; by analyzing the global and local characteristics of the image, the threshold range of RGB and HSV domains is automatically adjusted.
[0016] Optionally, for each red, green, and blue channel, a dynamic threshold range is set according to the characteristics of the full-slice image; by comparing the RGB value of each pixel with a preset threshold, pixels below the threshold are reset to white.
[0017] Optionally, after the threshold range is automatically adjusted, the image is decomposed into multiple scales, and the threshold range is set at different scales to adapt to pollutants of different sizes and types; after the pollutants are removed, the image is edge-smoothed.
[0018] Optionally, after the dicing process, an open source library is used for color standardization, and N×N image blocks are spliced to form a large image for batch processing.
[0019] Alternatively, the process of staining normalization using an open source library includes the following steps:
[0020] The staining distribution information in the image is extracted through the open source library, and the staining characteristics of multiple high-quality pathological images are statistically analyzed through the open source library to establish a staining reference template;
[0021] Based on the staining reference template, staining mapping and correction are performed on the target pathological image, and the staining intensity of the target image is mapped into the standardized range of the reference template;
[0022] After the staining standardization is completed, statistical analysis methods are used to verify whether the distribution of staining in the image meets the standards of the reference template; feature matching technology is used to evaluate the consistency of staining intensity, uniformity and contrast.
[0023] Optionally, the process of creating a staining reference template includes the following steps:
[0024] From multiple high-quality pathology images, key parameters such as staining intensity, staining uniformity, and staining contrast were extracted using open source libraries;
[0025] Based on the statistical analysis results of staining intensity, a standardized intensity range was constructed and used as the core parameter of the staining intensity template. Based on the statistical analysis results of staining uniformity, a uniformity reference standard was established and used as the core parameter of the staining uniformity template. Based on the statistical analysis results of staining contrast, a standardized contrast threshold was defined and used as the core parameter of the staining contrast template.
[0026] Optionally, the staining intensity is quantified by the distribution law of pixel values, the staining uniformity is statistically analyzed by the spatial distribution of the staining in the tissue, and the staining contrast is calculated by the difference between the stained area and the background area.
[0027] Optionally, after the color intensity is mapped to a standardized range of a reference template, the uniformity of staining in the tissue is improved by local contrast enhancement and staining distribution equalization; and the contrast between the staining and the background is optimized according to a contrast threshold of the reference template.
[0028] Optionally, parameters of the staining intensity, uniformity and contrast template are adjusted by an iterative optimization method; and the applicability of the staining reference template in different images is verified.
[0029] The present invention uses full-slice image thumbnail extraction and pollutant removal. Thumbnail extraction generates thumbnails to reduce image resolution, facilitate quick preview and preliminary analysis, and reduce computational burden. RGB and HSV dual color space processing, in the RGB domain, by color threshold filtering, pixels below the preset threshold are reset to white, which can effectively remove obvious pollutants (such as dust, stains, etc.); in the HSV domain, by setting the threshold range of hue, saturation, and brightness, different types of pollutants (such as unevenly stained areas) can be more accurately identified and removed. Pathological image segmentation, block cutting and staining standardization, image segmentation separates pathological tissue from the background, focuses on the target area, and reduces interference from irrelevant information; block cutting divides large-size pathological images into N×N small blocks, which is convenient for batch processing and efficient training of deep learning models; staining standardization uses open source libraries to perform staining standardization on images, eliminates color differences caused by different staining batches or equipment, and ensures image consistency; image stitching reassembles the processed N×N image blocks into a large image for overall analysis and feature extraction. Visual Transformer model feature extraction, pre-trained visual transformer (ViT) model, using the pre-trained ViT model to extract features from preprocessed images, can capture complex features and subtle differences in full-slice images; global modeling capability ViT's self-attention mechanism can capture long-distance dependencies in images and extract richer contextual information; high-dimensional feature representation The extracted features can be used for subsequent classification, segmentation or diagnosis tasks, providing strong support for pathological analysis.
[0030] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained by the structures particularly pointed out in the written description and the accompanying drawings.
[0031] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings:
[0033] Figure 1 Flow chart of the method for pathological image preprocessing and feature extraction in Example 1 of the present invention;
[0034] Figure 2 This is a schematic diagram of the method for pathological image preprocessing and feature extraction in Example 1 of the present invention;
[0035] Figure 3 This is a process diagram of pollutant removal using RGB and HSV dual color spaces in Example 2 of the present invention;
[0036] Figure 4 This is a process diagram of setting a dynamic threshold range according to the characteristics of a full-slice image in Embodiment 3 of the present invention;
[0037] Figure 5 This is a process diagram of setting dynamic threshold ranges for hue, saturation and brightness in HSV space in Embodiment 4 of the present invention;
[0038] Figure 6 This is a process diagram of automatically adjusting the threshold range of RGB and HSV domains in Example 5 of the present invention;
[0039] Figure 7 This is a process diagram of using an open source library to perform dyeing standardization in Example 6 of the present invention;
[0040] Figure 8 A process diagram of establishing a staining reference template in Example 7 of the present invention;
[0041] Fig. 9 This is a process diagram of staining mapping and correction of a target pathological image in Example 8 of the present invention;
[0042] Fig.10 This is a process diagram of feature extraction of a preprocessed full-slice image in Example 9 of the present invention;
[0043] Fig.11 This is a process diagram for calculating the correlation between image blocks on a global scale in Embodiment 10 of the present invention. DETAILED DESCRIPTION
[0044] The preferred embodiments of the present invention are described below in conjunction with the accompanying drawings. It should be understood that the preferred embodiments described herein are only used to illustrate and explain the present invention, and are not used to limit the present invention.
[0045] The terms used in the embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to limit the embodiments of the present application. The singular forms of "a", "said" and "the" used in the embodiments of the present application are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in this article refers to and includes any or all possible combinations of one or more associated listed items.
[0046] When the following description relates to the accompanying 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 the present application. On the contrary, they are only examples of devices and methods consistent with some aspects of the present application. In the description of the present application, it should be understood that the terms "first", "second", "third", etc. are only used to distinguish similar objects, and do not have to be used to describe a specific order or sequence, nor can they be understood as indicating or implying relative importance. For those of ordinary skill in the art, the specific meanings of the above terms in the present application can be understood according to the specific circumstances.
[0047] Example 1: Figure 1 As shown, an embodiment of the present invention provides a method for pathological image preprocessing and feature extraction, comprising the following steps:
[0048] S100: Obtain the full slice image for thumbnail extraction, and use the RGB and HSV dual color spaces for pollutant removal; in the RGB domain, pixels below the preset threshold are reset to white through color threshold filtering to remove obvious pollutants; in the HSV domain, different types of pollutants are identified and removed by setting the threshold range of hue, saturation and brightness;
[0049] S200: Use open source tools to segment pathological images, separate pathological tissue from background, and perform block processing; use open source libraries to standardize staining, and splice N×N image blocks to form large images for batch processing;
[0050] S300: Use the pre-trained visual transformer model to extract features from pre-processed whole-slice images to capture complex features and subtle differences in the standardized whole-slice images.
[0051] The working principle and beneficial effects of the above technical solution are as follows: In this embodiment, the whole slice image is first obtained for thumbnail extraction, and the RGB and HSV dual color spaces are used for pollutant removal; in the RGB domain, pixels below the preset threshold are reset to white through color threshold filtering to remove obvious pollutants; in the HSV domain, different types of pollutants are identified and removed by setting the threshold range of hue, saturation and brightness; secondly, the pathological image is segmented using open source tools to separate the pathological tissue from the background and perform block processing; the open source library is used for staining standardization, and N×N image blocks are spliced to form a large image for batch processing; finally, the pre-trained visual converter model is used to extract features from the pre-processed whole slice image to capture the complex features and subtle differences in the standardized whole slice image (for specific principles, refer to the attached Figure 2). Step S100 of the above scheme is full-slice image thumbnail extraction and contaminant removal. Thumbnail extraction generates thumbnails to reduce image resolution, facilitate quick preview and preliminary analysis, and reduce computational burden; RGB and HSV dual color space processing, in the RGB domain, through color threshold filtering, pixels below the preset threshold are reset to white, which can effectively remove obvious contaminants (such as dust, stains, etc.); in the HSV domain, by setting the threshold range of hue, saturation and brightness, different types of contaminants (such as unevenly stained areas) can be more accurately identified and removed. Significance: Significantly improves the quality of the image, provides clean and reliable input data for analysis, and reduces the interference of noise on feature extraction and diagnostic results. Step S200: Pathological image segmentation, block cutting and staining standardization. Image segmentation separates pathological tissue from background, focuses on the target area, and reduces the interference of irrelevant information. Block cutting divides large-size pathological images into N×N small blocks, which is convenient for batch processing and efficient training of deep learning models. Staining standardization uses open source libraries to standardize the staining of images, eliminates color differences caused by different staining batches or equipment, and ensures image consistency. Image stitching re-stitches the processed N×N image blocks into a large image, which is convenient for overall analysis and feature extraction. Significance: It realizes the standardization and modular processing of pathological images, provides a high-quality and consistent data foundation for feature extraction and model training, and significantly improves the accuracy and repeatability of analysis. Step S300: Feature extraction of visual transformer model, pre-training visual transformer (ViT) model, using pre-trained ViT model to extract features from pre-processed images, which can capture complex features and subtle differences in full-slice images; global modeling capability ViT's self-attention mechanism can capture long-distance dependencies in images and extract richer contextual information; high-dimensional feature representation The extracted features can be used for subsequent classification, segmentation or diagnosis tasks, providing strong support for pathological analysis. Significance: It makes full use of the powerful capabilities of deep learning models, can extract key features from complex pathological images, and provides technical support for accurate diagnosis and pathological research. At the same time, the introduction of ViT has brought new possibilities for pathological image analysis and promoted technological progress in this field.
[0052] In summary, the preprocessing and feature extraction of pathological images in this embodiment achieves full-process optimization from raw data to high-quality features. It not only improves the efficiency and accuracy of pathological analysis, but also provides reliable technical support for automated diagnosis, disease prediction and personalized treatment. At the same time, the standardization and modular design of this process lays the foundation for large-scale pathological image analysis and promotes the development of medical artificial intelligence. This embodiment effectively solves the above problems through image decontamination, image slicing, staining standardization and feature extraction using advanced deep learning models, improves the efficiency and accuracy of pathological image analysis, and provides a reliable technical support for the automated analysis of pathological images. This embodiment provides a set of systematic preprocessing processes, including image decontamination, image slicing and staining standardization; ensures that the images input into the feature extraction model are of high quality and consistency, thereby laying a solid foundation for analysis. The enhanced feature extraction accuracy of this embodiment significantly improves the accuracy of feature extraction by extracting features from preprocessed high-quality images; combined with the pre-trained deep learning model, it can capture more subtle and complex pathological features, improve the accuracy and reliability of image analysis, and help subsequent downstream tasks such as disease classification and diagnosis.
[0053] The improvement of the pathological image quality in this embodiment solves the problem of improving the image quality during the pathological image analysis process, including removing contaminants on the slide and solving the inconsistency of staining; these improvements ensure the clarity and color consistency of the image, thereby improving the reliability of the analysis. By extracting features from the pre-processed high-quality images, the accuracy problem of feature extraction is solved; using advanced pre-trained deep learning models, more precise and detailed features can be extracted from pathological images, supporting more accurate pathological analysis and diagnosis. It not only improves the efficiency and accuracy of pathological image analysis, but also provides strong technical support for automated pathological analysis.
[0054] Example 2: Figure 3 As shown, based on Example 1, the process of removing pollutants using the dual color space of RGB and HSV provided in the embodiment of the present invention includes the following steps:
[0055] S101: In the RGB color space, the image is decomposed into three independent channels of red, green and blue; for each channel, a dynamic threshold range is set according to the characteristics of the full-slice image; by comparing the RGB value of each pixel with a preset threshold, the pixels below the threshold are reset to white;
[0056] S102: After preliminary filtering in the RGB domain, the image is converted to the HSV color space. In the HSV space, dynamic threshold ranges are set for hue, saturation, and brightness to locate and remove interference information in the complex background while retaining detailed features of the pathological tissue;
[0057] S103: Automatically adjust the weight ratio of RGB and HSV domains according to the specific features of the full-slice image; automatically adjust the threshold range of RGB and HSV domains by analyzing the global and local features of the image; perform multi-scale decomposition on the image and set the threshold range at different scales to adapt to pollutants of different sizes and types; after the pollutants are removed, perform edge smoothing on the image.
[0058] The working principle and beneficial effects of the above technical solution are as follows: in this embodiment, first, in the RGB color space, the image is decomposed into three independent channels of red, green and blue; for each channel, a dynamic threshold range is set according to the characteristics of the full-slice image; by comparing the RGB value of each pixel with the preset threshold, the pixels below the threshold are reset to white; secondly, after preliminary filtering in the RGB domain, the image is converted to the HSV color space, and in the HSV space, the dynamic threshold range is set for the hue, saturation and brightness respectively, so as to locate and remove the interference information in the complex background while retaining the detailed features of the pathological tissue; finally, according to the specific features of the full-slice image, the weight ratio of the RGB and HSV domains is automatically adjusted; by analyzing the global and local features of the image, the threshold range of the RGB and HSV domains is automatically adjusted; the image is decomposed at multiple scales, and the threshold range is set at different scales to adapt to pollutants of different sizes and types; after the pollutants are removed, the image is edge-smoothed. Step S101 of the above scheme: Preliminary filtering in RGB color space, channel separation and dynamic threshold setting decompose the image into three independent channels of red, green and blue, which can more finely analyze the pixel distribution of each channel; by setting the dynamic threshold range, pathological tissue and background noise can be effectively distinguished; pixels are reset to white, and pixels below the threshold are reset to white, which can preliminarily remove low-brightness pollutants in the image and retain high-brightness pathological tissue information. Significance: Preliminary noise reduction can quickly remove obvious low-brightness interference through preliminary filtering in RGB space, laying the foundation for fine processing; the setting of dynamic threshold for retaining details avoids excessive filtering and ensures that the detailed features of pathological tissue are not destroyed. Step S102: Fine processing in HSV color space, color space conversion converts the image from RGB to HSV color space, which can better separate hue, saturation and brightness information, and facilitates more accurate processing for complex backgrounds; dynamic threshold setting and interference removal set dynamic thresholds for hue, saturation and brightness in HSV space, which can effectively locate and remove interference information in complex backgrounds; detail retention ensures that the detailed features of pathological tissue are retained through fine threshold adjustment. Significance: Complex background processing HSV space is more suitable for processing complex backgrounds with large changes in color and brightness, and can remove interference more accurately; Enhance image quality Through fine processing, further improve the clarity and readability of the image, and provide high-quality data for analysis. Step S103 Weight adjustment and multi-scale processing, weight ratio adjustment According to the specific characteristics of the image, the weight ratio of the RGB and HSV domains is automatically adjusted to ensure that the processing effects of the two color spaces are optimally balanced; Multi-scale decomposition and threshold setting Decompose the image at multiple scales, set the threshold range at different scales, and adapt to pollutants of different sizes and types; Edge smoothing After the pollutants are removed, the image is edge smoothed to eliminate jagged or uneven edges caused by filtering.Significance: Adaptability and robustness Through multi-scale processing and weight adjustment, it can adapt to the characteristics of different images and pollutant types, thereby improving the robustness of the algorithm; image optimization and edge smoothing further enhance the visual effect of the image, making it more in line with the needs of medical analysis.
[0059] In summary, this embodiment can effectively remove pollutants in images and improve image quality through the collaborative processing of RGB and HSV dual color spaces; dynamic threshold and multi-scale processing ensure that the detailed features of pathological tissues are not destroyed, providing reliable data support for medical diagnosis; automatic adjustment of weights and threshold ranges reduces the need for manual intervention and improves processing efficiency and accuracy. Through the above steps, the pollutant removal method of RGB and HSV dual color spaces can not only effectively improve image quality, but also provide a solid foundation for further analysis and diagnosis of medical images.
[0060] Example 3: Figure 4 As shown, based on Example 2, the process of setting the dynamic threshold range according to the characteristics of the full slice image provided by the embodiment of the present invention includes the following steps:
[0061] S1011: performing global pixel value distribution analysis on the red, green and blue channels respectively to generate a histogram; calculating the pixel value histogram of each channel to identify the brightness distribution characteristics of the main area; determining the upper and lower limits of the threshold interval in combination with the pathological characteristics of the full-slice image, and excluding extreme values through statistical analysis; for example, in the red channel, pathological tissue may present a higher pixel value, while contaminants may present a lower pixel value;
[0062] S1012: Perform local scanning on the full-slice image based on a sliding window, divide the image into multiple local windows, and perform statistical analysis on the pixel values in each window; for each window, calculate statistics such as the mean and variance of the pixel values, and dynamically adjust the local threshold range in combination with the global threshold range;
[0063] S1013: Decomposing the whole slice image into multiple scales by performing multi-scale decomposition, performing pixel value distribution analysis at each scale, and determining the threshold range of the scale; combining the threshold ranges of each scale, and determining the final dynamic threshold range by weighted average.
[0064] Among them, S1011 global pixel value distribution analysis and threshold interval determination:
[0065]
[0066] In the formula, x represents the pixel value; c represents the channel (R, G, B); w c represents the channel weight, which indicates the contribution of each channel to the overall distribution; K represents the number of Gaussian distributions; πc,k represents the mixing coefficient of the kth Gaussian distribution in the cth channel, satisfying μ c,k represents the mean of the kth Gaussian distribution in the cth channel; represents the variance of the kth Gaussian distribution in the cth channel;
[0067] Step S1012 represents local scanning and dynamic threshold adjustment:
[0068]
[0069] Where, T local (x, t) represents the dynamic threshold of the local window (x, y); T global represents the global threshold; μ(x,y) represents the mean pixel value of the local window (x,y); μ global represents the global pixel value mean; σ(x,y) represents the pixel value variance of the local window (x,y); σ global represents the global pixel value variance; α, β represent weight coefficients, which are used to balance the influence of mean and variance on local threshold;
[0070] Step S1013 represents multi-scale decomposition and comprehensive threshold determination:
[0071]
[0072] Where, T final represents the final dynamic threshold; S represents the total number of scales; w s represents the weight of the sth scale, satisfying T s represents the threshold of the sth scale; N s represents the number of pixel blocks at the sth scale; (μ s,i +γ·σ s,i ) represents the mean value of the i-th pixel block in the s-th scale; σ s,i represents the variance of the ith pixel block in the sth scale; γ represents the variance weight coefficient. The above algorithm and formula combine complex mathematical methods such as probability statistics, regression analysis and multi-scale decomposition, which can effectively adapt to the complex characteristics of full-slice images and achieve accurate setting of dynamic thresholds. Not only does it consider the global and local pixel value distribution, but it also captures the detailed information of the image through multi-scale analysis, providing more reliable technical support for pathological diagnosis.
[0073] The working principle and beneficial effects of the above technical solution are as follows: In this embodiment, first, a global pixel value distribution analysis is performed on the red, green and blue channels respectively to generate a histogram; the pixel value histogram of each channel is calculated to identify the brightness distribution characteristics of the main area; the upper and lower limits of the threshold range are determined in combination with the pathological characteristics of the full-slice image, and extreme values are excluded through statistical analysis; for example, in the red channel, pathological tissue may present a higher pixel value, while pollutants may present a lower pixel value; secondly, the full-slice image is locally scanned based on a sliding window, the image is divided into multiple local windows, and the pixel values in each window are statistically analyzed; for each window, the statistical quantities such as the mean and variance of its pixel values are calculated, and the local threshold range is dynamically adjusted in combination with the global threshold range; finally, the full-slice image is decomposed into multiple scales by performing multi-scale decomposition, and the pixel value distribution analysis is performed at each scale to determine the threshold range of the scale; the threshold ranges of each scale are comprehensively considered, and the final dynamic threshold range is determined by weighted average. In the above scheme, step S1011 global pixel value distribution analysis and threshold interval determination can fully understand the overall brightness distribution characteristics of the image by analyzing the pixel value histograms of the three channels of red, green and blue; combined with the pathological characteristics, the pixel value difference between the pathological tissue and the background or pollutants can be identified, so as to determine the reasonable upper and lower limits of the threshold interval. Significance: It provides a global reference for local threshold adjustment, ensuring that the threshold range can adapt to the overall characteristics of the image, while eliminating the interference of extreme values and improving the accuracy of the analysis. Step S1012 local scanning and dynamic threshold adjustment scans the image locally through a sliding window, which can capture the brightness changes in different areas of the image; statistical analysis is performed on the pixel values in each window, and combined with the global threshold interval, the local threshold range is dynamically adjusted so that the threshold can adapt to the local characteristics of the image. Significance: Local dynamic adjustment can effectively solve the problem of uneven brightness in the image and avoid misjudgment caused by the global threshold, especially in the full slice image, the distribution of pathological tissue may be uneven, which can significantly improve the accuracy of the analysis. Step S1013 multi-scale decomposition and comprehensive threshold determination: Through multi-scale decomposition, the image is decomposed into multiple scales, and pixel value distribution analysis is performed separately to determine the threshold range of each scale; the threshold ranges of each scale are combined, and the final dynamic threshold range is determined by weighted average, so that the threshold can take into account the global and local characteristics of the image. Significance: Multi-scale analysis can capture the detailed information of different levels in the image, ensuring that the setting of the threshold range will neither miss subtle features nor be disturbed by noise; further improving the robustness and adaptability of threshold setting.
[0074] In summary, this embodiment gradually refines the setting of the threshold range from global to local, from single scale to multi-scale. It can not only adapt to the complex characteristics of the full slice image, but also effectively eliminate interference factors and improve the accuracy and reliability of pathological analysis. For the field of medical image processing, this dynamic threshold setting method has important application value and can provide more accurate data support for pathological diagnosis.
[0075] Example 4: Figure 5 As shown, based on Example 2, the process of setting the dynamic threshold range for hue, saturation and brightness in the HSV space provided by the embodiment of the present invention includes the following steps:
[0076] S1021: Based on the global hue distribution of the whole slice image, multi-peak Gaussian fitting is used to identify the main peak area of the hue distribution;
[0077] Among them, the dynamic threshold range of hue is determined by calculating the skewness and kurtosis of hue distribution; the upper and lower thresholds of hue are set in combination with the global features of the whole slice image to exclude extreme values; the global saturation distribution is analyzed, and the main distribution area of saturation is identified by adaptive quantile regression; the dynamic threshold range of saturation is determined by calculating the cumulative distribution function (CDF) of saturation; for example, pathological tissue usually has a higher saturation, while the background or pollutants may have a lower saturation; the upper and lower thresholds of saturation are set in combination with global features; the global brightness distribution is analyzed, and the main distribution area of brightness is identified by local weighted density estimation; the dynamic threshold range of brightness is determined by calculating the probability density function (PDF) of brightness; for example, pathological tissue usually has a medium brightness, while pollutants may have extremely high or extremely low brightness. In combination with global features, the upper and lower thresholds of brightness are set;
[0078] The cumulative distribution function equation is expressed as:
[0079]
[0080] Wherein, CDF(x′) represents the cumulative probability that the random variable X is less than or equal to x′; X represents a random variable, representing the saturation value; x′ represents a specific saturation value; f(t) represents the probability density function (PDF), describing the distribution of saturation values; t represents the integral variable, representing the value of saturation; μ′ represents the mean of the random variable X; σ′ represents the standard deviation of the random variable X; exp represents the exponential function; represents the normalization constant, ensuring that the integral of the probability density function is 1;
[0081] The probability density function equation is expressed as:
[0082]
[0083] Where f(x″) represents the probability density of the random variable X at x″; CDF(x″) represents the cumulative distribution function; x″ represents a specific brightness value; μ′ represents the mean of the random variable X; σ′ represents the standard deviation of the random variable X; exp represents the exponential function; represents the normalization constant, ensuring that the integral of the probability density function is 1;
[0084] S1022: Divide the image into multiple local windows, and perform statistical analysis on the hue distribution in each window; dynamically adjust the local hue threshold range by calculating the mean and variance of the local hue distribution and combining the global hue threshold; and use nonlinear mapping technology to correct abnormal hue values in the local window;
[0085] Among them, local saturation threshold adjustment: statistical analysis is performed on the saturation distribution in each local window to calculate the mean and variance of the local saturation; combined with the global saturation threshold, the local saturation threshold range is dynamically adjusted through weighted regression technology; adaptive filtering is used to correct abnormal saturation values in the local window;
[0086] Adjustment of local brightness threshold: Statistical analysis is performed on the brightness distribution in each local window to calculate the mean and variance of the local brightness; combined with the global brightness threshold, the local brightness threshold range is dynamically adjusted through gradient optimization technology. For abnormal brightness values in the local window, local contrast enhancement technology is used to correct them;
[0087] S1023: performing multi-scale decomposition on the full slice image to obtain hue distributions at different scales; and comprehensively determining a final threshold value through a weighted average technique;
[0088] Among them, at each scale, the dynamic threshold range of hue is calculated respectively, and the final hue threshold is comprehensively determined by weighted averaging technology; multi-scale saturation threshold setting: the full slice image is decomposed at multiple scales to obtain saturation distribution at different scales; at each scale, the dynamic threshold range of saturation is calculated respectively, and the final saturation threshold is comprehensively determined by weighted averaging technology; multi-scale brightness threshold setting: the full slice image is decomposed at multiple scales to obtain brightness distribution at different scales; at each scale, the dynamic threshold range of brightness is calculated respectively, and the final brightness threshold is comprehensively determined by weighted averaging technology.
[0089] The working principle and beneficial effects of the above technical solution are as follows: This embodiment first uses multi-peak Gaussian fitting to identify the main peak area of the hue distribution based on the global hue distribution of the whole slice image; wherein, the dynamic threshold range of the hue is determined by calculating the skewness and kurtosis of the hue distribution; the upper and lower thresholds of the hue are set in combination with the global features of the whole slice image to exclude extreme values; the global saturation distribution is analyzed, and the main distribution area of saturation is identified by adaptive quantile regression; the dynamic threshold range of saturation is determined by calculating the cumulative distribution function (CDF) of saturation; for example, pathological tissue usually has a higher saturation, while the background or pollutants may have a lower saturation; combined with the global features, the saturation distribution of the whole slice image is directly proportional to the saturation distribution of the whole slice image; ... The upper and lower saturation thresholds are set based on the global brightness distribution. The main distribution area of brightness is identified by using local weighted density estimation. The dynamic threshold interval of brightness is determined by calculating the probability density function (PDF) of brightness. For example, pathological tissues usually have medium brightness, while pollutants may have extremely high or low brightness. Combined with the global features, the upper and lower thresholds of brightness are set. Secondly, the image is divided into multiple local windows, and the hue distribution in each window is statistically analyzed. The local hue threshold range is dynamically adjusted by calculating the mean and variance of the local hue distribution and combining the global hue threshold. The abnormal hue value in the local window is corrected by using nonlinear mapping technology. Among them, Local saturation threshold adjustment: Statistical analysis is performed on the saturation distribution in each local window to calculate the mean and variance of the local saturation; combined with the global saturation threshold, the local saturation threshold range is dynamically adjusted through weighted regression technology; adaptive filtering is used to correct abnormal saturation values in local windows; local brightness threshold adjustment: Statistical analysis is performed on the brightness distribution in each local window to calculate the mean and variance of the local brightness; combined with the global brightness threshold, the local brightness threshold range is dynamically adjusted through gradient optimization technology; local contrast enhancement technology is used to correct abnormal brightness values in local windows; finally, multi-scale decomposition is performed on the full slice image to obtain color images of different scales. Phase distribution; the final threshold is determined comprehensively by weighted averaging technology; wherein, at each scale, the dynamic threshold range of hue is calculated separately, and the final hue threshold is determined comprehensively by weighted averaging technology; multi-scale saturation threshold setting: multi-scale decomposition of the full slice image is performed to obtain saturation distributions of different scales; at each scale, the dynamic threshold range of saturation is calculated separately, and the final saturation threshold is determined comprehensively by weighted averaging technology; multi-scale brightness threshold setting: multi-scale decomposition of the full slice image is performed to obtain brightness distributions of different scales; at each scale, the dynamic threshold range of brightness is calculated separately, and the final brightness threshold is determined comprehensively by weighted averaging technology. Step S1021 of the above scheme sets the global threshold, and the hue dynamic threshold setting identifies the main peak area of the hue distribution through multi-peak Gaussian fitting, determines the dynamic threshold interval in combination with skewness and kurtosis, and excludes extreme values.Significance: Ensure that the setting of hue threshold can accurately reflect the distribution characteristics of the main colors in the image, avoid threshold deviation caused by extreme value interference, and improve the accuracy of analysis. The saturation dynamic threshold setting uses adaptive quantile regression to identify the main distribution area of saturation, and determines the dynamic threshold interval through the cumulative distribution function (CDF). Significance: According to the saturation difference between pathological tissue and background or pollutants, a reasonable threshold range is set to effectively distinguish the target area from the non-target area and improve the accuracy of image segmentation; the brightness dynamic threshold setting uses local weighted density estimation to identify the main distribution area of brightness, and determines the dynamic threshold interval through the probability density function (PDF). Significance: According to the brightness difference between pathological tissue and pollutants, a reasonable threshold range is set to avoid misjudgment caused by abnormal brightness and ensure the reliability of image analysis. Step S1022: Local threshold adjustment dynamically adjusts the local threshold by calculating the mean and variance of the local hue distribution, combined with the global threshold, and uses nonlinear mapping to correct outliers; Significance: Adapts to the hue changes in the local area of the image, improves the flexibility of threshold setting, and ensures that the hue analysis of the local area is more accurate; Local saturation threshold adjustment dynamically adjusts the local saturation threshold through weighted regression technology, and uses adaptive filtering to correct outliers. Significance: Optimize threshold setting for saturation changes in local areas, reduce noise interference, and improve local consistency of image segmentation; Local brightness threshold adjustment dynamically adjusts the local brightness threshold through gradient optimization technology, and uses local contrast enhancement technology to correct outliers. Significance: Adapts to changes in local brightness, optimizes threshold setting, enhances the visibility of image details, and improves the accuracy of image analysis. Step S1023: Multi-scale threshold synthesis comprehensively determines the final hue threshold through multi-scale decomposition and weighted averaging technology. Significance: Comprehensively considers the hue distribution characteristics of different scales, ensures the consistency of threshold setting at different resolutions, and improves the robustness of image analysis; Multi-scale saturation threshold setting comprehensively determines the final saturation threshold through multi-scale decomposition and weighted averaging technology. Significance: Comprehensively consider the saturation distribution characteristics of different scales, optimize the threshold setting, and improve the global consistency of image segmentation; multi-scale brightness threshold setting uses multi-scale decomposition and weighted average technology to comprehensively determine the final brightness threshold. Significance: Comprehensively consider the brightness distribution characteristics of different scales, optimize the threshold setting, and ensure the accuracy and stability of image analysis.
[0090] In summary, the dynamic threshold setting method of this embodiment can adapt to changes in global and local features of the image, effectively eliminate the interference of noise and outliers, and improve the accuracy and robustness of image segmentation and analysis. Especially in pathological image analysis, this method can accurately distinguish pathological tissue from background or pollutants, providing reliable data support for medical diagnosis and research. At the same time, the introduction of multi-scale analysis technology further enhances the adaptability of the method at different resolutions, making it perform better in complex scenes.
[0091] Example 5: Figure 6 As shown, based on Example 2, the process of automatically adjusting the threshold range of RGB and HSV domains provided in the embodiment of the present invention includes the following steps:
[0092] S1031: Perform global feature analysis on the whole slice image, including the overall brightness distribution, color distribution and texture characteristics of the image; preliminarily determine the distribution range and intensity of pollutants in the image by calculating statistical quantities such as the mean, variance and histogram of the image;
[0093] S1032: Divide the whole slice image into several local areas, and calculate the brightness, color and texture characteristics of each area respectively;
[0094] S1033: dynamically allocating weight ratios of RGB and HSV domains according to the analysis results of global and local features; fusing the processing results of RGB and HSV domains through weighted average or adaptive fusion algorithm;
[0095] RGB domain weight: If the contaminants in the full-slice image are mainly manifested as intensity distribution (such as brightness difference), increase the weight of the RGB domain and use the intensity information in the RGB space for filtering;
[0096] HSV domain weight: If the contaminants in the full-slice image are mainly manifested as color distribution (such as hue or saturation difference), increase the weight of the HSV domain and use the color information in the HSV space for filtering.
[0097] The working principle and beneficial effects of the above technical solution are as follows: In this embodiment, the global feature analysis of the whole slice image is first performed, including the overall brightness distribution, color distribution and texture characteristics of the image; by calculating the mean, variance and histogram of the image, the distribution range and intensity of the pollutants in the image are preliminarily determined; secondly, the whole slice image is divided into several local areas, and the brightness, color and texture characteristics of each area are calculated respectively; finally, according to the analysis results of the global and local features, the weight ratio of the RGB and HSV domains is dynamically allocated; the processing results of the RGB and HSV domains are fused by weighted average or adaptive fusion algorithm. The step S1031 global feature analysis of the above scheme can fully understand the basic characteristics of the image and the distribution of pollutants by analyzing the overall brightness distribution, color distribution and texture characteristics of the whole slice image; by calculating the mean, variance and histogram of the image, the distribution range and intensity of the pollutants can be preliminarily determined, providing a global reference for processing. Significance: Global feature analysis provides basic data for local feature extraction and weight allocation, ensuring that the processing process can cover the entire range of the image; through global analysis, the area of large-scale pollutants can be quickly located to improve processing efficiency. Step S1032: Local feature extraction divides the whole slice image into several local areas, calculates the brightness, color and texture features of each area respectively, and can capture the detailed information in the image; through local feature analysis, the distribution of small-scale or detailed pollutants can be more accurately identified. Significance: Local feature extraction makes up for the shortcomings of global analysis and ensures that the processing process can cover the detailed areas in the image; through local analysis, small-scale pollutants can be more accurately identified and processed, and the precision of the processing results can be improved. Step S1033: Dynamic weight allocation and fusion, according to the analysis results of global and local features, dynamically allocate the weight ratio of RGB and HSV domains, and can flexibly deal with different types of pollutants; through weighted average or adaptive fusion algorithm, the processing results of RGB and HSV domains are fused to ensure the comprehensiveness and accuracy of pollutant removal. Significance: Dynamic weight allocation can flexibly adjust the processing strategy according to the specific characteristics of the image to ensure the adaptability and robustness of the processing results; through the fusion of RGB and HSV domains, it can make full use of the information of color space and intensity space to improve the comprehensiveness and accuracy of pollutant removal.
[0098] In summary, this embodiment can comprehensively cover the distribution of pollutants in the image through global feature analysis, local feature extraction, and dynamic weight allocation and fusion, ensuring the accuracy and robustness of the processing results. It can flexibly respond to different types of pollutants and adapt to the processing needs of different scenarios. It significantly improves the efficiency and accuracy of pollutant removal and provides an innovative solution for the field of image processing; by making full use of the multi-scale features and color space characteristics of the image, this method has broad application prospects, especially in the fields of medical image processing and industrial detection.
[0099] Example 6: Figure 7 As shown, based on Example 1, the process of using an open source library to perform dyeing standardization provided in the embodiment of the present invention comprises the following steps:
[0100] S201: Extract the staining distribution information in the image through the open source library, including key parameters such as staining intensity, staining uniformity and staining contrast; Use the open source library to perform statistics on the staining features of multiple high-quality pathological images to establish a staining reference template;
[0101] Among them, the staining intensity template: constructs a standardized intensity range based on the distribution law of staining intensity; the staining uniformity template: establishes a uniformity reference standard by analyzing the distribution uniformity of staining in the tissue; the staining contrast template: defines a standardized contrast threshold based on the contrast relationship between staining and background;
[0102] S202: Based on the staining reference template, staining mapping and correction are performed on the target pathological image, and the staining intensity of the target image is mapped to the standardized range of the reference template; the uniformity of staining in the tissue is improved by local contrast enhancement and staining distribution equalization; and the contrast between staining and background is optimized according to the contrast threshold of the reference template;
[0103] S203: After the staining standardization is completed, the distribution of the staining in the image is verified to meet the standards of the reference template through statistical analysis methods; the consistency of the staining intensity, uniformity and contrast is evaluated through feature matching technology.
[0104] The working principle and beneficial effects of the above technical solution are as follows: In this embodiment, the staining distribution information in the image is first extracted through the open source library, including key parameters such as staining intensity, staining uniformity and staining contrast; the staining reference template is established by statistically analyzing the staining features of multiple high-quality pathological images through the open source library; wherein, the staining intensity template: based on the distribution law of staining intensity, a standardized intensity range is constructed; the staining uniformity template: by analyzing the distribution uniformity of staining in the tissue, a uniformity reference standard is established; the staining contrast template: based on the contrast relationship between staining and background, a standardized contrast threshold is defined; secondly, based on the staining reference template, the target pathological image is stained and corrected, and the staining intensity of the target image is mapped to the standardized range of the reference template; the uniformity of staining in the tissue is improved by local contrast enhancement and staining distribution equalization; the contrast between staining and background is optimized according to the contrast threshold of the reference template; finally, after the staining standardization is completed, the distribution of staining in the image is verified by statistical analysis methods to see whether it meets the standards of the reference template; the consistency of staining intensity, uniformity and contrast is evaluated by feature matching technology. Step S201 of the above scheme extracts the staining distribution information and establishes a staining reference template. The parameters such as staining intensity, uniformity and contrast in the image are extracted through the open source library to provide a data basis for template establishment. Significance: These parameters are the core indicators of staining standardization, which can fully reflect the staining characteristics of the image and provide a scientific basis for standardization. The establishment of a staining reference template is based on the distribution law of staining intensity to construct a standardized intensity range; a unified standard is provided for staining intensity to avoid misjudgment caused by too deep or too light staining. Significance: Ensure that different images are comparable in staining intensity and improve the accuracy of subsequent analysis; establish a uniformity reference standard by analyzing the uniformity of staining distribution in the tissue; provide a quantitative standard for staining uniformity and reduce the impact of uneven staining on image analysis. Significance: Improve the overall quality of the image, make the staining distribution more consistent, and facilitate subsequent pathological diagnosis; define a standardized contrast threshold based on the contrast relationship between staining and background; provide a clear standard for the contrast between staining and background to enhance the clarity of the image. Significance: Improve the readability of the image, make the pathological features more prominent, and reduce the possibility of misdiagnosis. Step S202 performs staining mapping and correction based on the staining reference template, and adjusts the staining intensity of the target image to the standardized range of the reference template. Significance: Eliminate the difference in staining intensity between different images to ensure the consistency of image intensity; improve the uniformity of staining in tissues through local contrast enhancement and distribution equalization. Significance: Improve the visual effect of the image, make the staining distribution more uniform, and facilitate the identification of pathological features; optimize the contrast between staining and background according to the contrast threshold of the reference template. Significance: Enhance the clarity and readability of the image, make the pathological features more obvious, and improve the accuracy of diagnosis.Step S203: Staining standardization verification and consistency assessment: Verify whether the staining distribution meets the standards of the reference template through statistical analysis. Significance: Ensure the effect of staining standardization and provide reliable data support for image analysis; evaluate the consistency of staining intensity, uniformity and contrast. Significance: Confirm the successful implementation of staining standardization and provide a high-quality image basis for pathological diagnosis.
[0105] In summary, the staining standardization process of this embodiment achieves the uniformity of staining intensity, uniformity and contrast of pathological images by extracting staining features, establishing reference templates, mapping correction and verification evaluation. It not only improves the quality and consistency of images, but also provides reliable technical support for pathological diagnosis and image analysis, which has important clinical and scientific research significance.
[0106] Example 7: Figure 8 As shown, based on Example 6, the process of establishing a staining reference template provided in the embodiment of the present invention comprises the following steps:
[0107] S2011: Extract key parameters such as staining intensity, staining uniformity and staining contrast from multiple high-quality pathological images using open source libraries; staining intensity is quantified by the distribution law of pixel values, staining uniformity is statistically analyzed by the spatial distribution of staining in tissues; staining contrast is calculated by the difference between the stained area and the background area;
[0108] S2012: Based on the statistical analysis results of staining intensity, a standardized intensity range is constructed and used as the core parameter of the staining intensity template; based on the statistical analysis results of staining uniformity, a uniformity reference standard is established and used as the core parameter of the staining uniformity template; based on the statistical analysis results of staining contrast, a standardized contrast threshold is defined and used as the core parameter of the staining contrast template;
[0109] S2013: Adjust the parameters of the staining intensity, uniformity and contrast templates through iterative optimization methods; verify the applicability of the staining reference template in different images.
[0110] The working principle and beneficial effects of the above technical solution are as follows: This embodiment first extracts key parameters such as staining intensity, staining uniformity and staining contrast from multiple high-quality pathological images using an open source library; the staining intensity is quantified by the distribution law of pixel values, and the staining uniformity is statistically analyzed by the spatial distribution of staining in the tissue; the staining contrast is calculated by the difference between the stained area and the background area; secondly, based on the statistical analysis results of the staining intensity, a standardized intensity range is constructed and used as the core parameter of the staining intensity template; based on the statistical analysis results of the staining uniformity, a uniformity reference standard is established and used as the core parameter of the staining uniformity template; based on the statistical analysis results of the staining contrast, a standardized contrast threshold is defined and used as the core parameter of the staining contrast template; finally, the parameters of the staining intensity, uniformity and contrast templates are adjusted through an iterative optimization method; and the applicability of the staining reference template in different images is verified. Step S2011 of the above scheme extracts staining features, which quantifies the staining intensity through the distribution law of pixel values, and can accurately reflect the depth of staining in the image; it provides a data basis for the standardization of staining intensity; through the statistics of the spatial distribution of staining in the tissue, it can quantify the uniformity of staining in the tissue, and provide spatial distribution features for the standardization of staining uniformity; through the difference calculation between the staining area and the background area, it can clarify the contrast relationship between staining and background, and provide a quantitative basis for the standardization of staining contrast. Significance: The foundation for the establishment of the entire staining reference template, by extracting key parameters such as staining intensity, uniformity and contrast, provides high-quality data input for subsequent statistical analysis; abstracting and quantifying staining features from the image, provides a scientific basis for standardization. Step S2012: Construction of a staining reference template. Based on the statistical analysis results of staining intensity, a standardized intensity range is constructed, which can provide a unified reference standard for staining intensity; ensure that the staining intensity is consistent in different images; based on the statistical analysis results of staining uniformity, a uniformity reference standard is established, which can provide a quantitative reference basis for staining uniformity; ensure that the distribution of staining in the tissue is uniform; based on the statistical analysis results of staining contrast, a standardized contrast threshold is defined, which can provide a clear reference standard for the contrast between staining and background; ensure that the contrast relationship between staining and background is consistent. Significance: Through statistical analysis, the staining features are converted into standardized reference templates, which provides specific technical support for staining standardization; through the template method, the staining features are promoted from the data level to the standardization level, which provides a basis for staining correction and optimization. Step S2013: Optimization and verification of the staining reference template. Through the iterative optimization method, the parameters of the staining intensity, uniformity and contrast templates are adjusted, which can improve the applicability and accuracy of the template; ensure that the template is universal in different images; through the statistical analysis method, the applicability of the staining reference template in different images is verified, which can ensure the reliability of the template; and provide a basis for the scientificity and practicality of the template.Significance: Through optimization and verification, the staining reference template is ensured to be universal and reliable in practical applications; through scientific verification, the accuracy and consistency of staining standardization are improved, providing technical support for the subsequent analysis and diagnosis of pathological images.
[0111] In summary, this embodiment provides a data basis for staining standardization through staining feature extraction; provides specific technical support for staining standardization through the construction of staining reference templates; ensures the accuracy and consistency of staining standardization through template optimization and verification; constructs a universal and standardized staining reference template through a hierarchical and systematic technical process, which provides a scientific basis and technical support for the staining standardization of pathological images, thereby improving the accuracy and reliability of pathological image analysis.
[0112] Example 8: Fig. 9 As shown, based on Example 6, the process of performing staining mapping and correction on the target pathological image provided by the embodiment of the present invention includes the following steps:
[0113] S2021: Obtain the staining intensity value of each pixel in the image, compare the staining intensity distribution of the target image with the standardized intensity range of the reference template, and identify the offset or deviation of the staining intensity in the target image; based on the intensity range matching result, design a staining intensity mapping function to linearly or nonlinearly map the staining intensity value of the target image to the standardized range of the reference template;
[0114] S2022: applying a mapping function to correct the staining intensity of the target image, eliminating the offset or deviation of the staining intensity so that it conforms to the standardized range of the reference template; performing local intensity optimization for areas in the target image where the staining intensity is unevenly distributed;
[0115] S2023: Verify whether the distribution of the target image staining intensity after mapping and correction conforms to the standardized range of the reference template; evaluate the consistency between the target image staining intensity and the reference template; dynamically adjust the standardized intensity range of the reference template based on the mapping and correction results of the target image staining intensity.
[0116] The working principle and beneficial effects of the above technical solution are as follows: In this embodiment, the staining intensity value of each pixel in the image is first obtained, and the staining intensity distribution of the target image is compared with the standardized intensity range of the reference template to identify the offset or deviation of the staining intensity in the target image; based on the intensity range matching result, a staining intensity mapping function is designed to linearly or nonlinearly map the staining intensity value of the target image to the standardized range of the reference template; secondly, the mapping function is applied to correct the staining intensity of the target image to eliminate the offset or deviation of the staining intensity so that it conforms to the standardized range of the reference template; local intensity optimization is performed for areas with uneven staining intensity distribution in the target image; finally, it is verified whether the distribution of the staining intensity of the target image after mapping and correction conforms to the standardized range of the reference template; the consistency of the staining intensity of the target image and the reference template is evaluated; based on the mapping and correction results of the staining intensity of the target image, the standardized intensity range of the reference template is dynamically adjusted. In the above scheme, step S2021 is to establish the staining intensity mapping relationship. By obtaining the staining intensity value of each pixel in the image and comparing it with the standardized intensity range of the reference template, the offset or deviation of the staining intensity in the target image is identified to provide a data basis for mapping and correction; based on the intensity range matching result, a staining intensity mapping function is designed to linearly or nonlinearly map the staining intensity value of the target image to the standardized range of the reference template to ensure the alignment and standardization of the staining intensity. Significance: Provide a scientific basis for staining mapping and correction to ensure the accuracy and reliability of the operation; through the design of the mapping function, the staining intensity of the target image can be aligned with the standardized range of the reference template, laying the foundation for staining standardization. Step S2022 is to correct and optimize the staining intensity. The mapping function is applied to correct the staining intensity of the target image, eliminate the offset or deviation of the staining intensity, make it conform to the standardized range of the reference template, and improve the overall consistency of the staining intensity; for the area with uneven staining intensity distribution in the target image, local intensity optimization is performed to ensure that the staining intensity is more evenly distributed in the tissue and improve the local quality of the image. Significance: Through intensity correction, the staining intensity of the target image is made to meet the standardization requirements of the reference template as a whole, improving the usability and analyzability of the image; through local optimization, the problem of uneven distribution of staining intensity is solved to ensure that the image is clearer and more accurate in the detail area. Step S2023 Verification of staining intensity mapping results and template update: Through statistical analysis methods, verify whether the distribution of the staining intensity of the target image after mapping and correction meets the standardized range of the reference template to ensure the accuracy of the correction results; through feature matching technology, evaluate the consistency of the staining intensity of the target image and the reference template to ensure the reliability and scientificity of the mapping and correction; based on the mapping and correction results of the staining intensity of the target image, dynamically adjust the standardized intensity range of the reference template to ensure the universality and applicability of the template.Significance: Through verification and evaluation, the scientificity and practicality of the staining intensity mapping and correction results are ensured, providing a reliable basis for analysis; through dynamic adjustment of the reference template, the continuous improvement and long-term applicability of the staining standardization technology are ensured, and the universality and stability of the technology are improved.
[0117] In summary, this embodiment, through hierarchical technical operations, respectively realizes the establishment of staining intensity mapping relationship, correction and optimization of staining intensity, verification of mapping results and template update, and finally makes the staining intensity of the target pathological image conform to the standardized range of the reference template, improving the consistency and analyzability of the image; through local optimization and overall correction, the quality of the image in the overall and local areas is improved, ensuring the uniformity of staining distribution and the rationality of contrast; through dynamic adjustment of the reference template, the continuous improvement and long-term applicability of the staining standardization technology are ensured, providing scientific basis and technical support for the standardized analysis of pathological images. It is not only technically innovative and practical, but also provides a systematic solution for the staining standardization of pathological images, which has important scientific significance and application value.
[0118] Example 9: Fig.10 As shown, based on Example 1, the process of extracting features from the preprocessed full-slice image provided by the embodiment of the present invention includes the following steps:
[0119] S301: The visual transformer model divides the input full-slice image into multiple fixed-size image blocks. Each image block is mapped to a high-dimensional feature vector. The image block captures the local features of the pathological image at different scales, such as the morphology of the cell nucleus and the distribution of staining intensity. The visual transformer model uses the self-attention mechanism to calculate the correlation between image blocks on a global scale.
[0120] S302: In the multi-layer structure of the visual converter model, each layer gradually refines features through the self-attention mechanism and feed-forward neural network; the low-level network extracts local detail features (such as cell nucleus boundaries, staining particles, etc.), while the high-level network fuses local features to generate higher-level semantic features (such as tissue type, lesion area, etc.);
[0121] S303: The visual converter model uses position encoding to embed the spatial position information of the image block into the feature vector; through the feature vector of the last layer, a high-dimensional feature representation of the pathological image is generated, which contains local detail information and global semantic information.
[0122] The working principle and beneficial effects of the above technical solution are as follows: First, in this embodiment, the visual converter model divides the input full-slice image into multiple image blocks of fixed size, each image block is mapped to a high-dimensional feature vector, and the image block captures the local features of the pathological image at different scales, such as the morphology of the cell nucleus, the distribution of staining intensity, etc.; the visual converter model uses the self-attention mechanism to calculate the correlation between image blocks on a global scale; secondly, in the multi-layer structure of the visual converter model, each layer gradually refines the features through the self-attention mechanism and the feedforward neural network; the low-level network extracts local detail features (such as cell nucleus boundaries, staining particles, etc.), while the high-level network fuses local features to generate higher-level semantic features (such as tissue type, lesion area, etc.); finally, the visual converter model uses position encoding to embed the spatial position information of the image block into the feature vector; through the feature vector of the last layer, a high-dimensional feature representation of the pathological image is generated, which contains local detail information and global semantic information. In the above scheme, step S301, image block division and global context modeling, the whole slice image is divided into image blocks of fixed size, each image block is mapped to a high-dimensional feature vector, which can capture the local features of the pathological image at different scales, such as the morphology of the cell nucleus, the distribution of staining intensity, etc. This division method ensures the accurate extraction of local details; the self-attention mechanism is used to calculate the correlation between image blocks on a global scale, and dynamically capture the long-distance dependencies between different regions in the pathological image, such as the interaction between the tumor area and the surrounding tissue, the spatial distribution of staining intensity, etc. Significance: Through image block division and self-attention mechanism, the model can pay attention to local details and global structure at the same time, avoiding the limitations of single-scale feature extraction in traditional methods; global context modeling enables the model to more comprehensively understand the overall semantic information of the image, and provide richer feature input for subsequent tasks. Step S302, hierarchical feature extraction and semantic enhancement, in the multi-layer structure of the visual converter model, each layer gradually extracts features through the self-attention mechanism and feedforward neural network. The low-level network extracts local detail features (such as cell nucleus boundaries, staining particles, etc.), while the high-level network fuses these local features to generate higher-level semantic features (such as tissue type, lesion area, etc.); through hierarchical feature extraction, the model can achieve semantic understanding from local to global and generate more discriminative feature representations. Significance: Hierarchical feature extraction enables the model to gradually extract higher-level semantic information from local details, improving the depth and richness of feature expression; through semantic enhancement, the model can more accurately identify key areas and lesion features in pathological images, providing more reliable support for diagnosis and treatment.Step S303: Position encoding and feature expression: The visual converter model uses position encoding to embed the spatial position information of the image block into the feature vector, which enhances the model's understanding of the spatial structure in the pathological image, such as the morphological distribution of the tumor, the regional difference in staining intensity, etc.; through the feature vector of the last layer, a high-dimensional feature representation of the pathological image is generated, which contains local detail information and global semantic information, providing high-quality feature input for subsequent tasks. Significance: Position encoding enables the model to perceive the spatial relationship between image blocks and improve its understanding of the spatial structure in the pathological image; through feature expression, the high-dimensional feature representation generated by the model not only contains local detail information, but also integrates global semantic information, which can fully describe the content of the pathological image and provide more accurate feature input for subsequent tasks.
[0123] In summary, this embodiment realizes the combination of local details and global features through image block division and global context modeling, and improves the comprehensiveness of feature expression; through hierarchical feature extraction and semantic enhancement, it realizes semantic understanding from local to global and enhances the discrimination ability of the model; through position encoding and feature expression, it enhances the model's perception of spatial structure and generates high-quality feature output. These steps work together to enable the visual converter model to efficiently capture the complex features and subtle differences of pathological images, providing strong technical support for tasks such as pathological diagnosis and lesion detection, and has important clinical significance and application value.
[0124] Example 10: Fig.11 As shown, based on Example 9, the process of calculating the correlation between image blocks in a global scope provided by the embodiment of the present invention includes the following steps:
[0125] S3011: For each image block’s feature vector, the model generates query, key, and value vectors respectively; the query vector is used to indicate the focus requirement of the current image block, the key vector is used to indicate the potential relevance of other image blocks, and the value vector is used to convey specific information;
[0126] S3012: Calculate the correlation weights between the current image block and other image blocks by performing a dot product operation on the query vector and the key vector; the weights reflect the dynamic correlation between the image blocks, such as the similarity of staining intensity, the spatial distribution law of cell nuclear morphology, etc.;
[0127] S3013: Perform weighted summation on the value vector using the correlation weight to generate a global context feature of the current image block.
[0128] The working principle and beneficial effects of the above technical solution are as follows: In this embodiment, firstly, for the feature vector of each image block, the model generates query, key and value vectors respectively; the query vector is used to indicate the attention requirement of the current image block, the key vector is used to indicate the potential relevance of other image blocks, and the value vector is used to transmit specific information; secondly, the correlation weight between the current image block and other image blocks is calculated by the dot product operation of the query vector and the key vector; the weight reflects the dynamic correlation between image blocks, such as the similarity of staining intensity, the spatial distribution law of cell nucleus morphology, etc.; finally, the value vector is weighted and summed using the correlation weight to generate the global context feature of the current image block. Step S3011 of the above solution generates query, key and value vectors, decomposes the feature vector of each image block into query, key and value vectors, which respectively assume different functions: the query vector indicates the attention requirement of the current image block, the key vector indicates the potential relevance of other image blocks, and the value vector transmits specific information; through this decomposition, the model can flexibly adjust the role of each image block in the global context, providing a basis for correlation calculation. Significance: The generation of query, key and value vectors enables the model to dynamically focus on the relationship between image blocks, rather than relying solely on fixed local features; this mechanism provides the possibility for global feature interaction; by decomposing the feature vector, the model can describe the content of the image block in more detail and provide richer information for global correlation calculation. Step S3012 calculates the correlation weight. Through the dot product operation of the query vector and the key vector, the model can quantify the dynamic correlation between the current image block and other image blocks; the weight reflects the similarity between image blocks, spatial distribution law, etc.; the calculation of the correlation weight enables the model to understand the relationship between image blocks from a global perspective, such as the similarity of staining intensity, the spatial distribution of cell nuclear morphology, etc. Significance: The calculation of the correlation weight enables the model to capture the relationship between image blocks in a global scope, breaking through the limitation of traditional methods that are limited to local features; by dynamically adjusting the correlation weight, the model can optimize the feature expression according to the task requirements, such as enhancing the contrast feature between the lesion area and the non-lesion area in the lesion area detection task. Step S3013 generates global context features, and uses the correlation weights to perform weighted summation on the value vector to generate the global context features of the current image block; so that the features of each image block not only contain its own local information, but also integrate the global information of other image blocks; the generation of global context features enables the model to fully describe the content of the image block and provide high-quality feature input for tasks (such as lesion detection, tissue classification, etc.). Significance: The generation of global context features realizes the deep fusion of local details and global semantics, so that the model can understand the content of pathological images more comprehensively; by integrating global context information, the model can more accurately identify lesion areas, classify tissue types, etc., and significantly improve task performance.
[0129] In summary, this embodiment provides a basis for dynamic attention mechanism and feature interaction by generating query, key and value vectors; realizes dynamic feature interaction on a global scale by calculating correlation weights; and realizes deep fusion of local details and global semantics by generating global context features. These steps together constitute a hierarchical and dynamic feature extraction process, providing a new technical path for the intelligent analysis of pathological images. Its significance lies in breaking through the limitations of traditional methods, realizing a comprehensive understanding and efficient use of pathological image features, and providing strong technical support for medical diagnosis and research.
[0130] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention belong to the scope of equivalent technologies of the present invention, the present invention is also intended to include these modifications and variations.
Claims
1. A method for pathological image preprocessing and feature extraction, characterized in that: The following steps are involved: Full-slice images were obtained for thumbnail extraction, and contaminants were removed using dual color spaces of RGB and HSV; Use open source tools to segment pathological images, separate pathological tissue from background, and perform block processing; The pre-trained visual transformer model is used to extract features from the pre-processed whole-slice images to capture the complex features and subtle differences in the standardized whole-slice images.
2. The method for pathological image preprocessing and feature extraction as claimed in claim 1, characterized in that: The process of pollutant removal using the dual color space of RGB and HSV includes the following steps: In the RGB color space, the image is decomposed into three independent channels: red, green, and blue; After preliminary filtering in the RGB domain, the image is converted to the HSV color space. In the HSV space, dynamic threshold ranges are set for hue, saturation, and brightness to locate and remove interference information in the complex background while retaining the detailed features of the pathological tissue; According to the specific characteristics of the whole slice image, the weight ratio of RGB and HSV domains is automatically adjusted; by analyzing the global and local characteristics of the image, the threshold range of RGB and HSV domains is automatically adjusted.
3. The method for pathological image preprocessing and feature extraction as claimed in claim 2, characterized in that: For each red, green, and blue channel, a dynamic threshold range is set according to the characteristics of the full-slice image; by comparing the RGB value of each pixel with the preset threshold, pixels below the threshold are reset to white.
4. The method for pathological image preprocessing and feature extraction as claimed in claim 2, characterized in that: After the threshold range is automatically adjusted, the image is decomposed into multiple scales, and the threshold range is set at different scales to adapt to pollutants of different sizes and types; after the pollutants are removed, the image is edge smoothed.
5. The method for pathological image preprocessing and feature extraction as claimed in claim 1, characterized in that: After the block processing, the open source library is used for color standardization, and the N×N image blocks are spliced to form a large image for batch processing.
6. The method for pathological image preprocessing and feature extraction as claimed in claim 5, characterized in that: The process of staining standardization using open source libraries includes the following steps: The staining distribution information in the image is extracted through the open source library, and the staining characteristics of multiple high-quality pathological images are statistically analyzed through the open source library to establish a staining reference template; Based on the staining reference template, staining mapping and correction are performed on the target pathological image, and the staining intensity of the target image is mapped into the standardized range of the reference template; After the staining standardization is completed, statistical analysis methods are used to verify whether the distribution of staining in the image meets the standards of the reference template; feature matching technology is used to evaluate the consistency of staining intensity, uniformity and contrast.
7. The method for pathological image preprocessing and feature extraction as claimed in claim 6, characterized in that: The process of establishing a staining reference template includes the following steps: From multiple high-quality pathology images, key parameters such as staining intensity, staining uniformity, and staining contrast were extracted using open source libraries; Based on the statistical analysis results of staining intensity, a standardized intensity range was constructed and used as the core parameter of the staining intensity template. Based on the statistical analysis results of staining uniformity, a uniformity reference standard was established and used as the core parameter of the staining uniformity template. Based on the statistical analysis results of staining contrast, a standardized contrast threshold was defined and used as the core parameter of the staining contrast template.
8. The method for pathological image preprocessing and feature extraction as claimed in claim 7, characterized in that: The staining intensity was quantified by the distribution of pixel values, the staining uniformity was statistically analyzed by the spatial distribution of staining in the tissue, and the staining contrast was calculated by the difference between the stained area and the background area.
9. The method for pathological image preprocessing and feature extraction as claimed in claim 7, characterized in that: After the staining intensity is mapped to the standardized range of the reference template, the uniformity of staining in the tissue is improved through local contrast enhancement and staining distribution equalization; the contrast between staining and background is optimized according to the contrast threshold of the reference template.
10. The method for pathological image preprocessing and feature extraction according to claim 7, characterized in that: The parameters of the staining intensity, uniformity, and contrast templates were adjusted through an iterative optimization method; and the applicability of the staining reference templates in different images was verified.
Citation Information
Patent Citations
Multi-modal breast tumor risk prediction method and system based on pathological image
CN118675618A
Pathological image imaging quality assessment method
CN119048446A
Immunohistochemical digital pathological image processing method
CN119181091A
Automatic digging method for remarkable objects of color images
CN102968782A
Image defogging method with high fidelity
CN106023110A
Cited By
Pathological label adaptive enhancement identification method and device and storage medium thereof
CN122243840A