Medical image lossless compression method and system based on transform coding and deep learning
By combining transform coding and deep learning technology, lossless compression of medical images is solved, and the problems of low lossless compression rate and difficult to migrate to medical images in the prior art are solved, and significant compression rate improvement and efficient encoding and decoding process are achieved.
Patent Information
- Application Number
- CN202411852910.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-16
- Publication Date
- 2025-03-18
- Estimated Expiration
- 2044-12-16
AI Technical Summary
The prior art is difficult to effectively improve the lossless compression rate of medical images, and the lossless compressor based on deep learning cannot be better transferred to medical images. Especially medical images of different modes have different characteristics, making it difficult to design a general compressor.
Using transform coding and deep learning methods, medical images are DCT transformed and quantized, split into DC coefficients and AC coefficients, and the AC coefficients are decomposed into structural layers and texture layers through linear mapping-decomposition models, and the depth probability estimation model based on convolutional neural network is used for autoregressive probability density modeling and entropy coding.
The effect of significantly improving the lossless compression rate of medical images is achieved, especially on 2D grayscale medical image data in X-Ray and ultrasonic modes, ensuring no information loss and the required neural network parameters and encoding and decoding time are small.
Smart Images

Figure CN119653110A_ABST
Abstract
Description
Technical Field
[0001] The present invention mainly relates to the field of image compression technology, and specifically to a medical image lossless compression method and system based on transform coding and deep learning. Background Art
[0002] Medical images are widely used in clinical diagnosis and are usually multimodal, high-resolution, and large in data volume. The space required for storage and the bandwidth required for transmission are very high. Their importance in clinical treatment and telemedicine requires lossless compression.
[0003] Since the emergence of VAE-based end-to-end learning compressors, deep learning-based lossy and lossless compression technologies have developed rapidly, with compression performance comparable to or exceeding that of the most advanced classical methods. In the process of implementing the present invention, the applicant of the present invention found that the methods of the prior art have at least the following technical problems:
[0004] Lossy compression has a compression ratio of up to 50 times, while actual lossless image codecs are usually between 2:1 and 3:1. Limited by Shannon's source coding theorem, it is very challenging to further improve the lossless compression rate of medical images. Most learning-based lossless compressors are general encoders designed for natural images and cannot be well transferred to special images such as medical images. On the other hand, due to different imaging reasons, medical images of different modalities have different characteristics, and it is difficult to design a general compressor. Therefore, it is necessary to design a medical image compressor for a specific modality. Summary of the invention
[0005] In view of the technical problems existing in the prior art, the present invention provides a medical image lossless compression method and system based on transform coding and deep learning with high compression efficiency.
[0006] In order to solve the above technical problems, the technical solution proposed by the present invention is:
[0007] A medical image lossless compression method based on transform coding and deep learning, comprising the steps of:
[0008] Step 1, perform DCT transformation and Round quantization on the input 2D medical image and split it into DC coefficients and AC coefficients;
[0009] Step 2, compress the DC coefficient and the loss R caused by Round quantization;
[0010] Step 3, decompose the AC coefficient into structure layer MSB and texture layer LSB;
[0011] Step 4, decomposing the texture layer LSB into multiple sub-coefficient blocks;
[0012] Step 5, construct a deep probability estimation model based on a convolutional neural network, perform group-based autoregressive probability density modeling, input multiple sub-coefficient blocks, and output the probability distribution matrix of each sub-coefficient block;
[0013] Step 6: Combine the entropy arithmetic encoder and the probability distribution matrix to perform lossless encoding and decoding on each sub-coefficient block.
[0014] Preferably, the specific process of step 1 is:
[0015] Step 1.1, perform 8x8 floating point DCT transform on the input 2D medical image X to obtain DCT frequency domain coefficients, and perform hard quantization on the floating point coefficients to obtain integer quantized DCT coefficients X′;
[0016] Step 1.2: The integer quantized DCT coefficients X′ are split into DC coefficients and AC coefficients in a zigzag scanning order.
[0017] Preferably, in step 2, the DC coefficient is compressed by a traditional encoder JPEGXL; and the loss R caused by Round quantization is compressed by run-length coding.
[0018] Preferably, in step 3, the AC coefficients are decomposed into structure layer MSB and texture layer LSB by a linear mapping-decomposition model;
[0019] Specifically, the linear mapping-decomposition model includes a linear mapping model and a linear decomposition model, and the linear mapping model is:
[0020]
[0021] Where C(i,j)) represents the AC coefficient at the spatial coordinate (i,j);
[0022] The linear decomposition model is:
[0023]
[0024] X LSB =C(i,j)mod256.
[0025] Preferably, the specific process of step 4 is: decomposing the texture layer LSB into multiple sub-coefficient blocks through a row-column grouping strategy;
[0026] Step 4.1, row grouping: except for the DC coefficient, the texture detail part LSB of the 63 AC coefficients at the horizontal position, vertical position, and diagonal position is recorded as {ch i |i∈[1,63]}, grouped and rearranged according to the direction of texture change, divided into 21 groups, each with 3 coefficients;
[0027] The coefficients in the horizontal direction are divided into group G1 = {ch1, ch5, ch6}, the coefficients in the vertical direction are divided into group G2 = {ch2, ch3, ch9}, and the coefficients in the oblique direction are divided into group G3 = {ch4, ch8, ch 11};
[0028] Step 4.2, column grouping: on the basis of row grouping, a coefficient component in each group is further divided into 4 sub-coefficient blocks in terms of spatial position; specifically, a 2x2 sliding window is used, and a sliding step is performed with a step size of 2, and the coefficient points falling in the same position in the sliding window are packed into a sub-coefficient block each time, so each sub-coefficient block is represented as S g,r,c =S n , where g∈[1,21], r∈[1,3], c∈[1,4], n∈[1,252], the three-dimensional coordinates (g, r, c) are the group coordinates, row coordinates, and column coordinates, respectively, and n is the corresponding one-dimensional index after flattening.
[0029] Preferably, in step 5, the deep probability estimation model Φ based on the convolutional neural network is composed of a 3x3 convolution layer and a ReLu activation function, including a context feature fusion module CFM and a probability density distribution prediction module PMF; wherein CFM is composed of a 64-channel convolution layer and 3 residual convolution blocks, and its input has two branches, namely, the frequency domain context C f and spatial context C s , output the fused context features;
[0030] The probability density distribution prediction module PMF consists of two 128-channel convolutional layers and ReLu activation functions, one 256-channel convolutional layer and a Softmax layer. Its input is the contextual features fused by CFM, and it outputs the probability distribution matrix p′ of the current sub-coefficient block. θ (S g,r,c ).
[0031] Preferably, the frequency domain context C of the current sub-coefficient block f =Concat(G g<i , G i,r< ) is designed by row grouping; G g<i is the sub-coefficient block preceding the current group, G i,r< The frequency domain context C is the block whose row coordinates in the current group are smaller than the current block. f The impact on the probability modeling of the current sub-coefficient block is expressed as:
[0032] p′ θ (G i,1 ,G i,2 G i,3 |G g<i ) = p′ θ(G i,1 |G g<i )·p′(G i,2 |G i,1 ,G g<i )·p′ θ (G i,3 |G i,1 ,G i,2 ,G g<i );
[0033] The spatial context C of the current sub-coefficient block s =G i,r,c< Designed by column grouping; G i,r,c< is the sub-coefficient block in the current group whose row coordinates are equal to the current block but whose column coordinates are smaller than the current block, denoted as G i,r,c< ;
[0034] Combined with frequency domain context C f and spatial context C s , the complete probability modeling of the current sub-coefficient block is expressed as:
[0035] p′ θ (G i,r,c ) = p′ θ (G i,r,c |G i,r,c<, G i,r< ,G g<i )
[0036] It outputs the probability of each point in the current sub-coefficient block within the value range of [0,255]. The probability matrix p′ and the true value of the current sub-coefficient block calculate the cross entropy loss, which is expressed as:
[0037] L θ = Cross_entroopy(p′(S g,r,c, ),S g,r,c )
[0038] Among them, the parameters θ of the probability estimation model Φ are updated by optimizing the above loss function through the Adam optimizer; the probability estimation model Φ outputs the probability matrix p′ of each possible symbol of the current sub-coefficient block, and p′ is combined with the arithmetic encoder to encode each coefficient into a 01 bit stream.
[0039] Preferably, in step 6, during decoding, the bit stream is decoded losslessly through the probability distribution matrix M predicted by the probability estimation model Φ, combined with an arithmetic decoder, and each sub-coefficient block is decoded, and all sub-coefficient blocks are then transformed into the original AC coefficients by the linear inverse transformation and merging module at the decoding end, specifically including:
[0040] The DC coefficient is obtained by JPEGXL decoding, and the run-length encoding decodes the error R and the MSB part of the AC coefficient;
[0041] The DC coefficient is input into the probability estimation model Φ to predict the probability distribution matrix p′0 of the first sub-coefficient S0, and p′0 is input into the arithmetic decoder torchac to decode the first sub-coefficient block S0;
[0042] S0 is used as the prior for the subsequent sub-coefficient blocks, and the probability estimation model Φ is input to predict the probability distribution matrix p′1 of the second sub-coefficient S1. Gradually, all 252 sub-coefficient blocks are decoded sequentially according to the predefined dependency relationship;
[0043] The sub-coefficient blocks are inversely operated in the order of row-column grouping and merged into the original LSB;
[0044] The LSB and the MSB of run-length decoding are combined into AC coefficients through linear mapping and inverse operation of decomposition module;
[0045] The AC coefficients and DC coefficients are recombined and rearranged, transformed back to the pixel domain through I-DCT, denoted as X′, and the final decoded lossless reconstruction is: Rec=X′+R.
[0046] The present invention further discloses a medical image lossless compression system based on transform coding and deep learning, comprising an interconnected memory and a processor, wherein a computer program is stored on the memory, and when the computer program is run by the processor, the steps of the method described above are executed.
[0047] Compared with the prior art, the advantages of the present invention are:
[0048] The present invention combines the characteristics of 2D medical images, combines traditional DCT-based transform coding with deep learning probability modeling to achieve mathematical lossless compression of medical images; the present invention achieves significant compression rates on 2D grayscale medical image data in X-Ray and ultrasound modalities, and ensures no information loss; the present invention utilizes the good decorrelation of discrete cosine transform to transform the pixel domain to the frequency domain, further designs similarity and redundancy characteristics of different components of frequency domain coefficients, and designs a group-based autoregressive context probability estimation network to predict the probability distribution of coefficients within each group; the predicted probability distribution is combined with an arithmetic encoder to compress data into a compact bit stream, achieving a lossless compression ratio that is significantly better than existing methods, and requires fewer neural network parameters and encoding and decoding time. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] Figure 1 This is a flowchart of an embodiment of the medical image lossless compression method based on transform coding and deep learning of the present invention.
[0050] Figure 2 This is a topological diagram of an embodiment of the medical image lossless compression system based on transform coding and deep learning of the present invention.
[0051] Figure 3 It is a structural diagram of the probability estimation model Φ in an embodiment of the present invention.
[0052] Figure 4 FIG. 4 is a schematic diagram of the multi-directionality of the AC coefficient in an embodiment of the present invention.
[0053] Figure 5 Schematic diagram of the row-column grouping method in the present invention; (a) is row grouping; (b) is column grouping. DETAILED DESCRIPTION
[0054] The present invention is further described below in conjunction with the accompanying drawings and specific embodiments.
[0055] like Figure 1 As shown, the medical image lossless compression method based on transform coding and deep learning provided by the embodiment of the present invention includes the steps of:
[0056] Step 1: Input 2D medical image X∈R H×W Perform 8x8 floating point DCT transform and round quantize to integer to get DCT coefficient X′∈R H×W =Round(DCT(X), and then split into DC coefficients and AC coefficients; the specific process is:
[0057] Step 1.1, perform 8x8 floating point DCT transform on the input 2D medical image X to obtain DCT frequency domain coefficients, and perform hard quantization on the floating point coefficients to obtain integer quantized DCT coefficients X′;
[0058] Step 1.2: The integer quantized DCT coefficients X′ are split into DC coefficients and AC coefficients in a zigzag scanning order.
[0059] Step 2: Run-length coding is used to additionally encode the error R between the inverse DCT transform of the quantized integer coefficient and the original pixel value. The information loss R is expressed as:
[0060] R=X-IDCT(Round(DCT(X))=X-IDCT(X′)
[0061] X is the input image, DCT and IDCT represent the 2D discrete cosine transform and inverse discrete cosine transform of 8x8 blocks respectively, and Round is the rounding operation;
[0062] The DC coefficient is compressed by the traditional encoder JPEGXL.
[0063] Step 3, the AC coefficient is decomposed into structure layer MSB and texture layer LSB by linear mapping-decomposition model;
[0064] Specifically, the linear mapping-decomposition model includes a linear mapping model and a linear decomposition model, and the linear mapping model is:
[0065]
[0066] Where C(i,j)) represents the AC coefficient at the spatial coordinate (i,j);
[0067] The formula maps the negative AC coefficients to positions closer to positive numbers, and the dynamic range of coefficient amplitude is further reduced.
[0068] The linear decomposition model is:
[0069]
[0070] X LSB =C(i,j)mod256
[0071] That is, the AC coefficient is decomposed into two parts, the structure layer MSB and the texture layer LSB; the MSB part represents the sparse structure and uses run-length coding lossless encoding and decoding; the LSB represents the texture details and is compressed by the neural network encoder in the present invention.
[0072] The above linear mapping-decomposition model consists of two linear functions and does not require neural network training. It is simple and efficient.
[0073] Step 4: For the LSB part of the texture layer decomposed in the above step, since it contains the main high-frequency texture, the present invention further applies a row-column grouping strategy to it, and uses a subsequent neural network method to perform entropy coding;
[0074] The row and column grouping strategy is formulated based on the distribution and texture characteristics of different components in the DCT frequency domain, and the 63 AC components are grouped in a refined manner, including:
[0075] Step 4.1, row grouping: except for the DC coefficient, the texture detail part LSB of the 63 AC coefficients at the horizontal position, vertical position, and diagonal position is recorded as {ch i |i∈[1,63]}, are grouped and rearranged according to their texture change direction, and are divided into 21 groups, with 3 coefficients in each group.
[0076] The coefficients in the horizontal direction are divided into group G1 = {ch1, ch5, ch6}, the coefficients in the vertical direction are divided into group G2 = {ch2, ch3, ch9}, and the coefficients in the oblique direction are divided into group G3 = {ch4, ch8, ch 11}, the specific division method is shown in Table 1:
[0077] Table 1 Row-column grouping of medical image lossless compressor based on transform coding and deep learning
[0078] G1 G2 G3 G4 G5 G6 G7 (1,5,6) (2,3,9) (4,8,11) (7,12,13) (17,18,24) (10,20,21) (14,15,16) G8 G9 G10 G11 G12 G13 G14 (19,22,23) (25,26,27) (28,29,30) (31,32,33) (34,35,36) (37,38,39) (40,41,42) G15 G16 G17 G18 G19 G20 G21 (43,44,45) (46,47,48) (49,50,51) (52,53,54) (55,56,57) (58,59,60) (61,62,63)
[0079] Step 4.2, column grouping: On the basis of row grouping, a coefficient component in each group is further divided into 4 sub-coefficient blocks in terms of spatial position. Specifically, a 2x2 sliding window is used, and a sliding step of 2 is performed, and the coefficient points that fall in the same position in the sliding window each time are packaged into a sub-coefficient block, such as Figure 5 As shown, each sub-coefficient block is represented as S g,r,c =S n , where g∈[1,21], r∈[1,3], c∈[1,4], n∈[1,252], the three-dimensional coordinates (g, r, c) are group coordinates, row coordinates, and column coordinates, respectively, and n is the corresponding one-dimensional index after flattening.
[0080] Step 5: Combine frequency domain context C f and spatial context C s , construct a group-based autoregressive contextual deep probability model Φ, and model the probability distribution of each sub-coefficient after the step using the formula:
[0081] p′(S g,r,c )=Φ(C f ,C s ) = p′ θ (G i,r,c |G i,r,c<, G i,r< ,G g<i )
[0082] p′ is the probability distribution matrix output by the neural network probability model Φ, and θ is the learnable parameter of the deep probability model Φ. The autoregressive context deep probability model receives the frequency domain context C of each sub-coefficient block. f and spatial context C s As input, output the probability distribution p′(S g,r,c ).
[0083] like Figure 3 As shown in the figure, the deep probability estimation model Φ based on the convolutional neural network is composed entirely of 3x3 convolutional layers and ReLu activation functions, including a context feature fusion module CFM and a probability density distribution prediction module PMF. CFM consists of a 64-channel convolutional layer and three residual convolution blocks. Its input has two branches, namely the frequency domain context and the spatial context, and outputs the fused context features.
[0084] The probability density distribution prediction module PMF consists of two 128-channel convolutional layers and ReLu activation functions, one 256-channel convolutional layer and a Softmax layer. Its input is the contextual features fused by CFM, and its output is the current sub-coefficient block S g,r,c The probability distribution matrix p′ θ (S g,r,c ).
[0085] The frequency domain context C f and spatial context C s , is designed after the row and column grouping strategy. When the coefficients are grouped by rows, the coefficients in the same group are similar in the frequency domain, and visually they present the same texture direction after visualizing each corresponding coefficient channel; when the coefficients are grouped by columns, the sub-coefficient blocks have spatial correlation due to their adjacent spatial positions; the frequency domain context and spatial context use the above two correlations respectively to artificially display the chronological dependency between the 12 sub-coefficient blocks in the group, so the sub-coefficient block encoded and decoded first can be used as the frequency domain context and spatial context of the subsequent sub-coefficient block.
[0086] Specifically, the frequency domain context C f Designed by row grouping, since the coefficient channels of each group have similar textures and are correlated in the frequency domain, in each group of sub-coefficient blocks, the sub-coefficient blocks preceding the current group can be used as the context of each block in the current group, denoted by G g<i ; The block G whose row coordinates in the current group are smaller than the current block i,r< can be used as the frequency domain context of the current block, so the frequency domain context C of the current sub-coefficient block f =Concat(G g<i ,G i,r< );
[0087] Similarly extended to spatial correlation, the block with column coordinates smaller than the column coordinates of the current sub-coefficient block and belonging to the same row as the current block is denoted as G i,r,c< Can be used as the spatial context of the current block, so C s =G i,r,c< ;
[0088] Since the linear mapping-decomposition model maps the amplitude range of the coefficients to [0, 255], the last layer of the probability density distribution prediction module is a 256-channel convolution layer, which outputs the probability of each point in the current sub-coefficient block being in the range of [0, 255]. This probability matrix p′ and the true value of the current sub-coefficient block are used to calculate the cross entropy loss L θ , expressed as:
[0089] L θ = Cross_entroopy(p′(S g,r,c, ),Sg,r,c )
[0090] Among them, the parameters θ of the probability estimation model Φ are updated by optimizing the above loss function through the Adam optimizer using the gradient descent method; the probability estimation model Φ outputs the probability matrix p′ of each possible symbol of the current sub-coefficient block, and p′ is combined with the arithmetic encoder to encode each coefficient into a 01 bit stream.
[0091] Step 6: During decoding, the bit stream is passed through the probability distribution matrix p′ predicted by the probability estimation model Φ, and combined with the arithmetic decoder, each sub-coefficient block can be losslessly decoded. All sub-coefficient blocks are then transformed into the original AC coefficients by the linear inverse transformation and merging module at the decoding end, specifically including:
[0092] The DC coefficient is obtained by JPEGXL decoding, and the run-length encoding decodes the error R and the MSB part of the AC coefficient;
[0093] The DC coefficient is input into the probability estimation model Φ to predict the probability distribution matrix p′0 of the first sub-coefficient S0, and p′0 is input into the arithmetic decoder torchac to decode the first sub-coefficient block S0;
[0094] S0 is used as the prior for the subsequent sub-coefficient blocks, and the probability estimation model Φ is input to predict the probability distribution matrix p′1 of the second sub-coefficient S1. Gradually, all 252 sub-coefficient blocks are decoded sequentially according to the predefined dependency relationship;
[0095] The sub-coefficient blocks are inversely operated in the order of row-column grouping and merged into the original LSB;
[0096] The LSB and the MSB of run-length decoding are combined into AC coefficients through linear mapping and inverse operation of decomposition module;
[0097] The AC coefficients and DC coefficients are recombined and rearranged, transformed back to the pixel domain through I-DCT, denoted as X′, and the final decoded lossless reconstruction is: Rec=X′+R.
[0098] On the training data, first transform the data in steps 1 to 4, and then input the transformed coefficient sliding context into the group-based autoregressive context probability model Φ constructed in step 5. The loss function for training optimization is: the cross entropy loss between the output probability distribution matrix p′ and the true coefficient distribution p is the objective function, denoted as:
[0099]
[0100] Where n is the subscript of the sub-coefficient block; the objective function L θ Perform gradient descent training until the network converges and save the network weights.
[0101] Only steps 1 to 5 are executed in the training phase. In the inference and encoding phase, steps 1 to 4 are executed first, and then steps 5 and 6 are iteratively executed in the order of the sub-coefficient blocks. That is, the context of the current sub-coefficient block is input into the corresponding trained deep probability model, and the probability distribution matrix of the current sub-coefficient block image is output. The sub-coefficient block is encoded into a bit stream in combination with the arithmetic encoder, and the iterative execution is carried out until all sub-coefficient blocks are encoded.
[0102] The model loads the weights trained in the above steps for inference, performs the transformations of steps 1 to 4 on the test image in sequence, and outputs the probability distribution matrix of each group of coefficients. At this time, there is no need to calculate the cross entropy loss. The probability distribution matrix p′ is directly used to perform arithmetic coding on each coefficient, output the final bit stream, and calculate the bit rate.
[0103] At the same time, although the upper limit of the compression rate of lossless compression is limited by Shannon's theorem, medical images have certain good characteristics and prior information, such as similarity, including mutual similarity and self-similarity, which provide some convenience for their compression. For example, the scanned images of the same part of different people are similar, such as lungs, legs, etc. Different parts of the same person also have similarities.
[0104] The present invention combines the characteristics of 2D medical images, combines traditional DCT-based transform coding with deep learning probability modeling to achieve mathematical lossless compression of medical images; the present invention achieves significant compression rates on 2D grayscale medical image data in X-Ray and ultrasound modalities, and ensures no information loss; the present invention utilizes the good decorrelation of discrete cosine transform to transform the pixel domain to the frequency domain, further designs similarity and redundancy characteristics of different components of frequency domain coefficients, and designs a group-based autoregressive context probability estimation network to predict the probability distribution of coefficients within each group; the predicted probability distribution is combined with an arithmetic encoder to compress data into a compact bit stream, achieving a lossless compression ratio that is significantly better than existing methods, and requires fewer neural network parameters and encoding and decoding time.
[0105] Specifically, the present invention improves the lossless compression ratio from two perspectives: First, reducing the entropy of the original source. According to Shannon's information entropy theory, the average number of bits per symbol L is defined as:
[0106]
[0107] where p(x) is the probability density function for a given symbol set X and l(x) is the code length of each symbol.
[0108] Its lower bound is the entropy of the information source, as follows:
[0109]
[0110] The present invention reduces the entropy value of the original data by traditional DCT transformation means, and then performs entropy coding on the new variables. Entropy coding requires more accurate probability estimation, so the present invention uses convolutional neural networks to construct a deep probability distribution model, making the probability distribution estimation more accurate, so that the original information can be represented by a shorter bit stream.
[0111] Figure 2 FIG. 4 shows a coding framework diagram of a lossless compression method for 2D medical images according to an embodiment of the present application. Figure 2 , the specific steps of the compression method of this application are:
[0112] Given an input original image X∈R H×W , where H and W are the height and width of the image. Since most of the medical images in the present invention are 2D grayscale images, the number of channels is 1;
[0113] First, a floating-point DCT transformation is performed on the grayscale image X with an 8x8 window, and a hard quantization rounding operation is performed to obtain an integer DCT coefficient X′. The rounding results in an error R=X-IDCT(Round(DCT(X)) between the value of the coefficient X′ after inverse DCT transformation and the original pixel value. The present invention performs a separate run-length encoding RLE on the error R to ensure lossless reconstruction of the medical image.
[0114] Combine the corresponding frequency positions of different 8x8 sub-blocks of X' into one channel Where C∈[0,63] represents the channel index. H×W×1 Converted into frequency coefficients with 64 channels
[0115] The DC channel X′0 is compressed using the traditional compression algorithm JPEGXL; the remaining AC channels X′ 1-63 It is decomposed into MSB and LSB by the linear mapping decomposition model Split; then row-column grouping is applied to the LSB to obtain 252 sub-coefficient blocks, each of which is uniquely identified by group, row, and column coordinates. The current sub-coefficient block uses the decoded sub-coefficient block as context input, and conditional probability modeling is performed through the constructed deep probability estimation model Φ.
[0116] Row and column grouping
[0117] The row-column grouping strategy decomposes the AC sparse texture part LSB into 252 sub-coefficient blocks.
[0118] Row Grouping
[0119] DCT coefficients have uneven energy distribution and multi-directional characteristics, that is, a certain area of the transform coefficients represents the spectral components in a specific direction, so that DCT coefficients can be used to classify texture images. Figure 4 As shown, region Ω0 is the DC component, region Ω1 represents the horizontal frequency change (vertical texture) in the DCT domain, region Ω2 focuses on the diagonal frequency change (diagonal texture), and region Ω3 captures the vertical frequency change (horizontal texture). The present invention rearranges 63 AC channels according to the multi-directivity and energy of each channel so that adjacent channels with high correlation share the same texture direction, that is, the 63 AC channels are divided into 21 groups, each group Gi={Gi|i∈[1,21]} contains 3 channels, and i represents the index of the group. Detailed grouping is shown in Table 1, in which G1=(1,5,6) indicates that the first group G1 consists of AC coefficients with channel numbers 1, 5, and 6, and G{i,j}, j∈[1,3] represents the jth coefficient channel in the Gi group.
[0120] Column Grouping
[0121] After row grouping, each AC channel G{i,j} is further split into 4 sub-coefficient blocks, as Figure 5 For G{i,j}, coefficients with the same sign are packed into the same sub-coefficient block S n =G{i,j,l},n∈[1,252],l∈{a,b,c,d}. The sub-coefficient block index n is determined by the three-dimensional coordinates (group, channel, position), denoted as (i,j,l). In the present invention, the horizontal AC coefficients representing the vertical pixel texture are packed in the order p{0}→p{2}→p{3}→p{1}, because the correlation is stronger in the vertical direction, and so on.
[0122] Arithmetic Coding
[0123] The present invention uses torchac pytorch library to implement arithmetic coding. It receives the cumulative probability distribution CDF of the current sub-coefficient block derived from the probability distribution matrix p′ and the true value symbol of the sub-coefficient block, and outputs a 0-1 bit stream:
[0124] Bitstream=torchac.encode(cdf,symbol)
[0125] Through this series of operations, the method of the present invention can efficiently transform high-resolution 2D medical images, accurately predict the distribution of coefficients through neural networks, and effectively improve the compression performance in combination with arithmetic encoders.
[0126] decoding
[0127] The decoding process is the inverse process of the encoding process, specifically:
[0128] First, JPEGXL decodes the DC coefficient, and run-length encoding decodes the error r and the MSB part of the AC coefficient;
[0129] The DC coefficient is input into the probability estimation model Φ to predict the probability distribution matrix p0 of the first sub-coefficient S0, and p0 is input into the arithmetic decoder torchac to decode the first sub-coefficient block S0;
[0130] S0 is used as the prior for the subsequent sub-coefficient blocks, and the probability estimation model Φ is input to predict the probability distribution matrix p′1 of the second sub-coefficient S1. Gradually, all 252 sub-coefficient blocks are decoded sequentially according to the predefined dependency relationship;
[0131] The sub-coefficient blocks are combined into the original LSB by reverse operation according to the order of row and column grouping;
[0132] The LSB and the MSB of run-length decoding are combined into AC coefficients through linear mapping and inverse operation of decomposition module;
[0133] The AC coefficients and DC coefficients are recombined and arranged, and transformed back to the pixel domain through I-DCT, which is recorded as X'. The final decoded lossless reconstruction is: Rec = X' + R.
[0134] Based on the large-scale spatial similarity characteristics of medical images, the present invention utilizes the traditional discrete cosine DCT transform to transform them into the frequency domain to reduce the spatial redundancy of pixels, utilizes the powerful probabilistic modeling ability of deep neural networks to estimate the probability distribution of frequency domain coefficients, and combines an arithmetic encoder to losslessly encode and decode medical images. Ultimately, the method adopted by the present invention obtains a codec with an ultra-high compression rate compared to similar methods in the prior art, and has comparable performance in terms of the number of model parameters and encoding and decoding speed.
[0135] An embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above method are executed. An embodiment of the present invention further discloses a computer device, including a memory and a processor connected to each other, on which a computer program is stored, and when the computer program is executed by the processor, the steps of the above method are executed.
[0136] The present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by hardware related to computer program instructions. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned method embodiment when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. Computer-readable storage media include: any entity or device that can carry computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium. The memory is used to store computer programs and / or modules, and the processor implements various functions by running or executing computer programs and / or modules stored in the memory, and calling data stored in the memory. The memory may include high-speed random access memory and may also include non-volatile memory, such as a hard disk, an internal memory, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0137] The above are only preferred embodiments of the present invention, and the protection scope of the present invention is not limited to the above embodiments. All technical solutions under the concept of the present invention belong to the protection scope of the present invention. It should be pointed out that for ordinary technicians in this technical field, some improvements and modifications without departing from the principle of the present invention should be regarded as the protection scope of the present invention.
Claims
1. A medical image lossless compression method based on transform coding and deep learning, characterized in that: Includes steps: Step 1, perform DCT transformation and Round quantization on the input 2D medical image and split it into DC coefficients and AC coefficients; Step 2, compress the DC coefficient and the loss R caused by Round quantization; Step 3, decompose the AC coefficient into structure layer MSB and texture layer LSB; Step 4, decomposing the texture layer LSB into multiple sub-coefficient blocks; Step 5, construct a deep probability estimation model based on a convolutional neural network, perform group-based autoregressive probability density modeling, input multiple sub-coefficient blocks, and output the probability distribution matrix of each sub-coefficient block; Step 6: Combine the entropy arithmetic encoder and the probability distribution matrix to perform lossless encoding and decoding on each sub-coefficient block.
2. The medical image lossless compression method based on transform coding and deep learning according to claim 1, characterized in that: The specific process of step 1 is: Step 1.1: Perform 8x8 floating-point DCT transform on the input 2D medical image X to obtain DCT frequency domain coefficients, and perform hard quantization on the floating-point coefficients to obtain integer quantized DCT coefficients X. ′ ; Step 1.2, integer quantized DCT coefficients X ′ It is split into DC coefficients and AC coefficients in zigzag scanning order.
3. The medical image lossless compression method based on transform coding and deep learning according to claim 1, characterized in that: In step 2, the DC coefficient is compressed by the traditional encoder JPEGXL; the loss R caused by Round quantization is compressed by run-length coding.
4. The medical image lossless compression method based on transform coding and deep learning according to claim 1, 2 or 3, characterized in that: In step 3, the AC coefficients are decomposed into structure layer MSB and texture layer LSB by a linear mapping-decomposition model; Specifically, the linear mapping-decomposition model includes a linear mapping model and a linear decomposition model, and the linear mapping model is: Where C(i,j)) represents the AC coefficient at the spatial coordinate (i,j); The linear decomposition model is: X LSB =C(i,j)mod 256。 5. The medical image lossless compression method based on transform coding and deep learning according to claim 1, 2 or 3, characterized in that: The specific process of step 4 is: decomposing the texture layer LSB into multiple sub-coefficient blocks through a row-column grouping strategy; Step 4.1, row grouping: except for the DC coefficient, the texture detail part LSB of the 63 AC coefficients at the horizontal position, vertical position, and diagonal position is recorded as {ch i |i∈[1,63]}, grouped and rearranged according to the direction of texture change, divided into 21 groups, each with 3 coefficients; The coefficients in the horizontal direction are divided into group G1 = {ch1, ch5, ch6}, the coefficients in the vertical direction are divided into group G2 = {ch2, ch3, ch9}, and the coefficients in the oblique direction are divided into group G3 = {ch4, ch8, ch 11 }; Step 4.2, column grouping: on the basis of row grouping, a coefficient component in each group is further divided into 4 sub-coefficient blocks in terms of spatial position; specifically, a 2x2 sliding window is used, and a sliding step is performed with a step size of 2, and the coefficient points falling in the same position in the sliding window are packed into a sub-coefficient block each time, so each sub-coefficient block is represented as S g,r,c =S n , where g∈[1,21], r∈[1,3], c∈[1,4], n∈[1,252], the three-dimensional coordinates (g, r, c) are the group coordinates, row coordinates, and column coordinates, respectively, and n is the corresponding one-dimensional index after flattening.
6. The medical image lossless compression method based on transform coding and deep learning according to claim 5, characterized in that: In step 5, the deep probability estimation model Φ based on the convolutional neural network consists of a 3x3 convolution layer and a ReLu activation function, including a context feature fusion module CFM and a probability density distribution prediction module PMF; The CFM consists of a 64-channel convolutional layer and three residual convolutional blocks. Its input has two branches, namely the frequency domain context C f and spatial context C s , output the fused context features; the probability density distribution prediction module PMF consists of two 128-channel convolutional layers and ReLu activation functions, one 256-channel convolutional layer and a Softmax layer. Its input is the context features fused by CFM, and it outputs the current sub-coefficient block S g,r,c The probability distribution matrix p ′ θ (S g,r,c ).
7. The medical image lossless compression method based on transform coding and deep learning according to claim 6, characterized in that: The frequency domain context of the current sub-coefficient block Designed by row grouping; is the sub-coefficient block preceding the current group, G i,r< The frequency domain context C is the block whose row coordinates in the current group are smaller than the current block. f The impact on the probability modeling of the current sub-coefficient block is expressed as:
8. The medical image lossless compression method based on transform coding and deep learning according to claim 7, characterized in that: The spatial context C of the current sub-coefficient block s =G i,r,c< Designed by column grouping; G i,r,c< is the sub-coefficient block in the current group whose row coordinates are equal to the current block but whose column coordinates are smaller than the current block, denoted as G i,r,c< , combined with the frequency domain context described in claim 7, the complete probabilistic modeling is expressed as: Output the probability of each point in the current sub-coefficient block being in the range [0,255], the probability matrix p ′ With the current sub-coefficient block S g,r,c The true value of Calculate the cross entropy loss, expressed as: L θ =Cross_entropy(p ′ (S g,r,c, ),S g,r,c ) Among them, the parameter θ of the probability estimation model Φ is updated by optimizing the above loss function through the Adam optimizer; The probability estimation model Φ outputs the probability matrix p for each possible symbol of the current sub-coefficient block ′ , p ′ Combined with the arithmetic encoder, each coefficient is encoded as a 01 bit stream.
9. The medical image lossless compression method based on transform coding and deep learning according to claim 6, characterized in that: In step 6, during decoding, the bitstream is passed through the probability distribution matrix p predicted by the probability estimation model Φ ′ , combined with the arithmetic decoder, each sub-coefficient block is losslessly decoded, and all sub-coefficient blocks are then transformed into the original AC coefficients by the linear inverse transform and merging module at the decoding end, specifically including: The DC coefficient is obtained by JPEGXL decoding, and the run-length encoding decodes the error R and the MSB part of the AC coefficient; The DC coefficient is input into the probability estimation model Φ to predict the probability distribution matrix p of the first sub-coefficient S0. ′ 0, input arithmetic decoder torchac to decode the first sub-coefficient block S0; S0 is used as the prior for the subsequent sub-coefficient block, and the input probability estimation model Φ predicts the probability distribution matrix p of the second sub-coefficient S1 ′ 1. Gradually, according to the predefined dependencies, all 252 sub-coefficient blocks are decoded sequentially; The sub-coefficient blocks are inversely operated in the order of row-column grouping and merged into the original LSB; The LSB and the MSB of run-length decoding are combined into AC coefficients through linear mapping and inverse operation of decomposition module; The AC coefficients and DC coefficients are recombined and arranged, and transformed back to the pixel domain through I-DCT, denoted as X ′ , the final decoded lossless reconstruction is: Rec = X ′ +R.
10. A medical image lossless compression system based on transform coding and deep learning, comprising a memory and a processor connected to each other, wherein a computer program is stored on the memory, characterized in that: When the computer program is executed by a processor, the computer program performs the steps of the method according to any one of claims 1 to 9.
Citation Information
Patent Citations
JPEG image lossless compression and decompression method, system and device
CN113810693A
Entropy coding / decoding method and device
CN114339262A
Methods And Apparatuses For Learned Image Compression
US20200160565A1
Method and system for context-based adaptive binary arithmetic coding
WO2003027940A1
Image compression method and apparatus
WO2020057182A1
Cited By
Video packet loss repair method based on image odd-even row / column recombination and block coding
CN120434409A
Image compression method and device, computer equipment and computer readable storage medium
CN121099053A