Introduction

The speedy development of computer networks and the popularity of electronic managing of medical records have made it possible for digital medical images to be shared across the world for services such as telemedicine, teleradiology, telediagnosis, and teleconsultation. With growing number of exchanging medical images among specialists of different hospitals via unsecured open network, the need for preserving the security of these images against any act of tampering by any unauthorized person is inevitable. Thus, the main concern of the existing electronic medical system is to develop some standard solutions to preserve the authenticity and integrity of the content of medical images [1, 2].

One solution for tackling the above issue is the use of digital watermarking, which consists of two main steps; embedding and extraction. In embedding process, special information called watermark or hidden data is inserted into medical images. In extraction process, the embedded information is retrieved and examined whether the medical image is transmitted from the actual source (authenticity) or any modification has been made to the medical image (integrity) [3].

In medical images watermarking, one crucial point is preserving the quality of important part of the image called the region of interest (ROI) during the embedding operation. Since this region is used by physicians for diagnostic purposes, even a small distortion in this area cannot be tolerated as it may cause misdiagnosis [4]. In order to preserve the quality of ROI, numerous approaches have been proposed in the past.

One technique is to use watermarking method on the medical image entirely. In these methods, the quality of ROI is preserved by using reversible methods. Thus, it is not necessary to separate ROI for further protection [1, 513].

The other solution is to ignore ROI during the watermarking process by having this part left without embedding any data and by concentrating on embedding data into the region of non interest (RONI) through reversible [1419] or non-reversible methods [2026].

Another technique is to use different watermarking methods for embedding the watermark into ROI and RONI. For instance, in [27, 28], reversible and non-reversible methods are used for embedding the watermark in ROI and RONI, respectively, and in [29, 30], fragile and robust methods are used for embedding the watermark in ROI and RONI, respectively.

The other alternative approach is to use similar techniques for embedding the watermark in ROI and RONI, but the recovery information of ROI is also embedded in the RONI, and in the extraction part, the ROI can be recovered exactly [3134].

With reference to all of the above mentioned methods, except in [1, 513], prior to starting the watermarking process, ROI needs to be detected and separated from the RONI, and this is considered as a preprocessing step of medical watermarking systems.

Through different works in the past, it can be found that ROI is mostly selected manually by doctors, physicians, or radiologists. For example, in [14, 16, 18, 20, 22, 25, 3134], the ROI is manually assigned by defining a rectangle box around it, and in [15, 17, 21, 27, 28], the polygonal ROI is specified manually. In automatic ROI partitioning [19, 23, 24, 26, 29, 30], there are some problems which will be highlighted later in this paper.

In 2008, an automatic pixel-based ROI detection method was proposed by Fotopoulos et al. [19]. This simple method scans images in two directions (left-to-right and top-to-down). Pixels with intensity value lower than a threshold value (ranged from 20 to 40) are considered as RONI pixels, while the remaining ones are classified as ROI pixels. During the row scanning, left and right edges of the ROI are stored in two vectors T and B, and during the column scanning, the upper and lower edge positions of the ROI are stored in L and R vectors, respectively. Thereafter, the smallest rectangle that contains the whole ROI is generated by choosing the minimum L and T as the top left coordinates and the maximum R and B as the bottom right coordinates of this rectangle.

Another automatic method was proposed by Memon et al. for separating the lung parenchyma in CT images [26]. In this method, the lung parenchyma is segmented by binarizing the image based on the Otsu thresholding method followed by the region-growing process. By using this method, the embedding capacity of RONI is increased.

In [29], their proposed method is a threshold-based ROI detection which is introduced in [35]. In this paper, ROI is defined as a region that can be obtained after appropriate thresholding. To find the correct threshold, several test images with various thresholding values are used and saved in the database. An optional input image must be compared with test images to find out which threshold can extract the ROI clearly and generate the best result. In mentioned paper, ROI is defined as the abnormal area that may exist in the image such as a brain tumor region.

However, all these three methods [19, 26, 29] used pixel-based automatic ROI detection method without protection against any noise. It means that after any modification on the medical image content, the ROI detection system may obtain ROIs with different boundaries.

