A shoulder image segmentation method and system based on topological constraint space attention

By introducing a topological prior spatial attention module and a Transformer architecture into shoulder anatomical structure image segmentation, the problem of unutilized spatial topological relationships in shoulder anatomical structure image segmentation is solved, achieving higher accuracy and robustness in segmentation results.

CN122289306APending Publication Date: 2026-06-26WUHAN UNIV

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
WUHAN UNIV
Filing Date
2026-04-14
Publication Date
2026-06-26

AI Technical Summary

Technical Problem

Existing technologies fail to effectively utilize spatial topological relationships in shoulder anatomical structure image segmentation, struggle to capture long-distance dependencies, and suffer from high similarity between target and background features, leading to segmentation errors and a lack of global context guidance capabilities.

Method used

A topological prior space attention module is designed. By generating a topological constraint space attention graph of the shoulder anatomy, and combining it with the Transformer architecture for global context modeling, a topological constraint mechanism for the shoulder anatomy is introduced to optimize the segmentation process.

Benefits of technology

It improves the recognition accuracy and robustness of shoulder anatomical targets, effectively suppresses background interference, ensures that the segmentation results conform to the spatial relationship between anatomical structures, and improves the segmentation accuracy and reliability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122289306A_ABST
    Figure CN122289306A_ABST
Patent Text Reader

Abstract

This invention provides a method and system for shoulder image segmentation based on topologically constrained spatial attention. The method constructs a topological prior spatial attention module, introducing prior topological relationships of shoulder anatomical structures to generate a spatial attention map with topological constraints on the shoulder anatomical structures to enhance the target region. Combined with the global context modeling capability of the Transformer architecture's main segmentation network, it effectively captures the spatial dependencies between complex anatomical structures while accurately suppressing background interference, thereby improving the recognition accuracy and robustness of shoulder anatomical targets.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of medical image segmentation, and in particular to a method for shoulder image segmentation based on topologically constrained spatial attention. Background Technology

[0002] Medical image segmentation technology is a core tool for achieving accurate identification and extraction of anatomical structures, playing a crucial role in computer-aided diagnosis, surgical planning, and treatment evaluation. Precise segmentation technology applied to shoulder images is of great significance for the accurate extraction of complex shoulder anatomical structures.

[0003] Segmentation techniques for shoulder anatomical structures still face challenges: First, the spatial topological relationships between shoulder anatomical structures are not effectively utilized. Strict spatial relative positions exist between different anatomical parts of the shoulder. However, most existing segmentation methods rely solely on data-driven methods to implicitly learn these relationships, lacking the incorporation of prior anatomical knowledge. Second, models such as convolutional neural networks are limited by local receptive fields, making it difficult to capture long-distance spatial dependencies and prone to segmentation errors that violate anatomical logic. Third, background interference arises due to the high similarity between target and background features. Different muscle groups and tissues in the shoulder region exhibit extremely high texture similarity, resulting in a high degree of overlap between the target region and the non-target background in feature space, easily causing false positive responses in the segmentation model.

[0004] With the development of deep learning technology, convolutional neural network architectures such as U-Net, nnU-Net, and Attention U-Net have made significant progress in the field of medical image segmentation. U-Net, with its symmetrical encoder-decoder structure and skip connection mechanism, has become a classic architecture in medical image segmentation. nnU-Net, building upon this, significantly improves the robustness and generality of the model on different datasets through adaptive image preprocessing strategies, data augmentation, and network topology configuration. Attention U-Net, by introducing a gated attention mechanism in skip connections, attempts to saliency-weight the features extracted by the encoder to suppress irrelevant background regions and improve segmentation accuracy. However, the above-mentioned network architectures based on convolutional operations still have inherent limitations: convolutional operations are limited by local receptive fields, making it difficult to effectively model the long-range spatial dependencies widely present in shoulder anatomical images. This results in a lack of global context guidance when facing interference from shoulder muscle groups with highly similar textures, and poor suppression of complex background noise, thus limiting further improvements in segmentation accuracy.

