A nasopharyngeal carcinoma lesion automatic positioning and three-dimensional prompt guided segmentation method and system based on improved SAM-Med3D
By adding a 3D lesion auto-localization and structured prompt generation module to the SAM-Med3D model, combined with multi-scale feature encoding and morphological dilation, the problems of insufficient automation and accuracy in nasopharyngeal carcinoma lesion segmentation are solved, achieving efficient and stable 3D segmentation results.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SOUTH CHINA AGRICULTURAL UNIVERSITY
- Filing Date
- 2026-03-11
- Publication Date
- 2026-06-09
AI Technical Summary
Existing SAM-Med3D-based nasopharyngeal carcinoma lesion segmentation methods are insufficient in terms of automation and segmentation accuracy, especially in the automatic localization and boundary segmentation of nasopharyngeal carcinoma lesions, which are difficult to meet clinical needs. Furthermore, existing methods lack autonomous localization and boundary correction mechanisms, resulting in unstable segmentation results.
Based on the SAM-Med3D model, an automatic 3D lesion localization module and a structured 3D cue generation module are added. Positive and negative cue points are generated through multi-scale feature encoding, collaborative attention mechanism and 3D morphological dilation. Combined with local inference and dynamic loss function optimization, autonomous localization and fine segmentation are achieved.
It significantly improves the automation and segmentation accuracy of nasopharyngeal carcinoma lesions, reduces manual intervention, and enhances the spatial consistency and stability of segmentation results, meeting the real-time needs of clinical applications.
Smart Images