In addition, the method proposed in [26] can only be applied for lung parenchyma in CT images. Moreover, drawing the black boundary on the input image before segmentation process and finding the seed pixel in region-growing part must be done manually. The only automatic method that can work robustly with additional noise on medical images is the one suggested by Memon [23, 30], in which the ROI is detected by drawing an ellipse around it. However, this method is only useful for a set of medical images with elliptical ROI located at the central part of the image.

In our work, an automatic and robust technique is utilized to segment the ROI from the RONI. Using an automatic and robust ROI detection method not only increases the speed of the watermarking process but also increases the correctness of the retrieved data in the extraction part.

The remainder of this paper is arranged as the following. In “ROI Detection Method,” the proposed ROI detection system is presented. The implementation of the method onto several databases as to prove the efficacy of the proposed approach is also presented in this section. Analysis of various attacks, which may happen intentionally or unintentionally onto the medical image, is given in “Robustness Evaluation of ROI Detection Against Attacks.” In this section, a number of attacks are simulated on the existing databases to examine the robustness of the proposed method. “Improving the Robustness of ROI Detection Against Attacks” introduces the improvement mode onto the ROI separation method in order to increase its robustness against different attacks. Finally, “Conclusion” concludes and summarizes the proposed work.

ROI Detection Method

Figure 1 shows an overview of the proposed ROI detection mechanism. The explanation of each step is given in the following parts.

Fig. 1
figure 1

Proposed automatic ROI detection procedure

Morphological Reconstruction

Morphological operation has become one of the most important mathematical tools in image processing for representing and describing shapes such as boundaries and skeletons [36]. All morphological techniques are fundamentally based on three basic concepts; structuring element, dilation and erosion. Structuring element is a matrix of 0 and 1’s with different shapes and sizes, and it determines the amount of enlargement or contraction.

Erosion is used for shrinking an object (see Fig. 2b). Using this operation, any object pixel that touches the background pixel will be changed into background pixel. The mathematical equation of eroding an image A with structuring element B is given in Eq. 1 [36]:

Fig. 2
figure 2

Four morphological operations: a original image, b erosion, c dilation, d opening, and e closing

$$ A\ominus B=\left\{z\left|{(B)}_z\cap {A}^c\ne \varnothing \right.\right\} $$
(1)

where A c denotes the complement of A and ⊝ is the symbol for the erosion operation.

Dilation is the dual operation of erosion. This operation is used for thickening objects as shown in Fig. 2c. After dilation, any background pixel that is connected to the object pixel will be changed to the object pixel. Mathematical equation of dilating an image A with a structuring element B is defined in Eq. 2 [36]:

$$ A\oplus B=\left\{z\left|{\widehat{(B)}}_z\cap A\ne \varnothing \right.\right\} $$
(2)

where \( \widehat{(B)} \) denotes the reflection of set B and ⊕ is the symbol for the dilation operation.

Opening operation is a secondary morphological process, which is achieved by performing erosion followed by dilation (see Fig. 2d). Using the same notation, mathematically it can be written as follows [36]:

$$ A\circ B=\left(A\ominus B\right)\oplus B $$
(3)

where ○ represents the opening operation.

Closing operation is another secondary operation which is achieved by performing dilation followed by erosion (see Fig. 2e) and is defined in Eq. 4 [36]:

$$ A\cdotp B=\left(A\oplus B\right)\ominus B $$
(4)

where · is used to symbolize the closing operation. As can be seen in Fig. 2d, opening operation removes protrusion while closing operation (Fig. 2e) fills holes inside the object based on the structuring element but does not remove the protrusion.

Morphological Opening by Reconstruction Filtering

Opening operation is the most frequently used morphological method for filtering a binary image using a disc as its structuring element. This operation preserves all positions in the binary image covered completely by disc and filters out other parts.

In order to keep the connected components within the entire disc and filter the rest, opening by reconstruction can be used [37]. In other words, after performing opening operation using the disc structuring element, the unwanted connected components will be removed and the remaining ones will be modified after the reconstruction part. Opening by reconstruction can also be applied for grayscale images in the same manner [37].