[0005] Furthermore, modeling spatial context relationships through self-attention mechanisms has become an important approach to improve the feature representation capabilities of medical images. However, in shoulder anatomical segmentation tasks, due to the small spatial proportion of the target tissue, existing self-attention mechanisms typically calculate associations across the entire image, resulting in the attention weights being diluted by a large area of ​​similar background pixels, making it difficult for the model to produce significant feature responses to subtle anatomical targets.

[0006] Existing technologies lack effective utilization of crucial prior knowledge regarding the spatial topological relationships between shoulder anatomical structures when dealing with background interference. If an initial location prior map containing anatomical location and structural association information can be obtained through intermediate layers of the network, and this information containing topological constraints can be transformed into spatial attention weights and applied to the feature extraction process, a local domain of interest conforming to anatomical logic can be constructed. This allows global attention to be refocused on the target and its neighborhood, thereby suppressing background interference while ensuring that the segmentation results conform to the inherent spatial relationships between anatomical structures.

[0007] Therefore, in the segmentation of shoulder anatomy, there is an urgent need to develop a segmentation method that can explicitly introduce anatomical topological priors and integrate global context modeling and spatial attention guidance mechanisms to address challenges such as the ineffective utilization of spatial topological relationships, the difficulty in capturing long-distance spatial dependencies, and the high similarity between target and background features. Summary of the Invention

[0008] To address the above problems, this invention provides a shoulder image segmentation method based on topologically constrained spatial attention. This method constructs a topological prior spatial attention module, introducing prior topological relationships of shoulder anatomical structures to generate a spatial attention map with topological constraints on the shoulder anatomical structures to enhance the target region. Combined with the global context modeling capability of the Transformer architecture's main segmentation network, it effectively captures the spatial dependencies between complex anatomical structures while accurately suppressing background interference, thereby improving the recognition accuracy and robustness of shoulder anatomical targets.

[0009] The technical solution of this invention is a shoulder image segmentation method based on topologically constrained spatial attention. The core of this method lies in: designing a topological prior spatial attention module, which generates an initial position prior map containing prior information about the target location through a segmentation sub-network, and then forms a spatial attention map through morphological processing; based on this, a topological constraint mechanism of shoulder anatomical structure is introduced, which calculates a topological loss based on predefined spatial relationships of the anatomical structure. During the training phase, this loss is used as a supervision signal to optimize the generation process of the spatial attention map. The spatial attention map is maximized along the channel dimension to obtain a single-channel spatial attention map, which is then element-wise multiplied with the original input image to suppress background interference and highlight the target region; finally, the enhanced image is input into the Transformer architecture main segmentation network, utilizing its global context modeling capability to achieve accurate segmentation. The entire network is trained end-to-end through joint optimization of segmentation loss and topological loss. Specifically, it includes: First, a medical image of the shoulder is input into the topological prior space attention module, which includes a segmentation sub-network, a morphological processing unit, an attention fusion unit, and an inline topological constraint mechanism for shoulder anatomy. The segmentation subnetwork uses an encoder. The decoder architecture is used to output a multi-channel probability map of the same size as the input. The morphological processing unit transforms the multi-channel probability map into a smooth and continuous attention map. The attention fusion unit applies the single-channel response map to the original image to obtain an enhanced image. The shoulder anatomical structure topological constraint mechanism constrains the attention map output by the topological prior space attention module through a loss function during the training phase to ensure that it contains the correct anatomical space structure. Finally, the enhanced image is fed into the main segmentation network of the Transformer architecture, which outputs the final segmentation result.

[0010] Furthermore, the encoder consists of multiple VGG blocks, each containing two convolutional layers, a batch normalization layer, and a ReLU activation function. After the feature maps are processed by the VGG blocks, they are downsampled by max pooling, and the decoder restores the spatial resolution by skip connections and upsampling.

[0011] Furthermore, the morphological processing unit expands the multi-channel probability map through a dilation operation. At the edge, the dilation operation is performed through max pooling. accomplish;

[0012] dilated feature map Perform Gaussian smoothing convolution and through Attention map obtained by normalizing activation function : .

