A method and system for adjusting contrast based on digital pathology images

CN122989498APending Publication Date: 2026-10-27BEIJING THOROUGH FUTURE INC
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610946050.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-06-29
Publication Date
2026-10-27

AI Technical Summary

Technical Problem

[0004]本发明提供一种基于数字病理图像的调节对比度的方法及系统,用以解决现有的对比度调节方法无法满足用户对数字病例图像的特殊需求以及处理速度慢的问题

Benefits of technology

本发明通过对位于显示区域内的光标的移动轨迹进行识别,获得对比度的修改值,识别通过后利用线性拉伸算法对当前显示设备显示的数字病理图像的对比度进行调整,线性拉伸算法能够将像素的灰度值范围扩展到整个灰度级范围内,对比度调节范围不受限并且处理速度快,满足了用户对数字病理图像质量的需求。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122989498A_ABST
    Figure CN122989498A_ABST
Patent Text Reader

Abstract

The application relates to the field of image processing, and particularly provides a method for adjusting contrast based on a digital pathology image, comprising the following steps: acquiring a digital pathology image and displaying the digital pathology image on a display device, wherein the digital pathology image is a high-resolution image obtained by digital shooting or scanning of a pathological tissue sample; in response to an activation instruction of a contrast adjustment operation, recognizing a moving track of a cursor in a display area, wherein the cursor is controlled by a user input device; determining a contrast modification value according to a track parameter of the moving track; and adjusting the contrast of the digital pathology image by using a linear stretching algorithm based on the contrast modification value.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of digital image processing technology, and in particular to a method and system for adjusting contrast based on digital pathological images. Background Technology

[0002] Digital pathology images are high-resolution images obtained by photographing or scanning pathological tissue samples using digital instruments. These images play a crucial role in medical diagnosis, research, and education. However, because digital pathology images are acquired by different digital devices, their contrast may vary, and the information on the original slides cannot be modified after output. Adjustable contrast would more clearly highlight the areas of interest. Therefore, adjusting the display contrast of digital pathology images without modifying the original digital pathology slides is an urgent technical problem.

[0003] In existing technologies, some image processing software and platforms offer image contrast adjustment functions. By adjusting the pixel values ​​of an image or applying specific image enhancement algorithms, users can enhance or reduce the image contrast. However, these methods cannot meet the specific needs of digital pathology images, have slow processing speeds, and limited contrast adjustment ranges. Summary of the Invention

[0004] This invention provides a method and system for adjusting the contrast of digital pathological images, which solves the problems that existing contrast adjustment methods cannot meet the special needs of users for digital medical images and have slow processing speed.

[0005] In a first aspect, this application proposes a method for adjusting contrast based on digital pathological images, applied to a computer device, comprising the following steps: Acquire digital pathological images and display them on a display device. The digital pathological images are high-resolution images of pathological tissue samples obtained by digital imaging or scanning. In response to an activation command for a contrast adjustment operation, the cursor's movement trajectory within the display area is identified, the cursor being controlled by the user input device; Based on the trajectory parameters of the movement trajectory, determine the contrast modification value; Based on the contrast modification value, a linear stretching algorithm is used to adjust the contrast of the digital pathological image.

[0006] In conjunction with the first aspect, determining the contrast modification value based on the trajectory parameters of the moving trajectory includes: Record the coordinates of the starting point and the ending point of the movement trajectory; Calculate the length of the movement trajectory based on the starting point coordinates and the ending point coordinates; Calculate the length ratio of the trajectory length to the preset total length; Based on the preset mapping relationship between the ratio and the modified value, the contrast modification value corresponding to the length ratio is obtained.

[0007] In conjunction with the first aspect, adjusting the contrast of the digital pathology image using a linear stretching algorithm based on the contrast modification value includes: The digital pathological image is converted to grayscale to generate a grayscale histogram; Based on the distribution characteristics of the grayscale histogram, at least one grayscale threshold is calculated, which can divide the grayscale histogram into multiple brightness regions. Based on the contrast modification value, the grayscale threshold is adjusted to redefine the range of the multiple brightness regions; Calculate the stretching slope corresponding to each brightness region based on the range of each brightness region and the pixel distribution ratio; By utilizing the stretching slope corresponding to each brightness region, the pixel grayscale values ​​in each brightness region are linearly stretched.