Opening by reconstruction procedure is employed as the preprocessing part of the proposed method to increase the accuracy of the detection by removing small objects and modifying the main object in medical images. Figure 3a, b shows the effect of using and skipping opening by reconstruction operation, respectively.

Fig. 3
figure 3

Comparing ROI detection results after skipping and applying morphological opening reconstruction: a without opening by reconstruction and b with opening by reconstruction

Gaussian Lowpass Filter in Frequency Domain

In the case of low quality images, after applying the opening by reconstruction operation an additional filtering step is needed to guarantee perfect detection of ROI.

In this work, Gaussian lowpass filter is used to enhance the result of ROI detection algorithm by attenuating frequency components that are further away from the image center \( \left(\raisebox{1ex}{$W$}\!\left/ \!\raisebox{-1ex}{$2$}\right.,\raisebox{1ex}{$H$}\!\left/ \!\raisebox{-1ex}{$2$}\right.\right) \) where W and H are image width and height respectively [36].

$$ {X}_{uv}^{\prime }={X}_{uv}{e}^{-\frac{{\left(\frac{H}{2}-u\right)}^2+{\left(\frac{W}{2}-v\right)}^2}{2{\sigma}^2}} $$
(5)

where \( \sigma \) is a standard deviation of the equivalent spatial domain Gaussian filter. The result of using this filter is shown in Fig. 4. It is clear that without using this filter, the ROI detection algorithm cannot work properly.

Fig. 4
figure 4

Comparing ROI detection results after skipping and applying lowpass filter: a without lowpass filter and b with lowpass filter

Thresholding and Filling Holes

In this work, automatic thresholding function (graythresh) of Matlab for thresholding is used but for any specific database a particular coefficient is multiplied by the automatic computed threshold in order to increase the accuracy of binarizing process. This coefficient can be obtained experimentally and may not be equal in different databases.

Some parts of ROI maybe removed during the thresholding process and some gaps and discontinuity may appear in the binarized image. Therefore, it is necessary to fill these gaps and holes, using morphological closing, before moving to the next step.

Labeling and Finding the Biggest Area

After applying opening by reconstruction and filtering to remove some noise and small objects around the region of interest, the labeling method can be considered as the last step for removing unwanted areas. By labelling and classifying the labeled objects according to their size, the biggest area can be obtained. Consequently, by selecting the biggest connected component of the labeled image, the ROI can be segmented. The only remaining part is how to specify the segmented region of medical image from the whole image. This is explained in the following sub-section.

Highlighting the Boundary of Biggest Area

Once the biggest area has been selected, the boundary can be highlighted by changing its pixel color. Figure 5 shows an example where the boundary of the segmented ROI is highlighted in green color.

Fig. 5
figure 5

Boundary of detected ROI with highlighted green color

By replacing the binarized image in Fig. 5 with its original image, the segmented ROI can be demonstrated inside the original images with green color. This process is performed on different databases and the results are shown in Fig. 6.

Fig. 6
figure 6

Detected ROI that are randomly selected from ten databases

ROI in a Rectangle

The other way to represent ROI is to use the smallest rectangle that covers the whole parts of the detected ROI as shown in Fig. 7. This rectangle can be obtained by selecting the smallest coordinate in the top left and the biggest coordinate in the bottom right of the segmented ROI in the previous part. The advantage of representing ROI in a rectangle is that only 4 points are needed to specify ROI area instead of a group of coordinates.

Fig. 7
figure 7

Segmented ROI in a rectangle

Figure 8 demonstrates the sequential progress of the proposed ROI detection method graphically.

Fig. 8
figure 8

ROI detection procedure: a input image, b morphological reconstruction, c Gaussian lowpass filter in frequency domain, d binarizing, e filling holes, f labeling and selecting biggest area, g boundary of biggest area, and h detected ROI in a rectangle

The proposed method is employed in ten databases that consist of 746 medical images with square and none square dimensions. Additional information about the number of images inside each database and coefficient to be multiplied by automatic threshold (T) are given in Table 1.

Table 1 Database information

