# Automatic Selective Encryption of DICOM Images
## 3 The Proposed Approach
### Approach II: Automatic Selective Encryption of Multi-Frame DICOM Images
#### 3.2.2 The Multi-Frame Encryption Process  
The proposed approach intends to decrease the encryption time burden of the multi-frame DICOM object. Hence, this section presents a hybrid encryption approach that combines a sophisticated encryption algorithm (AES) with a lighter encryption algorithm (XXTEA) to maintain minimum processing time. Thus, the most informative pixels must be encrypted using AES and the rest of the pixels will be encrypted using XXTEA. In this approach, two segmentation mechanisms are proposed: the first one is a holistic approach that segments all frames simultaneously, while the second approach segments each frame individually. The holistic segmentation approach uses a pre-defined threshold value of [25] to segment all pixel data from all frames. Then, segmented ROI and ROB are compressed, encrypted, and stored in a secured DICOM object. This approach is called Holistic-Based Selective Encryption (Holistic-Based SE). The second segmentation process will be executed in an automatic manner where a specific frame in the middle of the multi-frame DICOM object is selected as a reference frame; then its pixel data can be segmented based on automatic thresholding using a pre-defined threshold value [25]. Thereafter, the resultant segmentation map from the segmented reference frame will be used to segment all other frames in the DICOM object. Afterwards, the segmented ROI and ROB from all frames are compressed and encrypted using AES and XXTEA, respectively. This approach is called Frame-Based Selective Encryption (Frame-Based SE). Another essential feature that has been examined in this approach is the data redundancy within the multi-frame DICOM object. Since frames in a multi-frame DICOM object represent adjacent frames of the body part, adjacent frames have high similarity (redundancy). In order to employ this redundancy, the proposed approach employs an efficient lossless compression approach called LZ4 which is significantly fast and with a good compression ratio. The proposed approach can be classified as a selective approach as ROI pixels from all frames are encrypted using AES while the rest of the pixels are encrypted using XXTEA. Holistic-Based SE Approach  
A block diagram of the first proposed encryption routine is shown in Figure 7. The input to this procedure is the multi-frame DICOM object and a pre-defined threshold value. Next, the pixel data array that combines all frames is segmented into ROI and ROB. The resultant segmentation map based on this segmentation process has a similar size to the multi-frame pixel data. Hence, the segmentation map is massive in size. Then, the ROI and ROB can be compressed using LZ4 and then encrypted using AES (ROI) and XXTEA (ROB) encryption algorithms. It is worthwhile to mention that the holistic segmentation map of the multi-frame pixel data and the DICOM header data are combined, compressed, and finally encrypted using AES. The output DICOM object is a secured file such that patient data and pixel data are compressed and encrypted. Frame-Based SE Approach  
Figure 8 illustrates a block diagram of the second proposed encryption procedure. The primary input to this procedure is the multi-frame DICOM object, a pre-defined threshold value and a pre-defined reference frame. Then, the pre-defined reference frame is extracted and segmented. The resultant segmentation map based on the reference frame is used to segment all the frames in the multi-frame DICOM object individually into ROI and ROB. It is believed that this improves data redundancy; hence, ROI and ROB can be compressed using lossless compression. Next, compressed data are encrypted using AES (ROI) and XXTEA (ROB). It is worthwhile to mention that the segmentation map of the reference frame and the DICOM header data are combined, compressed, and finally encrypted using AES. The output DICOM object is a secured file such that patient data and pixel data are compressed and encrypted.