Method for medical image segmentation based on boundary constraints

By combining Fourier transform and linear self-attention encoder, the boundary constraint method solves the problem of inaccurate edge localization in medical image segmentation, achieves efficient segmentation of low-contrast regions and complex backgrounds, and improves segmentation accuracy and stability.

CN120782740BActive Publication Date: 2026-01-27盐城市第三人民医院
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510900324.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-07-01
Publication Date
2026-01-27
Estimated Expiration
2045-07-01

AI Technical Summary

Technical Problem

Existing medical image segmentation methods suffer from problems such as segmentation blurring, artifact generation, edge offset, and attention response drift when dealing with low-contrast regions, blurred edges, and complex background structures, making it difficult to balance the accuracy of edge localization with the stability of region prediction.

Method used

A boundary-constraint-based medical image segmentation method is adopted, which generates structure-aware frequency domain perturbations through Fourier transform and combines a linear self-attention encoder and a dual-domain interactive decoding strategy to enhance the attention response and frequency domain feature representation of the boundary region.

Benefits of technology

It significantly improves the model's structural perception capabilities in medical imaging scenarios with blurred anatomical boundaries and low texture contrast, enhances the preservation and expressiveness of edge information, and strengthens the detection capabilities for small lesions and complex boundaries.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120782740B_ABST
    Figure CN120782740B_ABST
Patent Text Reader

Abstract

The application discloses a medical image segmentation method based on boundary constraint, S1. Obtain medical image amplitude spectrum and medical image phase spectrum; S2. Form structure perception frequency domain disturbance result; S3. Obtain frequency domain enhanced medical image; S4. Calculate structure perception medical image boundary enhancement attention output feature; S5. Global relationship modeling and local texture modeling are carried out on the frequency domain enhanced medical image sequence; S6. Generate edge heat map; S7. Bidirectional gate interaction is carried out on the edge heat map and linear self-attention encoder output by adopting a dual-domain interactive fusion strategy, a dual-domain interactive fusion feature map is generated, and the dual-domain interactive fusion feature map is up-sampled and convolution-processed in the decoder, and a boundary enhancement segmentation feature map is output. The application effectively improves the structure perception capability of the model in the medical image scene with fuzzy anatomical structure boundary and low texture contrast.
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 technology, and in particular to a medical image segmentation method based on boundary constraints. Background Technology

[0002] With the widespread application of deep learning in the field of medical image processing, medical image segmentation, as a fundamental task, plays a key role in assisted diagnosis, lesion identification, and preoperative planning. Currently, most mainstream medical image segmentation methods are based on deep learning models such as fully convolutional networks, U-Net structures, attention mechanisms, and Transformer architectures. They are usually based on pixel-level supervised learning, learning the spatial feature distribution of different tissues or lesion regions in the image through end-to-end training. However, despite some progress in structure recognition and region contour extraction, there are still several technical limitations that cannot be ignored.

[0003] First, medical images contain many low-contrast areas, blurred edges, and complex background structures. This makes traditional networks prone to segmentation blurring, artifact generation, or edge offset at boundary locations, affecting the model's accuracy in identifying key lesion areas. Second, existing methods often rely on post-processing operations to improve boundary quality when dealing with fine-grained boundary features, but this easily introduces computational redundancy and is difficult to optimize end-to-end with the backbone network.

[0004] In addition, some studies have attempted to introduce frequency domain features into medical image segmentation tasks, enhancing image expressiveness by modeling the amplitude or phase features after Fourier transform. However, these studies are limited to global frequency domain enhancement or filtering operations, lacking the ability to directionally control structurally sensitive regions and making it difficult to finely control the response of specific edge or texture structures. Furthermore, frequency domain information is often introduced statically in modeling, making it difficult to form a dynamic linkage with image content, which reduces the adaptive expressiveness of different structural regions.

[0005] Furthermore, linear attention mechanisms have been introduced into medical image modeling in recent years to improve the modeling ability between distant regions. However, most current attention mechanisms ignore the importance of structural boundaries and cannot provide significant enhancement responses to structural abrupt changes or discontinuous boundary regions in the image. This global modeling approach is prone to attention response drift and boundary structure distortion when dealing with small targets or regions with edges close to the background, affecting the final segmentation accuracy.

[0006] Therefore, existing medical image segmentation methods have shortcomings in boundary-aware modeling, frequency domain enhancement strategies, and processing of structurally sensitive regions. In particular, when dealing with real medical images with blurred structural boundaries, complex textures, and low-frequency disturbances, it is difficult to balance the accuracy of edge localization with the stability of region prediction. There is an urgent need for an innovative method that combines frequency domain modeling capabilities with structural boundary awareness capabilities to overcome the above-mentioned technical deficiencies. Summary of the Invention

[0007] One objective of this invention is to propose a medical image segmentation method based on boundary constraints. This invention effectively improves the model's structural perception capability in medical imaging scenarios with blurred anatomical boundaries and low texture contrast.

[0008] A medical image segmentation method based on boundary constraints according to an embodiment of the present invention includes the following steps:

[0009] S1. Acquire raw medical image data and perform a differentiable Fourier transform to obtain the amplitude spectrum and phase spectrum of the medical images;

[0010] S2. Generate a structure region guidance mask based on the original medical image data, implement learnable perturbation on the low-frequency amplitude in the amplitude spectrum of the medical image, and implement random sampling adjustment on the low-frequency phase in the phase spectrum of the medical image to form a structure-aware frequency domain perturbation result.

[0011] S3. Combine the structure-aware frequency domain perturbation results to recombine the amplitude spectrum and phase spectrum of the medical image, and perform an inverse Fourier transform on the combined frequency domain information to obtain the frequency domain enhanced medical image.

[0012] S4. Divide the frequency domain enhanced medical image into fixed-size image blocks, expand the image blocks into a sequence input linear self-attention encoder, and calculate the structure-aware medical image boundary enhancement attention output features;

[0013] S5. A separable convolutional module and a phase-guided attention head are superimposed within a linear self-attention encoder to perform global relational modeling and local texture modeling on frequency-domain enhanced medical image sequences;