[0013] Furthermore, attention maps are obtained along channel c. The maximum value is used to obtain the single-channel response graph. :

[0014] Attention fusion unit will integrate single-channel response maps Acting on the original image To obtain an enhanced image :

[0015] in, for convolution, This is for splicing operations.

[0016] Furthermore, based on knowledge of shoulder anatomy, the following three spatial relationship constraints are predefined: (1) The supraspinatus muscle and the supraspinatus tendon are connected at the boundary but their cores do not overlap; (2) The supraspinatus tendon attaches to the upper edge of the humeral head and must not penetrate into the bone or the side / lower edge; (3) The supraspinatus tendon is located at the acromion Below the deltoid junction and above the humeral head; The topological constraint mechanism of shoulder anatomy design employs three core topological losses for the special shoulder structure, which are weighted and summed to form the total topological loss. ; Among them, flexible connection loss Used to constrain the supraspinatus muscle and its tendon at a boundary where they are connected but do not overlap; edge attachment loss. Used to constrain the supraspinatus tendon attachment to the upper edge of the humeral head; spatial hierarchy constraint loss. It is used to restrain the supraspinatus tendon, which is located below the acromion-deltoid junction and above the humeral head. These are the weight parameters.

[0017] Furthermore, let's assume , Attention diagrams for the supraspinatus muscle and supraspinatus tendon are shown below. The first channel is the supraspinatus muscle attention map. , The second channel is the attention map of the supraspinatus tendon. ; Dilation is used to expand the respective response regions, allowing them to cover the original structure and its neighborhood. Dilation is achieved through max pooling, ensuring that the spatial dimensions of the output feature maps remain consistent with the input.

[0018]

[0019] in and They are and The response result after dilation processing; Constructing the connection loss term The connectivity term measures the degree of boundary contact by calculating the intersection of the dilated region and the original probability map of another structure. To minimize the loss when the intersection is larger, a negative exponential transformation is used to map the sum of the intersections to the loss value.

[0020] in These represent the row index and column index in the spatial dimension, respectively; Constructing the repulsion loss term Calculate by penalizing core overlap and The overlapping portion is used as the loss value:

[0021] Finally and Adding them together gives : .

[0022] Furthermore, let's define an attention graph. ; Obtain the internal region of the skeleton To identify the internal region of the humeral head, a morphological erosion operation was employed. This erosion operation was implemented using minimum pooling, i.e., max pooling was performed on the negative probability map, and the negative value was then taken to obtain an approximate representation of the internal bone region.

[0023] Extract the overall boundary of the skeleton Subtracting the internal region from the original probability map and retaining the positive values ​​using the ReLU activation function yields the overall boundary of the skeleton.

[0024] Extract the top edge The top edge is defined as the t-row pixels at the top of the bone, achieved by shifting the probability map downwards along the height direction by a preset offset. Then subtract the shifted probability map from the original probability map; the positive values ​​represent the upper edge.

[0025]

[0026] Extract other edges Subtracting the top edge from the overall boundary gives:

[0027] Constructing the adhesion loss term To guide the supraspinatus tendon to intersect with the superior edge of the humeral head beyond a threshold. :

[0028] Constructing the repulsion loss term To punish tendons that intrude into the interior of the humeral head or attach to other edges of the humeral head:

[0029] Finally and The sum is the upper edge adhesion loss. : .

[0030] Furthermore, let's assume , These are attention diagrams for the acromion and deltoid muscles, respectively. For attention graph The fourth channel, For attention graph The fifth passage, This serves as the upper reference structure, namely the area where the acromion and deltoid muscle unite. As a reference structure for the lower level; Attention diagram of the supraspinatus tendon. The second channel is the attention map of the supraspinatus tendon. ; right Calculate the vertical prefix sum along the height direction so that the pixel value of each row is the sum of all pixel values ​​from the top of the image to the current row:

[0031] in For pixel row index, Indexed by pixel column, Represents pixels The cumulative response intensity of all pixels in the upper reference structure; right Calculate the vertical suffix sum along the height direction so that the pixel value of each row is the sum of all pixel values ​​from the bottom of the image to the current row:

