Multi-imaging mode pathological image background adaptive recognition method and system and storage medium
Patent Information
- Application Number
- CN202610787212.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-03
- Publication Date
- 2026-09-22
AI Technical Summary
第一,固定阈值法(如HistoQC默认配置),仅能适应明场成像的白色背景场景
(1)本发明通过判断均值加减预设倍数标准差是否达到灰度值范围的极值边界,自动识别当前图像属于明场白色背景、荧光黑色背景还是灰色特殊背景,并据此将背景范围上界扩展至灰度上限、下界扩展至灰度下限或保持初始范围,使得单一算法无需人工选择或切换即可自适应处理多种成像模式,解决了现有技术需要为不同成像模式设计独立算法的问题。
Abstract
Description
Technical Field
[0001] This invention relates to the field of digital pathological image processing technology, and in particular to a method and system for background recognition of whole-slice pathological images that can adaptively process multiple imaging modes. Background Technology
[0002] Whole-slide images (WSI) are ultra-high-resolution images generated from pathological tissue sections using a digital scanner. They play a fundamental role in key aspects such as pathological quality control, quantitative image analysis, and artificial intelligence model training. Accurate separation of tissue regions from background regions is a core prerequisite for ensuring the reliability of subsequent analyses. For example, in the quantitative analysis of immunohistochemical and fluorescence-based pathological images, it is first necessary to accurately identify background regions in the image to eliminate their interference with the analysis results. The accurate identification of background regions directly affects the accuracy of signal intensity measurements and diagnostic conclusions.
[0003] However, the imaging modes of pathological images exhibit significant diversity, resulting in fundamental differences in background features: under bright-field imaging modes, such as conventional hematoxylin-eosin staining or immunohistochemical staining, the background usually appears as a bright white with gray values concentrated in the range close to 255; fluorescence imaging modes produce a low-brightness black background with gray values approaching 0; special staining techniques may also form gray tones or other non-standard color backgrounds.
[0004] Existing background recognition technologies have the following drawbacks for these different imaging modes: First, the fixed threshold method (such as the default HistoQC configuration) is only suitable for bright-field imaging with a white background. When applied to fluorescence images, because the background grayscale values are in the low range, the fixed threshold method cannot dynamically adjust the judgment boundary, resulting in the background area being completely ignored or the tissue area being incorrectly covered, making the analysis process completely ineffective.
[0005] Second, Otsu's automatic thresholding method determines the segmentation threshold based on the assumption of a bimodal distribution of the image grayscale histogram. However, the histogram of fluorescence images often lacks a clear bimodal structure and often exhibits a single peak or a flat distribution affected by noise. This makes it impossible for this method to generate an effective threshold in fluorescence scenes, resulting in large-scale misjudgments.
[0006] Third, pixel-level morphological methods (such as TIA Toolbox) identify the background through structuring element manipulation. While they possess some processing capabilities at the pixel level, they are difficult to extend to block-level analysis grids. More seriously, in areas with sparse tissue, such as sparsely distributed cell sections, this method, due to its over-reliance on local pixel density, is prone to misclassifying low-density tissue pixels as background, resulting in irreversible loss of tissue information and severely affecting the integrity of pathological analysis.
[0007] The aforementioned technical shortcomings all point to a core problem: existing methods cannot construct a unified background recognition framework to adaptively address the differences in background features between multimodal images, such as brightfield, fluorescence, and special staining. The lack of a general algorithm capable of dynamically responding to different imaging modes necessitates that pathological image processing workflows require individual parameter configuration for each mode, significantly reducing analysis efficiency and increasing operational complexity. Summary of the Invention
[0008] To address the aforementioned technical problems, this invention provides a method, system, and storage medium for adaptive background recognition of whole-slice pathological images in multiple imaging modes. This method has the advantage of being able to adaptively recognize background regions under different imaging modes, thereby improving recognition accuracy and efficiency.
[0009] In a first aspect, the present invention provides a method for adaptive background recognition of whole-slice pathological images with multiple imaging modes, comprising the following steps: In response to a user selecting at least one background region on an image, grayscale pixel data of the background region is acquired; Calculate the statistics of the grayscale pixel data, including the Nth lower percentile, the Mth higher percentile, the mean, and the standard deviation, where N and M are preset parameters; The adaptive fill amount is determined based on the larger of the standard deviation and the preset minimum fill value. The initial background upper bound is determined by subtracting the adaptive fill amount from the Nth lowest percentile, and the initial background upper bound is determined by adding the adaptive fill amount to the Mth highest percentile. Determine whether the mean plus a preset multiple standard deviation reaches the upper limit of the grayscale value range. If so, extend the upper bound of the initial background to the upper limit. Determine whether the mean minus the preset multiple standard deviation reaches the lower limit of the grayscale value range. If so, extend the lower bound of the initial background to the lower limit. The final background grayscale range is determined based on the expanded background upper and lower bounds. Pixels whose grayscale values fall within the final background grayscale range are identified as background; otherwise, they are identified as tissue.
[0010] Preferably, the Nth lowest percentile is the 1st percentile, the Mth highest percentile is the 99th percentile, the preset multiplier is 3 times, and the preset minimum fill value is 5 gray levels; the preset parameters N and M are configurable parameters and can be configured to one of the following combinations: N=0.5 and M=99.5, or N=1 and M=99, or N=2 and M=98.
[0011] Preferably, the imaging mode is identified by whether the mean plus or minus the preset standard deviation touches the boundary of the grayscale value range: when the mean plus the preset standard deviation reaches or exceeds the upper limit of grayscale, the upper boundary of the background range is extended to the upper limit; when the mean minus the preset standard deviation reaches or falls below the lower limit of grayscale, the lower boundary of the background range is extended to the lower limit; when neither of these conditions is met, the initial background range remains unchanged.
[0012] Preferably, when the user selects multiple background regions, the grayscale pixel data of each background region are merged into a unified grayscale dataset, and the statistic is calculated on the unified dataset; it also includes independently calculating the grayscale standard deviation for each background region, and issuing a prompt message to the user when the standard deviation of any background region exceeds a preset uniformity threshold.
[0013] Preferred options also include: The image is divided into multiple analysis blocks, and the proportion of organized pixels in each analysis block is calculated. Organized pixels are pixels whose gray values fall outside the final background gray range. When the proportion of the tissue is lower than a preset threshold, the block is marked as a background block; otherwise, it is marked as a tissue block. A two-dimensional Boolean grid is constructed for the marking of all blocks. A 3×3 neighborhood expansion operation is performed on the two-dimensional Boolean grid to re-mark the background blocks adjacent to the organization blocks as organization blocks.
[0014] Preferably, the method further includes: after obtaining the final background grayscale range, reading a low-resolution thumbnail; for each analysis block, determining whether the tissue proportion condition is met based on the pixel ratio of the corresponding area in the thumbnail within the final background grayscale range; if the condition is met, submitting the block for complete analysis; otherwise, skipping the subsequent processing of the block.
[0015] Preferably, when acquiring grayscale pixel data of the background area, the image pyramid level is automatically selected according to the size of the background area, so that the size of the area read at the selected level is not lower than a preset pixel threshold.
[0016] Preferably, the method further includes: converting the background area to the HSV color space or the Lab color space, and using the saturation channel or the luminance channel to assist in verifying the grayscale space determination result.
[0017] Secondly, corresponding to the method described in the first aspect, the present invention also provides a multi-imaging mode whole-slice pathological image background adaptive recognition system, comprising: The background sampling module is used to obtain grayscale pixel data of the background area in response to at least one background area selected by the user on the image. The statistical analysis module is used to calculate the statistics of the grayscale pixel data, including the Nth lower percentile, the Mth higher percentile, the mean, and the standard deviation, where N and M are preset parameters; determine the adaptive fill amount based on the larger of the standard deviation and the preset minimum fill value; determine the initial background upper bound based on the Nth lower percentile minus the adaptive fill amount, and determine the initial background upper bound based on the Mth higher percentile plus the adaptive fill amount; determine whether the mean plus a preset multiple of the standard deviation reaches the upper limit of the grayscale value range to expand the background upper bound, and determine whether the mean minus the preset multiple of the standard deviation reaches the lower limit of the grayscale value range to expand the background lower bound; determine the final background grayscale range based on the expanded background lower bound and upper bound. The classification module is used to classify pixels whose grayscale values fall within the final background grayscale range as background, and otherwise as organization.
[0018] Thirdly, the present invention also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the method described in any of the first aspects above.
[0019] Compared with the prior art, the present invention has the following beneficial effects: (1) This invention automatically identifies whether the current image belongs to a bright field white background, a fluorescent black background or a gray special background by judging whether the mean plus or minus a preset multiple standard deviation reaches the extreme boundary of the gray value range. Based on this, the upper limit of the background range is extended to the upper limit of gray value, the lower limit is extended to the lower limit of gray value or the initial range is maintained. This allows a single algorithm to adaptively process multiple imaging modes without manual selection or switching, solving the problem that the prior art requires designing independent algorithms for different imaging modes.
[0020] (2) This invention uses the Nth lowest percentile and the Mth highest percentile (preferably the 1st percentile and the 99th percentile) instead of the minimum and maximum values to determine the initial background range. Percentiles can automatically exclude a small number of non-background pixels (such as tissue fragments, dust, and bubbles) that are occasionally mixed in the sampling area, so that users do not need to precisely select a clean background area, reducing the user's operational requirements. At the same time, the use of percentiles instead of extreme values, together with adaptive filling and 3σ boundary expansion, constitutes a redundant tolerance mechanism for user sampling errors.
[0021] (3) This invention automatically identifies the imaging mode and expands the background range by judging whether μ±3σ touches the grayscale boundary (0 or 255). This mechanism does not rely on the histogram bimodal assumption and can respond correctly to bright field, fluorescence, and gray background. Its technical effect is reflected in the following: when the mean is close to 255 and the distribution is stable, the upper boundary of 3σ will inevitably reach 255 and be automatically identified as bright field; when the mean is close to 0 and the distribution is stable, the lower boundary of 3σ will inevitably reach 0 and be automatically identified as fluorescence; in other cases, the initial range is maintained and no manual mode specification is required.
[0022] (4) This invention determines the fill amount based on the standard deviation σ, so that the fill amount can be automatically adjusted according to the uniformity of the background: the more uniform the background (smaller σ), the smaller the fill amount, avoiding overexpansion; the more non-uniform the background (larger σ), the larger the fill amount, ensuring coverage of the fluctuation range of the real background. At the same time, a minimum fill value of 5 gray levels is set to ensure that there is a basic tolerance even for extremely uniform backgrounds. This feature, combined with percentile statistical features, allows the initial background range to dynamically adapt to changes in background grayscale distribution under different scanning conditions.
[0023] (5) When the user selects multiple background regions, the grayscale pixel data of each region are merged into a unified dataset to calculate global statistics, so that the fused background range can cover multiple background modes (such as different grayscale regions caused by uneven coloring). At the same time, the standard deviation of each sampling region is checked. When the standard deviation exceeds the preset threshold, the user is prompted to reselect, ensuring the sampling quality from the source and further improving the accuracy of background range estimation, especially for large-size WSI images with uneven background grayscale distribution.
[0024] (6) This invention extends tissue mask generation to block-level analysis scenarios: first, each block is marked according to a tissue proportion threshold, and then the marked grid of the blocks is expanded by 3×3 neighborhood. This technical feature allows tissue edge blocks to be reclassified as tissue blocks even if the tissue proportion is slightly lower than the threshold, as long as there is tissue in their adjacent blocks. This achieves the conservative strategy of "preferring to under-classify the background rather than missing the tissue", effectively avoiding the problem of edge tissue loss caused by block cutting in block analysis. Compared with pixel-level morphology, block-level grid expansion is adapted to the specific scenarios of block analysis, has higher computational efficiency, and the expansion effect directly corresponds to the smallest unit of block analysis.
[0025] (7) The present invention reverses the background range generated by user sampling to pre-screen pure background blocks: before block-by-block analysis, read the low-resolution thumbnail to quickly determine whether the block meets the tissue proportion condition. If it is background, skip the subsequent I / O and calculation directly. 50%~80% of pure background blocks can be filtered in advance, which significantly reduces invalid calculations and improves the processing efficiency of WSI whole-slice analysis.
[0026] (8) Based on the default grayscale space processing, the present invention provides an auxiliary judgment extension scheme for HSV or Lab color space, which enables the use of saturation or brightness channel information to assist in verifying the background judgment result for certain special stained or fluorescent multi-labeled images, thus expanding the applicability of the algorithm of the present invention while maintaining the computational efficiency in the default mode.
[0027] In summary, this invention, through the organic combination of the aforementioned technical features, provides a universal, robust, and efficient adaptive background recognition method and system for whole-section pathological images. It acquires grayscale pixel data in response to a user-selected background region, calculates statistics, and adaptively determines the initial background range based on the standard deviation and a preset fill amount. Then, it expands the background range based on whether the mean plus or minus a preset multiple of the standard deviation touches the boundary. Finally, it determines the background and tissue based on the expanded grayscale range. This solves the problem that existing technologies cannot uniformly adapt to background differences in multimodal images such as brightfield and fluorescence. It has the advantage of adaptively recognizing background regions under different imaging modes, improving recognition accuracy and efficiency, and has significant practical value in application scenarios such as pathological quality control, AI training, and quantitative analysis.
[0028] The beneficial effects of the second and third aspects mentioned above can be found in the relevant descriptions in the first aspect above, and will not be repeated here. Detailed Implementation
[0029] The technical solutions of the present invention will be clearly and completely described below with reference to specific embodiments. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. Therefore, the following detailed description of the embodiments of the present invention is not intended to limit the scope of the claimed invention, but merely represents selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.
[0030] In traditional technologies, background recognition of whole-slice digital pathology images faces adaptability limitations due to the diversity of imaging modes. Bright-field imaging backgrounds exhibit high grayscale values, while fluorescence imaging backgrounds exhibit low grayscale values. Existing fixed thresholding methods can only handle single-mode backgrounds, while Otsu's automatic thresholding method fails in fluorescence images due to its reliance on the bimodal distribution of histograms. Pixel-level morphological methods, on the other hand, cannot adapt to block-level analysis grids and may produce misjudgments in sparse tissue areas. The essence of this problem lies in the lack of an adaptive recognition mechanism that can uniformly handle multimodal background features. This leads to a decrease in the reliability of tissue region extraction in the pathology image analysis process, thereby affecting the accuracy of pathological quality control and quantitative analysis.
[0031] For example, in a mixed case analysis scenario where HE-stained bright-field images and fluorescence immunohistochemical images are processed simultaneously, the system incorrectly identifies black backgrounds with gray values close to 0 as tissue regions when processing fluorescence images using a fixed threshold method. When processing specially stained gray background images using the Otsu method, the background boundary determination is biased because the histogram does not show a clear bimodal distribution. Furthermore, when the user selects multiple background regions for sampling, if there is uneven local illumination in a certain region, the existing method cannot detect the abnormal gray-scale standard difference in that region, causing the statistical calculation to be interfered with by noise. Specifically, in this scenario, the background recognition error directly leads to the inclusion of a large amount of non-tissue region data in the immunohistochemical quantitative analysis, thereby causing pollution of the input data for subsequent AI training models.
[0032] If the above problems are not addressed, the tissue region segmentation results of the pathological image analysis system will produce systematic biases. Misclassifying background as tissue will lead to abnormal pathological quality control indicators, while misclassifying tissue as background will result in missing quantitative analysis data. Furthermore, this bias is amplified after gridding in block-level analysis, causing distortion of the region labeling results of the two-dimensional Boolean grid. Ultimately, this affects the integrity and repeatability of the whole-slice image analysis process, thus highlighting the necessity of developing a general adaptive background recognition method.
[0033] To address this issue, this invention proposes an adaptive background recognition method for whole-slice pathological images with multiple imaging modes, comprising the following steps: In response to the user selecting at least one background region on the image, grayscale pixel data of that background region is acquired; Calculate the statistics of the grayscale pixel data, which include the Nth lower percentile, the Mth higher percentile, the mean, and the standard deviation, where N and M are preset parameters; The adaptive fill amount is determined based on the larger of the standard deviation and the preset minimum fill value. The initial background upper bound is determined by subtracting the adaptive fill amount from the Nth lowest percentile, and the initial background upper bound is determined by adding the adaptive fill amount to the Mth highest percentile. Determine whether the mean plus a preset multiple standard deviation reaches the upper limit of the grayscale value range. If so, extend the upper limit of the initial background to the upper limit. Determine whether the mean minus the preset multiple standard deviation reaches the lower limit of the grayscale value range. If so, extend the lower limit of the initial background to the lower limit. The final background grayscale range is determined based on the expanded background upper and lower bounds. Pixels whose grayscale values fall within the final background grayscale range are classified as background; otherwise, they are classified as organization.
[0034] For ease of understanding, the following explains some key terms in this embodiment: Background area: This refers to the region in a whole-section pathological image that does not contain tissue components, usually appearing as blank or non-tissue portions of the image. Accurate identification of the background area is crucial for subsequent tissue analysis.
[0035] Grayscale pixel data: refers to the brightness information of each pixel in an image, usually represented by an integer value from 0 to 255, where 0 represents black and 255 represents white.
[0036] Statistics: These are numerical values used to describe the distribution characteristics of grayscale pixel data, including the Nth lower percentile, the Mth higher percentile, the mean, and the standard deviation. These statistics can reflect the central tendency and dispersion of grayscale values in the background area.
[0037] The Nth lowest percentile: refers to the percentage of data points in grayscale pixel data that are lower than or equal to this value. For example, the 1st percentile means that 1% of pixel grayscale values are lower than or equal to this value.
[0038] The Mth highest percentile: This refers to the percentage of data points in grayscale pixel data that are higher than or equal to this value. For example, the 99th percentile means that 99% of pixel grayscale values are lower than or equal to this value.
[0039] Mean: refers to the average value of grayscale pixel data, reflecting the overall brightness level of grayscale values in the background area.
[0040] Standard deviation: refers to the dispersion of grayscale pixel data relative to the mean, reflecting the uniformity of grayscale values in the background area. The larger the standard deviation, the more dispersed the grayscale value distribution.
[0041] Preset parameters N and M: These are the values used to determine percentiles, and their selection affects the initial definition of the background range.
[0042] Preset minimum fill value: refers to a pre-set small gray value used to provide a basic fill amount when the standard deviation is small, so as to avoid the background range being too narrow.
[0043] Adaptive fill amount: refers to a value dynamically determined based on the standard deviation of the grayscale data of the background area and the preset minimum fill value, which is used to provide a certain margin when calculating the initial background upper and lower bounds.
[0044] Initial background lower and upper bounds: These refer to the lower and upper limits of the background grayscale value range initially determined based on percentiles and adaptive fill amount.
[0045] Upper and lower limits of grayscale value range: refers to the maximum possible value (e.g., 255) and the minimum possible value (e.g., 0) of the grayscale value of the image.
[0046] Preset multiplier: refers to the multiplier used to determine whether the mean plus or minus the standard deviation touches the boundary of the gray value range.
[0047] Example 1 (Method) This embodiment provides a method for adaptive background recognition of whole-section pathological images with multiple imaging modes. The method responds to at least one background region selected by a user on an image, acquiring grayscale pixel data of the background region; calculating statistics of the grayscale pixel data, including the Nth lower percentile, the Mth higher percentile, the mean, and the standard deviation, where N and M are preset parameters; determining an adaptive fill amount based on the larger of the standard deviation and a preset minimum fill value; determining an initial background lower bound based on the Nth lower percentile minus the adaptive fill amount, and determining an initial background upper bound based on the Mth higher percentile plus the adaptive fill amount; determining whether the mean plus a preset multiple of the standard deviation reaches the upper limit of the grayscale value range, and if so, extending the initial background upper bound to the upper limit; determining whether the mean minus the preset multiple of the standard deviation reaches the lower limit of the grayscale value range, and if so, extending the initial background lower bound to the lower limit; determining the final background grayscale range based on the extended background lower bound and upper bound; and identifying pixels whose grayscale values fall within the final background grayscale range as background, otherwise identifying them as tissue.
[0048] Its main technical features are described in detail below: First, in response to the user selecting at least one background region on the image, the system acquires the grayscale pixel data of that background region. In one implementation, the user can use a graphical user interface, a mouse, or other input device to select one or more rectangular regions on the displayed pathological image; these regions are designated as background regions. The system then extracts the grayscale values of all pixels from these selected regions. In another implementation, the user can click on multiple points in the image, and the system automatically identifies and extracts pixels within a small area around these points as background samples based on their positions.
[0049] Secondly, the system calculates the statistics for the grayscale pixel data, including the Nth lower percentile, the Mth higher percentile, the mean, and the standard deviation, where N and M are preset parameters. To obtain these statistics, the system can sort all the extracted grayscale pixel data and then directly calculate the corresponding percentiles based on the preset values of N and M.
[0050] Next, the adaptive fill amount is determined based on the larger of the standard deviation and the preset minimum fill value. In one implementation, the system first calculates the standard deviation of the grayscale values of the selected background area. Then, this standard deviation is compared to a preset fixed value (e.g., a small positive integer, such as 1 or 2). If the standard deviation is less than the preset minimum fill value, the preset minimum fill value is used as the adaptive fill amount; otherwise, if the standard deviation is greater than or equal to the preset minimum fill value, the calculated standard deviation is used as the adaptive fill amount. This mechanism aims to ensure that even when the grayscale values in the background area are extremely uniform (standard deviation close to zero), a certain buffer is provided for the background range.
[0051] Subsequently, the initial background lower bound is determined by subtracting the adaptive fill amount from the Nth lowest percentile, and the initial background upper bound is determined by adding the adaptive fill amount to the Mth highest percentile. Specifically, the system subtracts the determined adaptive fill amount from the previously calculated Nth lowest percentile to obtain a preliminary lower bound for background grayscale. Similarly, the system adds the adaptive fill amount to the Mth highest percentile to obtain a preliminary upper bound for background grayscale. This approach aims to capture the main distribution of background grayscale through percentiles and provide a certain tolerance margin through the adaptive fill amount to cope with slight fluctuations in background grayscale values.
[0052] Furthermore, the system determines whether the mean plus a preset standard deviation reaches the upper limit of the grayscale value range. If so, the initial background upper bound is extended to that upper limit. It also determines whether the mean minus the preset standard deviation reaches the lower limit of the grayscale value range. If so, the initial background lower bound is extended to that lower limit. For example, for an 8-bit grayscale image, the upper limit of the grayscale value range is typically 255, and the lower limit is 0. The system calculates the mean plus a preset standard deviation (e.g., 2 times) and checks if the result is greater than or equal to 255. If the condition is met, the initial background upper bound is directly set to 255. Similarly, the system calculates the mean minus the preset standard deviation and checks if the result is less than or equal to 0. If the condition is met, the initial background lower bound is directly set to 0. This extension mechanism aims to handle cases where the background grayscale value is extremely close to the image grayscale range boundary, such as a pure white or pure black background, ensuring that the background range can completely cover these extreme cases.
[0053] Based on this, the final background grayscale range is determined according to the expanded background lower and upper bounds. Once the initial background lower and upper bounds have undergone the above boundary expansion judgment and may be adjusted, the resulting two values constitute the final grayscale value range used for background recognition. This range represents the grayscale value range that the system believes background pixels should have.
[0054] Finally, pixels whose grayscale values fall within the final background grayscale range are classified as background; otherwise, they are classified as tissue. The system performs grayscale value detection on every pixel in the image. If a pixel's grayscale value is between or equal to the final background upper bound and the final background lower bound, the pixel is classified as a background pixel. Conversely, if a pixel's grayscale value is below the final background upper bound or above the final background lower bound, the pixel is classified as a tissue pixel.
[0055] The following example will provide a more detailed explanation of the above technical solution: Suppose user A is processing a whole-section pathological image B. This image may contain bright-field stained areas and fluorescent stained areas, resulting in significant differences in background grayscale values across different regions. For example, some areas have a near-pure white background (high grayscale value), some areas have a near-pure black background (low grayscale value), and some areas have a gray background. User A wants to accurately identify all background areas in image B for subsequent tissue quantitative analysis.
[0056] First, user A selects one or more representative background areas on image B. For example, user A selects a blank white area in the upper left corner of the image and a blank black area in the lower right corner. The system responds to the user's selections and retrieves a large amount of grayscale pixel data from these areas.
[0057] Next, the system performs statistical analysis on these merged grayscale pixel data. Assume the system calculates the following: the Nth lowest percentile (e.g., the 1st percentile) is 5, the Mth highest percentile (e.g., the 99th percentile) is 250, the mean is 120, and the standard deviation is 50. Simultaneously, the preset minimum fill value is set to 5 gray levels.
[0058] Then, the system determines the adaptive fill amount to be 50 based on the larger of the standard deviation of 50 and the preset minimum fill value of 5.
[0059] The system then uses these statistics and adaptive padding to determine the initial background range. The initial background upper bound is determined as the 1st percentile 5 minus the adaptive padding 50, resulting in -45. The initial background upper bound is determined as the 99th percentile 250 plus the adaptive padding 50, resulting in 300.
[0060] Based on this, the system performs boundary expansion judgment. For the initial background upper bound of 300, the system judges the mean of 120 plus a preset multiple (e.g., 3 times) and the standard deviation of 50, i.e., 120 + 3 * 50 = 270. Since 270 exceeds the upper limit of the grayscale value range of 255, the initial background upper bound of 300 is expanded to the upper limit of the grayscale value range of 255. For the initial background lower bound of -45, the system judges the mean of 120 minus the preset multiple of 3 times the standard deviation of 50, i.e., 120 - 3 * 50 = -30. Since -30 is lower than the lower limit of the grayscale value range of 0, the initial background upper bound of -45 is expanded to the lower limit of the grayscale value range of 0.
[0061] Therefore, the final background grayscale range was determined to be [0, 255].
[0062] It should be noted that when the grayscale standard deviation of the sampling area is too large (e.g., exceeding a preset threshold), it means that the sampling area may contain non-background pixels or multiple grayscale modes. In this case, the uniformity verification mechanism of this embodiment will prompt the user to reselect a cleaner background area. Therefore, in practical applications, the situation where the background grayscale range expands to the entire [0, 255] will not occur. The technical solution of this embodiment is based on the premise that the user correctly selects the background area, and fully guarantees the accuracy of the background range estimation through mechanisms such as percentile statistics, uniformity verification, and multiple sampling fusion.
[0063] Finally, the system iterates through all pixels in image B. Any pixel with a grayscale value between 0 and 255 is identified as a background pixel, while pixels with grayscale values outside this range (theoretically nonexistent, as the range has been extended to its limit) are identified as tissue pixels. In this way, even if there is a pure black, pure white, or gray background in image B, the method can adaptively identify background regions. For example, for a white background in a bright-field image, its grayscale value is close to 255 and will be accurately identified as background; for a black background in a fluorescent image, its grayscale value is close to 0 and will also be accurately identified as background. This method avoids the problem of traditional fixed threshold methods failing in multimodal images and also avoids the strict requirements of Otsu's method on histogram distribution.
[0064] Furthermore, this embodiment expands the background range by determining whether the mean plus or minus a preset multiple of the standard deviation touches the boundary of the grayscale value range, further enhancing the robustness of the method. In the example above, even if the initially calculated background lower bound is negative or the upper bound exceeds 255, the system can intelligently expand it to the actual boundary of the grayscale value range (0 or 255). This mechanism enables the method to effectively handle situations where the background grayscale values are extremely close to the boundary of the image grayscale range, avoiding inaccurate background recognition caused by the background grayscale values being too concentrated at one end. For example, for brightfield images with background grayscale values highly concentrated in the 250-255 range, or fluorescent images concentrated in the 0-5 range, this expansion mechanism ensures that the background range can completely cover these extreme cases, while the traditional Otsu method may fail in these cases because the histogram does not exhibit a bimodal distribution.
[0065] In this embodiment, the preferred parameter settings are as follows: the Nth lowest percentile is the 1st percentile (P1), the Mth highest percentile is the 99th percentile (P99), the preset multiplier is 3 times, and the preset minimum fill value is 5 gray levels; the preset parameters N and M are configurable parameters and can be configured to one of the following combinations: N=0.5 and M=99.5, or N=1 and M=99, or N=2 and M=98.
[0066] The effects of different percentile pairs are compared below: P0.5 / P99.5: Only the most extreme 0.5% of pixels are excluded, with low tolerance for noise, suitable for scenes with very clean sampling areas; P1 / P99 (preferred in this embodiment): Excluding the most extreme 1% of pixels, a balance is struck between robustness and information preservation, suitable for most scenarios; P2 / P98: Excluding the most extreme 2% of pixels, it is more robust, but may excessively shrink the background area; P5 / P95: Excluding the most extreme 5% of pixels, it has the highest tolerance and is suitable for scenes where a large number of non-background pixels are mixed in the sampling area.
[0067] The rationale for choosing P1 / P99 is as follows: In typical pathological image scenarios, the proportion of non-background pixels (such as tissue fragments, dust, and air bubbles) mixed in with the background area selected by the user is usually less than 1%. P1 / P99 can effectively eliminate the interference of these extreme pixels while retaining 99% of the effective background information. When the proportion of mixed pixels is higher, combined with the uniformity verification mechanism, the system will actively prompt the user to reselect, thereby ensuring the purity of the sample from the source.
[0068] This embodiment ensures the purity of the sampling area through a three-layer mechanism: First layer (percentile truncation): P1 / P99 automatically excludes the most extreme 1% of pixels in the sampling area, tolerating a small number of non-background pixels; The second layer (uniformity check): When the standard deviation σ of the sampling area exceeds the threshold, the system determines that the sampling is impure and prompts the user to reselect (see the uniformity check mechanism in step 1). The third layer (multiple sampling fusion): Users can select multiple background areas, and the system merges all sampled pixels and recalculates the statistics. The introduction of a large number of clean background pixels will dilute the influence of a small number of contaminated pixels, further improving the statistical robustness.
[0069] The three-layer mechanism works together to ensure that even if large tissue fragments (more than 1%) are occasionally mixed in in the user's selected area, the system can still obtain accurate background statistical features through verification prompts and multiple sampling.
[0070] Here, the Nth lower percentile and the Mth higher percentile are statistics used to describe the characteristics of data distribution; they represent data points in the dataset that are below or above a certain percentage. Setting N to 1 and M to 99 means that the lowest and highest 1% of extreme gray values in the dataset are excluded when calculating the initial background upper and lower bounds. This setting helps to remove noise points or a small number of non-background pixels that may exist in the background area, making the statistics more representative and avoiding interference from these outliers in determining the background range. This can be achieved by obtaining the distribution of gray-scale pixel data through a sorting algorithm in the data processing module, and then directly extracting the corresponding gray values according to the preset percentage positions; or by using histogram analysis to accumulate the gray-scale value distribution and find the gray values when the cumulative percentage reaches 1% and 99%.
[0071] The preset multiplier is a coefficient used to weight the standard deviation when determining whether the mean plus or minus the standard deviation reaches the upper or lower limit of the grayscale value range. Setting the preset multiplier to 3 typically corresponds to the range containing approximately 99.7% of the data in a normal distribution. When expanding the background range, the system considers a relatively wide statistical interval to ensure that background pixels can still be effectively captured and imaging patterns that may require background range expansion can be identified even when the background grayscale distribution is wide or has slight deviations. This can be achieved by hard-coding the multiplier as a fixed parameter in the software configuration; or by providing an adjustable option in the user interface, allowing administrators or advanced users to set the multiplier based on experience.
[0072] The preset minimum fill value is a fixed grayscale value used to compare with the calculated standard deviation to determine the final adaptive fill amount. Its purpose is to provide a minimum buffer range even when the standard deviation is very small, preventing misjudgment of background pixels due to an excessively narrow background area. Setting the preset minimum fill value to 5 grayscale levels means that even if the grayscale values in the background area are very concentrated and the standard deviation is small, the system will still provide a buffer of at least 5 grayscale levels to increase the robustness of the background range and avoid misjudgment caused by minor fluctuations. This can be achieved by reading this parameter from the configuration file during system initialization; or by setting a constant value directly in the algorithm logic.
[0073] The preset parameters N and M are configurable parameters, meaning their values can be adjusted and selected during system operation or before deployment, rather than being fixed. Setting N and M as configurable parameters and providing combinations such as (0.5, 99.5), (1, 99), and (2, 98) allows the system to flexibly adjust the background range calculation strategy based on different pathological image types, staining methods, or imaging devices. For example, for images with less background noise and a concentrated grayscale distribution, a smaller N and a larger M can be selected to obtain a more accurate background range; while for images with more background noise or a wider grayscale distribution, a larger N and a smaller M can be selected to enhance robustness and avoid the influence of extreme values. This can be achieved by providing drop-down menus or input boxes in the user interface for users to select or input values for N and M; alternatively, the system can automatically recommend or select appropriate N and M combinations based on image metadata or pre-trained models.
[0074] The following is a specific example to illustrate this: Suppose that when processing a HE-stained whole-section pathological image, the user selects multiple background regions on the image. The system first acquires the grayscale pixel data of these background regions. When calculating statistics, the system can be configured to use a combination of N=1 and M=99, i.e., calculating the 1st and 99th percentiles. For example, if the calculated 1st percentile is 200 gray levels, the 99th percentile is 240 gray levels, the mean is 220 gray levels, and the standard deviation is 8 gray levels. Simultaneously, the preset multiplier is set to 3, and the preset minimum fill value is 5 gray levels. The system will determine the adaptive fill amount as 8 gray levels based on the larger of the standard deviation of 8 gray levels and the preset minimum fill value of 5 gray levels. Then, the initial background upper bound is determined as the 1st percentile of 200 minus the adaptive fill amount of 8, i.e., 192 gray levels; the initial background upper bound is determined as the 99th percentile of 240 plus the adaptive fill amount of 8, i.e., 248 gray levels. Next, the system determines whether the mean of 220 plus a preset multiplier of 3 multiplied by a standard deviation of 8 (i.e., 244) reaches the upper limit of the grayscale range (usually 255). Since 244 does not reach 255, the initial upper limit of the background, 248, remains unchanged. Simultaneously, it determines whether the mean of 220 minus the preset multiplier of 3 multiplied by a standard deviation of 8 (i.e., 196) reaches the lower limit of the grayscale range (usually 0). Since 196 does not reach 0, the initial lower limit of the background, 192, also remains unchanged. Finally, the background grayscale range is determined to be [192, 248]. When processing another immunohistochemically stained pathological image, since the background may have a wider grayscale distribution or uneven staining, the user or system can configure a combination of N=2 and M=98. In this case, the system calculates the 2nd and 98th percentiles and performs subsequent background range determination in a similar manner. This configurability of parameters allows the system to flexibly address background recognition challenges under different staining and imaging modes.
[0075] For scenarios with uneven background grayscale distribution, such as HE-stained WSI, some background areas appear pale pink due to uneven staining, with a grayscale value of approximately 210-230; another part of the background is pure white, with a grayscale value of approximately 240-255. In this case, this embodiment employs a multi-sample fusion mechanism, specifically including the following steps: Step 1a: The user selects the first sampling area within a pure white background. The system verifies σ1=6 (<30), passing the uniformity check. Statistical values: μ1=245, σ1=6, P11=235, P991=253.
[0076] Step 1b: The user selects the second sampling area within the light pink background area. The system verifies σ²=8 (<30), passing the uniformity check. Statistical values: μ²=220, σ²=8, P1²=207, P99²=232.
[0077] Step 2: The system merges the grayscale pixels of the two sampling regions and calculates the fusion statistics: μ=233, σ=14, P1=208, P99=253.
[0078] Step 3: pad = max(5, round(14)) = 14, initial range: low = 208-14 = 194, high = 253+14 = 267 → 255 Step 4: 3σ extension judgment: μ + 3σ = 233 + 42 = 275 ≥ 255 → high = 255 Final range: [194, 255], covering two background grayscales: pure white and light pink.
[0079] If only the pure white area is sampled, then pad=max(5,round(6))=6, low=235-6=229, high=253+6=259→255, μ1+3σ1=245+18=263≥255→high=255, and the final range is [229, 255]. This range cannot cover the light pink background area with a grayscale of 210-228, and will misidentify it as tissue. The multi-sampling fusion mechanism of this embodiment expands the range to [194, 255], effectively solving this problem.
[0080] The Nth lowest percentile and Mth highest percentile are used instead of extreme values; that is, minimum or maximum values are not used. This is to avoid interference from these endpoints, which are most susceptible to noise, artifacts, or outliers, in determining the background range. In practice, all grayscale pixel data can first be sorted in ascending order. Then, based on preset N and M values, the corresponding percentiles can be directly selected from the sorted data as reference points for the initial background upper and lower bounds. For example, for a grayscale dataset containing a large number of pixels, if N=1, the grayscale value located at 1% of the total data after sorting is selected as the 1st percentile. Alternatively, interpolation methods, such as linear interpolation or nearest neighbor interpolation, can be used to calculate percentiles to obtain smoother or more accurate percentile estimates, especially when the data volume is small or the percentile position is not an integer index. By eliminating these extreme values, the robustness of background grayscale range determination can be effectively improved, making it less susceptible to the influence of individual outlier pixels.
[0081] Suppose a user receives 10,000 grayscale pixel values. To calculate the Nth lowest percentile and Mth highest percentile, the system first sorts these 10,000 grayscale values in ascending order. If the preset parameters N is 1 and M is 99, the system will find the grayscale value at the 100th position after sorting as the 1st percentile and the grayscale value at the 9900th position after sorting as the 99th percentile. These two percentiles will serve as reference points for determining the initial background lower and upper bounds. For example, if the sorted 100th pixel has a grayscale value of 20 and the 9900th pixel has a grayscale value of 240, then the calculation of the initial background lower and upper bounds will be based on these two values, rather than on the possible minimum (e.g., 0, if there is a bad pixel) or maximum (e.g., 255, if there is a highlight artifact). In this way, even if there are a few abnormally low values (such as 0-19) or abnormally high values (such as 241-255) in the dataset, they will not directly affect the calculation of the background range, thus ensuring the robustness of the background range.
[0082] The above technical solution effectively avoids interference from occasional noise, artifacts, or abnormal pixels (such as dust, scratches, and sensor defects) in the background grayscale range determination during adaptive background recognition of whole-slice pathological images in multiple imaging modes. By using percentiles instead of extreme values (minimum or maximum) to define the background boundary, the calculation of the background range is more stable and representative, less susceptible to the influence of individual extreme values. This significantly improves the accuracy and robustness of background recognition, especially when facing complex and varied pathological image backgrounds, enabling more precise differentiation between the background and tissue, thus providing more reliable basic data for subsequent image analysis and diagnosis.
[0083] This embodiment further proposes to identify the imaging mode by whether the mean plus or minus the preset multiple standard deviation touches the boundary of the grayscale value range: when the mean plus the preset multiple standard deviation reaches or exceeds the upper limit of grayscale, the upper boundary of the background range is extended to the upper limit; when the mean minus the preset multiple standard deviation reaches or falls below the lower limit of grayscale, the lower boundary of the background range is extended to the lower limit; when neither of these conditions is met, the initial background range remains unchanged.
[0084] The imaging pattern is identified by checking whether the mean plus or minus the preset standard deviation touches the boundary of the grayscale value range. This feature aims to infer the imaging pattern of the current pathological image by utilizing the characteristics of the grayscale statistics of the background region. In whole-section pathological images, different staining methods, scanning equipment, or image processing procedures may cause the background grayscale distribution to exhibit different characteristics. For example, in some patterns, the background may be very bright (close to the upper limit of grayscale), while in other patterns, the background may be very dark (close to the lower limit of grayscale). By observing whether the statistical range defined by the mean and standard deviation "touches" or "overflows" the physical boundary of grayscale values (such as 0-255 in an 8-bit image), the system can indirectly identify the tendency of these imaging patterns. For example, if the background statistical range significantly touches the upper limit of grayscale, it may indicate that the overall image background is too bright; if it touches the lower limit of grayscale, it may indicate that the overall background is too dark. This identification can provide valuable contextual information for subsequent image processing or analysis. The system can preset multiple imaging pattern templates, each corresponding to a background grayscale distribution feature. When the mean plus or minus a preset standard deviation reaches a boundary, the system matches the background features of the current image with these templates to identify the most suitable imaging mode. Alternatively, the system can categorize imaging modes into several types based on the boundary conditions, such as "bright background mode," "dark background mode," and "normal background mode." When the mean plus the preset standard deviation reaches the upper limit, it is identified as a bright background mode; when the mean minus the preset standard deviation reaches the lower limit, it is identified as a dark background mode; when neither condition is met, it is identified as a normal background mode.
[0085] When the mean plus the preset standard deviation reaches or exceeds the grayscale upper limit, the upper bound of the background range is extended to the upper limit. This feature describes how to adjust the upper bound of the background when the background grayscale distribution is too bright and its statistical range (mean plus the preset standard deviation) has reached or exceeded the maximum allowed grayscale value. The grayscale upper limit is usually the maximum grayscale value that an image data type can represent, such as 255 for an 8-bit image. When the statistical upper limit of the background reaches this physical upper limit, it means that there may be a large number of pixels in the background that are close to pure white, or the dynamic range of the background is compressed to near the upper limit. In this case, extending the upper bound of the background range directly to the grayscale upper limit can ensure that all background pixels that are close to pure white are correctly identified as background, avoiding misidentification of extremely bright background areas as tissue, thereby improving the accuracy of background recognition. After calculating the initial background upper bound, the result of the mean plus the preset standard deviation is checked. If the result is greater than or equal to the grayscale upper limit, the final background upper bound is directly set to the grayscale upper limit. Alternatively, after determining the initial background upper bound, the system will perform a conditional judgment. If the condition (mean plus a preset multiple of standard deviation ≥ grayscale upper limit) is met, then the upper limit of the background will be forcibly set to the grayscale upper limit; otherwise, the initial upper limit of the background will remain unchanged.
[0086] When the mean minus the preset standard deviation reaches or falls below the grayscale lower limit, the lower bound of the background range is extended to this lower limit. This feature describes how to adjust the background lower bound when the background grayscale distribution is dark and its statistical range (mean minus the preset standard deviation) has reached or fallen below the minimum allowable grayscale value. The grayscale lower limit is usually the smallest grayscale value that an image data type can represent, such as 0 for an 8-bit image. When the statistical lower bound of the background touches this physical lower bound, it means that there may be a large number of pixels in the background that are close to pure black, or that the dynamic range of the background is compressed to near the lower limit. In this case, extending the lower bound of the background range directly to the grayscale lower limit ensures that all background pixels that are close to pure black are correctly identified as background, avoiding misidentification of extremely dark background areas as tissue, thereby improving the accuracy of background recognition. After calculating the initial background lower bound, the result of the mean minus the preset standard deviation is checked. If the result is less than or equal to the grayscale lower limit, the final background lower bound is directly set to the grayscale lower limit. Alternatively, after determining the initial background lower bound, the system will perform a conditional judgment. If the condition (mean minus the preset multiple standard deviation ≤ gray level lower limit) is met, then the background boundary is forcibly set to the gray level lower limit; otherwise, the initial background boundary remains unchanged.
[0087] When neither condition is met, the initial background range remains unchanged. This feature clarifies the processing strategy when the statistical range of the background grayscale distribution (mean plus or minus a preset multiple of standard deviation) does not reach either the upper or lower grayscale limit. This means that the grayscale distribution of the background is within a relatively "normal" range, without a significant trend towards brightness or darkness, and its statistical characteristics can well reflect the actual grayscale range of the background. In this case, there is no need to further expand the initially calculated upper and lower bounds of the background; the initial background range is directly used as the final background grayscale range, thus avoiding unnecessary adjustments and maintaining the accuracy of background recognition. After completing the expansion judgment of the upper and lower bounds of the background, if neither of the two expansion conditions (reaching the upper and lower limits) is triggered, the initial background upper and lower bounds are directly assigned to the final background upper and lower bounds. Alternatively, the system processes this through a logical judgment branch. If the Boolean results of the aforementioned two expansion conditions (upper bound expansion condition and lower bound expansion condition) are both false, the operation of "keeping the initial background range unchanged" is executed, i.e., no boundary adjustment is performed.
[0088] This statistical boundary-based judgment mechanism not only adaptively adjusts the background grayscale range to accommodate extreme background brightness under different imaging modes, but also indirectly infers the imaging mode characteristics of the current image (e.g., whether it is a bright background mode, a dark background mode, or a normal background mode) through this adjustment behavior itself. This identification of imaging modes makes the background recognition process more robust, effectively addressing potential background grayscale differences in whole-section pathological images that may occur under different scanning devices, staining batches, or during digitization, thus ensuring accurate differentiation between the background and tissue under various complex imaging conditions.
[0089] For example, suppose the image's grayscale value range is 0 to 255. After acquiring the grayscale pixel data of the user-selected background area, the system calculates the mean of that area to be 240, the standard deviation to be 5, and the preset multiplier to be 3. At this point, the mean plus the preset multiplier standard deviation is 240 + 3 * 5 = 255. Since 255 reaches the upper limit of grayscale, the system expands the upper bound of the background range to 255. Simultaneously, suppose the mean minus the preset multiplier standard deviation is 240 - 3 * 5 = 225, which does not reach or fall below the lower grayscale limit of 0. In this case, the system recognizes the current imaging mode as a mode with a bright background and adjusts the upper bound of the background accordingly to the upper grayscale limit. In another example, if the calculated mean is 15, the standard deviation is 3, and the preset multiplier is 3, then the mean minus the preset multiplier standard deviation is 15 - 3 * 3 = 6. This value does not reach or fall below the lower grayscale limit of 0. Meanwhile, the mean plus the preset standard deviation is 15 + 3 * 3 = 24, which does not reach or exceed the grayscale upper limit of 255. In this case, since neither the mean nor the preset standard deviation touches the boundary of the grayscale range, the system will identify it as a normal background mode and maintain the initial background range unchanged without additional boundary expansion. For example, if the calculated mean is 10, the standard deviation is 5, and the preset factor is 3, then the mean minus the preset standard deviation is 10 - 3 * 5 = -5. Since -5 is below the grayscale lower limit of 0, the system expands the lower boundary of the background range to 0. Simultaneously, the mean plus the preset standard deviation is 10 + 3 * 5 = 25, which does not reach or exceed the grayscale upper limit of 255. In this case, the system identifies the current imaging mode as a dark background mode and adjusts the background lower boundary accordingly to the grayscale lower limit.
[0090] This embodiment further proposes that when the user selects multiple background regions, the grayscale pixel data of each background region is merged into a unified grayscale dataset, and the statistics are calculated on the unified dataset; it also includes calculating the grayscale standard deviation independently for each background region, and issuing a prompt message to the user when the standard deviation of any background region exceeds a preset uniformity threshold.
[0091] When a user selects multiple background regions on an image, the system extracts grayscale pixel data from these different regions. To obtain a more representative and robust background statistical model, these grayscale pixel data from different background regions are aggregated to form a single, unified grayscale dataset. On this unified dataset, statistics such as the Nth lower percentile, Mth higher percentile, mean, and standard deviation are calculated. This merging operation can be achieved by directly aggregating the pixel values of all selected regions into a large data structure, such as an array or list. Alternatively, the data for each region can be pre-sampled or pre-processed before merging, for example, removing obvious outliers to further improve the quality and representativeness of the merged data. To ensure the quality and uniformity of the selected background regions, this embodiment independently calculates the grayscale standard deviation for each background region selected by the user before merging the data. The grayscale standard deviation is an indicator of the dispersion of pixel grayscale values; a high standard deviation usually indicates that the region contains non-background elements (such as tissue debris, stains, bubbles, etc.) or has significant localized uneven illumination. The system compares the calculated standard deviation of each background region with a preset uniformity threshold. If the standard deviation of any background region exceeds the preset uniformity threshold, it indicates that the region may not be suitable as a pure background sample, and the system will issue a prompt to the user. This prompt may be presented as a graphical user interface pop-up, a log entry, or by highlighting the non-uniform area on the image, aiming to remind the user to check or reselect the background region, thereby avoiding the negative impact of unqualified background regions on the final calculation of the background grayscale range.
[0092] Suppose a user selects three different background regions on a whole-slice pathological image to more comprehensively define the image background. The system first extracts grayscale pixel data from each of these three regions. Next, the system independently calculates the grayscale standard deviation for each region. For example, if the preset uniformity threshold is 15 gray levels, and the standard deviation of one region is calculated to be 25 gray levels, this may indicate the presence of significant noise or non-background material in that region. In this case, the system will prompt the user, for example, by displaying a dialog box informing them that "the background uniformity of region 3 is poor; it is recommended to reselect." The user can choose to ignore this warning and continue, or reselect the background region according to the prompt. Assuming the user confirms that all regions are suitable for background analysis, the system will merge all grayscale pixel data from the three background regions into a unified grayscale dataset. Subsequently, the Nth lower percentile, Mth higher percentile, mean, and standard deviation are calculated on this unified dataset. For example, N can be set to 1, M to 99, to calculate the 1st percentile, 99th percentile, mean, and standard deviation. These statistics will be further used to determine the adaptive fill amount, the initial background upper and lower bounds, and ultimately to obtain the final background grayscale range for pixel classification.
[0093] Preferably, this embodiment further proposes dividing the image into multiple analysis blocks, calculating the proportion of tissue pixels within each analysis block, where tissue pixels are pixels whose grayscale values fall outside the final background grayscale range; when the tissue proportion is lower than a preset threshold, the block is marked as a background block, otherwise it is marked as a tissue block; a two-dimensional Boolean grid is constructed for the marking of all blocks, and a 3×3 neighborhood dilation operation is performed on the two-dimensional Boolean grid to re-mark the background blocks adjacent to the tissue blocks as tissue blocks.
[0094] For each analysis block, the proportion of organization pixels within that block is calculated. Organization pixels are pixels whose grayscale values fall outside the final background grayscale range, and their purpose is to assess the richness of organization content within each block. By calculating the proportion of organization pixels, it is possible to quantify whether a block is primarily composed of organization or primarily of background. This calculation can be performed by iterating through all pixels within the block, determining whether each pixel is an organization pixel based on the final background grayscale range determined by the above method, and then counting the number of organization pixels and dividing by the total number of pixels in the block. Alternatively, functions provided by an image processing library can be used to binarize the block (background as 0, organization as 1), and then the proportion of pixels with a value of 1 in the binarized image can be calculated.
[0095] When the tissue proportion is below a preset threshold, the block is marked as a background block; otherwise, it is marked as a tissue block. The purpose is to perform a preliminary classification of each block based on the quantified tissue proportion, categorizing it as either "background" or "tissue." This preset threshold is a key parameter for distinguishing between primary background and primary tissue regions. This threshold can be set as a fixed percentage value, such as 5% or 10%; alternatively, it can be dynamically adjusted according to different pathological image types or application scenarios, or even optimized using machine learning methods.
[0096] A two-dimensional Boolean grid is constructed for the labels of all blocks, aiming to store the preliminary classification results (background or organization) of each block in a structured manner, forming a logical grid corresponding to the block division of the original image. This provides the data foundation for subsequent morphological operations. This grid can be a two-dimensional array of the same size as the block division grid, with each element storing a Boolean value (e.g., True for an organization block, False for a background block) or an integer value (e.g., 1 for an organization block, 0 for a background block); alternatively, a bitmap structure can be used, with each bit representing the labeling state of a block, to save storage space.
[0097] A 3x3 neighborhood dilation operation is performed on the two-dimensional Boolean grid to "enlarge" the foreground region (in this case, the tissue block) in the image. This 3x3 neighborhood dilation effectively eliminates small background holes and connects broken tissue regions while ensuring the edges of the tissue regions are properly expanded. This operation can be achieved by checking for any tissue blocks within the 3x3 neighborhood (including itself) of each background block in the grid; if any exist, the background block is re-marked as a tissue block. Alternatively, a standard morphological dilation algorithm can be used, defining a 3x3 structuring element and then performing a convolution operation on the Boolean grid. If any tissue block exists within the area covered by the structuring element, the central block is marked as a tissue block.
[0098] Relabeling background blocks adjacent to tissue blocks as tissue blocks is a direct result and objective of the 3x3 neighborhood expansion operation. This relabeling effectively incorporates background regions immediately adjacent to tissue regions into the tissue region's scope, thus avoiding unnecessary background "gaps" at tissue edges and ensuring the integrity of the tissue region.
[0099] This approach not only enables efficient processing of large-scale images but also effectively addresses the local discontinuities that may arise from pixel-level classification, ensuring that the ultimately identified tissue regions are more complete, smoother, and more consistent with actual pathological conditions.
[0100] Specifically, the image can be divided into 256x256 pixel analysis blocks. For each block, firstly, using the final background grayscale range determined by the above method, all pixels within the block are traversed, and the number of pixels whose grayscale values fall outside this range is counted, i.e., the number of tissue pixels. Assuming a block has a total of 65536 pixels (256*256), if the number of tissue pixels is 3000, then the tissue pixel ratio of this block is approximately 4.58%. At this point, if the preset threshold is set to 5%, the tissue ratio of this block is lower than the preset threshold, so this block is initially marked as a background block. Conversely, if the number of tissue pixels is 4000, the ratio is approximately 6.1%, then this block is marked as a tissue block. After all blocks have been initially marked, a two-dimensional array corresponding to the image block division can be constructed, for example, a 100x100 array, where each element stores 0 (background block) or 1 (tissue block). Subsequently, a 3×3 neighborhood dilation operation is performed on this two-dimensional array. Specifically, for each element in the array marked as 0 (background block), its eight neighboring elements and itself are checked. If any of these nine elements is marked as 1 (organization block), then the central element (the original background block) will be remarked as 1 (organization block). For example, if a background block is adjacent to an organization block, after the expansion operation, the background block will be "swallowed" into the organization region, effectively filling small gaps at the organization edges or connecting previously separate but actually connected organization regions.
[0101] After obtaining the final background grayscale range, read the low-resolution thumbnail. For each analysis block, determine whether the tissue proportion condition is met based on the pixel ratio of the corresponding area in the thumbnail within the final background grayscale range. If it is met, submit the block for complete analysis; otherwise, skip the subsequent processing of the block.
[0102] The phrase "after obtaining the final background grayscale range" indicates that, prior to this step, the grayscale value range used to distinguish between the background and the organization has been determined using the aforementioned method. This final background grayscale range forms the basis for subsequent judgments, ensuring the accuracy of background recognition. "Reading a low-resolution thumbnail" refers to obtaining a scaled-down version of the original high-resolution image. This version typically contains fewer pixels but still retains the overall structure and main content of the image. For example, a thumbnail of 1 / 4, 1 / 8, or lower resolution of the original image can be read, or a lower level image from the image pyramid can be read to significantly reduce the amount of data, thereby accelerating image processing. "For each analysis block" refers to dividing the entire image into several sub-regions. These blocks can be fixed-size rectangular regions or dynamically divided regions based on image content. Processing each analysis block is to achieve refined analysis of local areas. The process of "determining whether the tissue proportion condition is met based on the pixel ratio of the corresponding area in the thumbnail within the final background grayscale range" involves extracting the area corresponding to the high-resolution image analysis block in the low-resolution thumbnail, then counting the number of pixels in that area whose grayscale values fall outside the determined final background grayscale range, and calculating the proportion of these pixels to the total pixels in that area. This proportion is the tissue pixel ratio at low resolution. The tissue proportion condition is usually a preset threshold; for example, if the tissue pixel ratio at low resolution is below a certain percentage, the block is considered to be mainly background. "Submit the block for complete analysis if satisfied" means that if the tissue pixel ratio at low resolution meets the preset condition, it indicates that the block may contain tissue, and the block will be marked as requiring complete, high-resolution analysis. Complete analysis usually refers to performing more precise image processing and analysis algorithms on the original high-resolution image data to extract detailed pathological information. "Otherwise, skip the subsequent processing of the block" means that if the tissue pixel ratio at low resolution does not meet the preset condition, it indicates that the block is likely purely background, and the block will be skipped and no further high-resolution detailed analysis will be performed. Skipping processing can avoid unnecessary calculations on pure background areas, thereby saving computing resources and time.
[0103] This embodiment optimizes the analysis process of whole-slice pathological images by introducing a pre-screening acceleration mechanism. After determining the final background grayscale range used to distinguish between background and tissue, the system no longer directly processes all high-resolution analysis blocks in detail. Instead, it first uses low-resolution thumbnails for rapid prediction, calculating the proportion of tissue pixels within the low-resolution region. If this proportion meets a preset tissue proportion condition, it indicates that the block is likely to contain valuable tissue information, and only then is the block submitted for complete high-resolution analysis. Conversely, if the tissue pixel proportion at low resolution does not meet the condition, the block is considered mainly background, and its subsequent high-resolution processing is skipped. This mechanism enables the system to intelligently identify and prioritize the processing of key areas containing tissue information, avoiding wasting computational resources on pure background areas, thereby significantly improving overall processing efficiency.
[0104] In this embodiment, when acquiring grayscale pixel data of the background area, the image pyramid level is automatically selected according to the size of the background area, so that the size of the area read at the selected level is not lower than a preset pixel threshold, ensuring that even after selecting a lower resolution pyramid level, the background area used for statistical analysis still contains enough pixel information.
[0105] The construction of the image pyramid can be carried out in various ways. For example, the next level can be generated by performing a Gaussian filter on the original image and then downsampling it by a factor of 2, or by using the preset multi-resolution levels in the image file format (such as TIFF) for storage and retrieval.
[0106] Automatically selecting the image pyramid level based on the size of the background region aims to intelligently choose the most suitable image resolution level for data reading based on the size of the background region selected by the user. This process can be implemented based on preset size-level mapping rules, such as associating background regions of different sizes (e.g., measured by pixel count or physical size) with specific pyramid levels. Alternatively, the system can dynamically evaluate, starting from the highest resolution level and gradually decreasing the level while calculating the pixel size of the background region at that level, until a level is found that meets the requirements of subsequent processing without being overly redundant.
[0107] This embodiment further proposes to convert the background area to the HSV color space or Lab color space, and use the saturation channel or luminance channel to assist in verifying the grayscale space determination result.
[0108] Specifically, converting the background area to the HSV or Lab color space means converting the pixel values of an image from its original color representation (e.g., RGB) to the HSV (hue, saturation, brightness) or Lab (brightness, a-channel, b-channel) color space. HSV and Lab color spaces have the characteristic of separating brightness information from color information, which is of great significance for image analysis, especially background recognition. This conversion can be achieved using standard color space conversion algorithms, for example, converting the R, G, B components of an RGB image to H, S, V components, or to L, a, b components using mathematical formulas. Alternatively, color space conversion can be performed directly using API functions provided by image processing libraries; these functions typically encapsulate efficient and optimized conversion algorithms. Using the saturation or brightness channel to assist in verifying the grayscale space determination results means that in the HSV color space, the saturation channel (S channel) represents the purity or intensity of a color; while in the HSV or Lab color space, the brightness channel (V channel or L channel) represents the lightness or darkness of a color. In pathological images, background areas typically have low saturation (impure color or near-gray) and relatively uniform brightness. Utilizing information from these channels can supplement pure grayscale value determination, improving the accuracy and robustness of background identification. For example, saturation or brightness thresholds can be set. If a pixel identified as background in the grayscale space has a saturation value below a certain preset threshold or a brightness value within a certain preset range, it is further confirmed as background. Conversely, if the saturation is too high or the brightness is abnormal, it may be necessary to reassess its background status. Another approach is to statistically analyze the saturation or brightness channel data. For instance, within the initially identified background area in the grayscale space, the mean and standard deviation of its saturation or brightness can be calculated and compared with preset background features to aid in verification.
[0109] If a pixel is identified as background in the grayscale space, but its saturation value is abnormally high or its brightness value deviates significantly from the typical brightness range of a background in the HSV or Lab color space, it may indicate that the pixel is not purely background, thus correcting the initial grayscale judgment. Conversely, if a pixel identified as background in the grayscale space also exhibits typical background characteristics in terms of saturation or brightness, the confidence level of the judgment is further enhanced. This method, which combines grayscale and color information, can effectively address background color variations in pathological images caused by uneven staining, lighting differences, or changes in imaging patterns, thereby improving the accuracy of background identification and reducing misjudgments.
[0110] For example, the pixel data of the initially identified background area can be converted from the RGB color space to the HSV color space. After conversion, the saturation (S) channel value of each pixel can be extracted. Typically, pure background areas will have low saturation values. Therefore, a saturation threshold can be set. For example, if a pixel is identified as background in grayscale space, but its saturation value is higher than this threshold (e.g., S value greater than 0.2, range 0-1), it can be reclassified as a tissue pixel because it may contain colored impurities or staining residue. Alternatively, the pixel data can be converted to the Lab color space, and the luminance (L) channel value can be extracted. For background areas, their L values usually fall within a relatively stable range. If a pixel is identified as background in grayscale space, but its L value deviates significantly from this range (e.g., an L value that is too high indicates overbrightness, and an L value that is too low indicates underbrightness), it can also be reclassified. This auxiliary verification mechanism can effectively correct misjudgments that may occur based solely on grayscale information. For example, some dark background areas may have similar grayscale values to tissue areas in a grayscale image, but their saturation or brightness characteristics are significantly different from those of tissue areas. Color space verification can correctly identify them as background.
[0111] Example 2 (System): This embodiment proposes a multi-imaging mode whole-slice pathological image background adaptive recognition system, including a background sampling module, a statistical analysis module, and a classification module.
[0112] The background sampling module is used to acquire grayscale pixel data of at least one background region selected by the user on the image. The statistical analysis module is used to calculate statistics of the grayscale pixel data, including the Nth lower percentile, the Mth higher percentile, the mean, and the standard deviation, where N and M are preset parameters. An adaptive fill amount is determined based on the larger of the standard deviation and a preset minimum fill value. An initial background upper bound is determined by subtracting the adaptive fill amount from the Nth lower percentile, and an initial background upper bound is determined by adding the adaptive fill amount to the Mth higher percentile. The upper bound of the background is expanded by determining whether the mean plus a preset multiple of the standard deviation reaches the upper limit of the grayscale value range, and the lower bound of the background is expanded by determining whether the mean minus the preset multiple of the standard deviation reaches the lower limit of the grayscale value range. The final background grayscale range is determined based on the expanded background upper and lower bounds. The classification module classifies pixels whose grayscale values fall within the final background grayscale range as background, and others as tissue.
[0113] The core innovation of this embodiment lies in combining user-interactive background sampling with multi-dimensional statistical analysis using specific logic, while introducing an adaptive filling mechanism based on standard deviation and boundary expansion judgment. This enables intelligent identification of background regions under various imaging modes, including bright field, fluorescence, and gray backgrounds. Specifically, the statistical analysis module uses percentiles rather than extreme values to calculate the background range, avoiding noise interference with minimum or maximum values. The adaptive filling amount is dynamically adjusted according to the gray-scale uniformity of the background region, ensuring a basic filling margin is provided even when the standard deviation is close to zero. The boundary expansion mechanism automatically expands the background range to 0 or 255 by judging whether the mean plus or minus a preset multiple of the standard deviation touches the gray-scale boundary, effectively handling extreme cases of pure white, pure black, or gray backgrounds. This design allows the system to achieve universal processing of multi-mode pathological image background recognition using a single algorithm without requiring separate parameter configuration for different imaging modes.
[0114] Preferably, this embodiment further includes a sampling fusion module, a uniformity verification module, a block-level post-processing module, and a pre-screening acceleration module.
[0115] The sampling fusion module is used to merge the grayscale pixel data of multiple background regions into a unified grayscale dataset when the user selects multiple background regions, and calculates the statistics on this unified dataset. The uniformity verification module is used to independently calculate the grayscale standard deviation for each background region, and issues a prompt to the user when the standard deviation exceeds a preset uniformity threshold.
[0116] The primary function of the sampling fusion module is to integrate the scattered background sample data when a user specifies multiple background regions on an image. Specifically, this module collects grayscale pixel data from all selected background regions and merges this data into a single, larger dataset. This merging operation ensures that subsequent statistical analysis can be based on a more comprehensive and representative set of background samples, thereby improving the accuracy and robustness of background grayscale range estimation. For example, the sampling fusion module can directly concatenate arrays of grayscale pixel values from different background regions to form a very large array containing all background pixels; alternatively, it can dynamically accumulate this pixel data using some data structure (such as a list or buffer) for unified processing.
[0117] The uniformity verification module focuses on evaluating the internal consistency of each background region selected by the user. This module independently calculates the standard deviation of grayscale pixel data within each selected background region. The standard deviation is a measure of data dispersion; a higher value indicates greater fluctuation in grayscale values within the region, meaning poorer uniformity. When the standard deviation of a background region exceeds a pre-set uniformity threshold, the uniformity verification module will issue a warning to the user. This warning aims to inform the user that the region may not be suitable as a pure background sample, for example, it may contain small amounts of tissue, stains, or have localized uneven lighting, thus guiding the user to re-evaluate or adjust their selection. For example, the uniformity verification module can calculate the grayscale variance of each background region and compare it to a preset threshold; alternatively, it can determine uniformity by analyzing the width or number of peaks in the grayscale histogram within the region.
[0118] The block-level post-processing module aims to perform macroscopic analysis and correction of images to optimize background and organization recognition results. It improves processing efficiency and corrects local misjudgments by subdividing the image into smaller, manageable analysis blocks and evaluating these blocks holistically. This module can be implemented through software algorithms, such as loading image data into memory and then logically dividing it according to a preset block size; or through hardware acceleration units, such as parallel processing of different blocks on an FPGA or GPU to accelerate partitioning and subsequent computation.
[0119] The pre-screening acceleration module aims to leverage the multi-resolution characteristics of images to quickly filter out pure background regions at lower resolutions, thereby avoiding detailed high-resolution analysis of these regions and significantly improving processing speed. This module can be implemented in software, for example, by introducing a pre-processing step specifically responsible for low-resolution image analysis and block filtering; or by integrating it into an image loading or management system to perform pre-judgment and filtering during the data reading stage. It can directly extract pre-generated low-resolution layered images from full-slice image files (such as SVS, NDPI, etc.); or generate them by downsampling high-resolution images. A flag can be set in the processing flow; for blocks pre-judged as pure background, subsequent steps such as tissue pixel recognition and feature extraction can be skipped; or the coordinates or IDs of pure background blocks can be stored in a list, which the subsequent processing module will check when traversing all blocks, skipping blocks if they are found.
[0120] Through the above technical solution, this embodiment effectively solves the problem of low computational efficiency caused by high resolution and large background areas in whole-slice pathological image processing. The block-level post-processing module, by performing block-based processing and morphological correction on the image, not only improves the accuracy and robustness of background recognition, but also avoids local misjudgments, especially in tissue edge areas. The pre-screening acceleration module uses low-resolution thumbnails for rapid prediction, intelligently skipping the fine processing of pure background areas, thereby significantly reducing unnecessary computation and greatly improving the processing speed and resource utilization efficiency of the entire image analysis system, making automated analysis of large-scale pathological images possible.
[0121] Example 3 (Storage Medium) This embodiment proposes a computer-readable storage medium storing a computer program that, when executed by a processor, implements the aforementioned method. The core innovation of this embodiment lies in embedding the adaptive background recognition method for multi-imaging mode whole-slice pathological images into the storage medium as a computer program. This allows the processor to call and execute the method, thereby achieving adaptive background region recognition for pathological images with various imaging modes, including bright-field, fluorescence, and gray backgrounds. This effectively overcomes the shortcomings of existing technologies, such as the fixed threshold method only applicable to bright-field images, the Otsu method failing for fluorescence images, and the inability of pixel-level morphological methods to handle block-level analysis. It achieves the technical effect of providing a single, universal algorithm to solve the problem of background recognition in multiple imaging modes.
[0122] Specifically, when the computer program stored in the computer-readable storage medium is executed by the processor, it first responds to at least one background region selected by the user on the image and acquires grayscale pixel data of the background region; then it calculates statistics of the grayscale pixel data, including the Nth lower percentile, the Mth higher percentile, the mean, and the standard deviation, where N and M are preset parameters; it determines an adaptive fill amount based on the larger of the standard deviation and a preset minimum fill value; then it determines an initial background lower bound based on the Nth lower percentile minus the adaptive fill amount, and determines an initial background upper bound based on the Mth higher percentile plus the adaptive fill amount; it expands the background upper bound by determining whether the mean plus a preset multiple of the standard deviation reaches the upper limit of the grayscale value range, and expands the background lower bound by determining whether the mean minus the preset multiple of the standard deviation reaches the lower limit of the grayscale value range; finally, it determines the final background grayscale range based on the expanded background lower bound and upper bound, and determines pixels whose grayscale values fall within the final background grayscale range as background, otherwise as tissue. This technical solution combines user-interactive sampling with dynamic statistical analysis, avoiding reliance on the distribution pattern of image histograms and ensuring accurate identification of background areas in various scenarios, such as bright-field images with a background close to white (grayscale value close to 255), fluorescent images with a background close to black (grayscale value close to 0), or specially stained gray backgrounds.
[0123] This embodiment transforms the key steps of the background recognition method into an executable computer program, enabling the processor to efficiently process background recognition tasks in whole-slice digital pathology images. Due to significant differences in background features across different imaging modes, traditional methods struggle to handle various scenarios. This embodiment, however, dynamically adjusts the background grayscale range through the synergistic effect of an adaptive fill mechanism and boundary expansion judgment: when the grayscale values of the background region are highly concentrated at the grayscale range boundary (such as a pure white background in a bright-field image or a pure black background in a fluorescence image), the system automatically expands the background range to the upper limit of grayscale values (255) or the lower limit (0); when the background exhibits intermediate grayscale values, the initial range determined by percentiles and adaptive fill is maintained. This design effectively solves the problem of Otsu's method failing due to the lack of a clear bimodal distribution in the background histogram, while also avoiding the complete failure of the fixed threshold method in fluorescence images, ensuring the robustness and versatility of background recognition.
[0124] Through the above technical solution, this computer-readable storage medium realizes a unified processing framework for background recognition of pathological images in multiple imaging modes. For example, when processing mixed images containing bright-field and fluorescent regions, the user only needs to select a representative background region in the image, and the processor will complete the statistical calculation and dynamic range adjustment by executing the stored program, without needing to switch algorithm parameters for different imaging modes. Compared with the basic solution, this invention has significant adaptability advantages, automatically identifying imaging mode features and adjusting the background judgment threshold, thereby providing an accurate background region segmentation basis for subsequent applications such as pathological quality control, image analysis, and AI training, significantly improving the automation level and analytical reliability of pathological image processing.
[0125] The above description is merely an embodiment of the present invention and is not intended to limit the scope of protection of the present invention. For those skilled in the art, the present invention can have various modifications and variations. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for adaptive background recognition of whole-slice pathological images with multiple imaging modes, characterized in that, Includes the following steps: In response to a user selecting at least one background region on an image, grayscale pixel data of the background region is acquired; Calculate the statistics of the grayscale pixel data, including the Nth lower percentile, the Mth higher percentile, the mean, and the standard deviation, where N and M are preset parameters; The adaptive fill amount is determined based on the larger of the standard deviation and the preset minimum fill value. The initial background upper bound is determined by subtracting the adaptive fill amount from the Nth lowest percentile, and the initial background upper bound is determined by adding the adaptive fill amount to the Mth highest percentile. Determine whether the mean plus a preset multiple of standard deviation reaches the upper limit of the grayscale value range; if so, extend the upper bound of the initial background to the upper limit. Determine whether the mean minus the preset multiple standard deviation reaches the lower limit of the gray value range; if so, extend the initial background boundary to the lower limit. The final background grayscale range is determined based on the expanded background upper and lower bounds. Pixels whose grayscale values fall within the final background grayscale range are identified as background; otherwise, they are identified as tissue.
2. The method according to claim 1, characterized in that, The Nth lowest percentile is the 1st percentile, the Mth highest percentile is the 99th percentile, the preset multiplier is 3 times, and the preset minimum fill value is 5 gray levels; the preset parameters N and M are configurable parameters and can be configured to one of the following combinations: N=0.5 and M=99.5, or N=1 and M=99, or N=2 and M=98.
3. The method according to claim 1, characterized in that, The imaging mode is identified by whether the mean plus or minus the preset multiple standard deviation touches the boundary of the gray value range: when the mean plus the preset multiple standard deviation reaches or exceeds the gray value upper limit, the upper boundary of the background range is extended to the upper limit; When the mean minus the preset multiple standard deviation reaches or falls below the grayscale lower limit, the lower bound of the background range is extended to the lower limit; when neither condition is met, the initial background range remains unchanged.
4. The method according to claim 1, characterized in that, When the user selects multiple background regions, the grayscale pixel data of each background region are merged into a unified grayscale dataset, and the statistic is calculated on the unified dataset; it also includes calculating the grayscale standard deviation independently for each background region, and issuing a prompt message to the user when the standard deviation of any background region exceeds a preset uniformity threshold.
5. The method according to claim 1, characterized in that, Also includes: The image is divided into multiple analysis blocks, and the proportion of organized pixels in each analysis block is calculated. Organized pixels are pixels whose gray values fall outside the final background gray range. When the proportion of the tissue is lower than a preset threshold, the block is marked as a background block; otherwise, it is marked as a tissue block. A two-dimensional Boolean grid is constructed for the marking of all blocks. A 3×3 neighborhood expansion operation is performed on the two-dimensional Boolean grid to re-mark the background blocks adjacent to the organization blocks as organization blocks.
6. The method according to claim 5, characterized in that, Also includes: After obtaining the final background grayscale range, read the low-resolution thumbnail. For each analysis block, determine whether the tissue proportion condition is met based on the pixel ratio of the corresponding area in the thumbnail within the final background grayscale range. If it is met, submit the block for complete analysis; otherwise, skip the subsequent processing of the block.
7. The method according to claim 1, characterized in that, When acquiring grayscale pixel data of the background region, the image pyramid level is automatically selected based on the size of the background region, so that the size of the read region at the selected level is not lower than a preset pixel threshold.
8. The method according to claim 1, characterized in that, Also includes: The background area is converted to the HSV or Lab color space, and the grayscale determination results are verified by using the saturation or luminance channels.
9. A multi-imaging mode whole-slice pathological image background adaptive recognition system, characterized in that, include: The background sampling module is used to obtain grayscale pixel data of the background area in response to at least one background area selected by the user on the image. The statistical analysis module is used to calculate the statistics of the grayscale pixel data, including the Nth lower percentile, the Mth higher percentile, the mean, and the standard deviation, where N and M are preset parameters; determine the adaptive fill amount based on the larger of the standard deviation and the preset minimum fill value; determine the initial background upper boundary based on the Nth lower percentile minus the adaptive fill amount; and determine the initial background upper boundary based on the Mth higher percentile plus the adaptive fill amount. Determine whether the mean plus a preset multiple standard deviation reaches the upper limit of the grayscale value range to expand the upper bound of the background, and determine whether the mean minus the preset multiple standard deviation reaches the lower limit of the grayscale value range to expand the lower bound of the background. The final background grayscale range is determined based on the expanded background upper and lower bounds. The classification module is used to classify pixels whose grayscale values fall within the final background grayscale range as background, and otherwise as organization.
10. A computer-readable storage medium, characterized in that, The device contains a computer program that, when executed by a processor, implements the method described in any one of claims 1 to 8.