[0014] S6. The output of the linear self-attention encoder is fed into the decoder along with the multi-scale jump connection to construct the edge enhancement branch of the decoder and generate an edge heatmap;

[0015] S7. A dual-domain interactive fusion strategy is adopted to perform bidirectional gating interaction between the edge heatmap and the output of the linear self-attention encoder to generate a dual-domain interactive fusion feature map. The dual-domain interactive fusion feature map is upsampled and convolved in the decoder to output a boundary enhancement segmentation feature map.

[0016] Optionally, S1 includes the following steps:

[0017] S11. Construct a raw medical image dataset, which is used to store multiple raw medical image I. i The original medical image has a size of H×W, where i represents the image index number, H represents the height of the original medical image, and W represents the width of the original medical image.

[0018] S12. Original medical imaging images I i Perform a Fourier transform to obtain the complex image F in the frequency domain. i From the frequency domain complex image F i Extract the corresponding medical image amplitude spectrum A from each. i Phase spectrum of medical images P i ;

[0019] S13. Combine the amplitude spectrum and phase spectrum of all original medical images to form a frequency domain medical image dataset.

[0020] Optionally, S2 includes the following steps:

[0021] S21. Based on original medical imaging images I i Generate structural region boot mask M i ;

[0022] S22. Obtain the structural region guide mask M i Mapped to the frequency domain coordinate system and compared with the corresponding medical image amplitude spectrum A in the frequency domain medical image dataset. i Phase spectrum of medical images P i Corresponding alignment to form a frequency domain structure guiding mask

[0023]

[0024] S23. Guiding the mask in the frequency domain structure Medical image amplitude spectrum A within the specified structurally sensitive region i The low-frequency amplitude values ​​are weighted and perturbed to obtain the perturbed amplitude spectrum of the medical image.

[0025] S24. Guiding the mask in the frequency domain structure Within the specified structurally sensitive region, the phase spectrum P of medical images i The low-frequency phase values ​​are randomly sampled and adjusted to obtain the adjusted medical image phase spectrum.

[0026] S25. Combining the perturbated amplitude spectrum of medical images Phase spectrum of adjusted medical images The results of structure-sensing frequency domain perturbation

[0027] Optionally, S3 includes the results of the structure-aware frequency domain perturbation. Performing a two-dimensional inverse Fourier transform operation yields frequency-domain enhanced medical images.

[0028] Optionally, S4 includes the following steps:

[0029] S41. Frequency Domain Enhancement of Medical Images According to a fixed size P h ×P w Divided into non-overlapping image blocks Perform channel-dimensional embedding operation on each image patch and flatten it in row-major order into a sequence feature vector of length D;

[0030] S42. Based on structural region guidance mask M i Generate the corresponding boundary-guided attention weight vector Where the boundary guides the attention weight vector The attention weight vector represents the saliency of the medical image edge structure within the corresponding image block, and the value of the attention weight vector is in the interval [0,1].

[0031] S43. Construct a boundary-guided dynamic kernel function φ bd (·), the boundary-guided dynamic kernel function combines the structural region guidance mask with the sequence feature vector in a high-dimensional kernel space, amplifying the differences in self-attention responses within structurally sensitive regions of medical images, and smoothing the self-attention response in structurally unrelated regions. The boundary-guided dynamic kernel function is expressed as:

[0032]

[0033] Where ⊙ represents the Hadamard element-wise product operation, and α is a learnable structural sensitivity scaling factor used to control the response difference between the boundary-sensitive region and the background region. The value represents the structural sensing feature of the frequency-domain enhanced medical image at the i-th scale with coordinate position (p,q).

[0034] S44. Calculate the query vector, key vector and value vector corresponding to each image block in the boundary-guided dynamic kernel function space. The feature vector output by the boundary-guided dynamic kernel function represents the nonlinear feature response of the frequency domain enhanced medical image block under the guidance of boundary structure saliency.

[0035] S45. Using the boundary-guided query matrix, key matrix, and value matrix in the dynamic kernel function space, the structure-aware medical image boundary-enhanced attention output features O are obtained through a linear self-attention mechanism. i :

[0036]

[0037] in, The query matrix, key matrix, and value matrix are serialized from the query vector, key vector, and value vector.

[0038] Optionally, S5 includes the following steps:

[0039] S51. Enhance attention output features of structure-aware medical image boundaries O i Restored to the spatial dimension of frequency domain enhanced medical images, intermediate feature maps are obtained.

[0040] S52. Intermediate Feature Map Perform spatially separable convolution operations along the channel dimension to form local structural response enhancement feature maps.

[0041] S53. Extract the phase perturbation map For each pixel in the array, map it to the corresponding frequency domain structure guide mask. After performing pointwise multiplication, it is mapped to a phase-guided attention heatmap.

[0042] S54. Phase-guided attention heatmap Upsampling to enhance the feature map of local structural response Using the same spatial dimension and broadcasting to all channels, attention-guiding factors are obtained. Attention-guiding factor With local structural response enhancement feature map Perform element-wise multiplication to obtain the fused feature map.

[0043] Optionally, S6 includes the following steps:

[0044] S61. Concatenate the fused feature map and the skip connection feature map to construct the decoder input feature map. The decoder input feature map is obtained by concatenating the fused feature map and the skip connection feature map according to the channel dimension after aligning them in the spatial dimension.

[0045] S62. Calculate the image gradients of the decoder input feature map in the horizontal and vertical directions respectively, sum the squared gradient values ​​in the two directions and take the square root to obtain the edge gradient response map of the decoder input feature map;

[0046] S63. Extract the second-order edge change response map based on the edge gradient response map. The second-order edge change response map is used to characterize the changing trend of the boundary significant region in medical images. It is obtained by calculating the second derivatives of the first-order gradient map in the horizontal and vertical directions and summing them. The second-order edge change response map is defined as a zero-crossing map.

[0047] S64. Construct a fused edge heatmap by splicing the edge gradient response map and the second-order edge change response map in the channel dimension.

[0048] Optionally, S7 includes the following steps:

[0049] S71. By applying an activation function to the fused edge heatmap by performing a weighted summation on the channel dimension and then applying an affine mapping to each channel of the fused feature map, a boundary attention-guided gating weight map is obtained.

