Modified of Single Deepest Vertical Detection (SDVD) Algorithm for Amniotic Fluid Volume Classification

- Amniotic fluid a crucial role in ensuring the well-being of the fetus during pregnancy and is contained within the amnion cavity, which is surrounded by a membrane. Several studies have shown that volume of amniotic fluid can vary throughout pregnancy and is closely linked to the health and safety of the fetus. This indicates that it is essential to perform accurate measurement and identification of its volume. Obstetric specialist often use a manual method to identify amniotic fluid by visually determining the longest straight vertical line between the upper and lower boundaries. Therefore, this study aims to develop detection model, known as modified Single Deepest Vertical Detection (SDVD) algorithm to automatically measure the longest vertical line by following medical rules and regulations. SDVD algorithm was designed to measure the depth of amniotic fluid vertically by searching the column of pixels that comprised the image sample, excluding any intersection with the fetal body. Performance testing was carried out using 130 images by comparing the manual measurement results obtained by obstetric specialists and the proposed model. Based on the experimental results using modified SDVD, the average accuracy, precision, and recall achieved for amniotic fluid classification were 92.63%, 85.23%, and 95.6%, respectively.


I. INTRODUCTION
Amniotic fluid is contained within the amnion cavity, which is enveloped by a protective membrane.The formation of the amnion cavity typically commences between days 10 and 20 after fertilization [1].Furthermore, the primary function of amniotic fluid is to shield the developing fetus from potential impacts against the uterine wall and to safeguard the umbilical cord from exerted pressure [2] [3].Several studies have shown that its volume gradually increases throughout the course of pregnancy.At 12 weeks, it measures approximately 50 ml, which increases to 350-400 ml at 20 weeks, and 1000 ml at 35-38 weeks [4].Based on previous reports, there is often a significant surge in amniotic fluid volume from weeks 8 to 28.After the 28th week, the increment rate typically diminishes, stabilizing at around 35-36 weeks.As the pregnancy progresses beyond 41 weeks (post-term), volume starts to decline, occasionally dropping below 500 ml [5].
Obstetric specialists often employ a medical technique known as Single Deepest Pocket (SDP) to assess volume of amniotic fluid [6].SDP classifies volume into 3 categories, namely Oligohydramnios, Polyhydramnios, and Normal characterized by the longest vertical line measuring <2 cm, ≥8 cm, and 2-8 cm, respectively [7] [8].The process commences by identifying and determining the largest single pocket of amniotic fluid during the examination, ensuring it is not obstructed by the umbilical cord and fetal body.Calipers are then positioned at the upper (adjacent to the placenta) and lower (adjacent to the uterus) boundaries of the largest single pocket of amniotic fluid.Subsequently, the longest vertical line between these calipers is drawn without contacting the fetal body or other objects [9].This procedure, known as the Maxima Vertical Pocket (MVP) method, is employed to draw the longest vertical line [10].The subsequent step involves measuring the length to categorize amniotic fluid volume.The ultrasound monitor screen displays calipers as measurement markers.The calipers and other parts of amniotic fluid image are presented in Fig. 1.  [11] One limitation of the manual volume measurement conducted by obstetric specialists is the potential of the drawn line between the two calipers to deviate from perfect vertical alignment, which can affect the diagnosis of amniotic fluid based on volume.Therefore, this study proposes the development of detection model, known as modified Single Deepest Vertical Detection (SDVD) algorithm.The primary aim of modified SDVD algorithm is to automatically measure the longest vertical line within the region of interest (ROI) of amniotic fluid in accordance with medical rules and regulations.The ROI is a binary image, where the white color (1) represents amniotic fluid, while the black color (0) indicates other organs.Algorithm searches the columns of pixels comprising the image to obtain vertical line that does not intersect with the fetal body.This ensures that the detected vertical line accurately reflects amniotic fluid volume.
Several studies have utilized various methods to determine amniotic volume, including SDP [12].This approach utilizes opening and closing methods within the ROI.The opening aims to eliminate small positive holes, while the closing fills small holes to obtain deepest vertical length.Furthermore, our previous researh [13][14] developed a calculation model that identified the column in the matrix with the highest number of 1 (white), representing amniotic fluid.The output of this algorithm is the number of pixels in the column with the highest number of 1, as well as its corresponding index.Several studies have successfully represented the length of the longest vertical line but the problem of intersecting lines caused by the fetal body has not been addressed.Therefore, the novelty of this study lies in the Development Model of modified SDVD algorithm, which aims to measure the depth of amniotic fluid vertically.Algorithm searches the columns of pixels constituting the image, specifically targeting those that do not intersect with the fetal body.Based on the experimental results using modified SDVD, show SDP/vertical length measurement results of amniotic fluid on the testing data had an absolute difference closeness of 86.86% or an absolute average error rate of 13.14%.The remaining part of this study is organized as follows: Section 2 explains the methods used, while Section 3 focuses on the experimental results and analysis.Section 4 elaborates on the conclusion of the study.