Figure CN122176004A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of medical image processing and artificial intelligence, specifically to an automatic localization and three-dimensional prompt-guided segmentation method and system for nasopharyngeal carcinoma lesions based on improved SAM-Med3D, belonging to the field of three-dimensional medical image segmentation and prompt-guided deep learning segmentation technology. Background Technology
[0002] With the development of medical imaging equipment and artificial intelligence technology, deep learning-based 3D medical image segmentation methods have been widely used in fields such as tumor-assisted diagnosis, treatment planning, and efficacy evaluation. Nasopharyngeal carcinoma (NPC), a common head and neck malignant tumor, typically exhibits characteristics such as blurred boundaries, irregular shapes, low contrast with surrounding soft tissues, and significant individual differences in 3D medical images, placing high demands on the spatial modeling capabilities and segmentation accuracy of segmentation models.
[0003] Currently, automatic segmentation methods for nasopharyngeal carcinoma lesions mainly include those based on whole-cell imaging. Figure 3 Methods for 3D segmentation and prompt-guided segmentation methods. Based on full... Figure 3 3D segmentation methods typically employ 3D convolutional neural networks or 3D Transformer structures to perform end-to-end prediction of the entire 3D medical image. While these methods are effective for handling targets with relatively regular anatomical structures and large volumes, they are less effective in nasopharyngeal carcinoma lesion segmentation. Due to the low voxel proportion of the lesion, significant spatial variations, and complex background structures, the model is easily affected by numerous non-target regions during inference, leading to insufficient lesion feature representation and segmentation results prone to omissions, misclassifications, or inaccurate boundaries. Furthermore, differences in imaging conditions and anatomical structures among different patients further limit the generalization ability and stability of full-image segmentation methods.
[0004] To mitigate background interference and improve segmentation accuracy, cue-guided medical image segmentation models have emerged in recent years. These models introduce cues such as points, boxes, or regions to provide spatial priors about the target region, guiding the model to focus on the region of interest. Among them, SAM-Med3D, a cue-guided segmentation model for 3D medical images, achieves general segmentation of various anatomical structures and lesions by constructing a 3D image encoder, a cue encoder, and a mask decoder, making it representative in the field of 3D medical image segmentation. However, existing SAM-Med3D-based segmentation methods still have certain limitations in the application scenario of nasopharyngeal carcinoma lesions. First, the original prompt generation method of SAM-Med3D mainly relies on manual interactive input of prompt points, which is difficult to meet the actual needs of automation and high efficiency in the clinical application of nasopharyngeal carcinoma. Second, its image feature encoding and prompt feature fusion mechanism is mainly based on general anatomical structure modeling, which has limited ability to enhance the discriminative features of small-volume, vaguely defined targets such as nasopharyngeal carcinoma lesions. In addition, in the mask decoding stage, existing methods usually directly output the segmentation results after a single inference, lacking an adaptive correction mechanism for uncertain regions of lesion boundaries, which easily leads to insufficient consistency of segmentation results in three-dimensional space. Summary of the Invention
[0005] I. Purpose of the Invention
[0006] To address the problems of existing SAM-Med3D-based 3D prompt-guided segmentation methods for nasopharyngeal carcinoma lesion segmentation, this invention proposes an automatic localization and 3D prompt-guided segmentation method and system for nasopharyngeal carcinoma lesions based on an improved SAM-Med3D model. This invention adds a 3D lesion localization module and a structured 3D prompt generation module to the original SAM-Med3D model, and improves the optimization strategy during model training. This enables the model to autonomously localize, automatically generate prompts, and perform boundary-enhanced segmentation, thereby improving the automation and spatial stability of 3D segmentation of nasopharyngeal carcinoma lesions.
[0007] II. Technical Solution
[0008] (I) Methodology
[0009] This invention provides an automatic localization and three-dimensional prompt-guided segmentation method for nasopharyngeal carcinoma lesions based on an improved SAM-Med3D, characterized by the following steps:
[0010] Step S1: Acquisition and Preprocessing of 3D Medical Images
[0011] 3D medical image data acquisition and preprocessing: Acquire 3D medical image data including the nasopharyngeal region.
[0012] Optionally, the three-dimensional medical imaging data may be magnetic resonance imaging (MRI), computed tomography (CT), or a multimodal combination thereof.
[0013] Standardization processing of raw 3D medical images includes:
[0014] Optionally, the image voxel spacing can be uniformly resampled to a preset isotropic resolution, preferably about 1.5 mm;
[0015] Optionally, the head and neck region can be coarsely trimmed to remove irrelevant anatomical areas.
[0016] Optionally, the image grayscale values can be truncated using quantile clipping to remove abnormal intensity values and then intensity normalized to obtain a standardized three-dimensional medical image with absolutely consistent physical scale and contrast.
[0017] Step S2: Automatic localization of multi-scale three-dimensional lesions
[0018] A multi-scale 3D lesion localization module is added before the original SAM-Med3D image encoding module.
[0019] The localization module includes (1) a lightweight 3D feature encoding submodule: extracting multi-scale downsampling features from the input image through a hierarchical 3D convolutional structure to form a feature representation containing global anatomical context information.
[0020] Optionally, the downsampling factor is 2 to 4 times. Optionally, the feature encoding structure includes a residual connection to enhance gradient propagation stability.
[0021] (2) Spatial-Channel Cooperative Attention (SCCA): The spatial-channel cooperative attention submodule calculates feature weights in the spatial dimension and the channel dimension respectively, and enhances the response of high-incidence areas such as the nasopharyngeal recess and parapharyngeal space through an adaptive weighted fusion mechanism.
[0022] Optionally, spatial attention is implemented using global average pooling and convolutional mapping.
[0023] (3) Three-dimensional coarse segmentation prediction submodule: Generates a coarse segmentation mask for lesions through three-dimensional convolution mapping.
[0024] Optionally, the coarse segmentation results can be thresholded, with the threshold preferably in the range of 0.3 to 0.7.
[0025] It also performs 3D Connected Component Analysis to retain candidate regions whose volume meets a preset threshold.
[0026] Optionally, retain the connected region with the largest volume or the connected region with a volume exceeding a preset threshold.
[0027] The three-dimensional center coordinates of the lesion are obtained by calculating the geometric center, and the candidate region boundary is generated by the three-dimensional bounding box algorithm.
[0028] Through the above steps, autonomous spatial localization of the lesion can be achieved.
[0029] Optionally, the geometric center is calculated using a voxel-weighted average.
[0030] Step S3: Generation of Structured 3D Hints
[0031] A Structured 3D Prompt Generation Module is added between the automatic localization module and the SAM-Med3D prompt encoding module.
[0032] (1) Positive prompt generation
[0033] Calculate the three-dimensional Euclidean Distance Transform (EDT) for the coarse segmentation mask. Obtain the shortest distance from each foreground voxel to the nearest background boundary to form a three-dimensional distance field.
[0034] Optionally, the top N local maxima points in the three-dimensional distance field are selected as positive cue points.
[0035] (2) Negative prompt generation
[0036] Three-dimensional morphological dilation is performed on the coarse segmentation mask.
[0037] Optionally, the three-dimensional morphological expansion employs a spherical structural element, preferably with a radius of 1 to 5 voxel units. An outer annular region is constructed and uniformly sampled to generate negative cue points.
[0038] Optionally, the number of negative prompts can be the same as or 1 to 2 times the number of positive prompts.
[0039] Optionally, the sampling method is either farthest point sampling (FPS) or uniform random sampling.
[0040] Step S4: Construction of local 3D candidate regions
[0041] Based on the geometric center of the lesion locked in step S2, local three-dimensional image blocks with fixed physical dimensions are adaptively cropped from the preprocessed image as candidate regions.
[0042] The pruning method employs a local 3D block inference strategy (Patch-based 3D Inference).
[0043] Optionally, when the prediction results reach the boundary, a sliding window extended inference method can be used for supplementary inference.
[0044] Step S5: 3D cue-guided segmentation based on improved SAM-Med3D
[0045] The local 3D candidate region image and structured 3D prompt information are simultaneously input into the improved SAM-Med3D model, and the model decodes and outputs the fine 3D segmentation results of the nasopharyngeal carcinoma lesion.
[0046] The improvements include: (1) adding a three-dimensional automatic localization module in the front end; (2) adding a structured prompt generation module; and (3) performing in-depth optimization of the loss function structure in the training stage for specific tasks.
[0047] The joint loss function includes: three-dimensional region overlap loss (Dice Loss); difficult voxel focusing loss (Focal Loss); and three-dimensional boundary constraint loss (Boundary Loss).
[0048] Optionally, the weights of the loss function can be adaptively adjusted using a dynamic weighting strategy.
[0049] Optionally, the dynamic weighting strategy is as follows: in the early stage of training, a higher weight is given to the three-dimensional region overlap loss to prompt the model to converge quickly to the lesion body; as the training epoch increases, the weights of the difficult voxel focusing loss and the three-dimensional boundary constraint loss are gradually and adaptively increased to achieve fine-tuning of the small infiltrative edges of the lesion in the later stage of training.
[0050] This invention also provides an automatic localization and three-dimensional prompting-guided segmentation system for nasopharyngeal carcinoma lesions based on an improved SAM-Med3D system, comprising:
[0051] Preprocessing unit: used to eliminate scale and intensity differences in multicenter images;
[0052] Multi-scale 3D lesion automatic localization unit: quickly locates the lesion center through attention mechanism and connected component analysis;
[0053] Structured 3D cue generation unit: Generates a structured cue array with positive and negative constraints through EDT and morphological operations;
[0054] Local candidate region construction unit: used to perform center-point-based patch 3D cropping;
[0055] Hint-guided segmentation unit: used to decode and output a fine mask using the SAM-Med3D architecture finely tuned with multi-scale boundary-aware joint loss;
[0056] III. Core Innovations and Beneficial Effects of this Invention
[0057] Compared with the prior art, the present invention has outstanding substantive features and significant progress:
[0058] (1) This invention enhances the model's ability to autonomously perceive and locate the core of the lesion by using a pre-positioned multi-scale three-dimensional localization module and a structured prompt generation mechanism based on distance transformation (EDT). This technical solution transforms the traditional manual process into objective sampling based on spatial geometric features of the system, eliminating point input errors caused by differences in the experience of different physicians, and significantly improving the standardization level and work efficiency of clinical batch screening and target delineation of nasopharyngeal carcinoma.
[0059] (2) To address the technical challenge of nasopharyngeal carcinoma lesions easily infiltrating surrounding low-contrast soft tissues (such as the skull base and parapharyngeal space), leading to model segmentation overshoot, this invention proposes a dual anatomical boundary constraint mechanism. At the feature input end, a negative cue lattice is constructed using three-dimensional morphological dilation to provide exclusive spatial priors; at the model training end, a boundary loss function based on a three-dimensional directed distance field (SDM) is introduced to apply gradient penalties to predicted voxels that deviate from the true anatomical contour. This dual optimization strategy effectively suppresses the over-segmentation phenomenon in the fuzzy boundary region. (3) Through the asymmetric computing architecture of "low-resolution global lightweight localization + local patch full three-dimensional fine decoding", this invention ensures the consistency of the tumor's three-dimensional space while compressing the GPU memory overhead to the range available for conventional medical devices. Attached Figure Description
[0060] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are merely some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without any creative effort.
[0061] Figure 1 This is a flowchart of an automatic localization and three-dimensional prompting-guided segmentation method for nasopharyngeal carcinoma lesions based on an improved SAM-Med3D, provided by an embodiment of the present invention.
[0062] Figure 2 This is a schematic diagram of the network architecture and data flow of the multi-scale three-dimensional lesion automatic localization module provided in this embodiment of the invention;
[0063] Figure 3 This is a test schematic diagram of the automatic positioning module in step S3 of the present invention;
[0064] Figure 4 This is a schematic diagram of the geometric morphological space principle of structured 3D prompt generation provided in the embodiments of the present invention;
[0065] Figure 5 This is a schematic diagram of local candidate region (Patch) clipping and sliding window inference provided in an embodiment of the present invention; Detailed Implementation
[0066] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.
[0067] It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.
[0068] Example 1: An automatic localization and 3D prompting-guided segmentation method for nasopharyngeal carcinoma lesions based on improved SAM-Med3D
[0069] like Figure 1 As shown, this embodiment provides an end-to-end fully automated three-dimensional medical image segmentation method, the specific execution flow of which is detailed below:
[0070] Step S1: Acquisition and Standardized Preprocessing of 3D Medical Images
[0071] Acquire raw 3D medical images containing the patient's head and neck region. Because images acquired from multiple centers differ in spatial resolution and signal strength, this embodiment employs the following standardization process:
[0072] 3D image acquisition and spatial orientation
[0073] Image Acquisition: Acquire raw 3D medical image data containing the patient's head and neck region, including but not limited to magnetic resonance imaging (MRI) or computed tomography (CT) images. Orientation Normalization: Redirect all images to the RAI (Right-Anterior-Superior) standard coordinate system using an affine transformation matrix. This aims to eliminate anatomical orientation differences caused by variations in patient scanning position or equipment definition, ensuring the model's unique perception of left-right and anteroposterior orientations.
[0074] Isotropic resampling: The three-dimensional voxel spacing of the original image is uniformly resampled to 1.5mm×1.5mm×1.5mm using third-order B-spline interpolation to ensure absolute consistency of physical spatial scale.
[0075] Quantile truncation and normalization: The 0.5% and 99.5% grayscale quantiles of the resampled image are used as upper and lower bounds for truncation (Percentile Clipping) to eliminate artifacts from extremely bright angiography or extremely dark atmospheric backgrounds. Then, the Z-score normalization formula is applied. = ( - ) / ,in and These represent the mean and standard deviation of the foreground voxels in the truncated image, respectively. This is the current input value. This is the final result calculated by the formula, which is the new grayscale value after standardization.
[0076] Step S2: Implementation details of multi-scale three-dimensional lesion auto-localization
[0077] This step involves constructing a multi-scale 3D lesion localization module to quickly and robustly locate the core area of the lesion in a full-view image.
[0078] Combination Figure 2 Standardized images The input module is a multi-scale 3D lesion localization module. Traditional high-resolution 3D convolutional networks covering the entire field of view are prone to memory overflow and have poor robustness in locating nasopharyngeal carcinoma lesions with blurred edges. Therefore, this embodiment innovates the underlying architecture of this module, and its specific processing logic and mathematical operations are as follows:
[0079] Lightweight 3D Feature Encoding Based on Extremely Low Computational Cost: Input Image... =2 or After downsampling with a 3D average pooling step size of 4, a global low-resolution anatomical view is quickly obtained, significantly reducing the 3D spatial dimension of subsequent calculations. This reduces the spatial dimension of subsequent calculations to 1 / 8 to 1 / 64 of the original size.
[0080] Subsequently, the images are fed into a lightweight feature encoder constructed using depthwise separable 3D convolutions. Depthwise separable convolutions break down standard 3D convolutions into channel-wise 3D convolutions in spatial dimensions, significantly reducing GPU memory overhead. Addressing the extremely large volume of head and neck 3D MRI / CT data, this design reduces the number of parameters and computational complexity by an order of magnitude compared to standard 3D convolutions. The model can quickly traverse the entire head and neck panorama with extremely low GPU memory consumption, extracting multi-scale features containing global anatomical context information. .
[0081] Spatial-Channel Cooperative Attention (SCCA) mechanism targeting low-contrast anatomical structures:
[0082] Nasopharyngeal carcinoma commonly occurs in areas with complex anatomical structures, such as the pharyngeal recess, which are bilaterally asymmetrical and have extremely low contrast with the surrounding soft tissues. To guide the network across these visual disturbances, the feature tensor... The SCCA mechanism is introduced for dual feature recalibration.
[0083] In the spatial dimension, three-dimensional global average pooling is used to... Global max pooling and average pooling are performed along the channel axis and concatenated, then spatial weights are generated by 7×7×7 3D convolution. In the channel dimension, three-dimensional global average pooling is used to... The vector is compressed into a one-dimensional vector, and channel weights are generated using a multilayer perceptron (MLP). The fusion formula is: = .
[0084] Probabilistic centroid calculation: After connected component analysis, candidate lesion regions are obtained, and the geometric center (probabilistic centroid) is calculated using the voxel weighted average formula. To improve positioning noise resistance, the coordinate component formula is as follows: , , .in voxels The predicted probability of belonging to a lesion. For example... Figure 3 A rough location map is provided.
[0085] Step S3: Automatic generation of structured 3D prompts
[0086] like Figure 4 As shown, this step transforms the coarse mask from step S2 into a point set matrix received by the SAM-Med3D cue encoder through rigorous geometric morphological operations.
[0087] Positive hint (EDT distance field): Assume the entire space is The background is For voxels inside the mask Calculate its Euclidean distance to the nearest background boundary using the following formula. Local nonmaximum suppression (NMS) is applied to the range field tensor, and the coordinates of the top N maxima are selected as positive cues. .
[0088] Negative hint (morphological annulus): Defined radius as Three-dimensional spherical structural elements A three-dimensional morphological dilation operation is performed to generate the envelope region, which is then subtracted from the original mask to obtain the annular zone. Negative cue points are extracted within this ring using farthest-point sampling (FPS). .
[0089] Cue array construction and encoding: The extracted coordinates of N positive cue points and M negative cue points are concatenated to form a 3D dot matrix of shape (N+M)×3. Subsequently, the SAM-Med3D prompt encoder is used to map the physical space coordinates into high-dimensional sparse embeddings through positional encoding, which serve as strong constraint priors for the fine segmentation stage.
[0090] Step S4: Adaptive Construction of Local 3D Candidate Regions (Patch)
[0091] Combination Figure 5 To reduce computational overhead while preserving lesion details, this embodiment employs a local 3D block inference strategy:
[0092] Adaptive clipping: based on the geometric center locked in step S2 In the standardized high-resolution image, a local three-dimensional image patch with a fixed physical size of 128×128×128 voxels is cropped out with this point as the center.
[0093] Coordinate system synchronization: The coordinates of the structured cue points generated in step S3 are linearly transformed from the original image coordinate system to the relative coordinate system of the local patch to ensure that the cue points are perfectly aligned with the anatomical structures.
[0094] Sliding window expansion (optional): If the initial bounding box size predicted in step S2 is close to the patch boundary, the sliding window inference mode is enabled. By setting an overlap rate of 25% to 50%, overlay inference is performed on the lesion edge, and the predicted probabilities of the overlapping areas are fused using Gaussian weights to eliminate the patch edge effect.
[0095] Step S5: Fine-grained segmentation guided by prompts from improved SAM-Med3D
[0096] The SAM-Med3D architecture is improved by embedding patched images and structured cues into vector input. This embodiment employs a multi-scale boundary-aware joint loss function for depth fine-tuning during the training phase, the specific logic of which is as follows:
[0097] To simultaneously address the issues of class imbalance (small tumor proportion) and blurred margins (invasive growth), a total loss function is defined. The formula is as follows:
[0098]
[0099] in, The formula for calculating the overlap of the responsible areas is as follows:
[0100]
[0101] For boundary constraint loss, the deviation of the prediction from the anatomical contour is penalized by calculating the difference in the directed distance field (SDF) between the predicted mask and the actual mask boundary.
[0102]
[0103] in It is the level set function of the true boundary.
[0104] Training strategy for dynamic weights: In this embodiment, the weights are set in the early stages of training (the first 50 epochs). In the later stages of training, a linear decay mechanism is used to... The threshold is increased to 0.4 to force the model to learn complex parapharyngeal space edge features. Inference and mask reconstruction: The model decoder outputs a 3D probability map, which is binarized by a threshold of 0.5 and then mapped back to the original 3D image space to obtain the final fine segmentation mask for nasopharyngeal carcinoma lesions.
[0105] Example 2: An Automatic Localization and Three-Dimensional Prompt-Guided Segmentation System for Nasopharyngeal Carcinoma Lesions Based on Improved SAM-Med3D
[0106] In conjunction with point 5, this embodiment provides a logical system for implementing the above method. This system runs on a high-performance medical imaging workstation, and its main modules include:
[0107] Preprocessing unit: Integrates B-spline interpolation operator and Z-score normalization operator, responsible for eliminating physical scale and grayscale shifts across devices and modalities (CT / MRI).
[0108] Multi-scale 3D lesion auto-localization unit: Built-in lightweight 3D convolutional neural network and SCCA collaborative attention operator to quickly generate lesion centroid coordinates in full-view images.
[0109] Structured 3D prompt generation unit: Employs a C++ optimized EDT (Distance Transform) engine and morphological dilation operator to automatically generate positive and negative prompt dot matrices that simulate a physician outlining logic.
[0110] Local candidate region construction unit: responsible for the dynamic pruning and sliding window logic control of the patch.
[0111] The prompt-guided segmentation unit: The core is an improved SAM-Med3D model fine-tuned with multi-scale boundary loss, which is responsible for generating the final clinical-grade segmentation results.
[0112] Summary of beneficial effects:
[0113] This invention overcomes the limitations of traditional SAM models that rely on manual prompts through a three-stage decoupled architecture of "localization-prompt-segmentation". It utilizes the EDT distance field to extract core lesion points as positive prompts and samples background points from morphological rings as negative prompts, constructing robust spatial constraints. Experiments show that this method improves the segmentation accuracy of nasopharyngeal carcinoma invasion boundaries (such as skull base invasion areas) by more than 8% compared to the original model, while meeting the inference speed requirements for real-time clinical interaction.
[0114] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A method for automatic localization and three-dimensional prompting-guided segmentation of nasopharyngeal carcinoma lesions based on improved SAM-Med3D, characterized in that, Includes the following steps: Step S1: Acquire three-dimensional medical image data containing the nasopharyngeal region and perform standardized preprocessing on the original three-dimensional medical images; Step S2: Add a multi-scale three-dimensional lesion automatic localization module before the image encoding module to generate a coarse segmentation mask for the lesion, and obtain the three-dimensional center coordinates of the lesion through geometric center calculation to achieve autonomous spatial localization of the lesion; Step S3: Add a structured 3D prompt generation module between the automatic positioning module and the SAM-Med3D prompt encoding module to generate positive and negative prompt points based on the coarse segmentation mask; Step S4: Based on the geometric center of the lesion locked in step S2, adaptively crop local three-dimensional image blocks of fixed physical size from the preprocessed image as candidate regions; Step S5: Simultaneously input the local 3D candidate region image and structured 3D prompt information into the improved SAM-Med3D model, and the model decodes and outputs the fine 3D segmentation results of the nasopharyngeal carcinoma lesion.
2. The method according to claim 1, characterized in that, The standardization process of the original three-dimensional medical image in step S1 specifically includes: The image voxel spacing is uniformly resampled to a preset isotropic resolution; The grayscale values of the image are truncated by quantiles, abnormal intensity values are removed and intensity is normalized to obtain a standardized three-dimensional medical image with absolutely consistent physical scale and contrast.
3. The method according to claim 1, characterized in that, The multi-scale three-dimensional lesion automatic localization module in step S2 specifically includes: Lightweight 3D feature encoding submodule: Extracts multi-scale downsampling features from the input image through a hierarchical 3D convolutional structure to form a feature representation containing global anatomical context information; Three-dimensional spatial and channel collaborative attention submodule: calculates feature weights in the spatial dimension and channel dimension respectively, and enhances the response through an adaptive weighted fusion mechanism; The 3D coarse segmentation prediction submodule generates a coarse segmentation mask for lesions through 3D convolutional mapping, performs 3D connected component analysis to preserve candidate regions, and obtains the 3D center coordinates of the lesions through geometric center calculation.
4. The method according to claim 1, characterized in that, The generation of positive and negative prompt points in step S3 specifically includes: Positive prompt generation: Calculate the three-dimensional Euclidean distance transformation for the coarse segmentation mask, obtain the shortest distance from each foreground voxel to the nearest background boundary to form a three-dimensional distance field, and select local maxima points in the three-dimensional distance field as positive prompt points; Negative cue generation: Perform 3D morphological dilation on the coarse segmentation mask to construct the outer ring region and generate negative cue points by uniform sampling or sampling at the farthest point.
5. The method according to claim 1, characterized in that, In step S4, the pruning method adopts a local three-dimensional block reasoning strategy; when the prediction result touches the boundary, a sliding window expansion reasoning method is used for supplementary reasoning.
6. The method according to claim 1, characterized in that, In step S5, the improved SAM-Med3D model undergoes in-depth optimization of the loss function structure during the fine-tuning training phase for a specific task. The joint loss function includes: 3D region overlap loss, difficult voxel focusing loss, and 3D boundary constraint loss; The weights of the loss function are adaptively adjusted through a dynamic weighting strategy: in the early stages of training, the 3D region overlap loss is given a higher weight, and as the training rounds increase, the weights of the difficult voxel focusing loss and the 3D boundary constraint loss are gradually and adaptively increased.
7. A system for automatic localization and three-dimensional guided segmentation of nasopharyngeal carcinoma lesions based on improved SAM-Med3D, characterized in that, include: Preprocessing unit: used to eliminate scale and intensity differences in multicenter images; Multi-scale 3D lesion automatic localization unit: quickly locates the lesion center through attention mechanism and connected component analysis; Structured 3D cue generation unit: Generates a structured cue array with positive and negative constraints through 3D Euclidean distance transformation and morphological operations; Local candidate region construction unit: used to perform local 3D clipping based on center point; Hint-guided segmentation unit: used to decode the output fine mask using the SAM-Med3D architecture finely tuned with multi-scale boundary-aware joint loss.