[0050] S72. Apply boundary guidance gating operation to the fused feature map to obtain the first-stage boundary-aware enhanced feature map. The first-stage boundary-aware enhanced feature map is used to embed edge heatmap information into the main segmentation feature map to form a structure-sensitive feature representation.

[0051] S73. Use the fusion feature map to guide the channel response adjustment of the fusion edge heatmap, and generate a feature feedback modulation map. The feature feedback modulation map is used to reversely control the response intensity of each channel in the edge heatmap.

[0052] S74. The feature feedback modulation map is applied to the fused edge heatmap to obtain the edge structure modulation enhancement map, which is used to enhance the structural expressiveness of the edge heatmap.

[0053] S75. The first-stage boundary-aware enhancement feature map and the edge structure modulation enhancement map are concatenated in the channel dimension. The concatenation result is used as the input of the convolution module, and the channel dimension is compressed to output a dual-domain interactive fusion feature map.

[0054] S76. Perform an upsampling operation on the dual-domain interactive fusion feature map to obtain the final boundary enhancement segmentation feature map, which is used to output the segmentation result of the medical image.

[0055] The beneficial effects of this invention are:

[0056] (1) This invention introduces a structure-aware frequency domain perturbation mechanism in the medical image segmentation process. Based on the amplitude spectrum and phase spectrum after Fourier transform, joint perturbation and reconstruction are performed, which significantly enhances the image's response to structural regions in the frequency domain. First, the region of interest is explicitly marked in the frequency domain by a structure region-guided mask, and learnable perturbation and random phase sampling are applied in the low frequency range to construct a frequency domain perturbation map that is sensitive to key structures. This effectively improves the model's structure perception capability in medical image scenarios with blurred anatomical structure boundaries and low texture contrast.

[0057] (2) This invention constructs a linear self-attention encoder module that integrates boundary-guided dynamic kernel functions, which effectively enhances the attention response expression of boundary regions in the image. By assigning structural saliency labels to each image block through boundary-guided weights, and combining the structure-aware Hadamard weighting mechanism, attention is guided to obtain a stronger response in boundary abrupt regions. At the same time, smooth response suppression is performed in non-structure-sensitive regions to avoid redundant interference, thus solving the problem of response drift and instability in boundary modeling of existing self-attention mechanisms.

[0058] (3) This invention designs a dual-domain interactive decoding strategy that integrates phase perturbation guidance and edge heatmap interaction enhancement. In the model decoding stage, it realizes the synergistic enhancement of frequency domain and spatial domain features. By constructing edge heatmaps and phase-guided attention maps, and introducing a bidirectional gating mechanism in the decoder for cross-modulation, it effectively solves the problem that structural details are easily masked by high-level semantics during the decoding process, significantly improves the retention and expressiveness of edge information, and enhances the model's ability to detect small lesions and complex boundaries. Attached Figure Description

[0059] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used in conjunction with embodiments of the invention to explain the invention and do not constitute a limitation thereof. In the drawings:

[0060] Figure 1 This is a flowchart of a medical image segmentation method based on boundary constraints proposed in this invention. Detailed Implementation

[0061] The present invention will now be described in further detail with reference to the accompanying drawings. These drawings are simplified schematic diagrams, illustrating only the basic structure of the invention, and therefore only show the components relevant to the invention.

[0062] refer to Figure 1 A medical image segmentation method based on boundary constraints includes the following steps:

[0063] S1. Acquire raw medical image data, perform differentiable Fourier transform on the raw medical image data to obtain the amplitude spectrum and phase spectrum of the medical image.

[0064] S2. Generate a structural region guiding mask based on the original medical image data, project the structural region guiding mask onto the coordinate domain corresponding to the amplitude spectrum and phase spectrum of the medical image, and according to the structural region guiding mask, implement learnable perturbation on the low-frequency amplitude in the amplitude spectrum of the medical image and implement random sampling adjustment on the low-frequency phase in the phase spectrum of the medical image to form a structure-aware frequency domain perturbation result.

[0065] S3. Combine the structure-aware frequency domain perturbation results to recombine the amplitude spectrum and phase spectrum of the medical image, and perform an inverse Fourier transform on the combined frequency domain information to obtain the frequency domain enhanced medical image.

[0066] S4. Divide the frequency domain enhanced medical image into fixed-size image blocks, expand the image blocks into a sequence input linear self-attention encoder, insert a boundary-guided dynamic gating attention head into the linear self-attention encoder, use the structural region guidance mask obtained in step S2 to adjust the weight distribution of query vector, key vector and value vector, and calculate the boundary enhancement attention output features of the structure-aware medical image.

[0067] S5. A separable convolutional module and a phase-guided attention head are superimposed within a linear self-attention encoder to perform global relational modeling and local texture modeling on frequency-domain enhanced medical image sequences;

[0068] S6. The output of the linear self-attention encoder and the multi-scale jump connection are fed into the decoder to construct the edge enhancement branch of the decoder. The gradient map and zero-crossing map are calculated in the edge enhancement branch to generate the edge heatmap.

[0069] S7. A dual-domain interactive fusion strategy is adopted to perform bidirectional gating interaction between the edge heatmap and the output of the linear self-attention encoder to generate a dual-domain interactive fusion feature map. The dual-domain interactive fusion feature map is upsampled and convolved in the decoder to output a boundary enhancement segmentation feature map.

[0070] In this embodiment, S1 includes the following steps:

[0071] S11. Construct a raw medical image dataset, which is used to store multiple raw medical image I. i The original medical image has a size of H×W, where i represents the image index number, H represents the height of the original medical image, and W represents the width of the original medical image.

[0072] S12. Original medical imaging images I i Perform a Fourier transform to obtain the complex image F in the frequency domain. i From the frequency domain complex image F i Extract the corresponding medical image amplitude spectrum A from each. i Phase spectrum of medical images P i Medical imaging amplitude spectrum A i Represents the complex image F in the frequency domain i The modulus information, medical image phase spectrum P i Represents the complex image F in the frequency domain i Angle information;

