A pathological image file full-automatic batch naming method, system and storage medium
Patent Information
- Application Number
- CN202410966163.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-18
- Publication Date
- 2026-10-09
AI Technical Summary
由于文件名仅仅是一串无意义的数字,无法直观反映病理图像的具体内容或相关信息,如患者姓名、病变部位、医院名称等
[0026]1、提高了工作效率:通过全自动化的批量命名,减少了人工操作的繁琐性,大大提高了工作效率。
Smart Images

Figure CN122884920A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of pathological image processing, and more specifically to a fully automated batch naming method, system, and storage medium for pathological image files. Background Technology
[0002] Digital pathology image scanning equipment converts cell images into digital format and stores them internally in a computer. Currently, there are various brands of pathology image scanning equipment available on the market, including international brands such as Hamamatsu, Leica, Aperio, and DMetrix, as well as domestic brands such as Ningbo Jiangfeng, Xiamen Macody, and Beijing Youna. However, when naming files after pathology image scanning, these devices primarily rely on automatically generated timestamps or default sequence numbers. While this naming method ensures file uniqueness, it neglects the descriptiveness and readability of the file content, making subsequent file management and retrieval difficult.
[0003] 1) The timestamp naming convention lacks intuitiveness. Since the filename is merely a string of meaningless numbers, it fails to intuitively reflect the specific content or relevant information of the pathological image, such as patient name, lesion location, hospital name, etc. This necessitates relying on additional metadata or database queries when searching for a specific image among a large number of pathological image files, increasing the complexity and time cost of the operation.
[0004] 2) The timestamp naming method lacks flexibility. Once a file is generated and named, its filename usually cannot be changed automatically. If it is necessary to rename the file according to the new naming rules, it usually needs to be done manually, which is not only inefficient but also prone to errors. Especially when dealing with a large number of pathology images, manual renaming becomes an almost impossible task.
[0005] 3) Similar products or peers often lack unified specifications and standards for file naming. Different medical institutions or laboratories may use different naming methods, leading to chaotic file naming and hindering information sharing and communication. Furthermore, the lack of unified naming standards can easily result in redundant or missing information in filenames, further reducing their readability and usability.
[0006] In summary, current pathological image scanning and file naming workflows often use simple timestamps or sequence numbers as filenames. This naming method not only lacks intuitiveness and fails to directly reflect the image content, but also lacks flexibility, making it impossible to customize names according to actual needs. Furthermore, manually renaming files is not only inefficient but also prone to errors, especially when processing large numbers of pathological images. At the same time, the lack of unified naming conventions and standards can lead to differences in file naming methods between different medical institutions or laboratories, making information sharing and communication difficult.
[0007] Therefore, how to solve one or more of the above-mentioned technical defects urgently needs to be studied by those skilled in the art. Summary of the Invention
[0008] In view of this, the present invention provides a fully automated batch naming method, system and storage medium for pathological image files to solve the problems existing in the background art.
[0009] To achieve the above objectives, the present invention adopts the following technical solution:
[0010] This invention discloses a fully automated batch naming method for pathological image files, comprising the following steps:
[0011] Standardize the format for pathological image preprocessing;
[0012] Feature extraction of label images from medical record images; file names extracted using image segmentation algorithms.
[0013] Using a deep learning OCR model to recognize and extract text information from pathological images;
[0014] Based on the preprocessed image, label image, and text information, a file renaming algorithm is designed to complete the renaming.
[0015] Optionally, the pathological image can be denoised and flipped before the label image in the feature extraction pathological image.
[0016] Optionally, the image segmentation algorithm introduces a skip-connected multi-head cross-attention module and a fully automatic post-processing method. The skip-connected multi-head cross-attention module is used for information fusion in the decoder, while the fully automatic post-processing method is used to optimize the recognition results.
[0017] Optionally, feature extraction of label maps from pathological images can be performed by calling the Openslide library to process SVS or TIFF format files.
[0018] Optionally, the file renaming algorithm may include naming rule design, error handling mechanism, manual review and feedback, and log recording.
[0019] This invention also discloses a fully automated batch naming system for pathological image files, comprising:
[0020] Format unification module: used to unify the format of pathological image preprocessing;
[0021] Image processing module: used to extract label images from medical record images and extract file names using image segmentation algorithms;
[0022] Text extraction module: Used to recognize and extract text information from pathological images using a deep learning OCR model;
[0023] The renaming module is used to design file renaming algorithms based on preprocessed images, label images, and text information, and then complete the renaming process.
[0024] Finally, this invention discloses a computer storage medium storing a computer program, wherein the computer program, when executed by a processor, comprises the steps of any one of the methods for fully automated batch naming of pathological image files.
[0025] As can be seen from the above technical solution, compared with the prior art, the present invention provides a fully automated batch naming method, system and storage medium for pathological image files, which has the following beneficial effects:
[0026] 1. Improved work efficiency: Fully automated batch naming reduces the tediousness of manual operations and greatly improves work efficiency.
[0027] 2. Improved accuracy: With the help of OCR technology and innovative attention mechanism, this invention can more accurately identify key information in pathological images, thereby ensuring the accuracy and consistency of file names.
[0028] 3. Enhanced flexibility: Users can customize naming rules according to their actual needs, making file names more descriptive and readable.
[0029] 4. Promotes information sharing and exchange: Through unified naming conventions and standards, the naming methods of files between different medical institutions or laboratories are unified, which facilitates information sharing and exchange.
[0030] 5. Promotes technological progress and application: This invention patent provides new ideas and methods for technological progress and application in the field of medical pathology image processing, which helps to promote the continuous development of this field.
[0031] 6. This invention patent, by introducing deep learning-based OCR technology from the computer science field, an innovative attention mechanism, and a fully automated post-processing method, successfully solves the problems existing in the naming process of pathological image files, and brings significant advantages and effects. This invention not only improves work efficiency and accuracy, but also provides new impetus and support for technological progress and application promotion in the field of medical image processing. Attached Figure Description
[0032] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0033] Figure 1 This is a schematic diagram of the process of the present invention;
[0034] Figure 2 This is a schematic diagram of the structure of the present invention. Detailed Implementation
[0035] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0036] This invention discloses a fully automated batch naming method for pathological image files. See [link to relevant documentation]. Figure 1 This includes the following steps:
[0037] S1: Standardized format for preprocessing pathological images;
[0038] S2: Extract the label image from the medical record image and use an image segmentation algorithm to extract the file name;
[0039] S3: Using a deep learning OCR model to recognize and extract text information from pathological images;
[0040] S4: Design a file renaming algorithm based on the preprocessed image, label image, and text information to complete the renaming.
[0041] Furthermore, in S1, preprocessing is the first step in the automated naming of pathology image files, and image preprocessing is necessary. Common formats for pathology images in hospitals are .sdpc and .kfb, but neither of these file types can be directly processed by Python. Therefore, it is necessary to first unify the various formats into .svs or .tiff files, and then use the OpenSlide library in Python for subsequent image preprocessing.
[0042] TIFF (Tagged Image File Format) is a file format used to store images. TIFF files support multiple "pages" or images, as well as various storage formats and compression methods. One such storage format is called TiledTIFF. Tiled TIFF: A Tiled TIFF image consists of many square tiles of the same size (typically 256×256 pixels). The advantage of the Tiled format is that it can efficiently load and display very large images by loading only those absolutely necessary images (rather than loading a single, large (huge), monolithic image).
[0043] SVS format: An SVS file is a Tiled TIFF image that includes additional pages (images) such as a slide label, overview image, and a few smaller, scaled copies of the scanned slide. A Whole Scan Image (WSI) is used to represent any image format containing a region of interest (ROI) scanned from a microscope slide. Whole scan images are typically very large. With approximately 100,000 × 100,000 pixels, the image size is generally between 60MB and 1.5GB, making these files too large to fit in the memory of most computers. Therefore, traditional image formats (such as JPG, PNG, and BMP) cannot be used to store such images. Tiled TIFF files propose dividing these images into small square "tiles".
[0044] The above mainly aims to explain that currently, different pathology equipment produces pathology images in different formats. Pathology images scanned using equipment from company A might be stored in format A, while those scanned using equipment from company B might be stored in format B, such as .sdpc and .kfb formats. However, neither format A nor format B are standard pathology image storage formats and cannot be processed using general algorithms. Therefore, we need to uniformly convert the image formats from these different devices to .svs or .tiff formats.
[0045] Furthermore, in S2, label extraction is a crucial step in pathological image analysis, involving the accurate identification and extraction of image regions containing key pathological information. To achieve more accurate OCR text extraction, a series of optimization operations are required during image preprocessing, including denoising and flipping, to ensure the quality of the extracted label images.
[0046] Processing SVS or TIFF files is done by calling the OpenSlide library, as this library has dedicated tools for handling SVS images. OpenSlide is a C library that provides a simple interface for reading entire WSI images. The current version is 4.0.0, released on October 11, 2023. First, it's important to note that many of OpenSlide's APIs are similar to Python's built-in PIL, returning Image objects rather than NumPy array objects. This is crucial to understand. Therefore, it's generally recommended to convert it to an array object, with the default channel order being RGB. However, it's also important to note that the converted array object has 4 channels, meaning an alpha (transparency) channel is added after the RGB channels, in the format [R, G, B, A].
[0047] Denoising is a crucial preprocessing step before label image extraction. By applying various denoising algorithms (such as Gaussian filtering and median filtering), noise and artifacts in the image can be effectively removed, improving the signal-to-noise ratio and thus enhancing the accuracy of label image extraction.
[0048] During processing, this invention may encounter reversed label images, which can easily lead to garbled characters when performing OCR text extraction. Therefore, before extracting the label images, this invention needs to perform necessary flipping operations (such as a 180° rotation) on the images to ensure the correct orientation of the label images.
[0049] Regarding coordinates, it's similar to Python's built-in PIL, where (image width, image height) is used, which is the reverse of the (image height, image width) order in an array matrix. However, OpenCV and skimage, based on NumPy, process image matrices by first determining the height and then the width, i.e., img[height, width].
[0050] Openslide can handle the following formats: Aperio (.svs, .tif); DICOM (.dcm); Hamamatsu (.ndpi, .vms, .vmu); Leica (.scn); MIRAX (.mrxs); Philips (.tiff); Sakura (.svslide); Trestle (.tif); Ventana (.bif, .tif); and Generic tiled TIFF (.tif).
[0051] During the label image extraction process, you may encounter label images that are reversed. Such images are prone to producing garbled text during OCR text extraction. Therefore, it is necessary to rotate them 180° to make the next step of OCR feature extraction more accurate.
[0052] Label map extraction is a crucial step. A label map is an image region containing key information about a pathological image. By applying image segmentation algorithms and feature extraction techniques, label maps can be extracted from pathological images. These label maps will be used for subsequent steps such as feature extraction and file naming.
[0053] The skip connection multi-head cross-attention module aims to enhance the representational power of the decoder by fusing feature information from different levels, thereby improving the performance of image segmentation.
[0054] Skip connections are used in image segmentation networks with encoder-decoder structures such as U-Net. Skip connections are typically used to combine high-resolution feature maps from the encoder with low-resolution feature maps from the decoder, thereby preserving more spatial detail information.
[0055] Multi-head cross-attention is a mechanism introduced in this module that allows feature maps from different levels to consider their global and local relationships during fusion. Specifically, it can process multiple feature maps simultaneously, calculate their attention weights, and then fuse these feature maps in a weighted manner according to their attention weights.
[0056] By introducing a skip-connected multi-head cross-attention module, the decoder can better utilize multi-scale feature information from the encoder, thereby segmenting target objects in images more accurately. For example, in medical image segmentation tasks, this method can effectively improve the segmentation accuracy of organs.
[0057] The fully automatic post-processing method is mainly used to optimize the recognition results of image segmentation and solve problems such as blurred boundaries of classification targets and fragmented misclassified regions.
[0058] Fully automated post-processing methods are typically based on Conditional Random Fields (CRFs) or their improved versions (such as fully connected CRFs). They utilize the relationships between all pixels in an image to post-process the classification results obtained through deep learning, refining segmentation boundaries and removing noise and fragmented regions through iterative optimization.
[0059] Fully automated post-processing methods can significantly improve the accuracy and visual quality of image segmentation. For example, in semantic segmentation tasks, using fully connected CRFs as a post-processing method can significantly improve the boundary details and continuity of the segmentation results.
[0060] Furthermore, in S3, the deep learning OCR model is a character recognition technology based on deep neural networks, capable of automatically detecting and recognizing textual information from images. The application of OCR models is particularly important in pathological image analysis because pathological images often contain a large amount of textual annotations, such as patient information, doctor's name, and pathology numbers. This textual information is of significant reference value to doctors and forms the basis for subsequent document naming and archiving.
[0061] To utilize a deep learning OCR model for feature extraction, this invention first requires a labeled training dataset. This dataset should contain a large number of pathological image samples, each with clearly defined textual annotations. By training the OCR model, this invention enables the model to learn how to recognize and extract this textual information from pathological images.
[0062] During training, this invention typically employs supervised learning. Specifically, labeled training data is input into the OCR model, allowing the model to learn how to recognize and extract text information based on the input data. Through continuous iteration and optimization, the model gradually improves its accuracy in recognizing text information in pathological images.
[0063] This invention can be improved through a feedback mechanism in supervised learning. Specifically, during training, the model's performance on the validation set is periodically evaluated, and hyperparameters such as the learning rate and batch size are adjusted based on the evaluation results. Early stopping is used to avoid overfitting; that is, training is stopped early when the model's performance on the validation set begins to decline. Alternatively, transfer learning can be performed on our dataset using Baidu's OCR model, fine-tuning the pre-trained model's weights as initial weights to accelerate the training process and improve performance.
[0064] Once the OCR model is trained, this invention can be applied to actual pathological image analysis. Specifically, the pathological image to be processed is input into the OCR model, allowing the model to automatically recognize and extract the text information. This extracted text information will be used in subsequent steps such as file naming and archiving.
[0065] The advantages of using deep learning OCR models for feature extraction lie in their efficiency and accuracy. Compared to traditional manual annotation methods, OCR models can automatically recognize and extract text information from pathological images, greatly improving processing efficiency. Furthermore, due to the powerful learning capabilities of deep learning models, OCR models also exhibit excellent recognition accuracy, accurately identifying and extracting text information from pathological images.
[0066] Furthermore, in S4, file renaming is crucial for achieving automated naming. Based on preprocessed images, extracted label images, and text information extracted by the OCR model, a file renaming algorithm is designed. This algorithm primarily standardizes the text extracted from the OCR model through operations such as denoising, segmentation, and selection. The text to be named is then compiled into a list, and a corresponding .txt file is generated based on the list's contents and the order of the pathological images. This text file is saved in the same path as the pathological images. Subsequently, this .txt file and the `OS` module in Python are used to manipulate the pathological image files. First, all files in the folder except the text file are listed and sorted. Then, the algorithm reads the list of new filenames from the text file. If the number of files does not match the number of new filenames, the function returns an error message. Otherwise, it iterates through the files and the list of new filenames, renaming each file to the corresponding new filename (while retaining the original file extension), and returns a "File renaming complete." message. This algorithm comprehensively considers this information to generate standardized and easily identifiable pathological image file names. To increase the robustness of file naming, especially when the OCR model is inaccurate, this invention can improve the file renaming algorithm to ensure that even if there are errors in the text information extracted by OCR, the naming mechanism can reflect this, thereby facilitating manual review and verification.
[0067] Naming Convention Design: When designing file naming conventions, it is necessary to comprehensively consider the preprocessed image features, extracted label image information, and text information extracted by OCR. When the OCR confidence level is lower than a certain threshold (e.g., below 90%), this invention needs to add a specific identifier, such as "error" or "check," to the filename to indicate that there may be a problem with the OCR portion of the filename.
[0068] Error handling mechanism: When the OCR model makes a mistake, in addition to adding an identifier to the filename, consider saving the original OCR output or the OCR confidence score as an attachment or metadata along with the pathological image file. This way, manual reviewers can directly view the original OCR output and confidence score, thus more accurately determining the accuracy of the filename.
[0069] Human review and feedback: For files containing identifiers such as "error" or "check," a mechanism for human review needs to be established. Simultaneously, human feedback to the OCR model should be allowed so that the model can continuously learn and improve.
[0070] Log recording: Records all steps and related information related to file renaming, including OCR model output, confidence score, filename generation rules, and any human review and feedback. This helps track down problems, analyze causes, and improve the entire process.
[0071] By implementing these improved strategies, this invention ensures that even when the OCR model's recognition is inaccurate, the file renaming mechanism can reflect the problem, facilitating manual review and verification. This will significantly improve the accuracy and efficiency of file naming, while enhancing the robustness of the entire system. It enables automated naming of pathological image files, greatly improving naming accuracy and efficiency.
[0072] and Figure 1 Corresponding to the method shown, this invention also discloses a fully automated batch naming system for pathological image files. Figure 1 The implementation of the method, specifically the structure is as follows: Figure 2 As shown, it includes:
[0073] Format unification module: used to unify the format of pathological image preprocessing;
[0074] Image processing module: used to extract label images from medical record images and extract file names using image segmentation algorithms;
[0075] Text extraction module: Used to recognize and extract text information from pathological images using a deep learning OCR model;
[0076] The renaming module is used to design file renaming algorithms based on preprocessed images, label images, and text information, and then complete the renaming process.
[0077] Finally, this embodiment discloses a computer storage medium storing a computer program, wherein the computer program, when executed by a processor, comprises the steps of any one of the methods for fully automated batch naming of pathological image files.
[0078] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to the method section.
[0079] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A fully automated batch naming method for pathological image files, characterized in that, Includes the following steps: Standardize the format for pathological image preprocessing; Feature extraction of label images from medical record images; file names extracted using image segmentation algorithms. Using a deep learning OCR model to recognize and extract text information from pathological images; Based on the preprocessed image, label image, and text information, a file renaming algorithm is designed to complete the renaming.
2. The fully automated batch naming method for pathological image files according to claim 1, characterized in that, Before extracting the label image from the pathological image, the pathological image is denoised and flipped.
3. The fully automated batch naming method for pathological image files according to claim 1, characterized in that, The image segmentation algorithm introduces a skip connection multi-head cross-attention module and a fully automatic post-processing method. The skip connection multi-head cross-attention module is used for information fusion in the decoder, while the fully automatic post-processing method is used to optimize the recognition results.
4. The fully automated batch naming method for pathological image files according to claim 1, characterized in that, Feature extraction of label maps from pathological images involves processing SVS or TIFF format files by calling the Openslide library.
5. The fully automated batch naming method for pathological image files according to claim 1, characterized in that, The file renaming algorithm specifically includes naming rule design, error handling mechanism, manual review and feedback, and log recording.
6. A fully automated batch naming system for pathological image files, characterized in that, include: Format unification module: used to unify the format of pathological image preprocessing; Image processing module: used to extract label images from medical record images and extract file names using image segmentation algorithms; Text extraction module: Used to recognize and extract text information from pathological images using a deep learning OCR model; The renaming module is used to design file renaming algorithms based on preprocessed images, label images, and text information, and then complete the renaming process.
7. A computer storage medium, characterized in that, The computer storage medium stores a computer program, which, when executed by a processor, implements the steps of a fully automated batch naming method for pathological image files as described in any one of claims 1-5.