Medical image compression method and system
By converting Dicom images into three-dimensional spatial images and simplifying axial plane and binary encoding, the problem of low compression rate of Dicom images in the prior art is solved, and more efficient medical image compression is achieved, and transmission and storage processes are simplified.
Patent Information
- Application Number
- CN202411229517.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-03
- Publication Date
- 2025-01-07
AI Technical Summary
The two-dimensional plane compression rate of existing Dicom images is low, and the compression rate of traditional lossless compression algorithms is not high, resulting in difficulties in transmission and storage of medical images.
The two-dimensional plane image is converted into a three-dimensional spatial image, and compressed by axial plane characteristic simplification and binary encoding, and lossless compression is performed using the contextual relationship between images.
It improves the lossless compression rate of Dicom images, reduces the amount of data transmitted and stored, and provides a more efficient compression solution for medical images.
Smart Images

Figure CN119277039A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image compression, and in particular to a medical image compression method and system. Background Art
[0002] Dicom (Digital Imaging and Communications in Medicine) is an internationally specified image format for exchanging medical imaging data. The Transfer Syntax in the Dicom standard, translated into Chinese as the transfer protocol, specifies which two-dimensional image compression algorithm to use when transmitting and storing images. Among the image compression algorithms specified in Transfer Syntax, except for the default four lossless compression algorithms, the rest are lossy compression algorithms. Since a Dicom image is an array of two-dimensional pixel values, if the image is not compressed, the amount of image data will be very large, and transmitting and storing images will bring a lot of problems. However, the clinical diagnosis of medical images has very high requirements for image quality. Usually, Dicom images are required to be losslessly compressed (that is, the decompressed image should be consistent with the original image), and the compression rate of traditional lossless compression algorithms is generally not high. Therefore, the application of two-dimensional plane compression of Dicom images is relatively small at present, and the compression rate is relatively low. Summary of the invention
[0003] In order to solve the deficiencies of the prior art, the purpose of the present invention is to provide a medical image compression method and system, which converts a set of two-dimensional plane images into a three-dimensional space image and compresses it to improve the compression rate of lossless compression of Dicom images.
[0004] In order to achieve the above object, a first aspect of the present invention provides a medical image compression method, comprising:
[0005] Obtain the image to be compressed and generate a two-dimensional plane image sequence;
[0006] Generate a three-dimensional spatial image based on a sequence of two-dimensional plane images;
[0007] Simplify three-dimensional space images;
[0008] The simplified three-dimensional space image is compressed to obtain a compressed image.
[0009] Preferably, generating a two-dimensional planar graph sequence comprises:
[0010] Group the images to be compressed;
[0011] Obtain a two-dimensional plane image corresponding to each file in each group;
[0012] A two-dimensional plane image sequence corresponding to each group is obtained according to the two-dimensional plane image.
[0013] Preferably, generating a three-dimensional space image according to a sequence of two-dimensional plane images comprises:
[0014] According to the axial direction, the pixels at the corresponding positions of each two-dimensional plane image in the two-dimensional plane image sequence are read in sequence to obtain the axis corresponding to each pixel point;
[0015] According to the sagittal direction, the axis corresponding to each pixel point in each row of pixels is read in turn to obtain the axis array corresponding to each row;
[0016] According to the coronal direction, the axis array corresponding to each row is read in sequence to obtain a three-dimensional spatial image.
[0017] Preferably, the simplifying of the three-dimensional space image includes:
[0018] Get the gray value of each pixel in each axis. If the gray value of each pixel is consistent, simplify the axis into a gray value pixel for storage.
[0019] If the grayscale value of each pixel is inconsistent, when lossless compression is used, the grayscale value of each pixel is retained and the grayscale value array corresponding to the axis is generated; when lossy compression is used, the grayscale value of each pixel is simplified according to the compression quality;
[0020] Traverse each axis in the three-dimensional space image, obtain the gray value array corresponding to each axis, and form a simplified three-dimensional space image.
[0021] Preferably, during lossy compression, the grayscale value with the largest number of occurrences is used as the reference value, and if there is any pixel point whose grayscale value is within the threshold range of the reference value, the grayscale value of the corresponding pixel point is replaced with the reference value.
[0022] Preferably, compressing the simplified three-dimensional space image includes:
[0023] Obtain the number of occurrences of each grayscale value pixel in the simplified three-dimensional space image, and perform binary tree layout according to the number of occurrences;
[0024] Binary encoding of each gray value pixel is performed according to a binary tree;
[0025] Binary coding is performed on each axis to obtain a compressed three-dimensional image.
[0026] A second aspect of the present invention provides a medical image compression system, comprising:
[0027] A two-dimensional plane image sequence generation module is configured to obtain an image to be compressed and generate a two-dimensional plane image sequence;
[0028] A three-dimensional space image generation module is configured to generate a three-dimensional space image according to a sequence of two-dimensional plane images;
[0029] A simplification module is configured to simplify the three-dimensional space image;
[0030] The compression module is configured to compress the simplified three-dimensional space image to obtain a compressed image.
[0031] According to a third aspect of the present invention, an electronic device is provided, comprising a memory, a processor and a computer program stored in the memory, wherein the processor executes the computer program to complete the steps of the above-mentioned medical image compression method.
[0032] According to a fourth aspect of the present invention, a computer-readable storage medium is provided for storing computer instructions, and when the computer instructions are executed by a processor, the steps of the above-mentioned medical image compression method are completed.
[0033] According to a fifth aspect of the present invention, a computer program product is provided, comprising a computer program / instruction, which implements the steps of the above-mentioned medical image compression method when executed by a processor.
[0034] Compared with the prior art, the present invention has the following beneficial effects:
[0035] The present invention provides a medical image compression method and system, which converts a group of two-dimensional plane images into a three-dimensional space image by analyzing the principle of machine acquisition of Di com images and identifying the relationship between the context of Di com images, and changes the traditional compression of only a single image to compression of a group of two-dimensional plane images, so that lossless compression can be performed by utilizing the context relationship between each two-dimensional plane image, thereby improving the compression rate. By utilizing the image characteristics of medical images (the axial plane has a higher spatial data redundancy), the axial plane characteristics of the three-dimensional space image are simplified and binary compressed and encoded, further improving the compression rate of the lossless compression of the Di com image, and providing convenience for image transmission and storage.
[0036] Advantages of additional aspects of the present invention will be given in part in the following description, and in part will become obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] The accompanying drawings in the specification, which constitute a part of the present invention, are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute improper limitations on the present invention.
[0038] Figure 1 Flow chart of the method of the present invention. DETAILED DESCRIPTION
[0039] The present invention will be further described below in conjunction with the accompanying drawings and embodiments.
[0040] Embodiment 1
[0041] In this embodiment, Figure 1 As shown, a medical image compression method is provided, comprising:
[0042] S1, obtaining the image to be compressed and generating a two-dimensional plane image sequence;
[0043] S2, generating a three-dimensional space image according to a sequence of two-dimensional plane images;
[0044] S3, simplify the three-dimensional space image;
[0045] S4. Compress the simplified three-dimensional space image to obtain a compressed image.
[0046] The general image compression algorithm assumes that in most cases, there is no connection or very little connection between each image in a group of two-dimensional images, so even if a group of two-dimensional images is compressed, the compression ratio will not be improved, but the compression time of a single image will be increased. Therefore, the image compression algorithms in the prior art are all for compressing a single two-dimensional image. However, in the medical field, because Dicom images are a group or multiple groups of two-dimensional images that continuously scan the human body structure, the images are strongly related, so the overall three-dimensional compression of a group of images will greatly improve the compression ratio. Based on this, this embodiment proposes to convert a group of two-dimensional plane images into a three-dimensional space image and compress it.
[0047] In step S1, first, the images to be compressed are grouped, and the Dicom images are grouped according to the serial number to obtain the Dicom image group Dicom Group. The structural characteristics of Dicom in the medical field lead to the need to group by serial number. For example, CT scans of the human body are not scanned from head to tail at one time, but scanned multiple times to obtain multiple groups of human structure images. For example, patients may need to check the head, chest, and abdomen in CT scans. It is not scanned directly from the head to the abdomen, but after scanning the head, repositioning the chest and then repositioning the abdomen. This results in multiple groups of continuous two-dimensional images in the Dicom image instead of one group of continuous two-dimensional images. The three-dimensional compression algorithm is essentially based on the strong correlation of continuous two-dimensional images to improve the compression ratio, so it is necessary to group the Dicom images according to the serial number, and the two-dimensional images with the same serial number must be continuous.
[0048] Secondly, obtain the two-dimensional plane image corresponding to each file in each group, and perform the two-dimensional plane image reading step for each file File in it with Dicom Group as the basic unit to ensure that each File has the same image resolution. Then, obtain the two-dimensional plane image sequence corresponding to each group based on the two-dimensional plane image, and combine the two-dimensional plane image Image of each File in Dicom Group into a two-dimensional plane image array, that is, the two-dimensional plane image sequence Series.
[0049] The step of reading a two-dimensional plane image includes:
[0050] First, read the binary image file File through the file stream;
[0051] According to the Dicom international standard protocol, decode the file and identify the file header Meta and data set Dataset;
[0052] Find the pixel data from the Dataset according to the tag Tag;
[0053] Take 8 bits (the pixel size of grayscale image is usually 8 bytes) as a basic unit to read the pixel data unit by unit and obtain the two-dimensional plane image Image;
[0054] For 12-bit (the pixel size of grayscale images collected by precision machines is usually 12 bytes) Pixel Data, the 12-bit Pixel Data is usually converted into 8-bit Pixel Data after value range scaling by adjusting the window width Window Width and window center Window Center, and then a two-dimensional plane image Image is further obtained.
[0055] In step S2, first, read the pixels at the corresponding positions of each two-dimensional plane image in the two-dimensional plane sequence in the axial direction, and obtain the axis corresponding to each pixel. Take the (0,0) pixel point (usually the first pixel point in the upper left corner of the image) in each Image in the two-dimensional plane sequence Series in the axial direction (from top to bottom) to form a new pixel array Axis (axis), which records all the axial information contained in the pixel point at the current position (which can be understood as all the information contained in the straight line from the top to the bottom of the human body). Secondly, read the axis corresponding to each pixel point in each row of pixels in the sagittal direction in turn to obtain the axis array corresponding to each row. Take (0,0) as the origin, read the Axis of all pixels in the first row in the sagittal direction (from left to right) to obtain an axis array Axis Array. Then, read the axis array corresponding to each row in the coronal direction in turn to obtain a three-dimensional space image. With (0,0) as the origin, read the Axis Array of all pixels in each row in the coronal direction (from front to back) to obtain a two-dimensional axis array, that is, a three-dimensional space image Space.
[0056] In step S3, the obtained three-dimensional space image is simplified. The grayscale value of each pixel in each axis is obtained. If the grayscale value of each pixel is consistent, the axis is simplified into a grayscale value pixel for storage. Taking the axis Axis as the basic unit, traverse each pixel in the Axis to obtain the Pixel, which records the grayscale value of the pixel. If the grayscale value of each pixel is the same, the Axis is simplified into a Pixel for storage, indicating that the grayscale value of this axis from top to bottom is exactly the same.
[0057] If the grayscale value of each pixel is not exactly the same, then there are two cases: lossless compression and lossy compression. If it is lossless compression, the grayscale value of each pixel in the Axis is completely retained, that is, it is stored in the form of a grayscale value array Pixel Array; if it is lossy compression, the pixel with the largest number in the Pixel Array will be taken as the reference value. If other different pixels are within the threshold of the reference value Pixel (the size of the threshold is determined by the quality of lossy compression), then the other pixels will be treated as reference value Pixels, that is, the grayscale values of the remaining points will be replaced with the reference values. In this way, an Axis can be simplified into a Pixel for storage.
[0058] Traverse each axis in the three-dimensional space image, obtain the grayscale value pixel array corresponding to each axis, and form a simplified three-dimensional space image. Traverse each Axis in the three-dimensional space image by simplifying the Axis above, and finally obtain a simplified three-dimensional space image Simple Space.
[0059] In step S4, binary code replacement is performed by using a binary tree layout method to achieve image compression. Binary tree layout is performed according to the number of occurrences of different grayscale value pixels in the simplified three-dimensional space image Simple Space. Pixels with high frequency use leaf nodes with short paths, and pixels with low frequency use leaf nodes with long paths. The left tree of the binary tree is 0, and the right tree is 1. Different pixels are binary-coded. It is necessary to reserve code 0 as an identifier, so the code of the pixel must start with 1 (10, 11, 110, 111). If it is a same-color Axis (which can be simplified into a Pxiel), it will be directly stored in the binary code of the pixel (for example, a pixel with a grayscale value of 128 normally occupies 8 bytes, and is replaced by 10 after coding, so it occupies 2 bytes). If it is a multi-color Axis (stored in the form of a Pxiel Array), each pixel in the PxielArray will be replaced with a binary code to form a Pxiel data stream, and the code 0 is supplemented at the head of the data stream to indicate that the position is a Pxiel Array instead of a Pixel. By performing binary code replacement on each Axis, we finally get a data stream consisting of two forms of data: Pxiel and Pxiel Array, that is, the compressed three-dimensional space image Compress Space.
[0060] The present invention provides a medical image compression method and system. By analyzing the principle of machine acquisition of DICOM images and identifying the relationship between the contexts of DICOM images, a group of two-dimensional plane images are converted into a three-dimensional space image, and the traditional compression of only a single image is changed to compression of a group of two-dimensional plane images, so that lossless compression can be performed by utilizing the contextual relationship between each two-dimensional plane image to improve the compression rate; the image characteristics of medical images (axial planes have higher spatial data redundancy) are utilized to simplify the axial plane characteristics and perform binary compression encoding on the three-dimensional space image, which further improves the compression rate of the lossless compression of the DICOM image and provides convenience for transmitting and storing images.
[0061] Embodiment 2
[0062] This embodiment provides a medical image compression system, including:
[0063] A two-dimensional plane image sequence generation module is configured to obtain an image to be compressed and generate a two-dimensional plane image sequence;
[0064] A three-dimensional space image generation module is configured to generate a three-dimensional space image according to a sequence of two-dimensional plane images;
[0065] A simplification module is configured to simplify the three-dimensional space image;
[0066] The compression module is configured to compress the simplified three-dimensional space image to obtain a compressed image.
[0067] It should be noted here that the modules in this embodiment correspond to the steps of the method in Embodiment 1, and the specific implementation process is the same, which will not be repeated here.
[0068] Embodiment 3
[0069] This embodiment provides an electronic device, including a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to complete the steps of the method in the first embodiment.
[0070] Embodiment 4
[0071] This embodiment provides a computer-readable storage medium for storing computer instructions. When the computer instructions are executed by a processor, the steps of the method in the first embodiment are completed.
[0072] Embodiment 5
[0073] This embodiment provides a computer program product, including a computer program / instruction, characterized in that the computer program / instruction implements the steps of the method in the first embodiment when executed by a processor.
[0074] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A medical image compression method, characterized in that: include: Obtain the image to be compressed and generate a two-dimensional plane image sequence; Generate a three-dimensional spatial image based on a sequence of two-dimensional plane images; Simplify three-dimensional space images; The simplified three-dimensional space image is compressed to obtain a compressed image.
2. A medical image compression method as claimed in claim 1, characterized in that: The generating of the two-dimensional plane diagram sequence comprises: Group the images to be compressed; Obtain a two-dimensional plane image corresponding to each file in each group; A two-dimensional plane image sequence corresponding to each group is obtained according to the two-dimensional plane image.
3. A medical image compression method as claimed in claim 1, characterized in that: The step of generating a three-dimensional space image according to a sequence of two-dimensional plane images comprises: According to the axial direction, the pixels at the corresponding positions of each two-dimensional plane image in the two-dimensional plane image sequence are read in sequence to obtain the axis corresponding to each pixel point; According to the sagittal direction, the axis corresponding to each pixel point in each row of pixels is read in turn to obtain the axis array corresponding to each row; According to the coronal direction, the axis array corresponding to each row is read in sequence to obtain a three-dimensional spatial image.
4. A medical image compression method as claimed in claim 1, characterized in that: The simplified three-dimensional space image includes: Get the gray value of each pixel in each axis. If the gray value of each pixel is consistent, simplify the axis into a gray value pixel for storage. If the grayscale value of each pixel is inconsistent, when lossless compression is used, the grayscale value of each pixel is retained and the grayscale value pixel array corresponding to the axis is generated; when lossy compression is used, the grayscale value of each pixel is simplified according to the compression quality; Traverse each axis in the three-dimensional space image, obtain the gray value array corresponding to each axis, and form a simplified three-dimensional space image.
5. A medical image compression method as claimed in claim 4, characterized in that: When lossy compression is performed, the grayscale value with the largest number of occurrences is used as the reference value. If the grayscale value of any pixel is within the threshold range of the reference value, the grayscale value of the corresponding pixel is replaced with the reference value.
6. A medical image compression method as claimed in claim 1, characterized in that: The compressing the simplified three-dimensional space image includes: Obtain the number of occurrences of each grayscale value pixel in the simplified three-dimensional space image, and perform binary tree layout according to the number of occurrences; Binary encoding of each gray value pixel is performed according to a binary tree; Binary coding is performed on each axis to obtain a compressed three-dimensional image.
7. A medical image compression system, characterized in that: include: A two-dimensional plane image sequence generation module is configured to obtain an image to be compressed and generate a two-dimensional plane image sequence; A three-dimensional space image generation module is configured to generate a three-dimensional space image according to a sequence of two-dimensional plane images; A simplification module is configured to simplify the three-dimensional space image; The compression module is configured to compress the simplified three-dimensional space image to obtain a compressed image.
8. An electronic device, characterized in that: The invention comprises a memory, a processor and a computer program stored in the memory, wherein the processor executes the computer program to complete the steps of the method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: Used to store computer instructions, which, when executed by a processor, complete the steps of the method according to any one of claims 1 to 6.
10. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.