[0073] S13. Combine the amplitude spectrum and phase spectrum of all original medical images to form a frequency domain medical image dataset D. freq The frequency domain medical image dataset is used to store data pairs of medical image amplitude spectrum and medical image phase spectrum. In each data pair, the medical image amplitude spectrum A i Phase spectrum of medical images P i Same as the original medical image I i It has a one-to-one correspondence and maintains the same image size as the original medical images in the original medical image dataset.

[0074] In this embodiment, S2 includes the following steps:

[0075] S21. Based on original medical imaging images I i Generate structural region boot mask M i Structural region guiding mask M i Used to identify prominent regions containing edges, tissue interfaces, or lesion structures in raw medical images; structural region guiding mask M. i This is a binary image, where a value of 1 represents a structure-sensitive region and a value of 0 represents a structure-independent region.

[0076] S22. Obtain the structural region guide mask M i Mapped to the frequency domain coordinate system and compared with the corresponding medical image amplitude spectrum A in the frequency domain medical image dataset. i Phase spectrum of medical images P i Corresponding alignment to form a frequency domain structure guiding mask

[0077]

[0078] S23. Guiding the mask in the frequency domain structure Within the specified structurally sensitive region, the amplitude spectrum A of medical images i The low-frequency amplitude values ​​are weighted and perturbed to obtain the perturbed amplitude spectrum of the medical image. The amplitude perturbation increment is generated by learnable parameters and applies only to structurally sensitive regions to enhance the spectral representation capability of structural regions.

[0079] S24. Guiding the mask in the frequency domain structure Within the specified structurally sensitive region, the phase spectrum P of medical images i The low-frequency phase values ​​are randomly sampled and adjusted to obtain the adjusted medical image phase spectrum. The random sampling results are derived from a preset phase perturbation distribution, which is used to introduce the diversity of frequency domain distribution and preserve the original phase spectrum unchanged in the structure-independent region.

[0080] S25. Combining the perturbated amplitude spectrum of medical images Phase spectrum of adjusted medical images The results of structure-sensing frequency domain perturbation The structure-aware frequency domain perturbation results represent the complex representation of medical images in the frequency domain after perturbation.

[0081] In this embodiment, S3 includes the results of structure-sensing frequency domain perturbation. Performing a two-dimensional inverse Fourier transform operation yields frequency-domain enhanced medical images.

[0082] In this embodiment, S4 includes the following steps:

[0083] S41. Frequency Domain Enhancement of Medical Images According to a fixed size P h ×P w Divided into non-overlapping image blocks Perform channel-dimensional embedding operation on each image patch and flatten it in row-major order into a sequence feature vector of length D;

[0084] S42. Based on structural region guidance mask M i Generate the corresponding boundary-guided attention weight vector Where the boundary guides the attention weight vector The attention weight vector represents the saliency of the medical image edge structure within the corresponding image block, and the value of the attention weight vector is in the interval [0,1].

[0085] S43. Construct a boundary-guided dynamic kernel function φ bd (·), the boundary-guided dynamic kernel function combines the structural region guidance mask with the sequence feature vector in a high-dimensional kernel space, amplifying the differences in self-attention responses within structurally sensitive regions of medical images, and smoothing the self-attention response in structurally unrelated regions. The boundary-guided dynamic kernel function is expressed as:

[0086]

[0087] Where ⊙ represents the Hadamard element-wise product operation, and α is a learnable structural sensitivity scaling factor used to control the response difference between the boundary-sensitive region and the background region. The value represents the structural sensing feature of the frequency-domain enhanced medical image at the i-th scale with coordinate position (p,q).

[0088] The dual-domain interactive fusion mechanism involved in S43 is an innovative structure that utilizes bidirectional gating information interaction between edge heatmaps and fused feature maps during the decoding stage. By applying gating weights to the edge heatmap channel and the fused feature map channel respectively, features are mutually adjusted, boundary information enhances the main segmentation stream, and the main segmentation stream feeds back to adjust the edge heatmap response. Finally, the dual-domain interactive fused feature map is generated through convolutional compression.

[0089] Unlike traditional decoder structures or simple skip connections, this model achieves explicit bidirectional interactive fusion of edge-region dual-domain information, going beyond simple feature overlay or unidirectional modulation. The introduction of a gating mechanism allows the model to dynamically focus on boundary-sensitive regions, effectively preventing the loss of boundary information during downsampling, upsampling, or channel compression. The mutually feedback design (main segmentation features modulating edge features, and edge features demodulating main segmentation features) is highly innovative, enhancing the continuity of segmentation boundaries and the integrity of semantic regions.

[0090] S44. Calculate the query vector, key vector, and value vector corresponding to each image patch in the boundary-guided dynamic kernel function space. The query vector is used to construct the structure-aware attention mapping, the key vector is used to measure the similarity between structural regions, and the value vector is used to encode the expressive information of the structural region. The query vector, key vector, and value vector are obtained by linearly mapping the feature vector output by the boundary-guided dynamic kernel function with the query mapping weight matrix, the key mapping weight matrix, and the value mapping weight matrix, respectively. The feature vector output by the boundary-guided dynamic kernel function represents the nonlinear feature response of the frequency domain enhanced medical image patch under the guidance of boundary structure saliency. The query mapping weight matrix, the key mapping weight matrix, and the value mapping weight matrix are learnable parameter matrices consistent with the channel dimension. The feature vector output by the boundary-guided dynamic kernel function is obtained by multiplying the channel embedding vector after flattening the image patch with the boundary-guided attention weight vector element by element, then multiplying by the structure sensitivity scaling factor and taking the exponential operation.

[0091] S45. Using the boundary-guided query matrix, key matrix, and value matrix in the dynamic kernel function space, the structure-aware medical image boundary-enhanced attention output features O are obtained through a linear self-attention mechanism. i :

[0092]

[0093] in, For the query matrix, key matrix, and value matrix serialized from the query vector, key vector, and value vector, O i Enhanced attention output features for structure-aware medical image boundaries, O i Enhanced and smoothed global contextual features that reflect the boundary details of medical images.