[0008] In conjunction with the first aspect, the method further includes: Receive user input for scene selection or personal preference selection; In response to the scene selection instruction, a first preset contrast value associated with the selected usage scene is obtained as the contrast modification value; or... In response to the personal preference selection instruction, a second preset contrast value pre-stored by the user is obtained as the contrast modification value.

[0009] In conjunction with the first aspect, the method further includes: Receive user input for save or export commands; In response to the save or export command, a save or export operation is performed on the digital pathology image after the current contrast adjustment.

[0010] In conjunction with the first aspect, the method further includes: In response to the activation command of the contrast adjustment operation, the real-time contrast preview value is determined based on the real-time position coordinates of the cursor. Based on the real-time contrast preview value, a contrast adjustment preview of the digital pathology image is generated and displayed.

[0011] In conjunction with the first aspect, the method further includes: The attribute information of the digital pathology image is analyzed to determine the initial contrast of the digital pathology image; If the initial contrast is lower than the preset contrast threshold, then according to the preset compensation mapping relationship, the compensation contrast value is obtained as the contrast modification value.

[0012] Secondly, this application proposes a system for adjusting contrast based on digital pathological images, including a data receiving module, a cursor movement recognition module, a path tracking module, and a contrast adjustment module, wherein: The data receiving module is used to acquire digital pathological images and display them on a display device. The digital pathological images are high-resolution images of pathological tissue samples obtained by digital photography or scanning. The cursor movement recognition module is used to respond to the activation command of the contrast adjustment operation and recognize the movement trajectory of the cursor within the display area. The cursor is controlled by the user input device. The path tracking module is used to determine the contrast modification value based on the trajectory parameters of the movement trajectory; The contrast adjustment module is used to adjust the contrast of the digital pathological image based on the contrast modification value using a linear stretching algorithm.

[0013] Thirdly, a computer device includes: a processor and a memory, the memory storing computer program instructions that, when executed by the processor, cause the computer device to perform the method described above.

[0014] Fourthly, this application provides a computer-readable storage medium storing computer program instructions that, when executed by a computer device, cause the computer device to perform the method described above.

[0015] The beneficial effects of this application are as follows: This invention identifies the movement trajectory of a cursor within the display area to obtain a contrast modification value. After successful identification, a linear stretching algorithm is used to adjust the contrast of the digital pathology image displayed on the current display device. The linear stretching algorithm can expand the grayscale value range of pixels to the entire grayscale range, with no limitation on the contrast adjustment range and fast processing speed, thus meeting the user's requirements for the quality of digital pathology images.

[0016] Other features and advantages of the invention will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other advantages of the invention may be realized and obtained by means of the structures particularly pointed out in the written description and the accompanying drawings.

[0017] The technical solution of the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. Attached Figure Description

[0018] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used in conjunction with embodiments of the invention to explain the invention and do not constitute a limitation thereof. In the drawings: Figure 1 This is a flowchart illustrating a method for adjusting contrast based on digital pathological images in an embodiment. Figure 2 This is a flowchart illustrating the method for determining the modified contrast value in this embodiment; Figure 3 This is a flowchart illustrating the method for adjusting contrast using a linear stretching algorithm in this embodiment; Figure 4 This is a system composition diagram of adjusting contrast based on digital pathological images in an embodiment; Figure 5 This is a schematic diagram of a computer device in an embodiment. Detailed Implementation

[0019] The preferred embodiments of the present invention will be described below with reference to the accompanying drawings. It should be understood that the preferred embodiments described herein are for illustration and explanation only and are not intended to limit the present invention.

[0020] It should be noted that the terms "first," "second," etc., used in the specification and claims of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. The terms "comprising," "having," and any variations thereof mentioned in the specification and claims of this invention are intended to cover non-exclusive inclusion.

[0021] In various embodiments of the present invention, the term "digital pathology image" refers to a high-resolution digital image obtained by scanning a pathological tissue slide line by line using a fully automated microscope or optical magnification scanning system and seamlessly stitching together multiple high-magnification fields of view using computer software algorithms. This image is typically stored in a data format containing a multi-level resolution pyramid structure, such as SVS (Scanned Virtual Slide), NDPI (NanoZoomer Digital Pathology Image), TIFF (Tagged Image File Format), etc., with a single image file ranging in size from hundreds of megabytes to tens of gigabytes.

[0022] A cursor is a graphical identifier on a display device that is controlled by a user input device and used to indicate the current operating position. This includes, but is not limited to, arrow cursors, crosshair cursors, and custom-shaped cursors. Users can control the cursor using input devices such as a mouse, stylus, touchscreen, or trackball.