Robustness Evaluation of ROI Detection Against Attacks

Most of the existing ROI detection methods found in the literature are manual based. Furthermore, the robustness against intentional or unintentional attacks in automatic methods is not considered. For non-automatic and non-robust ROI detection applied in watermarking application, the coordinates of the ROI need to be hidden into the specific part of the RONI during the embedding procedure.

During the transmission between hospitals or specialists through the network or over the archiving in hospital databases, the image content may be changed intentionally by unauthorized person or accidentally due to some unknown factors. In both cases, we assume that the watermarked image has been attacked with noises.

By modifying content of medical images, the embedded ROI vertices may also change and give wrong ROI boundaries to the extractor system. Consequently, the embedded watermark inside the ROI or RONI cannot be extracted correctly. This is the weakness of the scheme.

A solution to this problem is to use a similar ROI segmentation in both embedding and extracting process instead of hiding the ROI information into the medical images. In this case, the crucial matter is generating a unique result for ROI coordinates in embedding and extracting operations even after the attacks to the content of medical images. Hence, designing a ROI detection system to fulfil this requirement is desirable.

To evaluate the robustness of the proposed ROI detection system under numerous attacks, once the ROI vertices of a tampered image are obtained, they will be compared with the original ROI vertices of the same image. The graphical diagram is shown in Fig. 9.

Fig. 9
figure 9

Robustness evaluation of the proposed automatic ROI detection method after attacks

Attack Demonstration

In this work, seven attacks are considered for the sake of evaluating the robustness of proposed ROI detection algorithm. Figure 10 shows the effect of different attacks on the sample medical image.

Fig. 10
figure 10

Effect of different attacks on a medical image sample: a original image, b speckle noise (variance = 0.1), c average filter (3 × 3), d median filter (3 × 3), e Wiener filter (3 × 3), f Gaussian filter (3 × 3), g sharpening filter, and h motion (10.90)

Comparing the Results of ROI Detection Method Before and After the Attacks

In this part, the outcomes of the proposed ROI detection system before and after the alteration are compared. By this comparison, it can be shown whether the proposed segmentation approach can generate the same result before and after any attacks or not. This is called comparative accuracy (CA). The results are summarized in Table 2.

Table 2 Comparative accuracy of ROI detection scheme (%)

To explain the entry in this table, assume that speckle noise is applied in the first image of the first database, which consists of 20 images. The ROI detection method would be applied in the first image before and after the noise. These ROI vertices, before and after attack, would be compared with each other. If they are not equal, the detection method is unable to generate the same result before and after the attack. This process is then repeated for all of the 20 images in the first database. Hence, from Table 2 for speckle noise attack to database 1, the performance of the ROI detection method is only 35.2 %. The rest of the performance results can be explained in the same manner.

According to Table 2, the comparative accuracy of proposed ROI detection scheme is very low and in some cases is equal to zero.

Table 3 shows the mean of the comparative accuracy after applying seven attacks for ten databases. For instance, the element of the first column in Table 3 is obtained by averaging all the elements in the first column of Table 2. It is clear that the performance of proposed ROI detection system does not seem to be acceptable.

Table 3 Mean comparative accuracy of ROI detection scheme (%)

Improving the Robustness of ROI Detection Against Attacks

In order to increase the robustness of proposed ROI detection, another step is added to the algorithm. As shown in “ROI Detection Method,” the final extracted ROI has a rectangular shape with four vertices. The ROI vertices are then changed in a way that they become invariant against different attacks by using what we called “Window Size Correction” or WSC.

The mechanism of WSC is best explained by the following example. Referring to Fig. 11 let a i (i = 1, 2, 3, 4) be the vertices of the detected ROI. The figure shows two different sizes of detected ROI represented by the dashed lines. WSC then will try to change these vertices so that they will be at new locations, a i , shown by solid lines. This heuristic method tries to generate unique ROI vertices for medical image before and after any attack.

Fig. 11
figure 11

Window size correction

The WSC is implemented by the following formula:

