## 4 Proposed Scheme  
The proposed scheme is detailed in this section. The proposed reversible data hiding algorithm for embedding clinical data in the medical image is given in Algorithm 1. Algorithm 2 shows the newly modified Elias gamma encoding procedure to embed additional message bits during the encoding process. The key steps required to extract the clinical report and restore the original medical image are given in Algorithm 3. Figure 4 depicts the proposed scheme. Figure 4: Illustrative diagram of the proposed scheme. ```
Input: A medical image \(I\) of size \(R\times C\) pixels and the clinical report \(T\) Output: Encrypted medical image \(E\) embedded with clinical report \(T\) Extract all the 8-bit planes from \(I\), and let us denote the planes by \(P^{7}\), \(P^{6},\ldots,P^{0}\). Note that \(P^{7}\) is the most significant bit (MSB) plane, and \(P^{0}\) is the least significant bit (LSB) plane. Convert the clinical report \(T\) to the binary sequence \(T^{B}\). The length of \(T^{B}\) will be \(8V\) when there is \(V\) number of characters in \(C\). \(K=1;S=7\); while\((K\leq Q)\)do \(L=P^{S}\);  Consider the bits in the bit plane \(L\) in row-wise linear order and find the corresponding run-length sequence \(U\). Note that the bit at the location of \(L(0,0)\) will be the first element (\(U_{0}\)) in the run-length \(U\); later, it will be a sequence of integers that indicates the number of 0s or 1s appearing continuously. Let us assume that the length of \(U\) is \(N\) (including the start bit information). Pass the run-length sequence \(U\) to the modified Elias gamma algorithm given in Algorithm 2 and \((N-1)\) bits from \(C^{B}\) to obtain the binary sequence \(B\). Let us assume the length of \(B\) is \(B^{L}\). Find the empty space \(Y\) (in number of bits) created through the bit plane compression \[Y=(RC)-B^{L}\] (7) Consider the next \(Y\) number of bits from \(T^{B}\) and concatenate them with \(B\) to obtain \(B^{F}\). Now, the length of \(B^{F}\) will be \(RC\). Convert \(B^{F}\) to the corresponding 2D \(\hat{B}^{F}\) array of size \(R\times C\). Store the result in \(MP^{S}\). \(K=K+1\); \(S=S-1\);  Merge all the modified bit planes (\(Q\) bit planes) and unmodified bit planes to obtain the final image \(E^{\prime}\), and encrypt them to get \(E\). Output: \(E\). ```  
**Algorithm 1**Proposed bit plane compression-based RDH scheme using modified Elias gamma encoding  
```
Input: A RLE sequence \(U\) of size \(N\) and a bit sequence \(D\) of length \(N\) corresponding to the characters in clinical report Output: A modified Elias gamma-encoded sequence \(B\) corresponding to the given RLE sequence \(U\) after embedding bit sequence \(D\) Store all the values from \(U\) (except the first value \(U_{0}\)) in \(\hat{U}\). Note that the size of \(\hat{U}\) will be \(N-1\). Initialize a sequence \(B\) as an empty sequence. Later, the final modified Elias gamma-encoded sequence embedded with secret bits will be obtained in \(B\). Increment all the values in \(\hat{U}\) by one to get the \(\hat{U}\) \(K=0\) while\((K\leq(N-1))\)do  Consider \(\hat{U}_{K}\) and convert to the corresponding binary \(F\) \(Y=D_{K}\) /* Extract the \(K\)th bit from \(D\) */ \(G= \begin{cases}F&\text{if }Y==0,\\ F,&\text{if }Y==1\text{/* }\hat{F}\text{: Complement of }F\text{ */}\end{cases} \)  Find the number of bits \(Q\) in \(G\). if\((Y==1)\)then  Append \((Q-1)\) number 0 to \(B\). else  Append the \((Q-1)\) number 1 to \(B\). Append \(G\) with \(B\). \(K=K+1\) Return B. ```  
**Algorithm 2**Modified Elias gamma approach for variable length encoding. ```
Input: An encrypted image \(E\) and the decryption key \(K\) Output: The extracted clinical report \(T\) and the restored medical image \(I\) Decrypt the image \(E\) using the decryption key \(K\) to get the partially restored image \(\hat{P}\). \(K=0\); \(S=7\); \(Z=0\) Initialize the variables \(T\) and \(L^{R}\) as two empty arrays/lists to store the extracted bit sequence and bits of the recovered bit planes, respectively.