## 2 Materials and Methods
### Preprocessing  
Some problems were related to the image content and quality. In some slices, the presence of noise and the patients' arms in the background was noticeable (Figure 2). Moreover, some slices exhibited low luminosity, resulting in poor visualization of the organs. These issues can hinder the effectiveness of our automatic segmentation model. Low luminosity reduces image contrast, making it challenging for the model to distinguish organ boundaries accurately, while image noise or artifacts can introduce spurious details that lead to false positives or negatives. Additionally, the presence of the patient's arms in the background can interfere with accurate segmentation by potentially including them in the segmented regions. To address the content and image quality issues, we propose some preprocessing steps that are summarized in Figure 3.  
The initial and crucial step in the preprocessing workflow involves the precise elimination of extraneous anatomical structures beyond the designated region of interest. This strategic elimination not only improves the visual output but also significantly enhances the overall accuracy of the model. YOLO version 5 [27] was employed for this purpose. The selection of YOLO version 5 was driven by its advanced capabilities in accurately detecting bounding boxes and efficiently capturing the regions of interest. In our workflow, it served as a reliable means to eliminate extraneous anatomical structures. For training the network, we used 200 manually annotated images with bounding boxes outlining the regions of interest (ROI). YOLO version 5's streamlined architecture ensures swift processing, facilitating real-time detection and preprocessing of MR images. Moreover, the model benefits from robust transfer learning techniques, being pretrained on extensive natural image datasets, which enhances its adaptability to diverse domains, including medical images. This transfer learning leads to exceptional organ detection performance. Achieving accuracy in delineating organs and removing background and irrelevant structures, like arms, is accomplished through training with image sizes of \(640\ \times\ 640\), a batch size of 16, and YOLO version 5 small weights for 20 epochs. This process not only contributes to a cleaner and more visually appealing output but, more importantly, substantially enhances the overall accuracy of the model by ensuring that the segmentation focuses exclusively on the critical  
Figure 1: A preview of an MRI study in (**a**) axial orientation, (**b**) coronal orientation, and (**c**) sagittal orientation. The segmented organs include the left and right lung, the heart, the spinal cord, and the esophagus, depicted in light blue, blue, yellow, green, and pink colors, respectively. The delineation of the OARs can be rough as for the heart in this example, and then rectified to train our model. Figure 2: Problematic slices. (**a**): Slice with the presence of patients’ arms. (**b**): A slice with low luminosity. structures relevant to radiation therapy planning. This improvement is fundamental in minimizing the risk of radiation toxicity and optimizing treatment planning precision. To address the issue of low luminosity in the remaining images, adaptive histogram equalization (AHE) was employed [28]. AHE is a technique used to enhance the contrast and visibility of details in images with low luminosity. By applying AHE to the images, we can ensure that subtle structures and features within the images become more pronounced and distinguishable. This, in turn, leads to better image quality, which is crucial for accurate organ segmentation. Improved image quality resulting from AHE can enhance the model's ability to detect and delineate organ boundaries, making the segmentation process more precise and reliable. Figure 4 illustrates the impact of adaptive histogram equalization on image quality. Some remaining noise was removed through thresholding, which eliminates pixels, near zero intensity within the bounding boxes.