[0032] in The maximum number of rows in the feature map. Represents pixels The cumulative response intensity of all lower-level reference structure pixels; Attention diagram for supraspinatus tendon The penalty occurs in the area above the upper structure or below the lower structure:

[0033] in Take a constant, This is an indicator function.

[0034] Furthermore, the main segmentation network adopts a Transformer-based U-shaped structure, specifically the TransUNet architecture. Its encoder uses ResNet50 to extract multi-scale features and divides the last layer feature map into image patches, generating sequential embeddings through linear projection. Subsequently, global relationship modeling is performed through several Transformer blocks to obtain feature representations rich in contextual information. The decoder recovers spatial resolution by progressively upsampling and combining skip connections to fuse features from each stage of the encoder. The segmentation head consists of convolutional layers and upsampling layers, ultimately outputting a segmentation probability map of the same size as the input image. ; The entire network, consisting of the topological prior spatial attention module and the main segmentation network, is trained end-to-end, with the total loss function being:

[0035] in Topological loss Weight, For the segmentation loss, binary cross-entropy loss is used. Weighted sum of Dice loss:

[0036] in To predict the probability map, The results are standard segmentation results annotated manually. It is a constant.

[0037] This invention provides a shoulder image segmentation system based on topological constraint spatial attention, including a processor and a memory. The memory is used to store program instructions, and the processor is used to call the program instructions in the memory to execute the shoulder image segmentation method based on topological constraint spatial attention as described above.

[0038] Compared with the prior art, the beneficial effects of the present invention are as follows: 1. Introduce a topological constraint mechanism based on shoulder anatomy to optimize segmentation results.

[0039] Most existing technologies rely solely on data-driven implicit learning, which can easily lead to errors that violate anatomical common sense when faced with complex shoulder anatomy. This invention designs a "shoulder anatomical structure topological constraint mechanism," defining three types of topological losses for five core areas: supraspinatus muscle, tendon, humeral head, deltoid muscle, and supraspinatus tendon. These loss functions serve as supervisory signals during the training phase, constraining the model output to conform to anatomical logic in segmentation masks, reducing the risk of missegmentation and improving the reliability of clinical applications.

[0040] 2. The introduction of a topological prior space attention module effectively suppresses background interference and false positive responses.

[0041] To address the challenge of small target tissue proportions and high similarity to background texture (low contrast) in shoulder images, this invention employs a "topological prior space attention module." This module utilizes an initial position prior map generated by a segmentation sub-network to guide and enhance the original image. This module precisely focuses global attention on the target and its neighborhood, suppressing irrelevant background noise at the low-level feature level through element-wise multiplication operations. Compared to traditional gated attention mechanisms, the attention map in this invention is constrained by topological loss, thus possessing more explicit anatomical significance. Attached Figure Description

[0042] Figure 1 This is a schematic diagram of the network structure for the topological prior space attention module.

[0043] Figure 2 This is a schematic diagram of the loss in a flexible connection.

[0044] Figure 3 This is a schematic diagram of the adhesion loss at the upper edge.

[0045] Figure 4 This is a schematic diagram of spatial hierarchy constraint loss.

[0046] Figure 5 A visualization of the segmentation results. Detailed Implementation

[0047] To make the technical solution, objectives, and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings.

[0048] This invention provides a shoulder image segmentation method based on topology-constrained spatial attention, comprising a Topology Prior Spatial Attention Module (TPSAM) and a Transformer-based main segmentation network. The TPSAM generates a spatial attention map containing anatomical spatial priors under the supervision of the Shoulder Anatomical Topology Constraint Mechanism (SATCM) and enhances the input image. The enhanced image is then input into the Transformer-based main segmentation network, which outputs the final segmentation result. The entire network is trained end-to-end through joint optimization of segmentation and topology losses.

[0049] In a specific implementation, the input image is a shoulder medical image, with the size uniformly adjusted to 512×512 pixels and the number of channels being 3 (if the original image is a single channel, it is expanded to three channels by copying).