II. METHOD
This study proposed a model for measuring amniotic fluid volume using modified SDVD algorithm approach on 2D ultrasound images.Modified SDVD algorithm aimed to obtain the longest straight vertical line without any intersections or contact with other objects, such as the umbilical cord, bones, or fetal body parts.Furthermore, the development model for measuring amniotic fluid volume consisted of 4 stages, as shown in Fig. 2. The model began with image acquisition and preprocessing, followed by the determination of volume using modified SDVD algorithm.The next stage involved calibration from pixels to centimeters and the last stage was to compare measurement results produced by the proposed method (SDVD algorithm) with those obtained by obstetric specialists.This section generally consists of types of research, research objects, time of research, data collection, data analysis methods, ways of presenting analysis results, and data validity.These sections are tentative and adapted to the type of research.The flow or research steps are better presented as flowcharts to facilitate understanding the research steps being carried out.

A. Image Acquisition and Pre-Processing
B-mode ultrasound amniotic fluid images were recorded using an ultrasound machine.A total of 130 image samples were used, of which 95 and 40 were employed for training and testing, respectively [13], [15], [16].Amniotic fluid images were obtained from the Obstetrics and Gynaecology laboratory of Surya Husadha Hospital in Bali.Furthermore, the specifications of the machine used included Accuvix XG and transducer with 3.5 Hz frequency, 3-0.2 mm lateral resolution, jpg image format, and 800 x 600 pixels size [15], [16].The gestational age of the included data was in the second trimester during the 13th week, and obese pregnant women were excluded.The preprocessing process was carried out by segmenting the AF image using the U-Net semantic segmentation model approach with the Roonerberger architecture [16]- [19].

B. Modified SDVD Algorithm
To determine amniotic fluid volume using an ultrasound machine, the obstetrician drew the calipers vertically.Furthermore, the calipers were placed and drawn vertically after identifying amniotic fluid area that was free from the fetal body and umbilical cord.To obtain SDP measurement that aligned with the medical guidelines in obstetrics and gynecology, this study proposed algorithm to achieve the longest straight vertical line (modified SDVD) within the ROI of amniotic fluid, as shown in Fig. 3.The ROI was a binary image where the white color (1) represented amniotic fluid, while the black color (0) indicated other organs.The medical SDP method stated that the longest straight vertical line must not have any intersections or contact with other objects [10].The steps of this algorithm are presented below:  The first step was to create a bounding box around the ROI of amniotic fluid, where m and n represented the window size. The next step was to initialize the parameter k for column iteration.The flag was a parameter used to check for the presence of other organs in column k, indicated by the black color (0).When black (0) was encountered, the row in the window (n) could not be used to obtain the longest straight vertical line and algorithm moved to the next column (m), where b was the iteration for rows.Furthermore, Sum was used to store the count of white pixels in a row and Max was used to store the maximum count of white pixels in a column. The iteration started from the first column and the check was performed to determine whether the iteration of column (k) was ≤m.If the iteration was still within the column below the value of m, it proceeded to row b until b≤n.Each value of 1 with a flag value less than 2 was considered a white pixel contributing to the longest straight vertical line.The flag value changed to 2 when there was a transition from a value of 1 to 0. The result of this algorithm formed the white pixels (1), thereby automatically obtaining the longest straight vertical line.Meanwhile, to obtain measurement in centimeters for the longest straight vertical line, the pixel conversion process was performed as described in section.

C. Pixel to Centimeter Calibration
The calibration process from pixels to centimeters (cm) in amniotic fluid ultrasound image was carried out using a reference line (vertical) or strip in the right-side information area.The distance between these 2 points or lines/strips represented the value of 1 centimeter (cm), which was obtained from the information provided in the ultrasound image.The value of 1 centimeter (cm) consisted of 28 pixels, determined by summing the number of pixels.To create this line, the imline function in Matlab was used, which interactively placed a line on the desired pixel axis or coordinates in the image.The imline function generated the coordinates from the starting point and endpoint of the drawn line.Furthermore, to determine the distance between these points, the Euclidean distance calculation was used.The results showed the distance in terms of the number of pixels constituting the length of the line.In this study, the starting and endpoint coordinates used for calibration were 621,147 and 621,175, respectively.From these coordinates, the constituent pixels were then calculated.
Based on the calculation results, the distance or number of pixels between these 2 points was 28 pixels, which was stored in the variable d.Therefore, the calibration process from pixels to centimeters yielded 1 28 = 0,0357 , stored in the variable pixel_size.

