# Reversible Data Hiding for DICOM Image Using Lifting and Companding
## 5 Proposed Algorithm
### Data Encoding  
Step 1: Image transformation: Original host image (I) is decomposed into four sub-bands, i.e., low-low (LL), low-high (LH), high-low (HL), and high-high (_HH_) using lifting based DWT. One may use a higher level of decomposition for batter results.  
Step 2: Selection of wavelets coefficients for watermark embedding: The scheme selects \(HH\) sub-bands, as this component contains both the characteristics of horizontal and vertical edge components. Moreover, the choice of embedding the watermark information into the \(HH\) sub-bands was motivated by experimental tests, as this one offers the best compromise between robustness and invisibility. Moreover, in the case of scalable decoding, if only the high-energy sub-bands are sent to the decoder, the watermark can be detected efficiently from those sub-bands without waiting for the others [30]. It is also to be noted here that if other sub-bands are used, then capacity will also be increased.  
Step 3: Generation of the odd-even matrix: The odd-even matrix (\(P\)) is generated from \(HH\) sub-band according to the following rule.  
\[P(x_{i},y_{i})=1\ ifHH(x_{i},y_{i})isodd.\ i=\{0,1,...n\} \tag{8}\]  
\[P(x_{i},y_{i})=\ 0\ ifHH(x_{i},y_{i})\ iseven \tag{9}\]  
It is to be pointed out that the size of \(P\) and \(HH\) are the same.  
Step 4: Generation of sign matrix: A sign matrix (\(S\)) is generated from \(HH\) sub-band according to the following rule.  
\[S(x_{i},y_{i})=\ 1\ ifHH(x_{i},y_{i})isnegative \tag{10}\]  
\[S(x_{i},y_{i})=0\ ifHH(x_{i},y_{i})ispositive \tag{11}\]  
It is also to be pointed out that the size of \(S\) and \(HH\) are the same.  
Step 5: Generation of random binary matrix based on user-defined key: A binary pseudorandom matrix (\(R\))is created depending on the secret key (K) supplied by the owner.  
Step 6: Generation of watermark bit: The straightforward countermeasure against the collusion (average) attack is done by designing the watermark that depends on the host signal. A content dependent watermark (\(W\)) is produced depending on \(P\&R\), according to the following rule.  
Figure 5: Data decoding.  
\[W(x_{i},y_{i})=P(x_{i},y_{i})\oplus R(x_{i},y_{i}) \tag{12}\]  
The symbol '\(\oplus\)' represents bit by bit XOR operation.  
Step 7: Change of dynamic range: The coefficients of \(HH\) bands are divided by two. This is analogous to compression operation as the above division operation changes the dynamic range of wavelet coefficient for the original host signal to a smaller range [4]. This operation will prevent overflow/underflow after data embedding.  
\[HH_{n}(x_{i},y_{i})=floor(abs(HH(x_{i},y_{i}))/2) \tag{13}\]  
The symbol \(HH_{n}\) represents the high-high sub-band after the change of dynamic range. The function abs (.) returns the absolute value of a signal.  
Step 8: Watermark bit embedding: Then the watermark bits are embedded into the \(HH\) sub-band according to the following rule:  
\[HH_{w}(x_{i},y_{i})=2\times HH_{n}(x_{i},y_{i})+W(x_{i},y_{i}) \tag{14}\]  
The symbol \(HH_{w}\) represents the watermarked coefficients. Then the sign matrix(S) is multiplied with \(HH_{w}\), to get the final watermarked \(HH\) sub-band.  
Step 9: Inverse image transformation: Then, inverse lifting operation is done, and the watermarked image (\(I_{w}\)) is created.