[0094] The boundary-guided dynamic kernel function described in S45 is a kernel mapping design based on a structure-aware mechanism. It multiplies the boundary attention weights generated by the structure region guiding mask with the features of each image block element-wise, then multiplies by a scaling factor, and performs a non-linear mapping through an exponential function. Essentially, the operation adaptively amplifies the expression weights of structure-sensitive regions (anatomical boundaries, lesion contours) in the feature space, thereby significantly improving the response of boundary regions in the attention mechanism, while automatically suppressing structure-independent regions, thus achieving adaptive and differentiated feature enhancement for medical structures.

[0095] Compared to conventional kernel functions in existing technologies, this method introduces structural masks (boundary or tissue guidance information) into the kernel space mapping process for the first time, establishing an adaptive association between medical structure and feature weights, rather than uniformly processing the entire region. The scaling factor and nonlinear exponential activation in the dynamic kernel function enable the model to automatically adjust the response amplitude according to the structural differences in actual segmentation tasks, avoiding the loss of structural details due to averaging. Furthermore, it is particularly well-suited to the needs of medical image boundary enhancement, achieving an organic unity between global features and boundary details, overcoming the technical bottleneck of traditional attention mechanisms that can only process global or local features but cannot differentiate and weight structures.

[0096] In this embodiment, S5 includes the following steps:

[0097] S51. Enhance attention output features of structure-aware medical image boundaries O i Restored to the spatial dimension of frequency domain enhanced medical images, intermediate feature maps are obtained.

[0098] S52. Intermediate Feature Map Perform spatially separable convolution operations along the channel dimension to form local structural response enhancement feature maps. Spatially separable convolution operations involve performing depthwise convolution operations in the spatial direction and pointwise convolution operations in the channel direction, and then adding the outputs of the depthwise convolution operations and the pointwise convolution operations together.

[0099] S53. Extract the phase perturbation map For each pixel in the array, map it to the corresponding frequency domain structure guide mask. After performing pointwise multiplication, it is mapped to a phase-guided attention heatmap. Phase-guided attention heatmap Used to measure the change in directional response of structurally sensitive regions after phase perturbation;

[0100] S54. Phase-guided attention heatmap Upsampling to enhance the feature map of local structural response Using the same spatial dimension and broadcasting to all channels, attention-guiding factors are obtained. Attention-guiding factor With local structural response enhancement feature map Perform element-wise multiplication to obtain the fused feature map.

[0101] In this embodiment, S6 includes the following steps:

[0102] S61. Concatenate the fused feature map and the skip connection feature map to construct the decoder input feature map. The decoder input feature map is obtained by concatenating the fused feature map and the skip connection feature map along the channel dimension after spatial alignment. The concatenated decoder input feature map is used to jointly carry frequency domain enhanced semantic information and shallow structure texture information, with a spatial size of H. k ×W k The channel dimension is D k ;

[0103] S62. Calculate the image gradients of the decoder input feature map in the horizontal and vertical directions respectively. Sum the squared gradient values ​​in the two directions and take the square root to obtain the edge gradient response map of the decoder input feature map. The edge gradient response map is used to characterize the edge intensity change of each pixel in the horizontal and vertical directions. The edge gradient response map is defined as the first-order gradient map.

[0104] S63. Extract the second-order edge change response map based on the edge gradient response map. The second-order edge change response map is used to characterize the changing trend of the significant boundary region in medical images. It is obtained by calculating the second derivatives of the first-order gradient map in the horizontal and vertical directions and summing them. The second-order edge change response map is defined as a zero-crossing map, which is used to emphasize the jump position of the structural boundary region.

[0105] S64. A fused edge heatmap is constructed by splicing the edge gradient response map and the second-order edge change response map in the channel dimension. The fused edge heatmap is used to comprehensively represent the edge intensity and edge jump response. The fused edge heatmap contains two channels, which represent the directional gradient response channel and the boundary zero-crossing response channel, respectively.

[0106] In this embodiment, S7 includes the following steps:

[0107] S71. By applying an activation function to the fused edge heatmap through a weighted summation along the channel dimension and then performing an affine mapping on each channel of the fused feature map, a boundary attention-guided gating weight map is obtained. The boundary attention-guided gating weight map is used to control the saliency modulation intensity of the edge response region on each channel dimension of the fused feature map.

[0108] S72. Apply boundary guidance gating operation to the fused feature map to obtain the first-stage boundary awareness enhanced feature map. The first-stage boundary awareness enhanced feature map is used to embed edge heatmap information into the main segmentation feature map to form a structure-sensitive feature representation. The first-stage boundary awareness enhanced feature map is obtained by multiplying the boundary attention guidance gating weight map and the fused feature map element-wise in each channel dimension.

[0109] S73. Use the fused feature map to guide the channel response adjustment of the fused edge heatmap, and generate a feature feedback modulation map. The feature feedback modulation map is used to reversely control the response intensity of each channel in the edge heatmap. The feature feedback modulation map is obtained by performing a weighted summation of the fused feature map in the channel dimension and then performing an affine mapping with the edge heatmap channels, and applying an activation function.

[0110] S74. Apply the feature feedback modulation map to the fused edge heatmap to obtain the edge structure modulation enhancement map. The edge structure modulation enhancement map is used to enhance the structural expressive power of the edge heatmap. The edge structure modulation enhancement map is obtained by multiplying the feature feedback modulation map and the fused edge heatmap element by element in each channel dimension.

[0111] S75. The first-stage boundary awareness enhancement feature map and the edge structure regulation enhancement map are concatenated in the channel dimension. The concatenation result is used as the input of the convolution module. The convolution module is used to extract high-order fusion features and compress the channel dimension to output a dual-domain interactive fusion feature map. The dual-domain interactive fusion feature map comprehensively expresses the edge information and the main segmentation features.

[0112] S76. Perform an upsampling operation on the dual-domain interactive fusion feature map to obtain the final boundary enhancement segmentation feature map. The final boundary enhancement segmentation feature map is used to output the segmentation result of the medical image, and the number of segmentation categories is consistent with the number of categories in the medical image segmentation task.