[0023] Linear stretching algorithm: This refers to an image enhancement technique that expands or compresses the gray-level distribution range of an image by establishing a linear mapping relationship between input and output gray-level values. This algorithm remaps a narrower gray-level distribution range in the original image to a wider target gray-level range, thereby amplifying the brightness differences between different areas of the image and enhancing visual contrast. In various embodiments of this invention, the specific implementation of the linear stretching algorithm can vary depending on the application scenario, but its core feature lies in transforming pixel gray-level values ​​through a linear mapping function.

[0024] Existing contrast adjustment methods are slow and have limited adjustment ranges. Therefore, Embodiment 1 of this invention provides a method for adjusting contrast based on digital pathological images, which helps doctors observe the details of pathological tissues more clearly and provides more accurate information in diagnosis. This application applies to computer devices, which are electronic devices equipped with a central processing unit, a graphics processor, memory, and a display output interface, such as digital slide scanning workstations, remote consultation terminals, or mobile diagnostic tablets used in pathology departments. See also... Figure 1 The method includes the following steps: Acquire digital pathological images and display them on a display device. The digital pathological images are high-resolution images of pathological tissue samples obtained by digital imaging or scanning. Specifically, digital pathology images are high-resolution digital images created by scanning pathological tissue slides line by line using a fully automated microscope or optical magnification scanning system and seamlessly stitching together multiple high-power fields of view. Their file formats are typically SVS, NDPI, or TIFF, containing a multi-level resolution pyramid structure. Computer equipment, through its image processing module, reads the file header information, parses the base layer data of the image, and extracts appropriate levels of image data from the pyramid structure based on the current screen resolution and viewport size of the display device. After decoding, the image content is rendered in the main display area of ​​the graphical user interface.

[0025] In response to an activation command for a contrast adjustment operation, the cursor's movement trajectory within the display area is identified, the cursor being controlled by the user input device; Specifically, an activation command is a specific operation signal issued by the user through an input device to instruct the computer device to enter contrast adjustment mode. In this embodiment, the activation command is triggered by the user pressing and holding a specific function key on the keyboard and clicking the right mouse button within the image area.

[0026] After the computer device's event listener captures this combined event, it switches the current interaction mode variable in its internal state machine from normal browsing mode to contrast adjustment activation mode. In contrast adjustment mode, the computer device continuously listens for cursor position changes, acquiring the cursor's horizontal and vertical coordinates within the image display area in real time. These discrete coordinate points are then stored in a temporary buffer in chronological order, forming movement trajectory data. The cursor is a graphical identifier on the display device controlled by the user's input device, used to indicate the current operation position.

[0027] Based on the trajectory parameters of the movement trajectory, determine the contrast modification value; Specifically, trajectory parameters are quantitative indicators extracted from movement trajectory data that characterize movement features. The computer analyzes the coordinate point sequence stored in the buffer and extracts trajectory parameters of a preset type. In this embodiment, the trajectory parameter is selected as the total displacement distance of the movement trajectory. Based on the extracted displacement distance value, the computer looks up a preset mapping table, which records the contrast adjustment range corresponding to different displacement distance intervals. Based on the interval the actual displacement distance falls into, the computer determines the contrast modification value corresponding to this operation.

[0028] Based on the contrast modification value, a linear stretching algorithm is used to adjust the contrast of the digital pathological image.

[0029] Specifically, linear stretching is an image enhancement technique that expands or compresses the grayscale distribution range of an image by establishing a linear mapping relationship between input and output grayscale values. The computer device inputs the contrast modification value determined in the previous step as a control parameter into the linear stretching processing unit. Based on the magnitude of the modification value, the linear stretching processing unit automatically adjusts the grayscale mapping function of the currently displayed image, redistributing the narrower grayscale range in the original image to a wider output range. This amplifies the difference between dark and bright details that were originally similar in grayscale. After adjustment, the computer device refreshes the processed new image frame to the display device, allowing the user to observe the contrast-improved digital pathology image.

[0030] Through the above embodiments, the trajectory parameters of the cursor movement path are used as the control basis for contrast modification. Users do not need to operate complex sliders or numerical input boxes; they can complete the input of contrast adjustment commands simply through natural dragging actions, making the operation intuitive and efficient. At the same time, the use of a linear stretching algorithm to perform actual adjustments ensures fast algorithm execution speed and low processing latency, enabling a smooth real-time interactive experience in high-resolution display scenarios of pathological images.