[0050] The topological prior space attention module (structure as follows) Figure 1 (As shown) This module consists of a segmentation subnetwork, a morphological processing unit, an attention fusion unit, and an inline topological constraint mechanism for shoulder anatomy. The original shoulder image is input into this module. This module outputs enhanced images. Attention map ,in This represents the number of segmentation categories.

[0051] The segmentation subnetwork uses an encoder. Decoder Architecture. The encoder consists of five VGG blocks, each containing two convolutional layers, a batch normalization layer, and a ReLU activation function. After processing by the VGG blocks, the feature maps are downsampled using max pooling (2×2). The decoder restores spatial resolution through skip connections and upsampling. The final output is a multi-channel probability map of the same size as the input. .

[0052] Morphological processing units will process multi-channel probability maps Transform it into a smooth, continuous attention map. The specific steps are as follows: (1) Expanding through expansion operation At the edge, the dilation operation is performed through max pooling. Implementation: Core size set to 3, stride set to 1, padding set to 1.

[0053] dilated feature map Perform Gaussian smoothing convolution and through Attention map obtained by normalizing activation function :

[0054] Take along the passage The maximum value is used to obtain the single-channel response graph. :

[0055] Attention fusion unit will integrate single-channel response maps Acting on the original image :

[0056] The topological constraint mechanism based on shoulder anatomy is another core innovation of this invention. During the training phase, it constrains the attention map output by the topological prior space attention module through a loss function, ensuring that it contains the correct anatomical spatial structure. In this embodiment, based on shoulder anatomy knowledge, the following three spatial relationship constraints are predefined: (1) The supraspinatus muscle and the supraspinatus tendon should be connected at the boundary but their cores should not overlap; (2) The supraspinatus tendon should be strictly attached to the upper edge of the humeral head and should not invade the interior of the bone or the side / lower edge; (3) The supraspinatus tendon is located at the acromion Below the deltoid junction and above the humeral head.

[0057] To achieve the aforementioned spatial relationship constraints, this embodiment implements three topological loss functions, and calculates their weighted summation to form the total topological loss. .

[0058] Flexible connection loss (Structure as follows) Figure 2 (As shown) This is used when the supraspinatus muscle and supraspinatus tendon are connected at the boundary and their cores do not overlap. Let... , These are attention diagrams of the supraspinatus muscle and supraspinatus tendon, respectively. The first channel is the supraspinatus muscle attention map. , The second channel is the attention map of the supraspinatus tendon. .

[0059] (1) Expanding the response region to cover the boundary range. An expansion operation is used to expand the response region of each component, ensuring it covers the original structure and its neighborhood. The expansion operation is implemented through max pooling. The core size is set to 7. The step size is 1. With padding set to 3, the spatial dimensions of the output feature map remain consistent with the input.

[0060]

[0061] in and They are and The response result after dilation processing; (2) Constructing the connectivity loss term. The connectivity term measures the degree of boundary contact by calculating the intersection of the dilated region and the original probability map of the other structure. To minimize the loss when the intersection is larger, a negative exponential transformation is used to map the sum of the intersections to the loss value:

[0062] in These represent the row index and column index in the spatial dimension, respectively; (3) Construct a repulsion loss term to penalize core overlap. Calculate... and The overlapping portion is used as the loss value:

[0063] (4) Finally, and Adding them together gives :

[0064] Upper edge adhesion loss (Structure as follows) Figure 3 (As shown) is used to restrain the tendon from attaching to the upper edge of the humerus and from intruding into other areas. .

[0065] (1) Obtaining the internal region of the skeleton To identify the internal region of the humeral head, a morphological erosion operation was employed. This erosion operation was implemented using minimum pooling, i.e., max pooling the negative probability map and then taking the negative value to obtain an approximate representation of the internal bone region.

[0066] (2) Extract the overall boundary of the skeleton Subtracting the internal region from the original probability map and retaining the positive values ​​using the ReLU activation function yields the overall boundary of the skeleton.

