Journal of Medical Signals & Sensors

: 2022  |  Volume : 12  |  Issue : 1  |  Page : 84--89

Using marker-controlled watershed transform to detect Baker's cyst in magnetic resonance imaging images: A pilot study

Sadegh Ghaderi1, Kayvan Ghaderi2, Hamid Ghaznavi3,  
1 Department of Neuroscience and Addiction Studies, School of Advanced Technologies in Medicine, Tehran University of Medical Sciences, Tehran, Iran
2 Department of Information Technology and Computer Engineering, Faculty of Engineering, University of Kurdistan, Sanandaj 66177-15175, Iran
3 Department of Radiology, Faculty of Paramedical Sciences, Kurdistan University of Medical Sciences, Sanandaj, Iran

Correspondence Address:
Hamid Ghaznavi
Department of Radiology, Faculty of Paramedical Sciences, Kurdistan University of Medical Sciences, Sanandaj


Nowadays, magnetic resonance imaging (MRI) has a high ability to distinguish between soft tissues because of high spatial resolution. Image processing is extensively used to extract clinical data from imaging modalities. In the medical image processing field, the knee's cyst (especially Baker) segmentation is one of the novel research areas. There are different methods for image segmentation. In this paper, the mathematical operation of the watershed algorithm is utilized by MATLAB software based on marker-controlled watershed segmentation for the detection of Baker's cyst in the knee's joint MRI sagittal and axial T2-weighted images. The performance of this algorithm was investigated, and the results showed that in a short time Baker's cyst can be clearly extracted from original images in axial and sagittal planes. The marker-controlled watershed segmentation was able to detect Baker's cyst reliable and can save time and current cost, especially in the absence of specialists it can help us for the easier diagnosis of MRI pathologies.

How to cite this article:
Ghaderi S, Ghaderi K, Ghaznavi H. Using marker-controlled watershed transform to detect Baker's cyst in magnetic resonance imaging images: A pilot study.J Med Signals Sens 2022;12:84-89

How to cite this URL:
Ghaderi S, Ghaderi K, Ghaznavi H. Using marker-controlled watershed transform to detect Baker's cyst in magnetic resonance imaging images: A pilot study. J Med Signals Sens [serial online] 2022 [cited 2022 Sep 24 ];12:84-89
Available from:

Full Text


Knees are the largest synovial and most complex joints in the body. They suffer a lot of injuries due to their complex anatomical structure and weight-bearing.[1] Baker or popliteal cyst is one of the common injuries in knees, and this cyst is produced by herniation of synovial membrane or leakage of synovial fluid usually resulting from distention of semimembranosus medial gastrocnemius bursa, meniscal, and ligament injuries.[2] Baker's cyst is diagnosed in 10%–41% of knee magnetic resonance imaging (MRI).[3] MRI has a high spatial resolution, a high ability to distinguish between soft tissues and is less invasive, compared to other diagnostic modalities; therefore, it is the best modality to detect knee's injuries.[4],[5]

The golden standard for the diagnosis of Baker's cyst is MRI, especially in T2-weighted axial images, but ultrasound can be helpful especially for better diagnosis of this cyst in patients over 50-year-old because of osteoarthrosis occurrence in this age.[6] The high advantage of ultrasound is the revealing of hypoechoic and anechoic fluid between semimembranosus and medial gastrocnemius tendons, especially sonography can be very helpful when the Baker's cyst appears heterogeneous or has soft tissue neoplasm.[7] Some factors such as poor quality imaging, tiredness, and inattention of physicians, can limit the diagnosis of MRI reports.[8]

Using a computer program that can analyze the digital imaging and recognize injuries can be very helpful to physicians. One of these programs is the image segmentation algorithm. Characteristics of the nominated algorithm, one of the most prominent image segmentation algorithms, are discontinuity and similarity that do edge detection and threshold processing. It can be introduced as the watershed algorithm that is a morphological method based on region processing.[9] There are three methods to implement watershed: gradient method, distance transform approach, and marker controlled approach, the last of which being more effective than the other two.[10] Among the limitations of the watershed algorithm, we can mention oversegmentation, therewith many regions are recognized.[11] To control this problem, we can use some markers in or out of images. These markers are connected to images' elements and can dominate oversegmentation problems. This processing is called marker-controlled watershed segmentation. This algorithm can improve the accuracy of the radiologist's diagnosis.[12]

