Interpolation Features in ContExt Software for Mammography Processing
Tokairin, R.; Casamaximo, R. F.; Romeiro, N. M. L.; Silva, P. Z.; Cirilo, E. R.
DOI 10.5433/1679-0375.2025.v46.53582
Citation Semin., Ciênc. Exatas Tecnol. 2025, v. 46: e53582
Received: August 19, 2025 Received in revised for: October 21, 2025 Accepted: November 20, 2025 Available online: December 4, 2025
Abstract:
This study proposes the expansion of the functionalities of the ContExt software, designed for contour extraction and mesh generation for numerical simulations in medical imaging. The main innovation is the incorporation of interpolation methods to enlarge contours after image resolution reduction, thereby enabling greater computational efficiency. Bilinear, bicubic, biquadratic, and cubic spline methods were evaluated, along with refinement techniques such as node removal and the Ramer–Douglas–Peucker algorithm. Reducing the image to half of its original resolution resulted in a significant decrease in processing time (over 95%) while maintaining satisfactory contour quality. However, a reduction to one-quarter resolution compromised the fidelity of the extracted structures. Bilinear method achieved the highest overlap rate, whereas the cubic spline proved to be the most accurate. Tests demonstrate that the new functionalities integrated into ContExt make the software more versatile and efficient for processing high-resolution images, with potential applications in various clinical and computational contexts.
Keywords: medical image processing, contour extraction, interpolation methods, computational efficiency
Introduction
Image processing, particularly in medical imaging, has emerged as a promising tool for the diagnosis of lesions and as a means of supporting the identification of diseases such as cancer. The onset of cancer occurs due to modifications in the genetic structure of cells, resulting in uncontrolled cell proliferation and the formation of tumors (Yixiao Feng et al., 2018). In particular, breast cancer is the most common cancer in women over the course of their lifetime (Instituto, 2004), and mammography is essential, as it is an effective method for the early detection of breast abnormalities (Rosana Laira Azevedo et al., 2016), often before they become palpable to the patient or detectable during a clinical examination.
Advances in image processing technology have therefore become increasingly significant, enabling analyses with greater precision and focus on specific details within images (Liu et al., 2021). However, the growing dimensionality of images poses a challenge, as high-resolution imaging demands the adoption of discrete and simplified representations, as well as effective correspondence measures, to maintain computational efficiency (Zare et al., 2013), without compromising image quality. Furthermore, the literature explores various approaches to optimize the processing of ultra–high–definition images.
(Dumic et al., 2007) investigated the use of the Discrete Wavelet Transform (DWT) as a technique for image interpolation. The authors analyzed the method’s potential to enhance image quality by increasing resolution, highlighting that DWT can be highly effective for compression, encoding, and interpolation tasks, often producing superior results compared to traditional methods such as bilinear or spline interpolation. However, they noted that although the technique preserves important image details, its computational complexity and the risk of introducing processing artifacts are limitations that must be considered.
In downscaling–upscaling, (Jarosch et al., 2010) discussed advanced methods applied to temperature data to improve efficiency in glacier modeling, adapting broad climate datasets to smaller and more specific scales, such as a particular region or geographic area.
(Cirilo et al., 2023) modeled a new quality parameter for generating two-dimensional image edges via spline interpolation. The motivation of the study was to define a parameter that would allow establishing a stopping criterion for inserting image data and obtaining a sufficiently faithful spline representation.
(Chai et al., 2023) developed a strategy aimed at increasing computational efficiency when processing ultra-large satellite images by applying downscaling upscaling techniques. The method employs bilinear interpolation during resizing, allowing for the temporary reduction of high-resolution images before enlarging them back to their original resolution, thereby enhancing the region of interest.
(Yu et al., 2023) proposed an approach using a non-uniform, spatially variable resizer, in contrast to the conventional method of uniform reduction followed by upscaling. The proposed neural network model demonstrated superiority in both efficiency and quality for ultra–high-definition images.
Although techniques such as interpolation, resizing, DWT, and advanced downscaling–upscaling methods have demonstrated effectiveness in various applications, they often require greater computational resources and may not fully address the specificities of the medical domain. (Sickles et al., 2007) investigates features of breast asymmetries in digital images to identify possible benign or pathological conditions, describing additional evaluation steps, such as biopsies and complementary examinations, necessary to determine the cause of these asymmetries.
Conversely, (Yang et al., 2009) highlight that analyzing the symmetry of breast tumor shapes, using contour extraction and processing techniques combined with quantitative analysis, can provide valuable diagnostic information. The authors observe that benign tumors generally present greater symmetry compared to malignant ones, underscoring the need for image-processing approaches that are both efficient and tailored to the clinical characteristics of medical data.
Nonetheless, medical image processing faces significant challenges, especially with the substantial increase in data volume, which, as noted by (Scholl et al., 2011), has grown from kilobytes to terabytes. This exponential growth demands adaptations in processing and visualization algorithms to effectively handle the increasing load. Consequently, image preprocessing becomes fundamental for the accurate classification of diseases, particularly in mammography, which can contain various types of noise.
Noise can compromise the quality of information but can be mitigated through advanced filtering techniques, preparing images to emphasize relevant information while discarding irrelevant data (Canayaz, 2021; Suman et al., 2014; Jasti et al., 2022). This approach opens opportunities for improvements in preprocessing software, which, by enhancing images prior to their integration into machine learning algorithms, can facilitate lesion segmentation in laboratory images.
In this framework, the ContExt software (ContExt, 2024) plays an important role in image processing and contour extraction, facilitating contour segmentation, an essential preliminary step for isolating and analyzing regions that may indicate lesions in mammography. Despite the effectiveness of ContExt in contour extraction through advanced image processing techniques (Silva et al., 2025; Casamaximo et al., 2021), the high dimensionality of medical images can make the process computationally expensive.
Therefore, this study proposes the integration of a new functionality into the ContExt software for contour enlargement using interpolation methods such as bilinear, bicubic, biquadratic, and cubic spline (Thévenaz et al., 2000; Patel et al., 2013; Fadnavis, 2014; Smith, 2020). The selection of interpolation methods aims to enhance resolution and minimize quality loss in the extracted contours, adjusting the image for improved representation of regions of interest. Additionally, fine detail recovery techniques, such as node removal and the Ramer–Douglas–Peucker algorithm (Ramer, 1972), were employed to reduce data noise and improve contour smoothing, thereby enhancing the quality of the extracted structures.
The overall objective is to understand how these approaches can improve computational efficiency while maintaining contour quality in image processing. The methodology of this study encompasses a process of contour reduction and enlargement, followed by a comparative analysis based on the calculation of overlap percentage and the mean distances between interpolated contours and the originals from the reduced image, for each interpolation method, with and without the application of fine detail recovery techniques.
Materials and methods
Breast cancer encompasses various malignant neoplasms of the mammary glands, with carcinomas being the most common and sarcomas less frequent (Yixiao Feng et al., 2018). Understanding clinical and epidemiological characteristics (Romeiro et al., 2022) complements early detection strategies, which have broadened the identification of cases across all age groups and contributed significantly to reducing mortality, especially among women aged 50 to 70 (Hazel, 2001; Nyström et al., 2002; Siegel et al., 2018). Digital mammography is currently considered the gold standard for screening (Kösters & Gøtzsche, 2003).
As one of the most widely used examinations, mammography requires the adaptation of image processing algorithms to improve efficiency and accuracy in image analysis, especially in light of the substantial increase in data volume. Digital imaging enables the separation of acquisition, processing, and display stages, facilitating the optimization of each step (Kösters & Gøtzsche, 2003). Processing is used to adjust contrast, remove noise, sharpen edges, and filter images, thereby improving visualization and providing valuable diagnostic information (Schulz-Wendtland et al., 2009; Kshatri & Singh, 2023; Silva et al., 2025). Noise reduction techniques and the use of multi-loss functions help improve segmentation by addressing variations in the representation of different regions, enabling more accurate analysis even when certain regions are less frequent or more difficult to identify.
In this study, the original mammogram was analyzed to identify asymmetric regions that may indicate the presence of breast cancer (Sickles, 2007). To highlight possible lesions, image binarization was performed using the ContExt software (ContExt, 2024). The process begins with brightness and contrast adjustment of the mammogram image, followed by the application of thresholding. The same parameters can be applied to images of both the right and left breast, allowing for the overlay of binarized images to assess potential asymmetries.
According to (Yang et al., 2009), analyzing the symmetry of tumor shapes can provide important diagnostic information, as benign tumors tend to exhibit greater symmetry compared to malignant ones. Once a lesion is confirmed, the high-resolution image is reduced in two stages: first to half of the original resolution (1/2 resolution), and then to one quarter of the original resolution (1/4 resolution).
The contours extracted from the reduced images were enlarged using the new functionality of the ContExt software, applying interpolation methods such as bilinear, bicubic, biquadratic, and Cubic Spline. To minimize noise, fine detail recovery techniques, such as node removal and the Ramer–Douglas–Peucker algorithm, were considered as alternatives in the extraction of interpolated contours.
The flowchart shown in Figure 1 illustrates the steps of the mammogram image analysis process.
Interpolation techniques
Interpolation, the process of reconstructing continuous data from discrete points within a known interval, is essential in the medical field. Techniques such as bilinear, bicubic, biquadratic, and Splines (Thévenaz et al., 2000) are widely used, as the final quality of processed images when resampling, downscaling, or upscaling directly depends on the chosen interpolation method. In the ContExt software, under the interpolation tab, the main interpolation methods were implemented as follows:
Bilinear: bilinear interpolation calculates the value of an interpolated point using a weighted average of the values of four neighboring pixels (px) in the horizontal and vertical directions. This method is simple, fast, and produces smooth results, but may fail to capture fine image details. Nonetheless, it is widely used for image scaling (Patel et al., 2013).
Bicubic: bicubic interpolation, an extension of bilinear, uses a third-degree polynomial to fit the values within a 4\(\times\)4 px neighborhood instead of only four neighboring pixels, resulting in better preservation of details and image quality (Fadnavis, 2014).
Biquadratic: biquadratic interpolation uses a second-degree polynomial to fit neighboring pixel values. Similar to bicubic, it seeks a quadratic function that best fits the surrounding points to determine the interpolated value (Smith, 2020).
Cubic spline: cubic spline interpolation uses smooth curves formed by segments of cubic polynomials to interpolate values between known points. The polynomials are fitted to ensure a smooth curve with continuous first and second derivatives, resulting in an interpolation that preserves both smoothness and image detail (Fadnavis, 2014).
Downscaling–upscaling
Resizing is a common operation in image processing, necessary for adjusting the resolution of high-definition files while maintaining visual appearance. In contrast to downscaling, upscaling, also known as resolution enhancement or super-resolution, seeks to reconstruct a high-resolution image from a low-resolution input (Sun & Chen, 2020).
During upscaling, interpolation methods are often used to fill in newly created pixels, helping to smooth edges and improve the overall appearance of the enlarged image. However, the recovery of fine details remains a challenge, especially when the original image resolution is very low (Shannon, 1949). The present study applies node spacing and node removal (NR) techniques, along with the Ramer–Douglas–Peucker (RDP) contour simplification algorithm, to adjust resolution and enhance contour smoothing.
Node spacing
Node spacing (NS) is a method proposed in this study to adjust the distance between nodes along a contour in digital images while preserving relative node density across different image resolutions. The method works by inserting intermediate placeholder points between the original contour points, which are later filled through interpolation. Specifically, for images at half the original resolution (1/2), the node spacing value is set to 1, meaning one null point is inserted between each original node.
For images at one quarter of the original resolution (1/4), the spacing value is set to 3, inserting three null points between each node. During interpolation, these null points are filled, ensuring that the distance between nodes scales proportionally with the reduced pixel size. This approach preserves the relative node density along the contour and guarantees that the contour representation remains accurate and consistent across different image resolutions.
Node removal
Node removal (NR) is another proposed method aimed at adjusting the density of points along an image contour by removing intermediate nodes and replacing them with null values according to a defined node removal parameter. The process begins by keeping the initial and final nodes of the contour intact, while intermediate nodes are replaced with nulls in specific groups. For instance, if the node removal parameter is set to 2, each pair of intermediate nodes is replaced by nulls, and the third is retained, and so on. This approach effectively smooths contours and reduces insignificant variations caused by image noise.
In applications such as mammography analysis, this method is used to prepare data before applying more advanced techniques such as interpolation or contour fitting, thus contributing to fine detail recovery for more precise and efficient interpretation of medical data.
Contour approximation: Ramer–Douglas–Peucker algorithm xxxxxxxxxxxxxxx
The Ramer–Douglas–Peucker (RDP) algorithm is a technique used to simplify a contour while preserving its overall shape (Ramer, 1972). It identifies and removes points that do not significantly affect the general contour shape, based on a defined tolerance value. If the perpendicular distance of a point to the nearest line segment is greater than the tolerance, that point is retained; otherwise, it is removed. This method is useful for reducing contour data complexity without losing important features of the original shape and was implemented in the ContExt software as a contour approximation functionality.
Case study and image processing
This case study analyzes digital mammography images with the aim of evaluating the performance of contour-focused downscaling and upscaling processes. The study was previously approved by the Institutional Ethics Committee (CAAE 65942122.9.0000.5231).
Images from two patients, each with a resolution of 3584\(\times\)3584 px, were used in craniocaudal right (CCR) and craniocaudal left (CCL) views for breast symmetry assessment and the identification of possible suspicious regions. One image was provided by a patient with informed consent, while the other is available in the public repository described in (Jales, 2022).
The procedure followed these steps:
Image Analysis: Digital mammography images were processed in the ContExt software (ContExt, 2024) to identify asymmetric regions between the breasts.
Processing and Contour Extraction: The original image was processed in the filtering tab of ContExt. Contours were then extracted in the contour extraction tab, with the applied filter values recorded and the resulting data stored.
Resolution Reduction: The original 3584\(\times\)3584 px image was reduced in two stages: first to 1792\(\times\)1792 px, and subsequently to 896\(\times\)896 px. The reduced images were then used in the following steps.
Filtering and Interpolation: Using the same parameters defined in step 2, filters were applied to the reduced images. Contours extracted from these images were upscaled using different interpolation methods.
Noise Reduction: Contours were smoothed using node spacing and node removal, as well as the Ramer–Douglas–Peucker algorithm, combined with interpolation, to minimize imperfections and noise.
Comparative Analysis: Finally, contours obtained from the reduced images were compared with those extracted from the original image to assess quality loss, distortions, and shape variations after reduction, enlargement, and smoothing procedures.
Discussion and results
Mammography images, shown in Figure 2, with a resolution of 3584\(\times\)3584 px, were used to assess the breasts in the craniocaudal right (CCR) and craniocaudal left (CCL) views, aiming to identify potential asymmetric regions, as asymmetry may indicate pathological conditions such as breast cancer (Sickles, 2007). Patients were labeled as Patients 1 and 2 for visual distinction.
| (a) (b) | (c) (d) | |
![]() | ![]() | |
Upon examining the mammography images, a significant difference in internal structures can be observed: Figures 2(a) and 2(d) display an area of increased density in the upper breast region, possibly a mass or lesion, which is absent in the breasts shown in Figures 2(b) and 2(c).
Using the ContExt software, it is possible to identify, segment, and highlight the contours of the potential lesions observed in Figures 2(a) and 2(d), corresponding to Patients 1 and 2, respectively, thereby supporting evaluation by a medical professional.
The process begins with image preprocessing, which includes brightness and contrast adjustments, as well as the application of filters to highlight the suspected area. The parameters used are described in Table 1, and the settings applied in ContExt software are shown in Figure 3, under the Filtering tab.
| Filter | Patient 1 | Patient 2 |
|---|---|---|
| Brightness | -70 | -45 |
| Contrast | 1.506 | 1.714 |
| Threshold | 100 | 73 |
| (a) |
|
| (b) |
|
After applying the filters described in Table 1, the main image features, such as contrast and contours, are enhanced, facilitating the visualization of the potential lesion. The pre-processing performed in the ContExt software improves image quality by highlighting relevant details and reducing unwanted noise, thereby contributing to more accurate segmentation and enabling a clearer and more objective analysis.
Subsequently, each image shown in Figures 3(a) and 3(b) is analyzed using the Thresholding tab for binarization. ContExt implements the Chain of Responsibility design pattern (Silva et al., 2025), allowing processing requests to be sequentially passed through different handlers, which ensures flexibility and organization in the image processing workflow.
Figure 4 shows the results from the Thresholding tab, indicating the lesion contours of the patients.
| (a) |
|
| (b) |
|
The Thresholding process highlights the regions corresponding to the suspected lesions, as illustrated in Figures 4(a) and 4(b).
To identify possible asymmetric regions, since asymmetry may indicate pathological conditions such as breast cancer (Sickles, 2007), and to ensure consistency in the analysis, the same parameters from Table 1 were applied to the breast images shown in Figures 2(b) and 2(c), resulting in the binarized images shown in Figure 5.
| (a) |
|
| (b) |
|
The images in Figures 4(a), 4(b), 5(a) and 5(b) reveal the absence of symmetry in the evaluated region between the breasts, underscoring the need for further analysis. In some cases, such asymmetries may warrant additional examinations, such as biopsies, reinforcing the importance of effective processing and visualization methods.
In this study, the binarized images were overlaid to assess asymmetries using advanced image manipulation techniques. The breast shown in Figures 2(a) and 2(d) was colored red, with 30% opacity and the Darker Color blending mode, while the one in Figures 2(b) and 2(c) was marked in blue, with 20% opacity. The images were then superimposed to evaluate symmetry, as shown in Figure 6.
| (a) | (b) |
|
|
In Figure 6, shades of red, blue, and purple can be observed. The purple tone indicates symmetric regions between the breasts, while predominantly red or blue areas highlight asymmetries. Both patients present significant breast asymmetries, as already noted in Figure 2. The Lighten blending mode was applied to facilitate visual comparison between mammograms, emphasizing structural similarities and differences.
Finally, with the aid of ContExt, the lesion region highlighted in Figures 6(a) and 6(b), corresponding to Patients 1 and 2 respectively, was segmented using the Contour Extraction tab, as illustrated in Figure 7.
| (a) |
|
| (b) |
|
As shown in Figure 7(a) and 7(b), the highlighted regions obtained using the Contour Extraction tab for Patients 1 and 2 present distinct contours, yet both are asymmetric. As pointed out by (Yang et al., 2009), the absence of symmetry in segmented contours, depicted in green, can provide relevant diagnostic information, since benign tumors tend to be more symmetric when compared to malignant ones. In addition to assisting in segmenting regions that may contain lesions, the software offers various parameters for mesh generation, considering the application of the finite difference method, which facilitates mathematical modeling and numerical simulations (Silva et al., 2025).
All segmentation and contour extraction steps were carried out based on the images of two patients. However, to meet the study’s objectives, which include optimizing image processing and integrating interpolation functionalities into the ContExt software, detailed analysis was conducted using the image of Patient 1, specifically the right breast presented in Figure 2(a), whose segmented lesion is highlighted in Figure 7(a).
Contour Analysis
The original image of Patient 1, with a resolution of 3584\(\times\)3584 px, was downscaled in two stages: first to 1792\(\times\)1792 px (1/2 of the original resolution) and then to 896\(\times\)896 px (1/4 of the original resolution). The resulting images, processed using the ContExt software, followed the same procedures described for the generation of Figure 7(a), enabling a comparative analysis of contour quality across different resolutions.
For the analysis of the image at 1/2 of the original resolution, a node spacing of 1 and the contour expansion option were applied. For the image at 1/4 of the original resolution, the node spacing was set to 3, and the threshold in the thresholding tab was increased to 106. Noise reduction was tested through node removal and contour approximation using the Ramer–Douglas–Peucker algorithm. The parameters are described in Table 2.
| Filter | 1/2 of original resolution | 1/4 of original resolution |
| Lesion | Lesion | |
| Threshold | 100 | 106 |
| Node spacing | 1 | 3 |
| Node removal | 2 | 2 |
| Contour approximation (\(\epsilon\)) | 0.002 | 0.002 |
Using the software, it was possible to obtain information on the segmented lesion region’s area and position, considering both the original and the downscaled images. Such information can be used for medical analysis as well as to guide clinical interventions. The data were exported into text files containing the minimum and maximum \(X\) and \(Y\) coordinates, along with the number of cells in the \(x\) and \(y\) directions, represented by \(n_x\) and \(n_y\), as presented in Table 3.
| Property | Original resolution | 1/2 of original resolution | 1/4 of original resolution |
|---|---|---|---|
| Area | 28644 | 28472 | 25600 |
| \(X_{\min}\) | 3003 | 2996 | 3004 |
| \(Y_{\min}\) | 2279 | 2282 | 2288 |
| \(X_{\max}\) | 3282 | 3286 | 3276 |
| \(Y_{\max}\) | 2503 | 2508 | 2500 |
| \(n_x\) | 280 | 291 | 273 |
| \(n_y\) | 225 | 227 | 213 |
Table 3 shows that lesion area reduction results in a 0.60% loss for the image at 1/2 resolution, indicating good preservation of clinical information. In contrast, the 10.63% loss at 1/4 resolution is significant, suggesting a compromise in image quality and accuracy in lesion assessment. These results emphasize the importance of balancing resolution reduction with the maintenance of diagnostic quality, which directly impacts the performance of contour extraction methods for mammography images at different resolutions.
Contour extraction performance at different resolutions xxxxxxxxxxxxxxx
Based on preliminary tests performed on a machine with an i5-12400F processor, an RTX 4060 GPU, and 16 GB of RAM (6000 MHz), the software yielded the following average times for contour extraction from a mammography image at original and reduced resolutions:
At the original resolution, the average contour extraction time was 217.29 seconds.
At 1/2 resolution, processing time dropped to 9.17 seconds, representing a significant performance gain without substantial compromise in contour quality, as shown in Table 3, where the area remained close to the original resolution.
At 1/4 resolution, extraction time was 0.58 seconds. However, this extreme reduction resulted in a considerable loss of contour information, with significant area differences as shown in Table 3.
Ten trials were conducted to calculate the average contour extraction performance at both original and reduced resolutions. The comparison of processing times highlighted a trade-off between performance and quality: while reducing resolution to 1/2 and 1/4 drastically decreased extraction time, it came at the cost of a significant loss of detail, particularly at 1/4 resolution.
Reduced-resolution contour analysis with interpolation xxxxxxxxxxxxxxx
To evaluate contours at reduced resolution, the interpolation functionality of ContExt was employed to enhance image precision and quality. The Interpolation tab offers four methods bilinear, bicubic, bi-quadratic, and cubic spline, implemented using the Pandas library (McKinney, 2011) in Python (Python, 2021). Additionally, this tab includes two fine-detail recovery techniques: Node Removal (RN) and the Ramer–Douglas–Peucker algorithm (RDP), both designed to approximate the contour while preserving its overall shape.
Furthermore, the Expand Dimensions method was applied, which adjusts contour size by multiplying its spacing according to the value set in the Node Spacing Increment parameter. For the 1/2 resolution contour, the value was set to 1, resulting in a doubling of contour size. For the 1/4 resolution contour, the Node Spacing Increment was set to 3, producing a fourfold enlargement. This adjustment facilitates comparison between the original contour and the interpolated contour from the reduced image.
Accordingly, using the parameters presented in Table 2, the data generated in the Interpolation tab for the 1/2 resolution image were computed using the bicubic method.
Fine-detail recovery techniques were not applied, meaning the interpolated contour, in orange, represents the raw interpolation result without additional adjustments. In contrast, the reduced and resized contour without interpolation is shown in blue. The results are presented in Figure 8.
Figure 8 presents the comparison between the resized original contour (in blue) and the contour obtained after bicubic interpolation (in orange), illustrating how the method improves contour definition. A smoothing of the edges and preservation of lesion details can be observed.
Given that displaying all results simultaneously within the Interpolation tab would result in an overly cluttered visualization, separate data files containing different contour representations of the lesion were generated. These files were created from multiple resolutions and processing techniques, with the aid of MATLAB, to facilitate result evaluation and interpretation.
The contours were extracted from reduced resolutions and from the techniques implemented in the Interpolation functionality, all compared to the original-resolution image contour. Fine-detail recovery was performed using node removal and the Ramer–Douglas–Peucker algorithm.
The results are illustrated in Figures 9 and 10, where:
CL represents the lesion contour at original resolution,
CR corresponds to the reduced-resolution contour without fine-detail recovery,
RN and RDP show the reduced-resolution contour with fine-detail recovery using node removal and the Ramer–Douglas–Peucker algorithm, respectively.
| (a) | (b) |
![]() | ![]() |
| (c) | (d) |
![]() | ![]() |
| (a) | (b) |
![]() | ![]() |
| (c) | (d) |
![]() | ![]() |
The images in Figures 9 and 10 present, respectively, the results of contour upsampling obtained through different interpolation methods: bicubic, bilinear, bi-quadratic, and cubic spline. These methods were applied at two resolutions (1/2 and 1/4), with and without fine-detail recovery techniques. In each plot, the original contour is compared with the interpolated results, highlighting the versions using RN and RDP.
At 1/2 resolution, all methods produce contours closely resembling the original, with slight variations in smoothness and shape. Differences in fine-detail representation between RN and RDP become noticeable, with node removal contributing to reduced noise compared to the interpolated version without additional techniques.
At 1/4 resolution, the loss of detail becomes more pronounced regardless of the technique employed. While the general contour structure is preserved, smoothness precision is lower than at 1/2 resolution, underscoring the importance of detail-recovery strategies to maintain shape fidelity.
It is noteworthy that at 1/4 resolution, greater discrepancies are observed among interpolation methods, particularly in how each handles information loss and detail recovery; however, the lesion shape remains preserved. Among the methods shown in Figure 9 and 10, bilinear interpolation stands out in both resolutions (1/2 and 1/4) for maintaining a balance between contour definition and smoothness, while cubic spline interpolation can be more effective in cases where smoothing is desired, it may not be the best choice for accuracy.
These differences can be observed in the zoomed-in regions shown in Figures 9(a)–-9(d), and 10(a)–10(d).
To assess the similarity between lesion contours at reduced resolutions and the interpolated contours, the data were processed to include the minimum and maximum \(X\) and \(Y\) coordinates, as well as the number of cells in the \(x\) and \(y\) directions (\(n_x\) and \(n_y\)), providing a simplified representation that highlights variations and trends among the different interpolation methods. This process included variance calculation, which measures data dispersion relative to the mean. The results are presented in Table 4.
| Property | 1/2 of original resolution | 1/4 of original resolution |
|---|---|---|
| Enlargement without detail recovery technique (RL) | ||
| Area | 28493.56 \(\pm\) 77.73 | 25796.28 \(\pm\) 69.23 |
| \(X_{\min}\) | 2995.92 \(\pm\) 0.08 | 3004 |
| \(Y_{\min}\) | 2281.86 \(\pm\) 0.09 | 2287.59 \(\pm\) 0.24 |
| \(X_{\max}\) | 3286.31 \(\pm\) 0.20 | 3276 |
| \(Y_{\max}\) | 2508.17 \(\pm\) 0.11 | 2500.52 \(\pm\) 0.53 |
| \(n_x\) | 291.25 \(\pm\) 0.43 | 273 |
| \(n_y\) | 227.25 \(\pm\) 0.43 | 214 \(\pm\) 0.70 |
| Node removal (RN) | ||
| Area | 28641.48 \(\pm\) 42.60 | 26178.81 \(\pm\) 18.56 |
| \(X_{\min}\) | 2995.98 \(\pm\) 0.02 | 3007.9 \(\pm\) 0.10 |
| \(Y_{\min}\) | 2281.95 \(\pm\) 0.05 | 2287.47 \(\pm\) 0.48 |
| \(X_{\max}\) | 3286.06 \(\pm\) 0.06 | 3272.57 \(\pm\) 0.52 |
| \(Y_{\max}\) | 2508.06 \(\pm\) 0.03 | 2500.48 \(\pm\) 0.49 |
| \(n_x\) | 291.25 \(\pm\) 0.43 | 265.75 \(\pm\) 0.43 |
| \(n_y\) | 227 | 214.25 \(\pm\) 0.82 |
| Contour approximation: Ramer–Douglas–Peucker (RDP) | ||
| Area | 28551.35 \(\pm\) 79.75 | 26026.32 \(\pm\) 70.10 |
| \(X_{\min}\) | 2995.32 \(\pm\) 0.41 | 3004 |
| \(Y_{\min}\) | 2281.58 \(\pm\) 0.25 | 2287.37 \(\pm\) 0.38 |
| \(X_{\max}\) | 3286.59 \(\pm\) 0.67 | 3277.08 \(\pm\) 0.77 |
| \(Y_{\max}\) | 2508.11 \(\pm\) 0.19 | 2500.83 \(\pm\) 0.76 |
| \(n_x\) | 292.25 \(\pm\) 1.09 | 274 \(\pm\) 0.70 |
| \(n_y\) | 227.75 \(\pm\) 0.43 | 214.5 \(\pm\) 1.11 |
To analyze the similarity between the original and interpolated contours (CR, RN, and RDP), Algorithm 1 was used, which calculates the Euclidean distance between the original points and the others, evaluating the similarity between the two point sets.
- Input: Files
file1andfile2, containing coordinates of point sets; threshold for distance comparison. - Output: Overlap percentage
perc_interpolatedand mean distancemean_diff. - function load_points(file_name)
- Create empty list
points - For each line in
file_name: - Extract coordinates x and y
- Add (x, y) to
points - return
points - function euclidean_distance(p1, p2)
- return \(\sqrt{(p1_x - p2_x)^2 + (p1_y - p2_y)^2}\)
- function calculate_similarity(file1, file2, threshold)
- Load
original_points← load_points(file1) - Load
interpolated_points← load_points(file2) - Initialize
overlapping_points ← 0 - Create empty list
dist_within_radius - Create boolean list
points_usedwith length = interpolated_points - For each
point1inoriginal_points: - Set
min_dist ← ∞,min_dist_index ← -1 - For each
point2ininterpolated_points: - If
point2not used: - Compute
aux_dist = euclidean_distance(point1, point2) - If
aux_dist < min_dist: - Update
min_dist ← aux_dist - Update
min_dist_index - If
min_dist < threshold: - Increment
overlapping_points - Add
min_disttodist_within_radius - Mark point2 at
min_dist_indexas used perc_interpolated ← overlapping_points / len(interpolated_points)-
mean_diff ← mean(dist_within_radius)(or 0 if list is empty) - return
perc_interpolated, mean_diff - Call
calculate_similarity(file1, file2) - Print
perc_interpolatedandmean_diff
Using Algorithm 1, the percentage of overlap was calculated with a radius of 2.5 px as the threshold limit, as well as the mean distances for each interpolation method. Additionally, each original point was evaluated within the radius, verifying whether the corresponding point in the downsampled image fell within the defined area. If it was within the radius, the point was considered overlapped, which reinforces the accuracy of the interpolation. The results are presented in Table 5.
| Interpolation | 1/2 of original resolution | 1/4 of original resolution | |||
| Overlap (%) | Mean (px) | Overlap (%) | Mean (px) | ||
| Enlargement without detail recovery (LR) | |||||
| bilinear | 90.42 | 1.57 | 64.98 | 1.68 | |
| bicubic | 89.83 | 1.59 | 63.58 | 1.68 | |
| biquadratic | 89.90 | 1.60 | 63.76 | 1.67 | |
| Cubic spline | 88.32 | 1.49 | 62.17 | 1.65 | |
| Node removal (RN) | |||||
| bilinear | 88.32 | 1.48 | 58.99 | 1.51 | |
| bicubic | 88.06 | 1.55 | 60.58 | 1.65 | |
| biquadratic | 88.19 | 1.54 | 59.83 | 1.63 | |
| Cubic spline | 84.71 | 1.41 | 60.21 | 1.61 | |
| Contour approximation: Ramer–Douglas–Peucker (RDP) | |||||
| bilinear | 89.34 | 2.06 | 69.10 | 2.02 | |
| bicubic | 83.67 | 2.02 | 69.10 | 1.95 | |
| biquadratic | 86.00 | 2.01 | 69.58 | 1.93 | |
| Cubic spline | 87.30 | 2.02 | 68.87 | 1.94 | |
The results presented in Table 5 indicate that different interpolation methods have similar impacts on the quality of the enlarged contours. Bilinear method, without additional techniques, exhibited the highest overlap rate of 90.42% and a relatively low mean distance of 1.57 px at half the original contour, demonstrating good structural preservation. The cubic spline, although showing a slightly lower overlap of 88.32%, achieved the lowest mean distance of 1.49 px, indicating greater accuracy in contour reconstruction. With node removal, all methods consistently reduced distances, with cubic spline reaching 1.41 px, while bilinear maintained a good overlap of 88.32%. Under the contour approximation condition, overlap ranged from 83.67% to 89.34%, with mean distances slightly above 2.00 px.
For 1/4 of the original contour resolution, a more significant loss of detail was observed, with overlaps dropping to between 62% and 64% and mean distances around 1.65 px. This indicates that, although interpolation still preserves the contour structure, reducing to 1/4 resolution results in greater information loss, making this resolution less suitable in terms of accuracy, especially when compared to the 1/2 resolution, which maintains a more advantageous balance between quality and performance.
Conclusion
Medical image processing, particularly in mammography analysis, has proven crucial for effective diagnosis. Tests conducted demonstrated that reducing image resolution can significantly optimize processing time, especially when reduced to half the original resolution, where contour extraction time dropped to 9.17 seconds, corresponding to only 4.22% of the original time, a reduction of approximately 95.78%, while preserving contour quality.
At 1/4 resolution, extraction time was even shorter, 0.58 seconds, equivalent to just 0.27% of the original time, or a reduction of 99.73%. However, this sharp decrease resulted in significant information loss, with noticeable differences in contour areas.
The evaluated interpolation methods, particularly bilinear and Cubic Spline, demonstrated distinct performance, with the former more effective in maintaining overlap rates, while the latter excelled in achieving lower mean distances to the original points.
Detail recovery techniques, such as node removal and the Ramer–Douglas–Peucker algorithm, proved valuable in preserving contour quality, especially at lower resolutions. Thus, this study reinforces the importance of balancing performance and quality in contour extraction, highlighting that while resolution reduction can accelerate processing, it must be carefully considered to avoid compromising diagnostic effectiveness.
Implementing interpolation functionalities in the ContExt software can significantly contribute to advancements in mammography image analysis, enabling faster and more accurate diagnoses with a positive impact on clinical practice.
Information on the Software Developed
The software used in the analyses of this study is registered with the Brazilian National Institute of Industrial Property (INPI) under the Certificate of Computer Program Registration, Process No. BR512025005492-0, which provides legal protection for the source code and certifies its authorship. In addition, the ContExt software is open-source and available on GitHub under the GNU General Public License v3.0, allowing modification, copying, and redistribution. The repository includes executables and installation instructions for the required libraries. GitHub also enables users to report issues, ask questions, suggest improvements, and propose new functionalities (ContExt, 2024).
Acknowledgments
The first author would like to thank the National Council for Scientific and Technological Development (CNPq), for financial support (undergraduate scholarship). We also thank Dr. Pixel (2022), available at https://drpixel.fcm.unicamp.br/content/291, for providing the images.
Author Contributions
R. Tokairin participated in: conceptualization, data curation, formal analysis, methodology, software, validation, visualization, writing, review & editing. R. F. Casamaximo participated in: conceptualization, methodology, software, visualization. N. M. L. Romeiro participated in: supervision, review & editing. P. Z. da Silva participated in: software. E. R. Cirilo participated in: review and editing.
Conflicts of Interest
The authors certify that no commercial or associative interest in the manuscript represents a conflict of interest.
References
Canayaz, Murat (2021). MH-COVIDNet: Diagnosis of COVID-19 using deep neural networks and meta-heuristic-based feature selection on X-ray images. Biomedical Signal Processing and Control 64, 102257. https://doi.org/10.1016/j.bspc.2020.102257
Casamaximo, Rafael F., Romeiro, Neyva M. L., da Silva, Pedro Z., Souza, Isabela P., Silva, Juliana T., Natti, Paulo L. & Cirilo, Emerson R. (2021). Algorithm for extracting points from images: irregular contours. 3(03), 1-7. https://www.researchgate.net/publication/354930765_Algorithm_for_extracting_points_from_images_irregular_contours
Chai, X., Chen, J., Mao, Z. & Zhu, Q. (2023). An Upscaling–Downscaling Optimal Seamline Detection Algorithm for Very Large Remote Sensing Image Mosaicking. Remote Sensing 15, 89. https://doi.org/10.3390/rs15010089
ContExt (2024). Software for contour extraction and mesh generation for numerical analysis. https://github.com/RafaelCasamaximo/ContExt
Dumic, E., Grgic, S. & Grgic, M. (2007). The Use of Wavelets in Image Interpolation: Possibilities and Limitations. Radioengineering 16(4)
E. R. Cirilo, R. M. Figliaggi & P. L. Natti (2023). Quality Parameter for Edge Representation of Images via Cubic Spline. Semina: Ciências Exatas e Tecnológicas 44, e47720. https://doi.org/10.5433/1679-0375.2023.v44.47720
Hazel Thornton (2001). Screening for breast cancer with mammography. The Lancet 358(9299), 2167-2168. https://doi.org/10.1016/S0140-6736(01)07193-8
Instituto Nacional de Câncer José Alencar Gomes da Silva (2004). Controle do câncer de mama - Documento de consenso. Revista Brasileira de Cancerologia 50(2), 77-90. https://doi.org/10.32635/2176-9745.RBC.2004v50n2.2039
Jales, R. M. (2022). Incidência mamográfica em clivagem em caso de câncer de mama bilateral. r̆lhttps://drpixel.fcm.unicamp.br/content/291 http://drpixel.fcm.unicamp.br/conteudo/incidencia-mamografica-em-clivagem-em-caso-de-cancer-de-mama-bilateral
Jarosch, A., Anslow, F. & Clarke, G. (2010). High-resolution precipitation and temperature downscaling for glacier models. Climate Dynamics 38, 391-409. https://doi.org/10.1007/s00382-010-0949-1
Jasti, V Durga Prasad, Zamani, Abu Sarwar, Arumugam, K, Naved, Mohd, Pallathadka, Harikumar, Sammy, F, Raghuvanshi, Abhishek & Kaliyaperumal, Karthikeyan (2022). Computational technique based on machine learning and image processing for medical image analysis of breast cancer diagnosis. Security and communication networks 2022(1), 1918379. https://doi.org/10.1155/2022/1918379
Kshatri, S. S. & Singh, D. (2023). Convolutional Neural Network in Medical Image Analysis: A Review. Archives of Computational Methods in Engineering 30, 2793-2810. https://doi.org/10.1007/s11831-023-09898-w
Kösters, JP & Gøtzsche, PC (2003). Regular self-examination or clinical examination for early detection of breast cancer. Cochrane Database of Systematic Reviews, CD003373. https://pubmed.ncbi.nlm.nih.gov/12804462/
Liu, S., Liu, X., Wang, S. & Khan, M. (2021). Fuzzy-aided solution for out-of-view challenge in visual tracking under IoT-assisted complex environment. Neural Computing and Applications 33(4), 1055-1065. https://doi.org/10.1007/s00521-020-05021-3
McKinney, Wes (2011). pandas: a foundational Python library for data analysis and statistics. 14(9), 1-9. https://www.researchgate.net/publication/265194455_pandas_a_Foundational_Python_Library_for_Data_Analysis_and_Statistics
Nyström, L., Andersson, I., Bjurstam, N., Frisell, J., Nordenskjöld, B. & Rutqvist, L. E. (2002). Long-term effects of mammography screening: updated overview of the Swedish randomised trials. The Lancet 359(9310), 909-919. https://doi.org/10.1016/S0140-6736(02)08020-0
Patel, V., Mistree, K. & Gopalbhai, C. (2013). A Review on Different Image Interpolation Techniques for Image Enhancement. International Journal of Emerging Technology and Advanced Engineering 3(12), 129-133. https://iranarze.ir/wp-content/uploads/2017/10/7964-English-IranArze.pdf
Python Software Foundation (2021). Python Releases for Windows, Version 24. https://www.python.org/downloads/windows/
Ramer, U. (1972). An iterative procedure for the polygonal approximation of plane curves. Computer Graphics and Image Processing 1, 244-256. https://doi.org/10.1016/S0146-664X(72)80017-0
Romeiro, Neyva Maria Lopes, Panis, Carolina, dos Santos, Mara Caroline Torres, Rech, Daniel, Natti, Paulo Laerte & Cirilo, Eliandro Rodrigues (2022). Covariate clustering: women with breast cancer in southwestern Paraná, Brazil. Revista de Senolog\́ia y Patolog\́ia Mamaria 35(3), 175-183. https://doi.org/10.1016/j.senol.2021.12.005
Rosana Laira Azevedo, Rose Meire Galante Gerótica & Thalita Pinheiro Sanches (2016). A importância da mamografia no diagnóstico precoce do câncer de mama. UNILUS Ensino e Pesquisa 13(30) http://revista.lusiada.br/index.php/ruep/article/view/598
Scholl, I., Aach, T., Deserno, T. M. & Kuhlen, T. (2011). Challenges of medical image processing. Computing Science - Research and Development 26, 5-13. https://doi.org/10.1007/s00450-010-0146-9
Schulz-Wendtland, R., Fuchsjäger, M., Wacker, T. & Hermann, K.-P. (2009). Digital mammography: an update. European Journal of Radiology 72(2), 258-265. https://doi.org/10.1016/j.ejrad.2009.05.052
Shannon, C. E. (1949). Communication in the presence of noise. Proceedings of the IRE 37(1), 10-21. https://doi.org/10.1109/JRPROC.1949.232969
Sickles, E. A. (2007). The spectrum of breast asymmetries: imaging features, work-up, management. Radiologic Clinics of North America 45(5), 765-771. https://doi.org/10.1016/j.rcl.2007.06.002
Siegel, R. L., Miller, K. D. & Jemal, A. (2018). Cancer statistics, 2018. CA: A Cancer Journal for Clinicians 68(1), 7-30. https://doi.org/10.3322/caac.21442
Silva, Pedro Zaffalon, Casamaximo, Rafael F., Romeiro, Neyva M. L., Izidoro, Gabriel P., Tokairin, Rodrigo P. & Natti, Paulo L. (2025). Integrating breast cancer laboratory imaging with numerical analysis: ContExt software for contour extraction and mesh generation. Computers in Biology and Medicine 196, 110591. https://doi.org/10.1016/j.compbiomed.2025.110591
Smith, D. (2020). Biquadratic interpolation. National Oceanic and Atmospheric Administration. https://repository.library.noaa.gov/view/noaa/26464
Suman, S., Hussin, F. A., Malik, A. S., Walter, N., Lee Goh, K., Hilmi, I. & Ho, S. H. (2014). Image Enhancement Using Geometric Mean Filter and Gamma Correction for WCE Images. Springer https://doi.org/10.1007/978-3-319-12643-2_34
Sun, W. & Chen, Z. (2020). Learned image downscaling for upscaling using content adaptive resampler. IEEE Transactions on Image Processing 29, 4027-4040. https://doi.org/10.1109/TIP.2020.2970248
Thévenaz, Philippe, Blu, Thierry & Unser, Michael (2000). Image Interpolation and Resampling. Academic Press 1, 393-420. https://doi.org/10.1016/B978-0-12-373904-9.X0001-4
Yang, W., Zhang, S., Chen, Y., Li, W. & Chen, Y. (2009). Shape symmetry analysis of breast tumors on ultrasound images. Computers in Biology and Medicine 39, 231-238. https://doi.org/10.1016/j.compbiomed.2008.12.007
Yixiao Feng, Mia Spezia, Shifeng Huang, Chengfu Yuan, Zongyue Zeng, Linghuan Zhang, Xiaojuan Ji, Wei Liu, Bo Huang, Wenping Luo, Bo Liu, Yan Lei, Scott Du, Akhila Vuppalapati, Hue H. Luu, Rex C. Haydon, Tong-Chuan He & Guosheng Ren (2018). Breast cancer development and progression: Risk factors, cancer stem cells, signaling pathways, genomics, and molecular pathogenesis. Genes & Diseases 5(2), 77-106. https://doi.org/10.1016/j.gendis.2018.05.001
Yu, W., Zhu, Q., Zheng, N., Huang, J., Zhou, M. & Zhao, F. (2023). Learning Non-Uniform-Sampling for Ultra-High-Definition Image Enhancement. 1412-1421 https://doi.org/10.1145/3581783.3611836
Zare, M. R., Seng, W. C. & Mueen, A. (2013). Automatic classification of medical X-ray images. Malaysian Journal of Computer Science 26(1), 9-22. https://doi.org/10.22452/mjcs.vol26no1.2