[0067] (3) Extract the top edge The top edge is defined as the t-row pixels at the top of the bone. This is achieved by shifting the probability map downwards by a preset offset along the height direction. (Offset in this embodiment) (5 pixels), then subtract the shifted probability map from the original probability map, and the positive value part is the top edge:

[0068]

[0069] (4) Extract other edges Subtract the top edge from the overall boundary:

[0070] (5) Construct an attachment loss term to guide the intersection of the supraspinatus tendon and the upper edge of the humeral head to exceed a threshold. (This embodiment takes) =5):

[0071] (6) Constructing rejection loss terms to punish tendon intrusion into the humeral head or attachment to other edges of the humeral head:

[0072] (7) Finally, and The sum is the upper edge adhesion loss. :

[0073] Spatial hierarchy constraint loss (Structure as follows) Figure 4 (As shown) This is used to restrain the supraspinatus tendon, which lies below the acromion-deltoid junction and above the humeral head. Let... , Attention diagrams for the acromion and deltoid muscles respectively. for The fourth channel, for The fifth channel). This serves as the upper reference structure (the area where the acromion and deltoid muscle unite). The lower reference structure is the humeral head. Attention diagram of the supraspinatus tendon.

[0074] right Calculate the vertical prefix sum along the height direction so that the pixel value of each row is the sum of all pixel values ​​from the top of the image to the current row:

[0075] in For pixel row index, Indexed by pixel column, Represents pixels The cumulative response intensity of all upper-layer reference structure pixels.

[0076] right Calculate the vertical suffix sum along the height direction so that the pixel value of each row is the sum of all pixel values ​​from the bottom of the image to the current row:

[0077] in The maximum number of rows in the feature map. Represents pixels The cumulative response intensity of all lower-level reference structure pixels; Attention diagram for supraspinatus tendon The penalty occurs in the area above the upper structure or below the lower structure:

[0078] in Take 0.1, This is an indicator function.

[0079] The final topological loss is a weighted sum of three terms:

[0080] In this embodiment, the following is taken .

[0081] The main segmentation network adopts a Transformer-based U-shaped structure, specifically the TransUNet architecture. Its encoder uses ResNet50 to extract multi-scale features and divides the last layer feature map into image blocks, generating sequential embeddings through linear projection. Subsequently, it performs global relational modeling through several Transformer blocks (12 layers in this embodiment) to obtain feature representations rich in contextual information. The decoder restores spatial resolution by progressively upsampling and fusing features from each stage of the encoder with skip connections. The segmentation head consists of convolutional layers and upsampling layers, ultimately outputting a segmentation probability map of the same size as the input image. Where B is the number of samples input to the network for computation in a single iteration, and C is the number of classification categories.

[0082] The entire network is trained end-to-end, and the total loss function is:

[0083] in As the topology loss weight, this embodiment takes , For the segmentation loss, this embodiment uses binary cross-entropy loss. Weighted sum of Dice loss:

[0084] in To predict the probability map, The results are standard segmentation results with manual annotation. The SGD optimizer is used to iteratively update the model parameters. The trained segmentation model is then used for a practical medical image segmentation task.

[0085] To verify the effectiveness of the proposed method, ablation experiments were conducted on a shoulder image dataset using TransUNet as the baseline model. Table 1 shows the results. The ablation experiments were compared based on TransUNet. Experimental results show that when the Topological Prior Spatial Attention Module (TPSAM) is introduced, the model's Dice index increases from 84.48% to 86.60%, demonstrating the effectiveness of TPSAM. When the shoulder anatomical topological constraint mechanism (SATCM) of TPSAM is removed, the model's Dice index decreases from 86.60% to 84.67%, validating the effectiveness of SATCM.

[0086] Table 1 Ablation Experiment

[0087] Table 2 shows the evaluation results of the proposed method on a shoulder image dataset for five key shoulder structures: supraspinatus muscle, supraspinatus tendon, acromion, deltoid muscle, and humeral head, and compares it with TransUNet. The data shows that the segmentation accuracy of this model surpasses TransUNet for all five shoulder anatomical structures. The segmentation results are visualized as follows: Figure 5 As shown.