[0113] In this embodiment, S8 is extended: based on the boundary enhancement segmentation feature map, the region overlap loss, pixel classification loss, boundary consistency loss and spectrum preservation loss are calculated, and a cross-scale frequency domain-edge consistency loss function is constructed. The cross-scale frequency domain-edge consistency loss function is used to jointly optimize all parameters of the linear self-attention encoder, edge enhancement branch and decoder to complete the training of the medical image boundary enhancement segmentation model.

[0114] Includes the following steps:

[0115] S81. Enhanced Segmentation Feature Map Based on Final Boundary The ground truth mask Y for medical image segmentation tasks i Calculate the region overlap loss L dice The region overlap loss is used to measure the degree of overlap between the predicted region and the real region:

[0116]

[0117] Where C is the number of segmentation categories, and (x,y) are the image space coordinates;

[0118] The region overlap loss proposed in S81 is essentially used to measure the degree of spatial overlap between the model's segmentation output and the ground truth label. The principle is to multiply the predicted result and the ground truth label at each pixel and category channel to obtain the overlapping region area; simultaneously, the squares of the predicted and ground truth results are summed to obtain the total area. Finally, a weighted ratio reflects the accuracy of the model's segmentation. The region overlap loss is highly robust to the problem of extreme imbalance between positive and negative samples, which is beneficial for the accurate segmentation of small-volume lesions in medical images.

[0119] Compared to conventional pixel-level cross-entropy loss (which only compares the predicted probability with the label probability pixel by pixel), it better solves the problem of extreme foreground-background imbalance, improves the segmentation ability of small targets (small lesions, narrow-boundary structures), directly optimizes the overall overlap of spatial regions, and improves the consistency of segmentation contours, rather than focusing only on the accuracy of single points.

[0120] In this implementation, Dice loss is not used alone, but is a core component of the multi-loss joint optimization system, combined with frequency domain loss and boundary loss, to take into account the multi-scale consistency optimization objectives of region, boundary and frequency.

[0121] S82. Enhanced Segmentation Feature Map Based on Final Boundary With the truth mask image Y i Calculate cross-entropy loss L pixel by pixel ce The pixel classification loss is used to constrain the predicted class probability of each pixel to be consistent with the label;

[0122] S83. Enhance the final boundary segmentation feature map Input gradient operator to extract its predicted edge map The truth mask image Y i Similarly, the gradient operator is used to extract its true edge map. The boundary consistency loss is calculated by taking the absolute value of the difference between the predicted edge map and the true edge map at each pixel coordinate and then averaging the results spatially.

[0123] S84. Perform a two-dimensional Fourier transform on the final boundary enhancement segmentation feature map to obtain the frequency domain amplitude spectrum, and perform a Fourier transform on the ground truth mask map to obtain the true frequency domain amplitude spectrum. Calculate the spectrum preservation loss L by taking the absolute value of the difference between the predicted spectrum and the true spectrum at each frequency coordinate and performing spatial averaging. freq The spectrum preservation loss is used to measure the similarity between the predicted segmentation result in the frequency domain representation and the true structure in the frequency domain representation;

[0124] S85. Reduce the region overlap loss L dice Pixel classification loss L ce Boundary consistency loss L edge With spectrum preservation loss L freq A cross-scale frequency domain-edge consistency loss function L is constructed using fixed weights. total ;

[0125] S86. Construct a medical image boundary enhancement segmentation model, using the cross-scale frequency domain-edge consistency loss function L. total Backpropagation training was performed on the medical image boundary enhancement segmentation model, and all parameters in the linear self-attention encoder, separable convolution module, phase-guided attention head, edge enhancement branch and decoder were jointly optimized to complete the end-to-end optimization and training of the medical image frequency domain enhanced boundary sensitive segmentation model.

[0126] Example 1: Dr. Wang, an attending physician in the Department of Radiology at an affiliated hospital, is processing the data of a patient referred from the Department of Radiation Oncology. The patient, number ZSY2024120517, is a 62-year-old male patient who is suspected of having a recurrence of a tumor in his left frontal lobe. He needs to undergo MRI-assisted evaluation to develop a preoperative plan. Dr. Wang imports four sets of MRI sequences for the patient into the hospital's internal radiological image analysis platform, Radi-FusionV3.1: T1, T2, FLAIR, and T1c enhanced images. Each image is 256×256 pixels in size, the sequence length is 155 frames, and the total data volume exceeds 150MB.

[0127] The platform automatically uploads the patient's MRI sequence to the boundary-aware intelligent segmentation module (codename EB-SegModule). This module is deployed on the GPU node E-GPU-14 (NVIDIA A10080GB) of the hospital's imaging cloud. The system process receiving the image has the PID#4882047 number. The preprocessing workflow it calls includes image normalization, linear stretching enhancement, and bidirectional registration. After preprocessing is completed, the system automatically takes the 87th frame T1c image as the main analysis object and marks its structurally sensitive regions. The marked boundary mask area accounts for 22.4% of the entire image.

[0128] The image frame is sent to the frequency domain processing flow. The system first performs a two-dimensional fast Fourier transform, and identifies the low-frequency principal components concentrated in the frequency region from (0,0) to (6,6) in the frequency domain. Then, the structure-aware perturbation module is triggered to perform Gaussian weighted perturbation on the amplitude spectrum with a perturbation coefficient of 0.18. At the same time, random perturbation is performed on the phase spectrum with a perturbation point sampling rate of 7%. After the perturbation is completed, the inverse Fourier transform is performed to generate an enhanced frequency domain image from the processing result and return it to the spatial domain. This process is completed by process #FFT-Task1039 and takes a total of 2.4 seconds.

[0129] The frequency-enhanced image was divided into 64 32×32 image blocks and input into a linear self-attention encoder module named L-AttBlock. The system called the attention core parameters configured as follows: 64 channels, 4 attention heads, and dynamic kernel function scaling factor α = 1.75. The 19th block (position x = 2, y = 3) in the image block was detected as the region with the highest boundary saliency, and the corresponding boundary guidance weight was 0.963. The structural features of this block were maximized, and the output feature activation increased from 0.14 to 0.91.