Using marker-controlled watershed segmentation, which has been used mostly for the detection of brain tumors and knee injuries, has been discussed in many studies.[13],[14] These studies have investigated meniscus tearing and articular surface, but other pathologies such as Baker's cyst have not been investigated yet, so we have decided to evaluate this cyst by using marker-controlled watershed segmentation. The study aims to evaluate the feasibility of the marker-controlled watershed segmentation to detect the Baker's cyst in knee joint's MRI sagittal and axial T2 images.

 Materials and Methods

Magnetic resonance imaging databases (data acquisition)

In our study, Signa HDxt 1.5 T scanner of General Electric Company was used, this unit is equipped with an 8-channel coil for knee examination. Axial T2 (fat saturation), coronal proton density (fat saturation), coronal T1, sagittal T2 (fat saturation), and sagittal merg were performed on a patient's knees using the standard procedure in five sequences. Axial T2 and sagittal T2 images were used in our research. In this paper, we have suggested using the Marker-Controlled Watershed Transform Technique to remove Baker's cyst in MRI images using MATLAB (r2018b) software (Natick, Massachusetts, US states).

Image preprocessing was one of the primary steps in the advanced algorithm. The aim of preprocessing operation for input images was edge detection and image noise reduction. At the beginning of this process, images are converted to gray scale; in the next step, Sobel code is used for edge detection and noise reducing, and low-pass filtering is utilized by using Gaussian kernel. Sobel is a mask that detects points on the edge of an image. Based on the mask's coefficients, it gives more value to the neighboring edges whereupon better edges are gained.[9] Gaussian kernel is a two-dimensional low pass filter, the formula of which is presented below:


Where D0 and D (u, v) are the cutoff frequency and distance from the center of rectangular frequency, respectively.[9]


Gradient magnitude calculation

Before using the watershed transform for segmentation, it is common to use gradient magnitude to preprocess a grayscale image. High pixel values along object edges and low pixel values everywhere else characterize the gradient magnitude image.[9] Therefore, using the linear filtering technique in this method, the gradient magnitude of the grayscale image is computed. The gradient vector magnitude and the angle at which the maximum rate of change of intensity level occurs at the specified coordinates (x, y) can be computed for any grayscale image (x, y) at coordinates (x, y) using Eq. (2) and (3).




The gradients in the x and y directions are g1 (x, y) and g2 (x, y). The Sobel masks H1 and H2-used to calculate the magnitude of these gradients are described by Eq. (4).[9]

Watershed transformation

The watershed transformation is a popular image segmentation technique based on analytical morphology. It is a gradient-based segmentation system with catchment basins as the segmented areas. By treating a picture as a surface with high light pixels and low dark pixels, the watershed transform detects catchment basins and watershed ridgelines.[9],[10]

As previously mentioned, the key issue with the watershed transform is oversegmentation, which results in a large number of segmented regions in each image's local minimum. This technique has made a change in image intensity that constructs extraregional minima due to the oversegmentation difficulty. To control oversegmentation, markers of the gradient image beginning from these markers instead of regional minima are recommended.[11] Marker-controlled watershed segmentation is a systematic procedure that reduces the oversegmentation difficulty.[12]

Marker-controlled watershed transform algorithm

Dividing touching objects in an image is one of the most difficult image processing steps. For this issue, watershed transforms are commonly used. Marker-controlled watershed segmentation has proven to be a reliable and versatile method for segmenting artifacts with closed outlines, with ridges indicating the boundaries. Foreground and backdrop markers are aligned with internal and external markers, respectively. Following segmentation, the watershed sections' boundaries are drawn on desired ridges; hence, using the watershed transform to separate any object from its neighbors' segmentation works best if you can distinguish or “mark” foreground and background objects and locations. In these procedures, marker-controlled watershed segmentation is used; compute a segmentation function for the items we were trying to segment in this section. The second phase involved calculating foreground markers to link blobs of pixels within each of the objects. Due to the presence of pixels that were not part of an entity, the next step was to compute background markers. The segmentation feature was then modified to provide minima only at the foreground and background marker positions. Finally, the watershed transform of the modified segmentation function was computed.[9],[10]


Image acquisitions are the first step. Original images in this study consisting of axial T2 FS and sagittal T2 FS images of the left knee of a patient are illustrated in [Figure 1].{Figure 1}

The second step to gain our purpose in this study was preprocessing that consisted of conversion to gray scale [Figure 2]a and [Figure 2]d, Gaussian low pass filter [Figure 2]b and [Figure 2]e, and Sobel high-pass filter [Figure 2]c and [Figure 2]f, as shown for sagittal and axial images in [Figure 3], respectively.{Figure 2}{Figure 3}