[0088] Table 2 Model Comparison

[0089] On the other hand, embodiments of the present invention also provide a shoulder image segmentation system based on topological constraint spatial attention, including a processor and a memory. The memory is used to store program instructions, and the processor is used to call the program instructions in the memory to execute the shoulder image segmentation method based on topological constraint spatial attention as described in the above technical solution.

[0090] It should be understood that any parts not described in detail in this specification belong to the prior art.

[0091] It should be understood that the above description of the preferred embodiments is quite detailed, but it should not be considered as a limitation on the scope of protection of this invention. Those skilled in the art, under the guidance of this invention, can make substitutions or modifications without departing from the scope of protection of the claims of this invention, and all such substitutions or modifications fall within the scope of protection of this invention. The scope of protection of this invention should be determined by the appended claims.

Claims

1. A shoulder image segmentation method based on topological constraint space attention, characterized in that, include: First, a medical image of the shoulder is input into the topological prior space attention module, which includes a segmentation sub-network, a morphological processing unit, an attention fusion unit, and an inline topological constraint mechanism for shoulder anatomy. The segmentation subnetwork adopts an encoder The decoder architecture is used to output a multi-channel probability map with the same size as the input, a morphological processing unit converts the multi-channel probability map into a smooth continuous attention map, an attention fusion unit applies a single-channel response map to the original image to obtain an enhanced image, and a shoulder anatomy topology constraint mechanism constrains the attention map output by the topology prior space attention module during the training stage through a loss function, ensuring that it contains correct anatomical spatial structures. Finally, the enhanced image is fed into the main segmentation network of the Transformer architecture, which outputs the final segmentation result.

2. The shoulder image segmentation method based on topology-constrained space attention of claim 1, wherein: The encoder consists of multiple VGG blocks, each containing two convolutional layers, a batch normalization layer, and a ReLU activation function. After the feature maps are processed by the VGG blocks, they are downsampled by max pooling, and the decoder restores the spatial resolution by skip connections and upsampling.

3. The shoulder image segmentation method based on topological constraint spatial attention as described in claim 1, characterized in that: Morphological processing units expand multichannel probability maps through dilation operations. At the edge, the dilation operation is performed through max pooling. accomplish; dilated feature map Perform Gaussian smoothing convolution and through Attention map obtained by normalizing activation function : 。 4. The shoulder image segmentation method based on topological constraint spatial attention as described in claim 1, characterized in that: Attention map along channel c The maximum value is used to obtain the single-channel response graph. : Attention fusion unit will integrate single-channel response maps Acting on the original image To obtain an enhanced image : in, for convolution, This is for splicing operations.

5. The shoulder image segmentation method based on topological constraint spatial attention as described in claim 1, characterized in that: Based on shoulder anatomy, the following three spatial relationship constraints are predefined: (1) The supraspinatus muscle and the supraspinatus tendon are connected at the boundary but their cores do not overlap; (2) The supraspinatus tendon attaches to the upper edge of the humeral head and must not penetrate into the bone or the side / lower edge; (3) The supraspinatus tendon is located at the acromion Below the deltoid junction and above the humeral head; The topological constraint mechanism of shoulder anatomy design employs three core topological losses for the special structure of the shoulder, which are weighted and summed to form the total topological loss. ; Among them, flexible connection loss Used to constrain the supraspinatus muscle and its tendon at a boundary where they are connected but do not overlap; edge attachment loss. Used to constrain the supraspinatus tendon attachment to the upper edge of the humeral head; spatial hierarchy constraint loss. It is used to restrain the supraspinatus tendon, which is located below the acromion-deltoid junction and above the humeral head. These are the weight parameters.