[0130] After the image blocks are processed, they are stitched together and restored, and then sent to the fusion decoder module. The system detects two boundary abrupt change regions in the edge heatmap, located near image coordinates (123,80) and (187,89). The fusion mechanism enables a bidirectional gating interaction strategy, with corresponding boundary control weights of 0.78 and 0.84. After performing feedback modulation, the model finally generates a boundary-enhanced segmentation map. The segmentation contour has clear edges between the lateral ventricle and the lesion region, with an error range of ±1.7 pixels.

[0131] The platform automatically sent the segmented image to Dr. Wang's work terminal, file number "EBSEG-ZSY2024120517.png". The doctor used MedViewer version 4.3 to load and compare the overlap between the system's automatic annotation and the radiology department's initial manual segmentation. The system indicated that the result had a Dice coefficient of 0.905 and a boundary Hausdorff distance of 5.2 pixels, which is significantly better than the hospital's traditional U-Net segmentation module (Dice = 0.845, Hausdorff = 9.1).

[0132] Dr. Wang presented the automatic segmentation results, confirming that the lesion was located at the posterior border of the middle frontal gyrus, with a long diameter of 42.1 mm and a short diameter of 27.3 mm. The lesion had smooth borders and did not invade the frontal pole. Based on the segmentation results, the surgical plan was adjusted to a conservative resection approach, while minimizing damage to the resection margins of the functional cortex.

[0133] In a subsequent retrospective experiment, the system performed batch prediction on 20 frontal lobe tumor samples from the BraTS2021 test set. Frequency domain perturbation, attention modeling, and boundary heatmap modulation were performed on each sample. The results are as follows:

[0134] Table 1. Sample comparison data of the present invention

[0135]

[0136]

[0137] As can be seen from the actual process and retrospective experiments, the method of the present invention has significant advantages in structural boundary recognition and frequency domain enhancement modeling. Even when faced with medical images with blurred boundaries, low signal-to-noise ratio and complex textures, it can still output accurate and continuous lesion segmentation results, providing high-value support for precise clinical diagnosis and preoperative assessment.

[0138] This invention introduces a structure-aware frequency-domain perturbation mechanism in the medical image segmentation process. Based on the amplitude spectrum and phase spectrum after Fourier transform, joint perturbation and reconstruction are performed, which significantly enhances the image's response to structural regions in the frequency domain. First, the region of interest is explicitly labeled in the frequency domain by using a structure-guided mask. Then, learnable perturbations and random phase sampling are applied in the low-frequency range to construct a frequency-domain perturbation map that is sensitive to key structures. This effectively improves the model's structure perception capability in medical image scenarios with blurred anatomical boundaries and low texture contrast.

[0139] This invention constructs a linear self-attention encoder module that integrates a boundary-guided dynamic kernel function, which effectively enhances the attention response representation of boundary regions in images. By assigning structural saliency labels to each image block through boundary-guided weights, and combining the structure-aware Hadamard weighting mechanism, attention is guided to obtain a stronger response in boundary abrupt regions. At the same time, smooth response suppression is performed in non-structure-sensitive regions to avoid redundant interference, thus solving the problem of response drift and instability in boundary modeling of existing self-attention mechanisms.

[0140] This invention designs a dual-domain interactive decoding strategy that integrates phase perturbation guidance and edge heatmap interaction enhancement. It achieves synergistic enhancement of frequency domain and spatial domain features during the model decoding stage. By constructing edge heatmaps and phase-guided attention maps and introducing a bidirectional gating mechanism for cross-modulation in the decoder, it effectively solves the problem that structural details are easily obscured by high-level semantics during the decoding process, significantly improves the preservation and expressiveness of edge information, and enhances the model's ability to detect small lesions and complex boundaries.

[0141] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any equivalent substitutions or modifications made by those skilled in the art within the scope of the technology disclosed in the present invention, based on the technical solution and inventive concept of the present invention, should be covered within the scope of protection of the present invention.

Claims

1. A medical image segmentation method based on boundary constraints, characterized in that, Includes the following steps: S1. Acquire raw medical image data and perform a differentiable Fourier transform to obtain the amplitude spectrum and phase spectrum of the medical images; S2. Generate a structure region guidance mask based on the original medical image data, implement learnable perturbation on the low-frequency amplitude in the amplitude spectrum of the medical image, and implement random sampling adjustment on the low-frequency phase in the phase spectrum of the medical image to form a structure-aware frequency domain perturbation result. S3. Combine the structure-aware frequency domain perturbation results to recombine the amplitude spectrum and phase spectrum of the medical image, and perform an inverse Fourier transform on the combined frequency domain information to obtain the frequency domain enhanced medical image. S4. Divide the frequency domain enhanced medical image into fixed-size image blocks, expand the image blocks into a sequence input linear self-attention encoder, and calculate the structure-aware medical image boundary enhancement attention output features; S5. A separable convolutional module and a phase-guided attention head are superimposed within a linear self-attention encoder to perform global relational modeling and local texture modeling on frequency-domain enhanced medical image sequences; S6. The output of the linear self-attention encoder is fed into the decoder along with the multi-scale jump connection to construct the edge enhancement branch of the decoder and generate an edge heatmap; S7. A dual-domain interactive fusion strategy is adopted to perform bidirectional gating interaction between the edge heatmap and the output of the linear self-attention encoder to generate a dual-domain interactive fusion feature map. The dual-domain interactive fusion feature map is upsampled and convolved in the decoder to output a boundary enhancement segmentation feature map.

2. The medical image segmentation method based on boundary constraints according to claim 1, characterized in that, S1 includes the following steps: S11. Construct a raw medical image dataset, which is used to store multiple raw medical image I. i The original medical image has a size of H×W, where i represents the image index number, H represents the height of the original medical image, and W represents the width of the original medical image. S12. Original medical imaging images I i Perform a Fourier transform to obtain the complex image F in the frequency domain. i From the frequency domain complex image F i Extract the corresponding medical image amplitude spectrum A from each. i Phase spectrum of medical images P i ; S13. Combine the amplitude spectrum and phase spectrum of all original medical images to form a frequency domain medical image dataset.