[0031] Example 2: Determining the contrast modification value based on the trajectory parameters of the moving trajectory includes: Record the coordinates of the starting point and the ending point of the movement trajectory; Specifically, the starting point coordinates are the horizontal and vertical pixel indices corresponding to the cursor's instantaneous position within the display area when the contrast adjustment activation signal is first confirmed valid by the system. The ending point coordinates are the horizontal and vertical pixel indices corresponding to the cursor's final position within the display area when the user releases the key used to maintain the activation state or inputs a command indicating the end of the adjustment operation. The computer device stores these two coordinate values ​​in designated variable addresses in the system memory.

[0032] Calculate the length of the movement trajectory based on the starting point coordinates and the ending point coordinates; Specifically, the trajectory length is a quantified value of the straight-line distance between the starting point and the ending point on the two-dimensional display plane, and its unit is screen logical pixels. The computer device's processor reads the horizontal and vertical coordinates of the starting point and the ending point from memory, calls the geometric distance calculation subroutine, calculates the straight-line distance between the two points, and uses this value as the effective trajectory length for this movement.

[0033] Calculate the length ratio of the trajectory length to the preset total length; Specifically, the preset total length is a reference length constant pre-written into the configuration file during system development. This constant can be set as a fixed proportion of the diagonal length of the display area. The computer device compares the trajectory length value calculated in the previous step with the preset total length value, and obtains a ratio between zero and one through division. If the trajectory length exceeds the preset total length, the computer device automatically limits the ratio to its maximum value to prevent the contrast adjustment from exceeding a reasonable range.

[0034] Based on the preset mapping relationship between the ratio and the modified value, the contrast modification value corresponding to the length ratio is obtained.

[0035] Specifically, the mapping relationship is a data structure stored in system memory, using a continuous ratio range as the index key and a specific contrast adjustment value as the corresponding value. For example, this mapping relationship can be configured as follows: a ratio between zero and one-third corresponds to a mild contrast enhancement effect, a ratio between one-third and two-thirds corresponds to a medium contrast enhancement effect, and a ratio between two-thirds and one corresponds to a strong contrast enhancement effect. The computer device retrieves the mapping relationship based on the calculated length ratio, extracts the matching contrast modification value, and passes it to the subsequent image adjustment module.

[0036] Through the complete geometric parameter quantification system of the starting point, ending point, trajectory length, and preset total length in the above embodiments, the user's continuous and subjective dragging operation is transformed into an objective and repeatable contrast modification value. The introduction of a ratio calculation and mapping mechanism establishes an intuitive proportional relationship between the magnitude of contrast change and the magnitude of the user's operation; the longer the user drags, the more obvious the contrast change, which aligns with the user's psychological expectations for operation.

[0037] Example 3: The adjustment of the contrast of the digital pathology image using a linear stretching algorithm based on the contrast modification value includes: The digital pathological image is converted to grayscale to generate a grayscale histogram; Specifically, grayscale processing is the process of converting and merging the three color channel components (red, green, and blue) of each pixel in a color image into a single brightness channel component. The computer device calls a color space conversion function, reads the red, green, and blue component values ​​pixel by pixel, and performs weighted synthesis according to visual perception weights to obtain the grayscale brightness value of each pixel. Subsequently, the computer device performs frequency statistics on the grayscale brightness values ​​of all pixels in the entire image. The statistical results are stored in an array containing 256 counters. The index of this array represents the grayscale level, and the array element value represents the total number of pixels appearing at that grayscale level in the image. This statistical result is the grayscale histogram.

[0038] Based on the distribution characteristics of the grayscale histogram, at least one grayscale threshold is calculated, which can divide the grayscale histogram into multiple brightness regions. Specifically, the grayscale threshold is a critical grayscale value used to divide a continuous grayscale range into different brightness intervals. The computer analyzes the cumulative distribution of the grayscale histogram, locating the grayscale level when the cumulative proportion of dark pixels reaches a preset low proportion threshold, as the first grayscale threshold; and locating the grayscale level when the cumulative proportion of bright pixels reaches a preset high proportion threshold, as the second grayscale threshold. Thus, the computer divides the original grayscale range into three regions: dark shadow regions below the first grayscale threshold, midtone regions between the first and second grayscale thresholds, and bright highlight regions above the second grayscale threshold.

