High dose rate (HDR) prostate brachytherapy is a form of radiation treatment where a radioactive source is threaded through a series of thin catheters -- called needles -- that have been inserted directly into the prostate gland. By delivering radiation from within the prostate itself, HDR brachytherapy can concentrate high doses on the tumor while sparing surrounding organs such as the bladder and rectum. It is commonly used for intermediate- and high-risk prostate cancer, either as a boost alongside external beam radiation or as a standalone treatment.
A typical HDR procedure requires a physician to insert 12 to 20 needles into the prostate under real-time transrectal ultrasound (TRUS) guidance in the operating room. After needle placement, the patient is usually moved to a CT or MRI scanner so the needle positions can be precisely mapped for treatment planning. This adds time, cost, and the risk that needles shift when the patient is repositioned -- all avoidable if the needles could be accurately localized directly from the original ultrasound images.
The fundamental obstacle is that TRUS images are inherently noisy. Needles are difficult to distinguish from the speckle and acoustic artifacts that appear in ultrasound images, and when multiple needles are present their overlapping trajectories compound the difficulty. Prior knowledge of exact needle positions is essential because research has shown that a source positioned more than 3 mm from its intended location produces unacceptable dosimetric uncertainty -- meaning a small localization error can translate directly into underdosing the tumor or overdosing healthy tissue.
Currently, a skilled physicist manually outlines the position of each needle on the TRUS images -- a tedious process taking 15 to 20 minutes per patient. This delay makes real-time dose planning in the operating room impractical. An automated needle localization system that can deliver results in under a second would transform the workflow, allowing physicians to check dose coverage while the patient is still on the table and adjust needle positions before the treatment is locked in.
The network in this study is based on U-Net, a widely used deep learning architecture for biomedical image segmentation. U-Net gets its name from its shape: a contracting encoder pathway progressively extracts abstract features from the image while a mirrored expanding decoder pathway reconstructs a pixel-level prediction map. Skip connections between matching encoder and decoder layers allow fine spatial details to be preserved even after the compressing and expanding steps.
A key enhancement is the addition of attention gates. Standard convolutional networks apply equal attention to every region of an image, making them prone to detecting false positives in backgrounds that contain visually similar artifacts. Attention gates solve this by learning which regions of the image are relevant for the task -- in this case the needle locations -- and suppressing responses from irrelevant background areas. The gates use learned coefficients that scale feature activations, effectively directing the network's focus toward needle-like structures.
The third key component is total variation (TV) regularization. Needles are physically straight structures that run continuously through multiple adjacent image slices. TV regularization penalizes solutions where the predicted needle mask changes abruptly in the direction along the needle axis (the z-axis), encoding the physical expectation that a needle is a spatially continuous object. The regularization is applied with a higher weight along the z-axis than the x or y axes to match the geometry of vertically inserted needles.
Training used a deep supervision strategy, where intermediate hidden layers within the network each receive their own loss signal during training. This combats the vanishing gradient problem common in deep networks and ensures that features learned at every level of the architecture are useful, not only at the final output layer. The combined loss function integrates the standard U-Net cross-entropy loss with the weighted TV term, controlled by a trade-off parameter set to 0.5 in all experiments.
The dataset comprised 3D TRUS images from 23 patients who underwent HDR prostate brachytherapy at Emory University. Each patient had 12 to 19 needles inserted depending on prostate size, yielding a total of 339 individual needles across all cases. The ultrasound images were acquired using the same scanner and settings for all patients, with a 7.5 MHz probe and consistent imaging parameters.
Ground truth labels were generated by an experienced medical physicist who manually marked needle trace points on each image slice using clinical treatment planning software. A second and third physicist verified the annotations. From these manually marked points, the full needle trajectory was interpolated and a binary mask image was generated by placing circles of the true needle diameter (1.67 mm) at every intersection point. These mask images served as the learning targets for the neural network.
The network was trained on 3D image patches of size 576 by 576 by 16 voxels extracted from the full ultrasound volumes. Data augmentation including rotation, flipping, and scaling was applied to increase the effective training set size given the modest 23-patient cohort. Performance was evaluated using five-fold cross validation at the patient level -- patients were divided into five groups and the model was trained on four groups and tested on the fifth, rotating until all patients had been used as the test set exactly once.
Three metrics were used to evaluate results. Shaft localization error measured the mean distance between predicted and ground truth needle center positions across all image slices. Tip localization error measured how accurately the deepest point of each needle was identified. Detection accuracy was defined as the fraction of needles whose predicted tip fell within 10% of the true needle insertion length from the correct position.
The proposed method detected 96% of all 339 needles with a mean shaft localization error of 0.290 mm and a mean tip error of 0.442 mm. For shaft accuracy, 96% of all needle center localizations had an error below 0.8 mm -- well within the 1.67 mm diameter of the physical needle. For tip accuracy, 75% of needle tips were localized with zero error (meaning the correct slice), and 96% were within a 2 mm margin (equal to one TRUS image slice thickness).
These results were statistically significantly better than both comparison methods (p less than 0.05). Compared to standard U-Net, which produced shaft errors up to 0.54 mm and tip errors up to 0.741 mm (using a separate dictionary learning comparison), the attention and TV regularization components each contributed measurable independent improvements. The deeply supervised attention U-Net (DSA U-Net, which uses attention gates but no TV regularization) outperformed plain U-Net but underperformed the full proposed method -- confirming that TV regularization adds value beyond the attention mechanism alone.
Qualitative visualization of the 3D reconstructed needle maps showed that plain U-Net and DSA U-Net each produced several incorrectly detected points in representative slices, while the proposed method produced only two missed points in one challenging slice. The 3D rendering confirmed that the proposed method's detections followed smooth, physically plausible trajectories matching the manual contours, while comparison methods showed scattered false detections.
A separate comparison against a dictionary learning baseline (ORDL) found that the deep learning method achieved comparable shaft accuracy but significantly better tip accuracy (p less than 0.001), and dramatically faster computation -- under 1 second per patient versus 38 seconds for ORDL. The maximum shaft error across all patients was 1.6 mm, safely within the 3 mm clinical tolerance threshold.
The immediate clinical value of accurate, near-instant needle localization is the potential to provide real-time dosimetric feedback during needle placement in the operating room. Currently, physicians place needles based entirely on experience and visual TRUS guidance, with no immediate way to verify that the resulting needle pattern will produce adequate dose coverage of the tumor. The treatment plan is finalized only after the patient has been moved to a separate CT or MRI scanner -- at which point the needle pattern can no longer be adjusted without repeating the procedure.
With automated needle localization completing in under one second, combined with existing automated prostate segmentation tools, it becomes technically feasible to compute a treatment plan and display the predicted dose distribution on the ultrasound screen while the patient is still in the operating room. Physicians could see whether the needle arrangement delivers sufficient dose to the entire tumor and to any dose-boosted focal lesion, then insert additional needles or reposition existing ones before delivering any radiation.
A real-time OR planning system would also allow the CT scanning step to be eliminated from the workflow entirely. Currently, after needle insertion the patient must be transferred to a CT scanner for imaging, then returned to the treatment room -- a process that introduces delays and the risk of needles shifting position during transport. A TRUS-only workflow would reduce this risk, shorten each patient's procedure time, lower costs, and potentially allow treatment delivery in the same room immediately after needle placement.
The method also has direct applications beyond HDR brachytherapy. The same approach could be used to localize radioactive seeds in low dose rate (LDR) brachytherapy, to track fiducial markers used for prostate motion management during external beam radiation therapy, or to guide other percutaneous procedures in which small instruments must be identified in 3D ultrasound images.
This study presents an automatic multi-needle localization method using a deeply supervised attention U-Net with total variation regularization that achieves 96% needle detection accuracy and sub-millimeter shaft and tip errors on 3D TRUS images from 23 HDR prostate brachytherapy patients. The combination of attention gates, TV regularization, and deep supervision each contributed to performance improvements over simpler baselines.
The key clinical advance is speed: the method localizes all needles in a patient's TRUS volume in under one second, compared to 15 to 20 minutes for manual digitization. This time reduction is what makes the transition from post-procedure planning to real-time OR-based planning technically feasible -- a change that could meaningfully improve plan quality and patient outcomes.
Several limitations were acknowledged. First, the 23-patient dataset is small, and results should be validated on a larger and more diverse patient cohort. Second, while the method detects most needles accurately, clinical use would still require a physicist to review the results and correct any missed detections -- though this verification step is far less time-consuming than full manual digitization. Third, the ground truth labels themselves carry measurement uncertainty from manual contouring that was not formally quantified.
Future work will focus on expanding the dataset, reducing the remaining missed needle rate, and integrating the needle localization module with automatic prostate segmentation and dose calculation into a complete real-time HDR planning system. If validated at larger scale, this framework represents a significant step toward adaptive, real-time brachytherapy planning that was previously impossible in the operating room setting.