Using Gaussian and Sobel filters, pixels intensity was changed, and the following histograms have shown this fact. At this stage, the histogram of the image was obtained following the application of the Gaussian filter and then the Sobel filter. [Figure 4]a,[Figure 4]b,[Figure 4]c show the original image histogram, image histogram after preprocessing with Gaussian and Sobel filters, respectively, in the axial plane; and similarly [Figure 4]d,[Figure 4]e,[Figure 4]f show histograms of the sagittal plane. The image histogram after using the Gaussian filter graphically shows the effect of noise deletion on image, and after applying the Sobel filter on this image, the histogram of this image is split into two sections, brightness as edges and darkness as background [Figure 4].{Figure 4}

The third step in this process was segmentation. In the beginning, gradient magnitude [Figure 5]a and [Figure 5]e is performed, then watershed segmentation [Figure 5]b and [Figure 5]f on gradient magnitude image is applied. After that, on this image, with the aim of cleaning up the image, opening by reconstruction [Figure 5]c and [Figure 5]g is performed; and eventually, opening–closing by reconstruction [Figure 5]d and [Figure 5]h is performed. The aim of the nominated measures, which were foreground section subcategories, was to link blobs of pixels within each of the objects.{Figure 5}

The next step in this process was the background section; dark pixels refer to the background. Here, pixels that were not part of images are cleaned up. This section began with thresholding on the final image in the foreground section, and then to help better understanding, this image was superimposed on the original image. Finally, by operating the threshold opening and closing (morphological operation) by reconstruction, background pixels were removed. The following figure illustrates this section for the axial and sagittal image. [Figure 6]a[Figure 6]b,[Figure 6]c,[Figure 6]d show thresholding image, regional maxima are superimposed on the original image, modified regional maxima are superimposed on the original image, and thresholded opening–closing by reconstruction image for the axial plane, sequentially. Similarly, [Figure 6]e,[Figure 6]f,[Figure 6]g,[Figure 6]h show sagittal plane.{Figure 6}

Finally, by superimposing foreground and background markers and divided object boundaries images, this step is finished. Related images are shown below. [Figure 7]a and [Figure 7]b show markers and object boundaries superimposed on the original image.{Figure 7}

The last section has displayed the result that includes colored watershed label matrix [Figure 8]a and [Figure 8]c and colored labels transparently superimposed on the original image [Figure 8]b and [Figure 8]d.{Figure 8}


We find no article applying Marker-Controlled Watershed Transform to detect Baker's cyst in MRI images. The results of this study reveal that using Marker-Controlled Watershed Transform can detect the Baker's cyst. Using this algorithm, the Baker's cyst can be extracted with high precision. The role of filters was highlighted in this study, low-pass filter (e.g., Gaussian) affects the high frequencies and causes the image to be smoothened, while high-pass filter (e.g., Sobel) creates changes on low-frequency pixels that cause edges to be detected.

Nowadays, 3-Tesla (3T) MRI scanners, compared to 1.5T scanners, provide high resolution as a result of an increased signal to noise (SNR). Utilizing 3T can improve the diagnosis of knee' small pathologies, especially Anterior Cruciate Ligament (ACL) tearing, but in addition to the high cost of these facilities, it does not have a significant impact on the Baker's cyst diagnosis.[15]

Knee joint has a complex structure like soft tissues, articular, and bone; therefore, in MRI images, much pathology can be reported. This means that image processing may confront errors, especially around the bone.[16] To decrease these errors, some studies used the region of interest (ROI) that is an external marker used to evaluate a point or background signal, for example, while utilizing this algorithm for examination meniscus tearing and malignant lesions in the breast. In this process, we should determine the pathology of interest in MRI images that needs some parameters to detect ROI.[17],[18] The outstanding advantage of our study was no need for applying ROI. The time used in our study was 1.5 s. This value can change based on the power of the computer central processing unit.

In addition to the watershed, other methods like thresholding and region growing were used in some papers. In a study, with the aim of detecting meniscus tearing by image processing, the three mentioned methods were used. The results show the superiority of the watershed segmentation from the point of view of effectiveness and better distinguishing of some irregularities.[19]

In some studies, using marker-controlled watershed segmentation was discussed for the detection of brain tumors, malignant lesions of the breast, meniscus tearing, and the articular surface of the knee. These studies illustrated the capability of this algorithm for extracting these pathologies from MRI images. The results demonstrated that watershed segmentation has the potential to be used as a screening method for meniscal injuries and diseases, with the aim of improving care.[17],[18],[19],[20] We could not find an article that has used this algorithm for the detection of Baker's cyst in MRI. Moreover, due to more accuracy detection of lesions and delineation lymphomas, a nominated algorithm was performed in mammography and computed tomography.[21],[22]