[0039] Based on the contrast modification value, the grayscale threshold is adjusted to redefine the range of the multiple brightness regions; Specifically, the adjustment involves shifting the originally calculated grayscale threshold according to the direction and magnitude indicated by the contrast modification value. When the contrast modification value indicates a need to enhance contrast, the computer moves the first grayscale threshold towards a darker direction while simultaneously moving the second grayscale threshold towards a brighter direction. This adjustment widens the grayscale range in dark shadow areas and highlight areas, while correspondingly compressing the grayscale range in midtone areas.

[0040] Specifically, the stretching slope corresponding to each brightness region is calculated based on the range of each brightness region and the pixel distribution ratio. Specifically, the stretching slope is the proportional coefficient between the output grayscale change and the input grayscale change in the linear mapping function, determining the degree of expansion or compression of grayscale contrast within that region. Computer equipment determines the appropriate linear transformation proportional coefficient for each of the dark, midtone, and bright areas based on their adjusted interval width and output target range.

[0041] By utilizing the stretching slope corresponding to each brightness region, the pixel grayscale values ​​in each brightness region are linearly stretched.

[0042] Specifically, linear stretching involves scaling each original grayscale value belonging to a certain brightness region proportionally according to the scaling factor corresponding to that region, and adding an offset to map a new output grayscale value. The computer iterates through each pixel in the currently displayed image, determines the brightness region to which its original grayscale value belongs, and applies the stretching mapping rules specific to that region to generate new image data with enhanced contrast.

[0043] Through the above embodiments, the histogram is divided into multiple brightness regions, and different stretching slopes are applied to each region, achieving targeted piecewise linear stretching. This adaptively adjusts the contrast distribution of dark, midtone, and bright areas according to the image content, enhancing overall visual contrast while avoiding overcompression or loss of detail in key diagnostic areas. In practical implementation, this prevents excessive compression or loss of detail in densely packed cell nuclei or loosely interstitial areas, resulting in an image with richer diagnostic hierarchy information after adjustment.

[0044] Example 4: In an optional embodiment, the computer device provides a set of preset option controls on a graphical user interface, including but not limited to scenarios such as breast pathology interpretation, lymphoma screening, teaching demonstration, and personal preference settings one and two. The method further includes: Receive user input for scene selection or personal preference selection; For example, when a user clicks the radio button corresponding to the breast pathology interpretation scenario with a mouse, the computer device then performs an operation to obtain a first preset contrast value associated with the selected scenario.

[0045] In response to the scene selection instruction, a first preset contrast value associated with the selected usage scene is obtained as the contrast modification value; Specifically, the first preset contrast value is a contrast parameter pre-calibrated and fixed in the system configuration file by pathologists or system developers based on the optimal display requirements of tissue morphology features in a specific diagnostic scenario. For example, for the display characteristics of collagen fibers and glandular epithelial cell nuclei in breast tissue images, the first preset contrast value corresponding to this scenario is preset to a moderately strong contrast enhancement value. The computer device reads this value from the configuration database and directly assigns it as the current contrast modification value, skipping the cursor trajectory recognition step and immediately driving the contrast adjustment module to perform image enhancement.

[0046] In response to the personal preference selection instruction, a second preset contrast value pre-stored by the user is obtained as the contrast modification value.

[0047] Specifically, when the computer device receives a user's input instruction to select a personal preference, such as when the user clicks the button corresponding to personal preference settings, the computer device retrieves the user's pre-stored second preset contrast value. This second preset contrast value is a personalized contrast parameter recorded in the current user account after the user manually adjusted it to achieve a satisfactory effect during previous use. The computer device reads this value stored in the user's configuration file and uses it as the contrast modification value, enabling one-click recall of the user's preferred display style. In both cases, after retrieving the first or second preset contrast value, the computer device transmits the value to the contrast adjustment module to complete the contrast adjustment of the current digital pathology image.

[0048] The fast recall mechanism for preset scene values ​​and user preference values ​​in the above embodiments avoids the repetitive work of manually adjusting the contrast every time a different type of slice is opened or a different user is switched.

[0049] Example 5: The method further includes: Receive user input for save or export commands; In response to the save or export command, a save or export operation is performed on the digital pathology image after the current contrast adjustment.

[0050] Specifically, when a user completes a contrast adjustment and wishes to retain the adjusted visual effect, they can issue the corresponding command by clicking the "Save Adjustment Status" button or the "Export Current View" button on the interface. The computer device receives the user's save or export command through the standard operating system message queue.