3. The medical image segmentation method based on boundary constraints according to claim 2, characterized in that, S2 includes the following steps: S21. Based on original medical imaging images I i Generate structural region boot mask M i ; S22. Obtain the structural region guide mask M i Mapped to the frequency domain coordinate system and compared with the corresponding medical image amplitude spectrum A in the frequency domain medical image dataset. i Phase spectrum of medical images P i Corresponding alignment to form a frequency domain structure guiding mask S23. Guiding the mask in the frequency domain structure Medical image amplitude spectrum A within the specified structurally sensitive region i The low-frequency amplitude values ​​are weighted and perturbed to obtain the perturbed amplitude spectrum of the medical image. S24. Guiding mask in frequency domain structure Within the specified structurally sensitive region, the phase spectrum P of medical images i The low-frequency phase values ​​are randomly sampled and adjusted to obtain the adjusted medical image phase spectrum. S25. Combining the perturbated amplitude spectrum of medical images Phase spectrum of adjusted medical images The results of structure-sensing frequency domain perturbation 4. The medical image segmentation method based on boundary constraints according to claim 3, characterized in that, S3 includes the results of structure-aware frequency domain perturbation. Performing a two-dimensional inverse Fourier transform operation yields frequency-domain enhanced medical images.

5. The medical image segmentation method based on boundary constraints according to claim 1, characterized in that, S4 includes the following steps: S41. Frequency Domain Enhancement of Medical Images According to a fixed size P h ×P w Divided into non-overlapping image blocks Perform channel-dimensional embedding operation on each image patch and flatten it in row-major order into a sequence feature vector of length D; S42. Based on structural region guidance mask M i Generate the corresponding boundary-guided attention weight vector Where the boundary-guided attention weight vector The attention weight vector represents the saliency of the medical image edge structure within the corresponding image block, and the value of the attention weight vector is in the interval [0,1]. S43. Construct a boundary-guided dynamic kernel function φ bd (·), the boundary-guided dynamic kernel function combines the structural region guidance mask with the sequence feature vector in a high-dimensional kernel space, amplifying the differences in self-attention responses within structurally sensitive regions of medical images, and smoothing the self-attention response in structurally unrelated regions. The boundary-guided dynamic kernel function is expressed as: Where ⊙ represents the Hadamard element-wise product operation, and α is a learnable structural sensitivity scaling factor used to control the response difference between the boundary-sensitive region and the background region. The value represents the structural sensing feature of the frequency-domain enhanced medical image at the i-th scale with coordinate position (p,q). S44. Calculate the query vector, key vector and value vector corresponding to each image block in the boundary-guided dynamic kernel function space. The feature vector output by the boundary-guided dynamic kernel function represents the nonlinear feature response of the frequency domain enhanced medical image block under the guidance of boundary structure saliency. S45. Using boundary-guided query, key, and value matrices in a dynamic kernel space, structurally-aware medical image boundary-enhanced attention output features are obtained through a linear self-attention mechanism. i : in, The query matrix, key matrix, and value matrix are serialized from the query vector, key vector, and value vector.

6. The medical image segmentation method based on boundary constraints according to claim 5, characterized in that, S5 includes the following steps: S51. Enhance attention output features of structure-aware medical image boundaries O i Restored to the spatial dimension of frequency domain enhanced medical images, intermediate feature maps are obtained. S52. Intermediate Feature Map Perform spatially separable convolution operations along the channel dimension to form local structural response enhancement feature maps. S53. Extract the phase perturbation map For each pixel in the array, map it to the corresponding frequency domain structure guide mask. After performing pointwise multiplication, it is mapped to a phase-guided attention heatmap. S54. Phase-guided attention heatmap Upsampling to enhance the feature map of local structural response Using the same spatial dimension and broadcasting to all channels, attention-guiding factors are obtained. Attention-guiding factor With local structural response enhancement feature map Perform element-wise multiplication to obtain the fused feature map.

7. The medical image segmentation method based on boundary constraints according to claim 6, characterized in that, S6 includes the following steps: S61. Concatenate the fused feature map and the skip connection feature map to construct the decoder input feature map. The decoder input feature map is obtained by concatenating the fused feature map and the skip connection feature map according to the channel dimension after aligning them in the spatial dimension. S62. Calculate the image gradients of the decoder input feature map in the horizontal and vertical directions respectively, sum the squared gradient values ​​in the two directions and take the square root to obtain the edge gradient response map of the decoder input feature map; S63. Extract the second-order edge change response map based on the edge gradient response map. The second-order edge change response map is used to characterize the changing trend of the boundary significant region in medical images. It is obtained by calculating the second derivatives of the first-order gradient map in the horizontal and vertical directions and summing them. The second-order edge change response map is defined as a zero-crossing map. S64. Construct a fused edge heatmap by splicing the edge gradient response map and the second-order edge change response map in the channel dimension.

8. The medical image segmentation method based on boundary constraints according to claim 7, characterized in that, S7 includes the following steps: S71. By applying an activation function to the fused edge heatmap by performing a weighted summation on the channel dimension and then applying an affine mapping to each channel of the fused feature map, a boundary attention-guided gating weight map is obtained. S72. Apply boundary guidance gating operation to the fused feature map to obtain the first-stage boundary-aware enhanced feature map. The first-stage boundary-aware enhanced feature map is used to embed edge heatmap information into the main segmentation feature map to form a structure-sensitive feature representation. S73. Use the fusion feature map to guide the channel response adjustment of the fusion edge heatmap, and generate a feature feedback modulation map. The feature feedback modulation map is used to reversely control the response intensity of each channel in the edge heatmap. S74. The feature feedback modulation map is applied to the fused edge heatmap to obtain the edge structure modulation enhancement map, which is used to enhance the structural expressiveness of the edge heatmap. S75. The first-stage boundary-aware enhancement feature map and the edge structure modulation enhancement map are concatenated in the channel dimension. The concatenation result is used as the input of the convolution module, and the channel dimension is compressed to output a dual-domain interactive fusion feature map. S76. Perform an upsampling operation on the dual-domain interactive fusion feature map to obtain the final boundary enhancement segmentation feature map, which is used to output the segmentation result of the medical image.

Citation Information

Patent Citations

  • Colorectal cancer image segmentation method based on nuclear quasi matrix feature guidance

    CN119169031A

  • Complex model clinical image semantic segmentation method based on frequency phase guidance

    CN119399464A