The marker-controlled watershed segmentation was able to detect the Baker's cyst reliability. Watershed segmentation can save time and current costs, especially in the absence of specialists who can help us with easier diagnosis of MRI images. We will consider checking the accuracy and validity of this algorithm for the detection of Baker's cyst by checking the data set of patients. Our future purpose includes evaluation accuracy of marker-controlled watershed segmentation for detecting Baker's cyst by selecting more patients that have Baker's cyst in their knees' MRI images.

Financial support and sponsorship


Conflicts of interest

There are no conflicts of interest.


1Drake R, Vogl AW, Mitchell AW. Gray's Anatomy for Students. 41st ed. United State. Elsevier Health Sciences; 2017. p. 1386-92.
2Grey M, Alinani J. CT and MRI Pathology: A Pocket Atlas. Part VII., 2nd ed. United State McGraw-Hill; 2003. p. 388.
3Janzen DL, Peterfy C, Forbes JR, Tirman P, Genant H. Cystic lesions around the knee joint: MR imaging findings. AJR Am J Roentgenol 1994;163:155-61.
4Thomas S, Pullagura M, Robinson E, Cohen A, Banaszkiewicz P. sports traumatology, arthroscopy. Value Magnetic Resonance Imaging Curr Manage ACL Meniscal Injur 2007;15:533-6.
5Lefevre N, Naouri JF, Herman S, Gerometta A, Klouche S, Bohu Y. A current review of the meniscus imaging: Proposition of a useful tool for its radiologic analysis. 2016;47:???.
6Jacobson JA. Musculoskeletal ultrasound and MRI: Which do I choose? Semin Musculoskeletal Radiol 2005;9:135-49.
7Ward EE, Jacobson JA, Fessell DP, Hayes CW, van Holsbeeck M. Sonographic detection of Baker's cysts: Comparison with MR imaging. Am J Roentgenol 2001;176:373-80.
8Ha AS, Porrino JA, Chew FS. Radiographic pitfalls in lower extremity trauma. Am J Roentgenol 2014;203:492-500.
9Gonzalez R, Woods R. Digital Image Processing. 4th ed., Ch. 3. Boston, US states: Pearson; 2018. p. 133-248.
10Kaur A, Image Segmentation Using Watershed Transform. Int J Soft Comput Eng 2014;4:5-8.
11Beucher S. Unbiased Implementation of the Watershed Transformation Based on Hierarchical Queues. CMM internal note; 2004.
12Goshal D, Acharjya PP. MRI image segmentation using watershed transform. Int J Emerg Technol Adv Eng 2012;2:373-6.
13Rahman MM, Dürselen L, Seitz A. Automatic segmentation of knee menisci – A systematic review. Artificial Intelligence Med 2020,105,1018492.
14More S, Singla J, Abugabah A, AlZubi A. Machine Learning Techniques for Quantification of Knee Segmentation from MRI. 2020.
15Schub DL, Altahawi F, Meisel AF, Winalski C, Parker RD, Saluan PM. Accuracy of 3-Tesla magnetic resonance imaging for the diagnosis of intra-articular knee injuries in children and teenagers. J Pediatric Orthopaedics 2012;32:765-9.
16Lee JS, Chung YN. Integrating edge detection and thresholding approaches to segmenting femora and patellae from magnetic resonance images. Biomed Eng Appl Basis Commun 2005;17:1-11.
17Cui Y, Tan Y, Zhao B, Liberman L, Parbhu R, Kaplan J, et al. Malignant lesion segmentation in contrast-enhanced breast MR images based on the marker-controlled watershed. Med Physics 2009;36:4359-69.
18Mittal N, Tayal S. Advance computer analysis of magnetic resonance imaging (MRI) for early brain tumor detection. Int J Neurosci 2021;131:555-70.
19Kohut P, Holak K, Obuchowicz R. Image processing in detection of knee joints injuries based on MRI images. J Vibroeng 2017;19:3822-310.
20Sudharson M, Rajapandiyan ST, Ilavarasi P. Brain Tumor Detection by Image Processing Using MATLAB. Middle-East J Sci Res 2016;24:143-8.
21Yan J, Zhao B, Wang L, Zelenetz A, Schwartz LH. Marker-controlled watershed for lymphoma segmentation in sequential CT images. Med Physics 2006;33:2452-60.
22Xu S, Liu H, Song E. Marker-controlled watershed for lesion segmentation in mammograms. J Digital Imaging 2011;24:754-63.