[0051] Upon receiving a save command, the computer device responds by saving the current contrast adjustment state. The save operation does not alter the pixel data of the original digital pathology image file; instead, it records the currently applied contrast modification value and related linear stretching parameters in a separate auxiliary description file. This auxiliary description file is stored in a structured text format and contains a unique identifier for the original image file, the applied contrast modification value, grayscale threshold adjustment records, and stretching slope information for each brightness region. The computer device saves this auxiliary file in the same directory as the original image file or in the user data directory specified by the system. When the user opens the same digital pathology image again, the computer device automatically checks for the existence of the corresponding auxiliary description file. If it exists, it reads the parameters from it and automatically restores the display effect after the last adjustment.

[0052] In response to an export command, the computer device performs an export operation. The export operation saves the final visual effect presented to the user after contrast enhancement processing in the current display device's frame buffer as a new, independent, universally applicable image file. The computer device extracts the complete red, green, and blue pixel matrix data of the currently displayed image from video memory or system memory, calls an image encoding compressor, generates a separate image file according to the user-specified format, and writes it to disk storage. This exported image file permanently contains all the visual changes from the contrast adjustment and can be used for report creation, paper publication, or remote sharing.

[0053] Through the above embodiments, the two behaviors of saving adjustment state and exporting image are clearly distinguished. Saving adjustment state records display preferences without destroying the integrity of the original pathological image data and its legal evidentiary attributes, thus meeting the strict requirements of medical data originality management. Exporting image generates the enhanced visual effect into a universal image that can be independently disseminated, making it convenient for users to apply the processing results to various external scenarios.

[0054] Example 6: The method further includes: In response to the activation command of the contrast adjustment operation, the real-time contrast preview value is determined based on the real-time position coordinates of the cursor. Specifically, when the computer device receives the activation command for the contrast adjustment operation, in addition to entering the main adjustment logic, it also starts a high-frequency refresh cycle to provide a real-time preview effect.

[0055] During this preview loop, the computer device continuously reads the real-time position coordinates of the cursor within the display area. The real-time position coordinates are the instantaneous horizontal and vertical pixel index values ​​of the cursor within the display area at the sampling moment of the current screen refresh cycle. Based on the real-time position coordinates obtained from each sampling, the computer device determines a real-time contrast preview value. The method for determining the real-time contrast preview value is consistent with the method described in Example 2 for determining the contrast modification value based on the length of the movement trajectory, the difference being that the instantaneous trajectory length of the cursor from the activation starting point to the current real-time position is used.

[0056] Based on the real-time contrast preview value, a contrast adjustment preview of the digital pathology image is generated and displayed.

[0057] Specifically, the computer device generates and displays a contrast adjustment preview image of the digital pathology image based on the real-time contrast preview value. The preview image is a temporary version of a linear stretching mapping relationship quickly calculated using the real-time contrast preview value, and this mapping relationship is loaded into the display pipeline in the form of a graphics hardware lookup table. When rendering image textures, the graphics processing unit directly remaps the pixel grayscale values ​​in real time using this lookup table. This process does not involve pixel-by-pixel central processing unit calculations on the original image pixel data, thus the processing speed is extremely fast. As the user's cursor moves, the contents of the graphics hardware lookup table are continuously updated, and the image contrast presented on the display device changes smoothly and continuously.

[0058] When the user ends the operation and releases the activation command, the preview loop terminates, and the computer device uses the real-time contrast preview value at the final position as the officially confirmed contrast modification value to complete the final image adjustment.

[0059] Through the above embodiments, users can achieve high-speed real-time preview using a graphics hardware lookup table. Users can observe the dynamic effect of image contrast changing with the dragging range in real time without any lag while dragging the cursor.

[0060] Example 7: The method further includes: The attribute information of the digital pathology image is analyzed to determine the initial contrast of the digital pathology image; Specifically, when a computer device loads and opens a digital pathology image, before or simultaneously displaying the image to the user, it automatically performs steps to parse the attribute information of the digital pathology image and determine its initial contrast. The attribute information is recorded in the image file's metadata header or is a quantitative indicator used to describe the overall contrast level of the image, obtained through rapid image analysis. In this embodiment, the computer device performs rapid gray-level histogram statistics on representative image blocks in the central region of the image to calculate the dispersion index of its gray-level distribution, which is used as a measure of the initial contrast.

[0061] If the initial contrast is lower than the preset contrast threshold, then according to the preset compensation mapping relationship, the compensation contrast value is obtained as the contrast modification value.