6. The shoulder image segmentation method based on topological constraint spatial attention as described in claim 5, characterized in that: set up , Attention diagrams for the supraspinatus muscle and supraspinatus tendon are shown below. The first channel is the supraspinatus muscle attention map. , The second channel is the attention map of the supraspinatus tendon. ; Dilation is used to expand the respective response regions, allowing them to cover the original structure and its neighborhood. Dilation is achieved through max pooling, ensuring that the spatial dimensions of the output feature maps remain consistent with the input. in and They are and The response result after dilation processing; Constructing the connection loss term The connectivity term measures the degree of boundary contact by calculating the intersection of the dilated region and the original probability map of another structure. To minimize the loss when the intersection is larger, a negative exponential transformation is used to map the sum of the intersections to the loss value. in These represent the row index and column index in the spatial dimension, respectively; Constructing the repulsion loss term Calculate by penalizing core overlap and The overlapping portion is used as the loss value: Finally and Adding them together gives : 。 7. The shoulder image segmentation method based on topological constraint spatial attention as described in claim 5, characterized in that: Set attention graph ; Obtain the internal region of the skeleton To identify the internal region of the humeral head, a morphological erosion operation was employed. This operation was implemented using minimum pooling, i.e., max pooling was performed on the negative probability map, and the negative values ​​were then taken to obtain an approximate representation of the internal bone region. Extract the overall boundary of the skeleton Subtracting the internal region from the original probability map and retaining the positive values ​​using the ReLU activation function yields the overall boundary of the skeleton. Extract the top edge The top edge is defined as the t-row pixels at the top of the bone, achieved by shifting the probability map downwards along the height direction by a preset offset. Then subtract the shifted probability map from the original probability map; the positive values ​​represent the upper edge. Extract other edges Subtracting the top edge from the overall boundary gives: Constructing the adhesion loss term To guide the supraspinatus tendon to intersect with the superior edge of the humeral head beyond a threshold. : Constructing the repulsion loss term To punish tendons that intrude into the interior of the humeral head or attach to other edges of the humeral head: Finally and The sum is the upper edge adhesion loss. : 。 8. The shoulder image segmentation method based on topological constraint spatial attention as described in claim 5, characterized in that: set up , These are attention diagrams for the acromion and deltoid muscles, respectively. For attention graph The fourth channel, For attention graph The fifth passage, This serves as the upper reference structure, namely the area where the acromion and deltoid muscle unite. As a reference structure for the lower level; Attention diagram of the supraspinatus tendon. The second channel is the attention map of the supraspinatus tendon. ; right Calculate the vertical prefix sum along the height direction so that the pixel value of each row is the sum of all pixel values ​​from the top of the image to the current row: in For pixel row index, Indexed by pixel column, Represents pixels The cumulative response intensity of all pixels in the upper reference structure; right Calculate the vertical suffix sum along the height direction so that the pixel value of each row is the sum of all pixel values ​​from the bottom of the image to the current row: in The maximum number of rows in the feature map. Represents pixels The cumulative response intensity of all lower-level reference structure pixels; Attention diagram for supraspinatus tendon The penalty occurs in the area above the upper structure or below the lower structure: in Take a constant, This is an indicator function.

9. The shoulder image segmentation method based on topological constraint spatial attention as described in claim 1, characterized in that: The main segmentation network adopts a U-shaped structure based on Transformer, specifically the TransUNet architecture. Its encoder part uses ResNet50 to extract multi-scale features and divides the last layer feature map into image blocks, generating serialized embeddings through linear projection. Subsequently, global relationship modeling is performed through several Transformer blocks to obtain feature representations rich in contextual information. The decoder recovers spatial resolution by progressively upsampling and combining features from each stage of the encoder with skip connections. The segmentation head consists of convolutional layers and upsampling layers, and finally outputs a segmentation probability map of the same size as the input image. ; The entire network, consisting of the topological prior spatial attention module and the main segmentation network, is trained end-to-end, with the total loss function being: in Topological loss Weight, For the segmentation loss, binary cross-entropy loss is used. Weighted sum of Dice loss: in To predict the probability map, The results are standard segmentation results annotated manually. It is a constant.

10. A shoulder image segmentation system based on topological constraint spatial attention, characterized in that: It includes a processor and a memory, the memory being used to store program instructions, and the processor being used to call the program instructions in the memory to execute the shoulder image segmentation method based on topological constraint spatial attention as described in any one of claims 1-9.