Medical image selective encryption method based on dicom information generating key
By using a key generation method based on DICOM information, only the region of interest in medical images is encrypted. By generating a key stream using DICOM files and combining index scrambling and two-dimensional diffusion techniques, the problems of low encryption efficiency and insufficient security in existing technologies are solved, achieving efficient and secure medical image encryption.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHANGCHUN UNIV OF SCI & TECH
- Filing Date
- 2022-04-29
- Publication Date
- 2026-05-19
AI Technical Summary
Existing medical image encryption technologies are inefficient, cannot effectively resist known-plaintext and chosen-plaintext attacks, and full-image encryption wastes resources and cannot efficiently protect the privacy information of areas of interest.
The method for generating keys based on DICOM information uses adaptive threshold segmentation and chaotic encryption techniques to encrypt only the region of interest in medical images. It generates a key stream using data information from the DICOM file and combines index scrambling and two-dimensional bidirectional diffusion techniques to improve encryption efficiency and security.
It improves the efficiency and security of medical image encryption, with a high correlation between plaintext and ciphertext, enhancing protection of regions of interest and resisting known-plaintext and chosen-plaintext attacks.
Smart Images

Figure CN114978464B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image encryption technology, specifically to a chaotic encryption method for regions of interest in medical images based on DICOM (Digital Imaging and Communications in Medicine) information to generate keys. Background Technology
[0002] With the rapid development of information and internet technologies, a large amount of information needs to be transmitted over the internet, thus information security has received widespread attention. Digital images, as important data content for multimedia transmission, contain a large amount of visualized private information, making secure transmission over public channels and reliable storage in cloud environments difficult to guarantee. Medical images, as a special type of image, differ from ordinary digital images, carrying vital information closely related to patients' lives. They have high resolution, large storage space, and large data volume. Due to the high sensitivity and privacy of medical images, their theft and dissemination will have adverse effects on individual patients, hospitals, and society. Medical image data is large in volume and number. Existing encryption technologies generally encrypt the entire medical image, but only a portion of a medical image is meaningful. Full encryption would waste resources and reduce efficiency. Therefore, we selectively encrypt the regions of interest (ROIs) of medical images, combining adaptive threshold segmentation with medical image encryption to encrypt only the ROIs, thus improving encryption efficiency. To enhance transmission security, unlike other encryption technologies, we use data information from the medical file's DICOM file for key stream generation, greatly improving plaintext correlation. Summary of the Invention
[0003] To address the problems of low encryption efficiency and inability to resist known-plaintext and chosen-plaintext attacks in existing medical image encryption technologies, this invention provides a medical image selective encryption method based on DICOM information-generated keys.
[0004] A medical image selection encryption method based on DICOM information key generation, which is implemented by the following steps:
[0005] Step 1: Take a grayscale medical image of size M×N as the original image Image;
[0006] Step 2: Generate an initial key sequence A of length T using a random number generator; T>M×N;
[0007] Step 3: Discard the first 10,000 elements of A to obtain the control key sequence B. Select the first x elements from B, denoted as b1, b2, ..., bx. x ;
[0008] Step 4: Perform floor and remainder operations on b1, b2, …, b x to obtain an element sequence b1′, b2′, ……, b x ′, and use the element sequence b1′, b2′, ……, b x ′ as the control pointer for DICOM tag information selection; and select the corresponding tag information d1, d2, …, dx;
[0009] Perform a hashing operation on d1, d2, ……, dx using a hashing algorithm to obtain a hash value string d1 hash , d2 hash , ……, dx hash ;
[0010] Convert d1 hash , d2 hash , ……, dx hash to a binary hash value string: d1 (2) hash , d2 (2) hash , …, dx (2) hash ;
[0011] Step 5: Convert the control key sequence B in Step 3 to a binary sequence B (2) , and intercept B (2) x times with a step size of L to obtain x tag ciphertext sequences with a length of L
[0012] Step 6: Encrypt the binary hash value string in Step 4 to obtain tag ciphertexts C1, C2, ……, C x ,
[0013] Divide each of the tag ciphertexts C1, C2, ……, C x into y groups, and y < L, with the length of each group sequence being L / y, and perform folding encryption on the group elements according to the following method:
[0014]
[0015] In the formula, represents the exclusive OR operation, C 11 , C 12 , …… C xy is the result after group segmentation;
[0016] Calculate the obtained key1, key2, key3, key4, key5, and key6 to obtain the control parameters u0, u1, and u2 for the encryption process, and the initial values x0, x1, and x2; the calculation formula is as follows:
[0017]
[0018]
[0019] In the formula, key(1:), key(2:), key(3:), key(4:), key(5:), and key(6:) are all the elements in the first, second, third, fourth, fifth, and sixth rows, respectively;
[0020] Step 7: Calculate the region of interest segmentation of the original image Image and obtain the region of interest segmentation threshold t;
[0021] The original image Image is divided into n×n image blocks B. s , together Image blocks, Where n is the size of the image block divided by the user according to their needs; calculate image block B. s The average grayscale value of all pixels within
[0022] Step 8: Determine the region of interest. The specific method is as follows:
[0023] when When, then the image block B s Region of Interest (ROI) r Set the corresponding region of interest flag. =1;
[0024] when When, then the image block B s For regions of interest (ROBs), set the corresponding region of interest flag. =0;
[0025] in This is the flag bit for the corresponding s-th region of interest, where r is the region of interest number in the image, r = 1, 2, ..., sum(ROI), and sum(ROI) is the number of all image patches in the image that are identified as regions of interest;
[0026] Step 9: Analyze the ROI r The pixels in the region are rearranged to transform it into a one-dimensional sequence of interest (ROI) of length (n×n)×sum(ROI). 1D ;
[0027] Step 10: Substitute the control parameter u1 and the initial value x1 from Step 6 into the random number generator from Step 2, iterate M×N+1000 times, and obtain the chaotic sequence A1;
[0028] Substitute the control parameters u2, u3 and the initial values x2, x3 into the random number generator in step two, iterate 2×M×N+1000 times, and obtain the chaotic sequence A2.
[0029] Step 11: Discard the first 1000 random numbers of the chaotic sequence A1, and select (n×n)×sum(ROI) random numbers starting from 1001 as the scrambled sequence Q1;
[0030] Discard the chaotic sequence A2 and the first 1000 random numbers of A2, and select (n×n)×sum(ROI) random numbers starting from 1001 as the diffusion sequence Q2 and Q3;
[0031] Step 12: Calculate the diffusion sequences Q2 and Q3 from Step 20 to obtain the diffusion key streams K1 and K2; and divide the diffusion key stream K1 into two chaotic sequences K, each of length M×N. 11 ,K 12 ;
[0032] The diffused key stream K2 is divided into two chaotic sequences K, each of length M×N. 21 ,K 22 ;
[0033] For the chaotic sequence K respectively 11 K 12 ,K 21 ,K 22 Perform the truncation to obtain four segments of length 1. The chaotic sequence D1, D2, D3, D4;
[0034] Step 13: Transform the chaotic sequence D1, D2, D3, D4 to obtain a sequence of size... The diffusion key matrix P1, P2, P3, P4;
[0035] Step Fourteen: Sort the scrambled sequence Q1 described in Step Eleven in ascending order and record the index values to form an index sequence T; then sort the one-dimensional sequence of interest (ROI) described in Step Nine... 1D The scrambling process yields the scrambled one-dimensional sequence CROI. 1D ;
[0036] Step 15: The scrambled one-dimensional sequence CROI 1D Transform it to obtain a scrambled matrix CROI of size sum(ROI)×(n×n);
[0037] The scrambled matrix sequence CROI is subjected to top-down modulo row diffusion with the diffusion key matrix P1 from step thirteen to obtain the first diffused matrix E1.
[0038] The matrix E1 and the diffusion key matrix P2 are subjected to modulo column diffusion from left to right to obtain the matrix E2 after the second diffusion.
[0039] The matrix E2 and the diffusion key matrix P3 are subjected to a bottom-up modulo row diffusion to obtain the matrix E3 after the third diffusion.
[0040] The matrix E3 and the diffusion key matrix P4 are subjected to right-to-left modulo column diffusion to obtain the final 16-bit unsigned integer region of interest ciphertext matrix EnROI;
[0041] Step 16: Configure the 16-bit unsigned integer region of interest (EnROI) ciphertext matrix according to the region of interest flags in Step 8. Replace the positions of the elements that are 1 to obtain the final ciphertext image EnImg.
[0042] The beneficial effects of this invention are as follows: The medical image selection encryption method based on DICOM information key generation proposed in this invention generates an encryption key using patient information in the DICOM file during the key generation stage, making the plaintext and ciphertext highly correlated, which greatly improves the security of the ciphertext. The key generated by this generation model is used to encrypt the region of interest in the medical image. The encryption stage adopts index scrambling and two-dimensional bidirectional diffusion, which improves the encryption efficiency of medical images while ensuring image security. Attached Figure Description
[0043] Figure 1 This is a flowchart of the encryption process of the medical image selection encryption method based on DICOM information to generate a key, as described in this invention.
[0044] Figure 2 This is a flowchart of the decryption process in the medical image selection encryption method based on DICOM information key generation as described in this invention;
[0045] Figure 3 The diagram shows the effect of using the medical image selection encryption method based on DICOM information to generate keys as described in this invention: [Diagram showing the effect of using this method] Figure 3 (a) is the original image of the "abdominal cavity"; in which Figure 3 (b) is the encrypted result of the "abdominal cavity" image; where Figure 3 (c) is the final decryption result of the "abdominal cavity" image.
[0046] Figure 4Histogram analysis of the medical image selection encryption method based on DICOM information key generation described in this invention: where Figure 4 (a) is Figure 3 (a) Histogram, where Figure 4 (b) is Figure 3 (b) Histogram, where Figure 4 (c) is Figure 3 (c) Histogram. Detailed Implementation
[0047] Specific Implementation Method 1: Combination Figure 1 This embodiment describes a medical image selection encryption method based on DICOM information to generate a key. The method is implemented through the following steps:
[0048] Step 1: Take a grayscale medical image of size M×N as the original image Image;
[0049] Step 2: Use a random number generator to generate an initial key sequence A of length T (T>M×N);
[0050] Step 3: Discard the first 10,000 elements of A to obtain the control key sequence B. Select the first x elements from B and denote them as b1, b2, ..., b x ;
[0051] Step 4: For b1, b2, ..., b x Performing the operation of formula (1), we obtain b1′, b2′, ..., b x ′;
[0052]
[0053] Where R represents the total number of DICOM tag information in the medical document, and b1′, b2′, ..., b x 'Serves as a control pointer for selecting DICOM tag information;
[0054] Step 5: Use b1′, b2′, ..., b from Step 4. x Select the corresponding label information d1, d2, ..., dx from the DICOM labels;
[0055]
[0056] Step 6: Use the hash algorithm to perform the operation shown in formula (3) on d1, d2, ..., dx to obtain the hash value string d1. hash ,d2 hash ,……,dx hash ;
[0057]
[0058] Step Seven: Convert d1 hash , d2 hash , ……, dx hash into binary strings: d1 (2) hash , d2 (2) hash , …, dx (2) hash ;
[0059] Step Eight: Convert the control key sequence B in Step Three into a binary sequence B (2) , and intercept B (2) x times with L as the step length to obtain x tag ciphertext sequences with a length of L
[0060] Step Nine: Encrypt the binary hash value string in Step Seven to obtain tag ciphertexts C1, C2, ……, C x , as shown in Formula (4):
[0061]
[0062] where bitxor() represents the exclusive OR operation;
[0063] Step Ten: Divide each ciphertext sequence of C1, C2, ……, C x into y groups, and y < L, the length of each group sequence is L / y, and the folding encryption is performed on the group elements by the method shown in Formula (5):
[0064]
[0065] where represents the exclusive OR operation, C 11 , C 12 , …… C xy is the result after group segmentation;
[0066] Step Eleven: Perform operations according to the obtained key1, key2, key3, key4, key5, key6 using Formulas (6) and (7) to obtain the control parameters u0, u1, u2, and the initial values x0, x1, x2 required in the subsequent encryption process;
[0067]
[0068]
[0069] Step Twelve: Calculate the region of interest segmentation threshold of the original medical image Image to obtain the region of interest segmentation threshold t;
[0070] Step 13: Divide the original medical image Image into image blocks B of size n×n. s , together Image blocks, Where n is the size of the image blocks that the user divides according to their needs;
[0071] Step 14: Calculate the image block B described in Step 13 according to formula (8). s The average grayscale value of all pixels within
[0072]
[0073] Where mean2() represents the matrix mean function;
[0074] Step 15: The method for determining the region of interest is as follows:
[0075] when When, then the image block B s Region of Interest (ROI) r Set the corresponding region of interest flag. =1;
[0076] when When, then the image block B s For regions of interest (ROBs), set the corresponding region of interest flag. =0;
[0077] in This is the flag bit for the corresponding s-th region of interest, where r is the region of interest number in the image, r = 1, 2, ..., sum(ROI), and sum(ROI) is the number of all image patches in the image that are identified as regions of interest;
[0078] Step 16: Calculate the ROI r The pixels in the region are rearranged to transform it into a one-dimensional sequence of interest (ROI) of length (n×n)×sum(ROI). 1D ;
[0079] ROI 1D =reshape(ROI) r ,1,(n×n)×sum(ROI)) (9)
[0080] Here, reshape() represents the matrix transformation operation.
[0081] Step 17: Substitute the control parameter u1 and initial value x1 from Step 11 into the random number generator from Step 2, iterate M×N+1000 times, and obtain the chaotic sequence A1.
[0082] Step 18: Substitute the control parameters u2, u3 and the initial values x2, x3 from Step 11 into the random number generator in Step 2, and iterate 2×M×N+1000 times to obtain the chaotic sequence A2, A2.
[0083] Step 19: Discard the first 1000 random numbers of the chaotic sequence A1 described in Step 17, and select (n×n)×sum(ROI) random numbers starting from 1001 as the scrambled sequence Q1;
[0084] Step 20: Discard the diffusion sequence A2 described in Step 18. The first 1000 random numbers of A2 are selected from 1001 as (n×n)×sum(ROI) random numbers as diffusion sequences Q2 and Q3.
[0085] Step 21: Perform the operations shown in formulas (10) and (11) on the chaotic sequences Q2 and Q3 from step 20 to obtain the diffused key streams K1 and K2:
[0086] K1 = int16(mod(floor(A3×10). 9 ),65536) (10)
[0087] K2 = int16(mod(floor(A4×10). 9 ),65536) (11)
[0088] Step 22: The diffusion key stream K1 described in step 21 is divided into two chaotic sequences K of length M×N. 11 ,K 12 ;
[0089] Step 23: The diffusion key stream K2 described in Step 21 is divided into two chaotic sequences K of length M×N. 21 ,K 22 ;
[0090] Step 24: For the chaotic sequence K respectively 11 K 12 ,K 21 ,K 22 After truncating, we get 4 segments of length (n×n)× The chaotic sequence D1, D2, D3, D4;
[0091] Step 25: Transform the chaotic sequence D1, D2, D3, D4 to obtain a sequence of size... The diffusion key matrix P1, P2, P3, P4;
[0092]
[0093]
[0094]
[0095]
[0096] Step 26: Sort the scrambled sequence Q1 from step 19 in ascending order according to the method shown in formula (14), and record the index values to form the index sequence T;
[0097] [Q1 sorted ,T]=sort(Q1) (16)
[0098] Where sort() represents the sorting function, Q1 sorted Let T represent the sequence Q1 sorted in ascending order. sorted The position information of the value in Q1;
[0099] Step 27: The one-dimensional ROI sequence described in Step 16... 1D The index sequence T obtained according to formula (16) is scrambled to obtain the scrambled one-dimensional sequence CROI. 1D The scrambling formula is as follows:
[0100] CROI 1D =ROI 1D (T) (17)
[0101] Step 28: The scrambled one-dimensional sequence CROI obtained in Step 27... 1D After transformation, we obtain a matrix CROI of size sum(ROI)×(n×n);
[0102] CROI = reshape(CROI) 1D ,n×n,sum(ROI)) (18)
[0103] Step 29: Perform top-down modulo row diffusion on the scrambled matrix sequence CROI and the diffusion key matrix P1 to obtain the first diffused matrix E1;
[0104] E1(1,:)=mod(E1(0)+P1(1,:)+CROI 1D (1,:),65536) (19)
[0105] E1(i,:)=mod(E1(i-1,:)+P1(i,:)+CROI 1D (i,:),65536) (20)
[0106] Where i = 2, 3, ..., n×n;
[0107] Step 30: Perform modulo column diffusion from left to right on matrix E1 and diffusion key matrix P2 to obtain matrix E2 after the second diffusion.
[0108] E2(:,1)=mod(E2(0)+P2(:,1)+E1(:,1),65536) (21)
[0109] E2(:,j)=mod(E2(:,j-1)+P2(:,j)+E1(:,j),65536) (22)
[0110] Where j = 2, 3, ..., sum(ROI);
[0111] Step 31: Perform a bottom-up modulo row diffusion on matrix E2 and diffusion key matrix P3 to obtain matrix E3 after the third diffusion;
[0112] E3(n×n,:)=mod(E3(0)+P3(n×n,:)+E2(n×n,:),65536) (23)
[0113] E3(i:)=mod(E3(i+1,:)+P3(i,:)+E2(i,:),65536) (24)
[0114] Where i = n × n - 1, ..., 1;
[0115] Step 32: Perform right-to-left modulo column diffusion on matrix E3 and diffusion key matrix P4 to obtain the final ciphertext matrix EnROI;
[0116] EnROI(:,sum(ROI))=mod(EnROI(0)+P4(:,sum(ROI))+D(:,sum(ROI)),65536) (25)
[0118] EnROI(:,j)=mod(En_ROI(:,j+1)+P4(:,j)+E3(:,j),65536) (26)
[0119] Where j = sum(ROI)-1,……,2,1;
[0120] Step 33: Determine the 16-bit unsigned integer region of interest (EnROI) ciphertext described in Step 32 as the region of interest flag bit according to the procedure described in Step 14. Replace the elements that are 1 to obtain the final encrypted image EnImg.
[0121] Combination Figure 2This embodiment describes a decryption method, the decryption process of which is as follows:
[0122] Step 34: Segment the ciphertext image EnImg using the region of interest threshold t from the encryption process;
[0123] Step 35: Divide the encrypted image EnImg into image blocks B2 of size n×n. s , total There are 1 image block B2, where s is the image block B2. s The number,
[0124] Step 36: Calculate the image block B2 mentioned in step 32 according to formula (27). s The average grayscale value of all pixels within
[0125]
[0126] Where mean2() represents the matrix mean function;
[0127] Step 37: Determine the encrypted region of the encrypted image. The determination method is as follows:
[0128] when When, then the image block B2 s EnROI is an encrypted region z Set the corresponding encryption region flag EnROI. z =1;
[0129] when When, then the image block B2 s This is an unencrypted area. Set the corresponding encrypted area flag (EnROI). z =0;
[0130] Where t is the region of interest threshold during the encryption process, and k is the image encryption region number. EnROI z For the corresponding Z-th encrypted region, sum(EnROI) z ) represents the number of all image blocks in EnImg that were identified as encrypted regions;
[0131] Step 38: encrypt the Z regions EnROI described in Step 37. z Perform matrix rearrangement, transforming it into a matrix of size (n×n)×sum(EnROI). z The encrypted region sequence En_ROI;
[0132] En_ROI = reshape(EnROI) z,sum(EnROI z ),n×n) (28)
[0133] Step 39: Perform a reverse diffusion operation on the diffusion key matrix P4 described in step 25 and the encrypted region of interest En_ROI to obtain the reverse diffusion matrix de_E3.
[0134] de_E3(:,sum(EnROI z ))=
[0135] mod(En_ROI(:,sum(EnROI z ))-En_ROI(0)-P4(:,sum(EnROI z ),65536) (29)
[0137] de_E3(:,j)=mod(En_ROI(:,j)-En_ROI(:,j+1)-P4(:,j),65536) (30)
[0138] Where j = sum(EnROI) z -1, ..., 2, 1;
[0139] Step 40: Perform an inverse diffusion operation on the diffusion key matrix P3 and de_E3 described in step 25 to obtain the inverse diffusion matrix de_E2.
[0140] de_E2(n×n,:)=mod(de_E3(n×n,:)-de_E3(0)-P3(n×n,:),65536) (31)
[0141] de_E2(i,:)=mod(de_E3(i,:)-de_E3(i+1,:)-P3(i,:),65536) (32)
[0142] Where i = n × n - 1, ..., 2, 1;
[0143] Step 41: Perform an inverse diffusion operation on the diffusion key matrix P2 and de_E2 described in step 25 to obtain the inverse diffusion matrix de_E1;
[0144] de_E1(:,sum(EnROI z ))=
[0145] mod(de_E2(:,sum(EnROI z ))-de_E2(0)-P2(:,sum(EnROI z ),65536) (33)
[0147] de_E1(:,j)=mod(de_E2(:,j)-de_E2(:,j-1)-P2(:,j),65536) (34)
[0148] Where j = 2, 3, ..., sum(EnROI) z );
[0149] Step 42: Perform a reverse diffusion operation on the diffusion key matrix P1 and de_E1 described in Step 25 to obtain the scrambled matrix de_CROI. 1D ;
[0150] de_CROI 1D (1,:)=mod(de_E1(1,:)-de_E1(0,:)-P1(1,:),65536) (35)
[0151] de_CROI 1D (i,:)=mod(de_E1(i,:)-de_E1(i-1,:)-P1(i,:),65536) (36)
[0152] Where i = 1, 2, ..., n × n - 1;
[0153] Step 43: Use the scrambled random number sequence Q1 described in Step 19 as the decryption scrambled sequence de_Q1;
[0154] [de_Q1 sorted ,DT1]=sort(De_Q1) (37)
[0155] Where sort() represents the sorting function, de_Q1 sorted DT1 represents the sequence after de_Q1 is sorted in ascending order. sorted The position information of the value in De_Q1;
[0156] Step 44: The scrambled de_CROI described in Step 42... 1D The index value DT1 described in step 43 is reverse-scrambled using formula (36) to obtain a one-dimensional reverse-scrambled decryption sequence De_ROI;
[0157] de_C1D ROI (DT1) = De_ROI (38)
[0158] Step 45: Convert the matrix pixels of the region of interest sequence De_ROI from 16-bit unsigned integers to 8-bit unsigned integers;
[0159] Step 46: Determine the encrypted region of interest (ROI) plaintext De_ROI′ (8-bit unsigned integer) as the EnROI_flag bit according to the steps described in Step 23. s Replace the block position that is 1 to obtain the final decrypted image DeImg.
[0160] Specific Implementation Method Two: Combination Figures 1 to 4 This embodiment describes a medical image selection encryption method based on DICOM information key generation as described in Specific Embodiment 1. The specific process is as follows:
[0161] Step 1: Take a grayscale medical image with a size of 512×512 as the original image Image;
[0162] Step 2: Use a random number generator, logistic chaotic mapping, to generate an initial key sequence A of length T (T>512×512);
[0163] x n+1 =μ(1-x n )x n (1)
[0164] Where μ = 3.89, x0 = 0.23;
[0165] Step 3: Discard the first 10,000 elements of A to obtain the control key sequence B. Select the first 6 elements of B and denote them as b1, b2, b3, b4, b5, b6.
[0166] Step 4: Perform the operation of formula (2) on b1, b2, b3, b4, b5, b6 to obtain b1′, b2′, b3′, b4′, b5′, b6′;
[0167]
[0168] Where R represents the total number of DICOM tag information in the medical document, and b1′, b2′, b3′, b4′, b5′, b6′ are used as control pointers for selecting DICOM tag information;
[0169] Step 5: Use b1′, b2′, b3′, b4′, b5′, b6′ from Step 4 to select the corresponding tag information d1, d2, d3, d4, d5, d6 from the DICOM tags;
[0170]
[0171] Step Six: Select the SHA-512 hash algorithm and perform operations on d1, d2, d3, d4, d5, and d6 respectively to obtain a 128-bit hexadecimal hash value string. Record this hash value as d1.hash ,d2 hash ,d3 hash ,d4 hash ,d5 hash ,d6 hash ,
[0172]
[0173] Step 7: d1 hash ,d2 hash ,d3 hash ,d4 hash ,d5 hash ,d6 hash Convert each hexadecimal number to binary. Since one hexadecimal number equals four binary numbers, the string length becomes 512, resulting in six binary sequences:
[0174] Step 8: Convert the chaotic sequence B from decimal to binary. For the chaotic sequence B, truncate it every 512 bits, for a total of six truncations, resulting in six binary chaotic sequences of length 512, denoted as […].
[0175] Step 9: Encrypt the binary hash value string from Step 7 to obtain the tag ciphertext C1, C2, C3, C4, C5, C6 as shown in Formula (5):
[0176]
[0177] Here, bitxor() represents the XOR operation;
[0178] Step 10: Divide each ciphertext sequence C1, C2, C3, C4, C5, and C6 into 32 groups, each group having a length of 16. Perform folding encryption on the elements of each group as shown in formula (6), and convert the encryption result from binary to decimal.
[0179]
[0180] in Represents the XOR operation, C 1,1 C 1,2 ,……,C 1,32 The result after grouping into segments;
[0181] Step 11: Based on the obtained key1, key2, key3, key4, key5, key6, perform the operations of formulas (7) and (8) to obtain the control parameters u0, u1, u2 and the initial values x0, x1, x2 required in the subsequent encryption process;
[0182]
[0183]
[0184] Where u1 = 3.74, u2 = 3.99, u3 = 3.69, x1 = 0.32, x2 = 0.28, x3 = 0.19.
[0185] Step 12: Calculate the region of interest segmentation threshold of the original medical image Image, and obtain the region of interest segmentation threshold t = 66;
[0186] Step 13: Divide the original medical image Image into 4×4 image blocks B. s A total of 4,194,304 image blocks were obtained.
[0187] Step 14: Calculate the image block B described in Step 13 according to formula (8). s The average grayscale value of all pixels within
[0188]
[0189] Where mean2() represents the matrix mean function;
[0190] Step 15: The method for determining the region of interest is as follows:
[0191] when Then the image block B s Region of Interest (ROI) r Set the corresponding region of interest flag. =1;
[0192] when Then the image block B s For regions of interest (ROBs), set the corresponding region of interest flag. =0;
[0193] in This is the flag bit for the corresponding s-th region of interest, where r is the region of interest number in the image, and r = 1, 2, ..., 8146 is the number of all image blocks in the image that are identified as regions of interest;
[0194] Step 16: Rearrange the pixels in the ROI region to transform it into a one-dimensional sequence ROI of length 130336. 1D ;
[0195] ROI 1D =reshape(ROI,1,130336) (10)
[0196] Step 17: Substitute the control parameter u1 and the initial value x1 from Step 11 into the random number generator in Step 2, and iterate 512×512+1000 times to obtain the chaotic sequence A1;
[0197] Step 18: Substitute the control parameters u2, u3 and the initial values x2, x3 from Step 11 into the random number generator in Step 2, and iterate 2×512×512+1000 times to obtain the chaotic sequence A2, A3;
[0198] Step 19: Discard the first 1000 random numbers of the chaotic sequence A1 described in Step 17, and select 130336 random numbers starting from 1001 as the scrambled sequence Q1;
[0199] Step 20: Discard the diffusion sequence A2 described in Step 18. The first 1000 random numbers of A2 are selected from 1001 to form the diffusion sequence Q2 and Q3.
[0200] Step 21: Perform the operations shown in formulas (11) and (12) on the chaotic sequences Q2 and Q3 from step 20 to obtain the diffused key streams K1 and K2:
[0201] K1 = int16(mod(floor(A3×10). 9 ),65536) (11)
[0202] K2 = int16(mod(floor(A4×10). 9 ),65536) (12)
[0203] Step 22: Divide the diffused key stream K1 described in Step 21 into two chaotic sequences K of length 512×512. 11 ,K 12 ;
[0204] Step 23: Divide the diffused key stream K2 described in Step 21 into two chaotic sequences K of length 512×512. 21 ,K 22 ;
[0205] Step 24: For the chaotic sequence K respectively 11 K 12 ,K 21 ,K 22 After truncation, four chaotic sequences D1, D2, D3, and D4 with a length of 16×130336 are obtained.
[0206] Step 25: Transform the chaotic sequence D1, D2, D3, D4 to obtain a diffusion key matrix P1, P2, P3, P4 with a size of 16×130336.
[0207] P1=reshape(K1,16,130336) (13)
[0208] P2=reshape(K2,16,130336) (14)
[0209] P3=reshape(K3,16,130336) (15)
[0210] P4=reshape(K4,16,130336) (16)
[0211] Step 26: Sort the scrambled sequence Q1 from step 19 in ascending order according to the method shown in formula (17), and record the index values to form the index sequence T;
[0212] [Q1 sorted ,T]=sort(Q1) (17)
[0213] Where sort() represents the sorting function, Q1 sorted Let T represent the sequence Q1 sorted in ascending order. sorted The position information of the value in Q1;
[0214] Step 27: The one-dimensional ROI sequence described in Step 16... 1D The index sequence T obtained according to formula (17) is scrambled to obtain the scrambled one-dimensional sequence CROI. 1D The scrambling formula is as follows:
[0215] CROI 1D =ROI 1D (T) (18)
[0216] Step 28: The scrambled one-dimensional sequence CROI obtained in Step 27... 1D After transformation, we obtain a matrix CROI of size sum(ROI)×(n×n);
[0217] CROI = reshape(CROI) 1D ,16,8146) (19)
[0218] Step 29: Perform top-down modulo row diffusion on the scrambled matrix sequence CROI and the diffusion key matrix P1 to obtain the first diffused matrix E1;
[0219] E1(0) = 107
[0220] E1(1,:)=mod(E1(0)+P1(1,:)+CROI 1D (1,:),65536) (20)
[0221] E1(i:)=mod(E1(i-1,:)+P1(i,:)+CROI 1D (i,:),65536) (21)
[0222] Where i = 2, 3, ..., 16; E1(1,:) represents all elements in the first row of E1;
[0223] Step 30: Perform modulo column diffusion from left to right on matrix E1 and diffusion key matrix P2 to obtain matrix E2 after the second diffusion.
[0224] E2(0)=122
[0225] E2(:,1)=mod(E2(0)+P2(:,1)+E1(:,1),65536) (22)
[0226] E2(:,j)=mod(E2(:,j-1)+P2(:,j)+E1(:,j),65536) (23)
[0227] Where j = 2, 3, ..., 8146; E2(:, 1) represents all elements in the first column of E2;
[0228] Step 31: Perform a bottom-up modulo row diffusion on matrix E2 and diffusion key matrix P3 to obtain matrix E3 after the third diffusion;
[0229] E3(0)=122
[0230] E3(16,:)=mod(E3(0)+P3(16,:)+E2(16,:),65536) (24)
[0231] E3(i:)=mod(E3(i+1,:)+P3(i,:)+E2(i,:),65536) (25)
[0232] Where i = 15, 14, ..., 1;
[0233] Step 32: Perform modulo row diffusion from right to left on matrix E3 and diffusion key matrix P4 to obtain the final ciphertext matrix EnROI;
[0234] EnROI(0) = 135
[0235] EnROI(:,8146)=mod(EnROI(0)+P4(:,8146)+D(:,8146),65536) (26)
[0236] EnROI(:,j)=mod(En_ROI(:,j+1)+P4(:,j)+E3(:,j),65536) (27)
[0237] Where j = 8145, ..., 2, 1;
[0238] Step 33: Determine the 16-bit unsigned integer region of interest (EnROI) ciphertext described in Step 32 as the region of interest flag bit according to the procedure described in Step 14. Replace the elements that are 1 to obtain the final encrypted image EnImg.
[0239] This embodiment also includes a decryption step, the specific process of which is as follows:
[0240] Step 34: Segment the ciphertext image EnImg using the region of interest threshold t from the encryption process;
[0241] Step 35: Divide the encrypted image EnImg into 4×4 image blocks B2. s A total of 4,194,304 image blocks were obtained, where s is image block B2. s The numbers are s = 1, 2, 3, ..., 4194304.
[0242] Step 36: Calculate the image block B2 mentioned in step 32 according to formula (28). s The average grayscale value of all pixels within
[0243]
[0244] Where mean2() represents the matrix mean function;
[0245] Step 37: Determine the encrypted region of the encrypted image. The determination method is as follows:
[0246] when When, then the image block B2 s EnROI is an encrypted region z Set the corresponding encryption region flag EnROI. z =1;
[0247] when When, then the image block B2 s This is an unencrypted area. Set the corresponding encrypted area flag (EnROI). z =0;
[0248] Where t is the region of interest threshold during the encryption process, and k is the image encryption region number, Z = 1, 2, ..., 8146. EnROI zFor the corresponding Z-th encrypted region, sum(EnROI) z ) represents the number of all image blocks in EnImg that were identified as encrypted regions;
[0249] Step 38: encrypt the Z regions EnROI described in Step 37. z Perform matrix rearrangement to transform it into an encrypted region sequence En_ROI with a size of 16×8146;
[0250] En_ROI = reshape(EnROI) z ,16,8146) (29)
[0251] Step 39: Perform a reverse diffusion operation on the diffusion key matrix P4 described in step 25 and the encrypted region of interest En_ROI to obtain the reverse diffusion matrix de_E3.
[0252] de_E3(:,8146)=mod(En_ROI(:,8146)-En_ROI(0)-P4(:,8146),65536) (30)
[0253] de_E3(:,j)=mod(En_ROI(:,j)-En_ROI(:,j+1)-P4(:,j),65536) (31)
[0254] Where j = 8145, ..., 2, 1;
[0255] Step 40: Perform an inverse diffusion operation on the diffusion key matrix P3 and de_E3 described in step 25 to obtain the inverse diffusion matrix de_E2.
[0256] de_E2(16,:)=mod(de_E3(16,:)-de_E3(0)-P3(16,:),65536) (32)
[0257] de_E2(i,:)=mod(de_E3(i,:)-de_E3(i+1,:)-P3(i,:),65536) (33)
[0258] Where i = 15, ..., 1;
[0259] Step 41: Perform an inverse diffusion operation on the diffusion key matrix P2 and de_E2 described in step 25 to obtain the inverse diffusion matrix de_E1;
[0260] de_E1(:,1)=mod(de_E2(:,1)-de_E2(0)-P2(:,1),65536) (34)
[0261] de_E1(:,j)=mod(de_E2(:,j)-de_E2(:,j-1)-P2(:,j),65536) (35)
[0262] Where j = 2, 3, ..., 8146;
[0263] Step 42: Perform a reverse diffusion operation on the diffusion key matrix P1 and de_E1 described in Step 25 to obtain the scrambled matrix de_CROI. 1D ;
[0264] de_CROI 1D (1,:)=mod(de_E1(1,:)-de_E1(0,:)-P1(1,:),65536) (36)
[0265] de_CROI 1D (i,:)=mod(de_E1(i,:)-de_E1(i-1,:)-P1(i,:),65536) (37)
[0266] Where i = 1, 2, ..., 15;
[0267] Step 43: Use the scrambled random number sequence Q1 described in Step 19 as the decryption scrambled sequence de_Q1;
[0268] [de_Q1 sorted ,DT1]=sort(De_Q1) (38)
[0269] Where sort() represents the sorting function, de_Q1 sorted DT1 represents the sequence after de_Q1 is sorted in ascending order. sorted The position information of the value in De_Q1;
[0270] Step 44: The scrambled de_CROI described in Step 42... 1D The index value DT1 described in step 43 is reverse-scrambled using formula (39) to obtain a one-dimensional reverse-scrambled decryption sequence De_ROI;
[0271] de_C1D ROI (DT1) = De_ROI (39)
[0272] Step 45: Convert the matrix pixels of the region of interest sequence De_ROI from 16-bit unsigned integers to 8-bit unsigned integers;
[0273] Step 46: Decrypt the 8-bit unsigned integer plaintext region of interest De_ROI′ and classify it as an encrypted region using the EnROI_flag flag. s Replace the block position that is 1 to obtain the final decrypted image DeImg.
[0274] Combination Figure 3 and Figure 4 ,in Figure 3 (a) is the original image of the "abdominal cavity"; in which Figure 3 (b) is the encrypted result of the "abdominal cavity" image; where Figure 3 (c) is the final decryption result of the "abdominal cavity" image. Figure 4 Histogram analysis of the medical image selection encryption method based on DICOM information key generation described in this embodiment, wherein... Figure 4 (a) is Figure 3 (a) Histogram, where Figure 4 (b) is Figure 3 (b) Histogram, where Figure 4 (c) is Figure 3 (c) Histogram. The horizontal axis represents pixel value; the vertical axis represents the number of pixels.
[0275] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0276] The embodiments described above are merely illustrative of several implementations of the present invention, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these all fall within the protection scope of the present invention. Therefore, the protection scope of this invention patent should be determined by the appended claims.
Claims
1. A medical image selective encryption method based on DICOM information-generated keys, which is implemented by the following steps: Step 1: Take the size as Grayscale medical images as the original images ; Step 2: Use a random number generator to generate a number of lengths... The initial key sequence A; ; Step 3: Discard the first 10,000 elements of A to obtain the control key sequence B, and select the first 10,000 elements from B. There are n elements, denoted as n. ; Step 4, for Perform floor and modulo operations to obtain the element sequence. The element sequence As The control pointer for selecting tag information; And select the corresponding tag information ; Use hash algorithm to Perform a hash operation to obtain the hash value string. ; Will Convert to binary hash value string: ; Step 5: Transfer the control key sequence from Step 3. Convert to binary sequence ,by For step size pair Total interception Next time, obtain A length of Tag ciphertext sequence ; Step 6: Encrypt the binary hash value string from Step 4 to obtain the ciphertext of the tag. , Encrypt the label Each ciphertext sequence is divided into Group, and L, the length of each sequence is... The group elements are folded and encrypted using the following method: ; In the formula, This represents the XOR operation. The result after grouping into segments; For the obtained Calculations are performed to obtain the control parameters during the encryption process. and initial value The calculation formula is as follows: ; ; In the formula, , These are all the elements in the first, second, third, fourth, fifth, and sixth rows, respectively. Step 7: Calculate the original image Region of interest segmentation, obtaining the region of interest segmentation threshold. ; The original image Divided into Image blocks , together Image blocks, Where n is the size of the image patch that the user divides according to their needs; calculate the image patch The average grayscale value of all pixels within ; Step 8: Determine the region of interest. The specific method is as follows: when When, then the image block Region of Interest Set the corresponding region of interest flag. =1; when When, then the image block Region of non-interest Set the corresponding region of interest flag. =0; in This is the flag bit for the corresponding s-th region of interest, where r is the region of interest number in the image. , This represents the number of image patches in the image that are identified as regions of interest. Step Nine, The pixels in the region are rearranged and transformed into a shape of length [length missing]. One-dimensional sequence of interest ; Step 10: Set the control parameters from Step 6 to... and initial value Substitute each number into the random number generator in step two and iterate. Next, obtain the chaotic sequence. ; Control parameters and initial value Substitute each number into the random number generator in step two and iterate. Next, obtain the chaotic sequence. ; Step 11: Discard the chaotic sequence. The first 1000 random numbers are selected starting from 1001. 1 random number as the scrambling sequence ; Discard the chaotic sequence , The first 1000 random numbers are selected starting from 1001. 1 random number as the diffusion sequence ; step 12. The diffusion sequence from step 20 Perform calculations to obtain the diffusion key stream. , ; and the diffusion key stream Divided into 2 lengths Chaotic sequence ; The diffusion key stream Divided into 2 lengths Chaotic sequence ; For chaotic sequences respectively Perform the truncation to obtain four segments of length 1. chaotic sequence ; Step 13: The chaotic sequence Perform deformation to obtain a size of diffusion key matrix ; Step Fourteen: Scramble the sequence described in Step Eleven. Sort in ascending order and record the index values to form an index sequence. ; The one-dimensional sequence of interest described in step nine The scrambled sequence is obtained by scrambling. ; Step 15: The scrambled one-dimensional sequence Perform deformation to obtain a size of The scrambled matrix ; The scrambled matrix sequence With the diffusion key matrix in step thirteen Perform top-down modulo row diffusion to obtain the matrix after the first diffusion. ; The matrix With diffusion key matrix Perform a left-to-right modulo column diffusion to obtain the matrix after the second diffusion. ; The matrix With diffusion key matrix Perform a bottom-up modulo row diffusion to obtain the matrix after the third diffusion. ; The matrix With diffusion key matrix A right-to-left modulo column diffusion is performed to obtain the final 16-bit unsigned integer region of interest ciphertext matrix. ; Step 16: Ciphertext matrix of the 16-bit unsigned integer region of interest According to the region of interest marker in step eight Replace the elements that are 1 to obtain the final ciphertext image. .
2. The medical image selection encryption method based on DICOM information key generation according to claim 1, characterized in that: It also includes the decryption process, and the specific decryption method is as follows: Step A: Use the region of interest threshold during the encryption process. For encrypted images Segmentation; that is: dividing the encrypted image Divided into Image blocks , total There are 3 image patches, where s is the image patch. The number, ; And calculate the image patch The average grayscale value of all pixels within ; Step B: Determine the encrypted region of the encrypted image. The determination method is as follows: when When, then the image block Encrypted area Set the corresponding encryption area flag. =1; when When, then the image block For unencrypted areas, set the corresponding encrypted area flag. =0; Where t is the region of interest threshold during the encryption process, and k is the image encryption region number. ,in This is the flag bit for the corresponding Z-th encrypted region. for The number of all image blocks identified as encrypted regions; Step C: Encrypt the Z regions Perform matrix rearrangement, transforming it into encrypted region of interest ; Step D: Diffusion key matrix With encrypted region of interest Perform an inverse diffusion operation to obtain the inverse diffusion matrix. ; The diffusion key matrix With the inverse diffusion matrix Perform an inverse diffusion operation to obtain the inverse diffusion matrix. ; The diffusion key matrix With the inverse diffusion matrix Perform an inverse diffusion operation to obtain the inverse diffusion matrix. ; The diffusion key matrix With the inverse diffusion matrix Perform a reverse diffusion operation to obtain the scrambled matrix. ; Step E: Scramble the random number sequence described in Step 11. As a decryption scrambling sequence It can be expressed as follows: ; In the formula, Represents the sorting function. express The sequence after ascending order. Indicates after sorting The value is in Location information within; Step F: The scrambled items described in step D... Location information as described in step E Perform inverse scrambling to obtain the sequence of regions of interest. ; Step G: Sequence of regions of interest The matrix pixels are converted from 16-bit unsigned integers to 8-bit unsigned integers; the decrypted 8-bit unsigned integer region of interest plaintext sequence is then used. As described in step B, it is identified as an encrypted region flag bit. Replace the block position that is 1 to obtain the final decrypted image. .
3. The medical image selection encryption method based on DICOM information key generation according to claim 1, characterized in that: In step nine, the one-dimensional sequence of interest This can be expressed as follows: ; Among them, reshape This represents a matrix transformation operation.
4. The medical image selection encryption method based on DICOM information key generation according to claim 1, characterized in that: The diffusion key matrix in step thirteen This can be expressed as follows: ; ; ; 。 5. The medical image selection encryption method based on DICOM information key generation according to claim 1, characterized in that: The specific process of step fourteen is as follows: The scrambled sequence described in step eleven... Sort in ascending order and record the index values to form an index sequence. ; ; In the formula, Represents the sorting function. express The sequence after ascending order. Indicates after sorting The value is in Location information within; The one-dimensional sequence of interest described in step nine The index sequence obtained according to the above formula Scramble the sequence to obtain a scrambled one-dimensional sequence. The scrambling formula is as follows: 。