[0062] Specifically, the computer equipment determines whether the initial contrast ratio is lower than a preset contrast threshold. The preset contrast threshold is the lowest acceptable contrast ratio limit determined during the development phase based on statistical analysis of a large number of standard pathological image samples, used to distinguish whether an image requires contrast compensation. The computer equipment compares the calculated initial contrast ratio with the preset threshold.

[0063] If the comparison results indicate that the initial contrast is lower than the preset contrast threshold, it suggests that the current image may appear grayish and lack clear tissue details due to improper scanning equipment parameter settings or insufficient staining during slide preparation. The computer then executes an operation to obtain a compensated contrast value based on a preset compensation mapping relationship. This preset compensation mapping relationship is a built-in empirical data table that provides contrast compensation values ​​corresponding to different initial contrast deviations, capable of restoring the image to a suitable observation range. The computer queries this mapping relationship to obtain a compensated contrast value, which is then used as the contrast modification value for this session. It automatically invokes a linear stretching algorithm to adjust the contrast of the current digital pathology image, bringing it to a basic level of diagnostic observation.

[0064] If the initial contrast is not lower than the preset threshold, the computer device will not perform automatic compensation adjustment, but will maintain the original display state of the image and wait for the user to adjust it manually.

[0065] By adding an intelligent contrast detection and automatic compensation mechanism during image loading in the above embodiments, the problem of inconsistent initial appearance of pathological images due to differences in scanning conditions is effectively solved.

[0066] Example 8: This application also proposes a system for adjusting contrast based on digital pathological images, including a data receiving module, a cursor movement recognition module, a path tracking module, and a contrast adjustment module, wherein: The data receiving module is used to acquire digital pathological images and display them on a display device. The digital pathological images are high-resolution images of pathological tissue samples obtained by digital photography or scanning. The data receiving module acquires digital pathology images and interacts with the operating system's file input / output interface to identify the format type of the digital pathology image file. Based on the format type, it selects the corresponding decoder for parsing. For SVS format files, the data receiving module parses the image pyramid data layer by layer according to the file structure specifications of that format. For NDPI format files, the data receiving module extracts image tiles according to the data encapsulation method of that format. For TIFF format files, the data receiving module locates the image data storage location based on the tag information. The decoded pixel data is organized into an image data matrix in memory for subsequent modules to access.

[0067] The cursor movement recognition module is used to recognize the movement trajectory of the cursor within the display area in response to the activation command of the contrast adjustment operation. The cursor is controlled by the user input device. The cursor movement recognition module is used to display digital pathology images on the display device. It manages the creation and maintenance of the image display viewport in the graphical user interface, is responsible for real-time calculation of image scaling and translation transformations, and outputs the image pixel data provided by the acquisition module to the display device through the graphics processor's rendering pipeline. The cursor movement recognition module is also responsible for responding to window size change events and automatically adjusting the layout of the image display area and the image adaptation method.

[0068] The path tracking module determines the contrast modification value based on the trajectory parameters of the movement trajectory; it also identifies the cursor's movement trajectory within the display area in response to the activation command of the contrast adjustment operation. The path tracking module internally includes an event listening unit and a trajectory recording unit. The event listening unit registers to listen for keyboard and mouse button events through the operating system's user input event processing interface, detecting whether a preset combination of activation commands is triggered. The trajectory recording unit continuously collects the cursor's position coordinates while active, organizes discrete coordinate points into movement trajectory data in chronological order, and outputs the start and end coordinates of the trajectory and complete trajectory parameters when the active state ends.

[0069] The contrast adjustment module adjusts the contrast of the digital pathology image using a linear stretching algorithm based on the contrast modification value. The contrast adjustment module determines the contrast modification value according to the trajectory parameters of the movement trajectory. The trajectory data output by the contrast adjustment module undergoes a series of processing steps, including calculating the trajectory length, calculating the ratio of the trajectory length to the preset total length, and retrieving the contrast modification value based on the ratio's mapping relationship. The module internally maintains a mapping table between the ratio and the modification value, which can be configured and updated according to application requirements.

[0070] Example 9: The figure is a schematic diagram of a computing device provided in an embodiment of this application. As shown, the computing device includes at least one processor, a memory, and a communication interface. The processor, memory, and communication interface are communicatively connected, which can be achieved via a wired (e.g., bus) or wireless connection. The communication interface is used to receive data sent by other devices; the memory stores computer instructions, and the processor executes these computer instructions to perform the method described in the foregoing method embodiment.