D. IF-THEN Algorithm
The testing scheme for amniotic fluid volume classification model was divided into 2 two parts, namely training and testing data.Classification of amniotic fluid volume was carried out by forming rules in the form of IF-THEN.SDVD value served as a reference to determine the class of the input image.An SDVD value of <2.0, ≥8.0, and 2-8 cm belonged to the Oligohydramnios, Polyhydramnios, and Normal classes, respectively.The performance of amniotic fluid volume classification was divided into 3 classes (Normal, Oligohydramnios, and Polyhydramnios) and was evaluated using a multiclass confusion matrix.

E. Performance Evaluation
To assess the performance of SDVD algorithm, a comparison was made between SDP measurement results obtained from obstetric specialists and the proposed method.The experiment was conducted on 40 amniotic fluid testing images and the unit of length was centimeters (cm).Meanwhile, the parameters used to evaluate the performance of amniotic fluid volume classification included accuracy, precision, and recall, as indicated in equations (1-3) [20].

𝐴𝑐𝑐𝑢𝑟𝑎𝑐𝑦 = TP + TN TP + FP + TN + FN
(1) TP is True Positive (a positive label predicted as an actual label), FP is False Positive (negative label but predicted as a positive label), TN is True Negative (negative data predicted correctly), and FN is False Negative (a positive label but predicted as a negative label).

III. RESULT AND DISCUSSION
Tests were carried out using 3 scenarios, where the first was to test and see the performance of the proposed method on the classification of amniotic fluid volume in the training dataset.The second scenario is to test the classification of the test dataset the third scenario is to compare the proposed method with the previous study.

A. Performance Results of Modified SDVD for Amniotic Fluid Volume on Training Data
Table I presented a comparison of several examples of amniotic fluid volume classification results on the training data.The results showed 7 out of 95 images had different classification compared to the ground truth labels, namely AF65, AF66, AF77, AF81, AF86, AF89, and AF93.The differences in volume classification results were attributed to poor segmentation outcomes in these images.This was caused by the presence of significant redundancy between amniotic fluid and the ultrasound wave reflections on the uterine wall, leading to the formation of black areas with a similar appearance to amniotic fluid.Table II shows the multiclass confusion matrix for amniotic fluid volume on training data.
Based on Table II, classification model for measuring SDP on training data had 92.63% accuracy, 85.23% precision, and 95.60% recall.

B. Performance Results of Modified SDVD for Amniotic Fluid Volume on Testing Data
In this section, a comparison testing was conducted between amniotic fluid SDP measurement made by obstetric specialists and the proposed method (SVDD).This was performed to determine the absolute difference closeness between the 2 measurements.Furthermore, the experiment was performed on 40 testing images and the results are shown in Table III.
SDP measurement results of amniotic fluid from the proposed modified SDVD method on the testing data had an absolute difference closeness of 86.86% or an absolute average error rate of 13.14%.The results of the liquid volume classification on the testing data with a total of 40 images are shown in Table IV.
The testing was conducted using 40 images that contained SDP information obtained from the obstetric specialists' measurement.According to Table 4, a total of 4 out of the 40 images had different classification results compared to the obstetric specialists' labels, namely AFU08, AFU13, AFU15, and AFU39.Furthermore, the multiclass confusion matrix for the testing data was presented in Table V.
Based on Table V, the performance of the model using the IF-THEN algorithm and the proposed method (SDVD) in classifying amniotic fluid volume in the testing data showed 90% accuracy, 80% precision, and 92% recall.The results shown by the multiclass confusion matrix in Tables 2 and 5 for amniotic fluid classification using the IF-THEN algorithm demonstrated good performance on both training and testing data.Furthermore, Fig. 4 presented vertical length measurement results using the proposed SDVD algorithm method.

C. Performance Result of Modified SDVD on Previous Study
This section presented a comparison of the performance between the proposed method and previous studies on classification of amniotic fluid volume, as shown in Table VI.
Based on Table VI, the proposed method experienced an improvement in performance, namely a 9%, 4%, and 13% increment in accuracy, precision, and recall, respectively.Based on experimental results using modified SDVD algorithm, the average accuracy, precision, and recall achieved for amniotic fluid classification were 92.63%, 85.23%, and 95.6%, respectively.

Fig. 2 Fig. 3
Fig. 2 The development model for measuring amniotic fluid volume

Fig. 4
Fig. 4 on the red line in parts (c) and (d) showed measurement results of vertical length with the proposed modified SDVD algorithm method.

Fig. 4
Fig. 4 SDP measurement results using the proposed method (a) original image, (b) segmentation result, (c) segmentation image with vertical length, (d) segmentation result and SDVD algorithm