$$ {a}_i^{\prime }=\left\{\begin{array}{c}\kern1em {a}_i+{k}_1,{k}_1<\frac{{\mathrm{C}}_{\mathrm{p}}}{2}\kern1em \\ {}\kern1em {a}_i-{k}_0,{k}_1\ge \frac{{\mathrm{C}}_{\mathrm{p}}}{2}\kern1em \end{array}\right. $$
(6)

where a i and a i are old and new coordinates for ROI vertices respectively and Cp is the correction parameter. Two additive coefficients k 0 and k 1 are defined as:

$$ \left\{\begin{array}{c}\kern1em {k}_0=\kern1em \mod \left({\mathrm{a}}_i,{\mathrm{C}}_{\mathrm{p}}\right)\kern1em \\ {}\kern1em {k}_1={\mathrm{C}}_{\mathrm{p}}-\kern1em \mod \left({\mathrm{a}}_i,{\mathrm{C}}_{\mathrm{p}}\right)\kern1em \end{array}\right. $$
(7)

These two coefficients determine how to change from the old vertices of detected ROI to the new ROI vertices. As can be seen in Eqs. 6 and 7, different Cp will generate different ROIs. To find the best Cp for each database, several values of Cp are examined. Cp used in this paper ranges from 5 to 25 pixels and the mean comparative accuracy for all attacks are recalculated for all databases. As shown in Fig. 12, WSC method is now applied to correct the vertices of both detected ROI before and after an attack. The comparison is then performed based on the corrected vertices.

Fig. 12
figure 12

Robustness evaluation of proposed automatic ROI detection method against the attacks after applying the WSC method

In Table 4, the new mean comparative accuracy of the enhanced ROI detection using different Cp is shown.

Table 4 Mean comparative accuracy of enhanced ROI detection for different Cp (%)

As can be seen in Table 4, the maximum mean comparative accuracy for the enhanced ROI detection result in each database cannot be achieved by a unique Cp. For instance, the perfect segmentation result in the first database is attained by Cp equal to 19 and for second database the best Cp is 21.

In order to acquire the highest comparative accuracy for the enhanced ROI detection, the best Cp is chosen for each database, as bolded in Table 4. With these best Cp values, the comparative accuracy for each database under all mentioned attacks can be calculated again. The results are presented in Table 5. In addition, the mean comparative accuracy after the enhancement using the best Cp for each database is calculated in Table 6. The manner of computing each element in Tables 5 and 6 is the same as explained in Tables 2 and 3, respectively.

Table 5 Comparative accuracy for enhanced ROI detection using best Cp (%)
Table 6 Mean comparative accuracy for enhanced ROI detection using best Cp (%)

To compute the improvement achieved by the proposed ROI detection after the enhancement, the mean comparative accuracy before the enhancement (Table 3) and the mean comparative accuracy after the enhancement (Table 6) are compared and the results are illustrated in Fig. 13.

Fig. 13
figure 13

Comparing the mean comparative accuracy before and after the enhancement using best Cp for ten databases and seven attacks

Conclusion

In this paper, a heuristic automatic and robust ROI detection method has been presented for medical images watermarking application. In the first part, a medical ROI detection method has been suggested by using sequential combination of different image processing tools such as morphological operation, lowpass filtering, thresholding and labeling. This method is applied to ten databases in DICOM format containing 746 medical images with different size and quality.

The second section introduces seven kinds of attacks and demonstrates their effects on the medical images. Afterwards, the robustness of the proposed ROI detection system after applying these attacks is examined. For this purpose, the detected ROI vertices before and after the attack were compared, and it was found that most of the time, the segmentation method cannot generate similar coordinates for ROI and the system does not show acceptable results.

In the third part of this work, an additional block has been proposed for the proposed ROI detection algorithm, which is called “Window Size Correction” in order to produce unique ROI vertices before and after various attacks. The proposed additional step is able to increase the comparative accuracy results. In order to achieve the best result, different values for Cp have been utilized. By selecting the best Cp in each database, the highest rate of comparative accuracies has been achieved. To show the rate of improvement, the means of comparative accuracy before and after the enhancement have been compared with each other and the proposed method shows a very promising result.