[0071] Example 10: This application embodiment also provides a computer-readable storage medium. The computer-readable storage medium can be any available medium that a computing device can store, or a data storage device such as a data center containing one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state drive). The computer-readable storage medium includes instructions that instruct a computing device to execute the method of this application.

[0072] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its spirit and scope. Therefore, if these modifications and variations fall within the scope of the claims of this invention and their equivalents, this invention also intends to include these modifications and variations.

Claims

1. A method for adjusting contrast based on digital pathological images, applied to computer equipment, characterized in that, Includes the following steps: Acquire digital pathological images and display them on a display device. The digital pathological images are high-resolution images of pathological tissue samples obtained by digital imaging or scanning. In response to an activation command for a contrast adjustment operation, the cursor's movement trajectory within the display area is identified, the cursor being controlled by the user input device; Based on the trajectory parameters of the movement trajectory, determine the contrast modification value; Based on the contrast modification value, a linear stretching algorithm is used to adjust the contrast of the digital pathological image.

2. The method for adjusting contrast based on digital pathological images as described in claim 1, characterized in that, Determining the contrast modification value based on the trajectory parameters of the movement trajectory includes: Record the coordinates of the starting point and the ending point of the movement trajectory; Calculate the length of the movement trajectory based on the starting point coordinates and the ending point coordinates; Calculate the length ratio of the trajectory length to the preset total length; Based on the preset mapping relationship between the ratio and the modified value, the contrast modification value corresponding to the length ratio is obtained.

3. The method for adjusting contrast based on digital pathological images as described in claim 2, characterized in that, The step of adjusting the contrast of the digital pathology image using a linear stretching algorithm based on the contrast modification value includes: The digital pathological image is converted to grayscale to generate a grayscale histogram; Based on the distribution characteristics of the grayscale histogram, at least one grayscale threshold is calculated, which can divide the grayscale histogram into multiple brightness regions. Based on the contrast modification value, the grayscale threshold is adjusted to redefine the range of the multiple brightness regions; Calculate the stretching slope corresponding to each brightness region based on the range of each brightness region and the pixel distribution ratio; By utilizing the stretching slope corresponding to each brightness region, the pixel grayscale values ​​in each brightness region are linearly stretched.

4. The method for adjusting contrast based on digital pathological images as described in claim 2, characterized in that, The method further includes: Receive user input for scene selection or personal preference selection; In response to the scene selection instruction, a first preset contrast value associated with the selected usage scene is obtained as the contrast modification value; or... In response to the personal preference selection instruction, a second preset contrast value pre-stored by the user is obtained as the contrast modification value.

5. The method for adjusting contrast based on digital pathological images as described in claim 1, characterized in that, The method further includes: Receive user input for save or export commands; In response to the save or export command, a save or export operation is performed on the digital pathology image after the current contrast adjustment.

6. The method for adjusting contrast based on digital pathological images as described in claim 1, characterized in that, The method further includes: In response to the activation command of the contrast adjustment operation, the real-time contrast preview value is determined based on the real-time position coordinates of the cursor. Based on the real-time contrast preview value, a contrast adjustment preview of the digital pathology image is generated and displayed.

7. The method for adjusting contrast based on digital pathological images as described in claim 2, characterized in that, The method further includes: The attribute information of the digital pathology image is analyzed to determine the initial contrast of the digital pathology image; If the initial contrast is lower than the preset contrast threshold, then according to the preset compensation mapping relationship, the compensation contrast value is obtained as the contrast modification value.

8. A system for adjusting contrast based on digital pathological images, characterized in that, It includes a data receiving module, a cursor movement recognition module, a path tracking module, and a contrast adjustment module, among which: The data receiving module is used to acquire digital pathological images and display them on a display device. The digital pathological images are high-resolution images of pathological tissue samples obtained by digital photography or scanning. The cursor movement recognition module is used to respond to the activation command of the contrast adjustment operation and recognize the movement trajectory of the cursor within the display area. The cursor is controlled by the user input device. The path tracking module is used to determine the contrast modification value based on the trajectory parameters of the movement trajectory; The contrast adjustment module is used to adjust the contrast of the digital pathological image based on the contrast modification value using a linear stretching algorithm.

9. A computer device, characterized in that, include: A processor and a memory, the memory storing computer program instructions that, when executed by the processor, cause the computer device to perform the method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer program instructions that, when executed by a computer device, cause the computer device to perform the method as described in any one of claims 1 to 7.