CTV segmentation method for rectal cancer based on CViL-UNet

CN122089749APending Publication Date: 2026-05-26LISHUI PEOPLES HOSPITAL
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
LISHUI PEOPLES HOSPITAL
Filing Date
2026-02-04
Publication Date
2026-05-26

Smart Images

  • Figure CN122089749A_ABST
    Figure CN122089749A_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of rectal cancer CTV segmentation, in particular to a rectal cancer CTV segmentation method based on CViL-UNet, comprising the following steps: preprocessing rectal cancer CT image data, converting a 3D CT sequence into a multi-channel 2D input format, removing image noise and intensity non-uniformity, and standardizing the pixel value range to adapt to the CViL-UNet model input. The present application realizes accurate identification of the key areas of CTV primary tumor, subclinical spread area and micro-infiltration focus through local-global feature cooperation and high-frequency detail enhancement, solves the pain points of missing micro-infiltration and misjudging healthy tissue in traditional methods, can process conventional CT images without intestinal preparation, breaks the dependence of traditional methods on ideal image conditions, and the automatic and real-time segmentation process in clinical value eliminates the subjectivity and inefficiency caused by manual intervention, while meeting the dual requirements of millimeter-level precision and rapid deployment for radiotherapy planning.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of rectal cancer CTV segmentation technology, specifically a rectal cancer CTV segmentation method based on CViL-UNet. Background Technology

[0002] Colorectal cancer (CRC) is a leading cause of cancer-related death worldwide. Radiotherapy plays a crucial role in the multimodal treatment of locally advanced CRC, not only achieving tumor downstaging and local control but also improving surgical outcomes. Precise delineation of the clinical tumor volume (CTV) is essential to ensure adequate radiation dose to the tumor area while protecting surrounding healthy tissue. An ideal CTV should include the primary tumor and its potential microscopic extensions, while avoiding damage to adjacent healthy tissue. However, manual CTV segmentation remains time-consuming, labor-intensive, subjective, and subject to significant inter-observer variability, especially in anatomically complex areas such as the rectum. Despite advancements in medical imaging and computational methods, precise tumor volume segmentation in radiotherapy planning remains a significant challenge due to the complex anatomy of the rectum, high tumor morphological heterogeneity, and the fine boundary between malignant and normal tissue. While deep learning technologies have made significant progress in colorectal structure and automated tumor segmentation, existing methods are mostly limited to segmentation of the entire colorectal region or gross tumor volume (GTV), failing to adequately address the unique challenges of radiotherapy-specific CTV delineation. This disparity highlights the need to develop personalized solutions to meet the clinical needs of radiation oncology.

[0003] Early studies primarily employed region growing algorithms and supravoxel clustering techniques for colorectal tumor segmentation. For example, Day et al. proposed a tumor volume segmentation region growing method based on PET images, while Irving's team utilized supravoxel neighborhood contrast features in DCE-MRI. Wu et al. used adaptive thresholding and region growing methods for cell nucleus segmentation in colorectal pathology images, but manual intervention was required to correct errors. However, these methods generally suffer from the need for manual intervention and perform poorly when dealing with noise, intensity inhomogeneity, and weak contrast between tumors and background.

[0004] Traditional rectal segmentation methods typically focus on whole rectal segmentation to aid in diagnosis or surgical planning. However, radiotherapy target delineation requires a radically different objective. Whole rectal segmentation aims to identify the organ's overall topology and continuity, while tumor volume segmentation requires pixel-level precision to capture irregular tumor margins, intraluminal protrusions, and extramural invasions. The mismatch between these two tasks is evident: methods optimized for whole organ segmentation may ignore local tumor heterogeneity, while clearly localized approaches may underestimate peritumoral invasions crucial for defining the clinical target volume (CTV). Furthermore, the lack of bowel preparation in routine CT scans—a common clinical scenario—introduces additional complexity, such as collapsed intraluminal segments and low-contrast tumor-normal tissue interfaces, which exacerbate segmentation errors. These challenges underscore the urgent need to develop algorithms specifically tailored to radiotherapy requirements. Radiotherapy CTV segmentation encompasses not only the primary tumor but also subclinical disease spread areas as defined by clinical guidelines and microscopic areas of invasive risk. For rectal cancer, the CTV typically includes the mesorectum, presacral space, and affected lymph node areas. These areas exhibit heterogeneous imaging features and lack clear anatomical boundaries on CT scans. Traditional whole rectal segmentation methods (such as U-Net-based architectures or enhanced Transformer models) often struggle to capture these subtle features because they rely on local texture patterns rather than the spatial relationships between image slices.

[0005] In summary, a CViL-UNet-based method for CTV segmentation of rectal cancer needs to be proposed to address the aforementioned issues. Summary of the Invention

[0006] The purpose of this invention is to provide a CTV segmentation method for rectal cancer based on CViL-UNet, so as to solve the problems mentioned in the background art.

[0007] To achieve the above objectives, the present invention provides the following technical solution: This invention proposes a CTV segmentation method for rectal cancer based on CViL-UNet, comprising the following steps: S1. Preprocess the CT image data of rectal cancer, convert the 3DCT sequence into a multi-channel 2D input format, remove image noise and intensity inhomogeneity, and standardize the pixel value range to adapt to the CViL-UNet model input; S2. Construct a CViL dual-branch feature extraction module, extract local texture features of images through a convolutional neural network (CNN), and combine it with a visual LSTM unit to model long-range spatial dependencies, simultaneously capturing fine details of the tumor and global anatomical features; S3. Introduces a frequency response correction module to separate high- and low-frequency components of CT images, prioritizes the extraction of high-frequency features related to tumor margins and microinvasiveness, and corrects the energy bias of traditional feature extraction; S4. Lightweight dense gates are used to replace traditional skip connections, and multi-scale encoder and decoder features are parametrically fused to bridge the semantic gap between the encoding and decoding stages; S5. The fused features are upsampled and reconstructed using a decoder to output pixel-level CTV segmentation results, clearly defining the boundaries of the primary tumor, peritumoral infiltration area, and related risk areas; S6. Based on clinically labeled data, the segmentation results are verified for accuracy, segmentation indicators are calculated and feedback is provided to adjust model parameters, optimize the weights of bi-branch feature extraction and the frequency selection threshold, and achieve iterative improvement of segmentation performance.

[0008] Preferably, the implementation process of step S1 is as follows: select conventional abdominal CT scan data with a slice thickness of 1-3 mm and a pixel spacing of 0.5-1.0 mm, and directly include clinical images that do not require bowel preparation into the processing; use Gaussian filtering with a standard deviation of σ=0.8-1.2 to remove Gaussian noise, and use the N4 bias field correction algorithm to eliminate intensity non-uniformity; normalize the image pixel values ​​to the range of [-1,1], split the 3DCT sequence into a 2D image set according to the axial slice order, and form a multi-channel input block with 3-5 consecutive slices, and set the number of input channels to 4 for later use.

[0009] Preferably, in step S2, the convolutional neural network (CNN) branch adopts a 4-layer encoding structure, with each layer containing two 3×3 convolutional kernels, a BatchNorm layer, and a ReLU activation function. The number of convolutional kernels is 64, 128, 256, and 512 respectively. Downsampling is achieved through 2×2 max pooling. The ViL unit has a hidden layer dimension of 256, and the time step is consistent with the number of slices in the multi-channel input block. A gated recurrent unit is used to optimize the efficiency of long-range dependency modeling. Forward and backward spatial information is fused through bidirectional propagation. The features of the two branches are reduced to the same dimension by a 1×1 convolutional kernel and then spliced ​​and fused to form a composite feature map.

[0010] Preferably, the implementation process of step S3 is as follows: the output features of the CNN branch are converted to the frequency domain by fast Fourier transform, and high-frequency components are separated by a Butterworth high-pass filter with a cutoff frequency of 0.3-0.5 and an order of 4; the energy ratio of the high-frequency features is calculated, and when the ratio is less than 15%, the cutoff frequency of the filter is adaptively increased by 0.1-0.2; the selected high-frequency features are converted back to the spatial domain by inverse Fourier transform, and then fused with the global features output by the ViL unit at a weight of 0.6:0.4 to enhance the feature response of the tumor boundary and the microinvasive region.

[0011] Preferably, the implementation process of step S4 is as follows: the lightweight dense gate consists of two layers of 1×1 convolutions and a sigmoid activation function. The first layer of convolution maps the encoder features and decoder features to 128 dimensions. The second layer outputs feature weight coefficients, ranging from 0 to 1. The encoder features at each scale of 64, 128, 256, and 512 dimensions are upsampled and matched with the corresponding layer dimensions of the decoder. Then, they are multiplied element-wise with the decoder features according to the weight coefficients output by the dense gate to achieve adaptive feature fusion. The fused features are further refined by a 3×3 convolution kernel.

[0012] Preferably, the implementation process of step S5 is as follows: the decoder adopts a 4-layer decoding structure, and upsampling is achieved through transposed convolution 2×2. Each layer of the decoding structure includes two 3×3 convolution kernels, a BatchNorm layer and a ReLU activation function. The number of convolution kernels is 256, 128, 64 and 32 respectively. Finally, the features are mapped to two channels, namely the CTV region and the background region, through a 1×1 convolution kernel. The Softmax function is used to output the pixel classification probability. A probability threshold of 0.5 is set. Pixels greater than the threshold are judged as CTV regions. A binarized segmentation mask is output. The segmentation inference time is ≤30 seconds / example.

[0013] Preferably, step S6 uses Dice similarity coefficient, intersection-union ratio, and Hausdorff distance as evaluation metrics, requiring DSC ≥ 0.85, IoU ≥ 0.75, and HD95 ≤ 5mm; when DSC is lower than 0.82, the number of convolutional kernels in each CNN branch is increased by 20%, and the dimension of the hidden layer of the ViL unit is increased to 320; when the proportion of high-frequency feature energy is consistently lower than 12%, the FFT cutoff frequency is fixed at 0.6, and the model parameters are iterated and optimized once every 100 data points, using an Adam optimizer with a learning rate of 1e-4 and a decay coefficient of 0.9 to minimize the Dice loss function.

[0014] Preferably, in step S1, the scanning range of the CT image data covers the mesentery, presacral space, and pelvic lymph node region, with a pixel matrix size of 512×512, tube voltage of 120kV, and tube current of 200-300mA. The preprocessed data is divided into training set, validation set, and test set in a 7:2:1 ratio. The training set is augmented with horizontal / vertical random flipping, rotation angle ±10°, and elastic deformation coefficient of 0.2 to avoid model overfitting.

[0015] Preferably, in step S1, the hardware deployment environment of the CViL-UNet model is a CPU with a clock speed of ≥3.0GHz, a GPU with ≥8GB of video memory, and supports CUDA 11.0 and above. The model is built using the PyTorch framework, with 300 training iterations and a batch size of 8. When the validation set loss does not decrease for 10 consecutive iterations, a learning rate decay strategy with a decay coefficient of 0.5 is adopted to ensure that the model converges to a stable state.

[0016] Preferably, the clinical adaptation of the segmentation results in step S6 includes importing the output CTV segmentation mask into a radiotherapy planning system to support overlay display with CT images; after the clinician corrects the segmentation boundary, the corrected labeled data is added to the training set to retrain the model to improve its adaptability to individualized anatomical structures; for sub-centimeter tumors with a diameter <10mm, high-frequency feature enhancement is automatically activated, and the filter cutoff frequency is increased to 0.7 to ensure the segmentation accuracy of small lesions.

[0017] Compared with existing technologies, the beneficial effects of this invention are as follows: This invention achieves accurate identification of key areas of CTV primary tumor, subclinical spread area, and microinvasive lesions through local-global feature synergy and high-frequency detail enhancement, solving the pain points of traditional methods such as missed detection of microinvasives and misjudgment of healthy tissue. In terms of scene adaptability, it can process conventional CT images without bowel preparation, breaking the dependence of traditional methods on ideal image conditions. In terms of clinical value, the automated and real-time segmentation process eliminates the subjectivity and inefficiency caused by manual intervention, while meeting the dual requirements of radiotherapy planning for millimeter-level accuracy and rapid deployment. It fills the technical gap between conventional colorectal segmentation and precise delineation of radiotherapy CTV, providing reliable technical support for precise radiotherapy of locally advanced rectal cancer. Attached Figure Description

[0018] Figure 1 A flowchart of the rectal cancer CTV segmentation method based on CViL-UNet of the present invention is shown. Detailed Implementation

[0019] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0020] Example 1, please refer to Figure 1 This invention proposes a CTV segmentation method for rectal cancer based on CViL-UNet, comprising the following steps: S1. Preprocess the CT image data of rectal cancer, convert the 3DCT sequence into a multi-channel 2D input format, remove image noise and intensity inhomogeneity, and standardize the pixel value range to adapt to the CViL-UNet model input; It should also be noted that the hardware deployment environment of the CViL-UNet model in step S1 is a CPU with a main frequency of ≥3.0GHz, a GPU with ≥8GB of memory, and supports CUDA 11.0 and above. The model is built using the PyTorch framework, with 300 training iterations and a batch size of 8. When the validation set loss does not decrease for 10 consecutive iterations, a learning rate decay strategy with a decay coefficient of 0.5 is adopted to ensure that the model converges to a stable state.

[0021] The CT imaging data covers the mesorectum, presacral space, and pelvic lymph node region. The pixel matrix size is 512×512, the tube voltage is 120kV, and the tube current is 200-300mA. The preprocessed data is divided into training, validation, and test sets in a 7:2:1 ratio. The training set is augmented with horizontal / vertical random flipping, rotation angle ±10°, and elastic deformation coefficient of 0.2 to avoid model overfitting.

[0022] Specifically, the implementation process of step S1 is as follows: Select routine abdominal CT scan data with a slice thickness of 1-3 mm and a pixel spacing of 0.5-1.0 mm. Clinical images that do not require bowel preparation are directly included in the processing. Use a Gaussian filter with a standard deviation of σ=0.8-1.2 to remove Gaussian noise and use the N4 bias field correction algorithm to eliminate intensity non-uniformity. Normalize the image pixel values ​​to the range of [-1,1] and split the 3DCT sequence into a 2D image set according to the axial slice order. Each 3-5 consecutive slices form a multi-channel input block with 4 input channels for later use.

[0023] S2. Construct a CViL dual-branch feature extraction module, extract local texture features of images through a convolutional neural network (CNN), and combine it with a visual LSTM unit to model long-range spatial dependencies, simultaneously capturing fine details of the tumor and global anatomical features; It should also be noted that in step S2, the convolutional neural network (CNN) branch adopts a 4-layer encoding structure, with each layer containing two 3×3 convolutional kernels, a BatchNorm layer, and a ReLU activation function. The number of convolutional kernels is 64, 128, 256, and 512 respectively. Downsampling is achieved through 2×2 max pooling. The ViL unit has a hidden layer dimension of 256, and the time step is consistent with the number of slices in the multi-channel input block. Gated recurrent units are used to optimize the efficiency of long-range dependency modeling, and forward and backward spatial information is fused through bidirectional propagation. The features of the two branches are reduced to the same dimension by 1×1 convolutional kernels and then spliced ​​and fused to form a composite feature map.

[0024] S3. Introduces a frequency response correction module to separate high- and low-frequency components of CT images, prioritizes the extraction of high-frequency features related to tumor margins and microinvasiveness, and corrects the energy bias of traditional feature extraction; It should also be noted that the implementation process of step S3 is as follows: the output features of the CNN branch are converted to the frequency domain by fast Fourier transform, and the high-frequency components are separated by a Butterworth high-pass filter with a cutoff frequency of 0.3-0.5 and an order of 4; the energy ratio of the high-frequency features is calculated, and when the ratio is less than 15%, the cutoff frequency of the filter is adaptively increased by 0.1-0.2; the selected high-frequency features are converted back to the spatial domain by inverse Fourier transform, and then fused with the global features output by the ViL unit at a weight of 0.6:0.4 to enhance the feature response of the tumor boundary and the microinvasive region.

[0025] S4. Lightweight dense gates are used to replace traditional skip connections, and multi-scale encoder and decoder features are parametrically fused to bridge the semantic gap between the encoding and decoding stages; It should also be noted that the implementation process of step S4 is as follows: The lightweight dense gate consists of two layers of 1×1 convolutions and a sigmoid activation function. The first layer of convolution maps the encoder features and decoder features to 128 dimensions. The second layer outputs feature weight coefficients, ranging from 0 to 1. The encoder features at each scale of 64, 128, 256, and 512 dimensions are upsampled and matched with the corresponding layer dimensions of the decoder. Then, they are multiplied element-wise with the decoder features according to the weight coefficients output by the dense gate to achieve adaptive feature fusion. The fused features are further refined by a 3×3 convolution kernel.

[0026] S5. The fused features are upsampled and reconstructed using a decoder to output pixel-level CTV segmentation results, clearly defining the boundaries of the primary tumor, peritumoral infiltration area, and related risk areas; It should also be noted that the implementation process of step S5 is as follows: The decoder adopts a 4-layer decoding structure, and upsampling is achieved through transposed convolution 2×2. Each decoding structure contains two 3×3 convolution kernels, a BatchNorm layer and a ReLU activation function. The number of convolution kernels is 256, 128, 64 and 32 respectively. Finally, the features are mapped to two channels, namely the CTV region and the background region, through a 1×1 convolution kernel. The Softmax function is used to output the pixel classification probability. A probability threshold of 0.5 is set. Pixels with a probability greater than the threshold are judged as CTV regions. A binarized segmentation mask is output. The segmentation inference time is ≤30 seconds / example.

[0027] S6. Based on clinically labeled data, the segmentation results are verified for accuracy, segmentation indicators are calculated and feedback is provided to adjust model parameters, optimize the weights of bi-branch feature extraction and the frequency selection threshold, and achieve iterative improvement of segmentation performance.

[0028] It should also be noted that step S6 uses the Dice similarity coefficient, intersection-union ratio, and Hausdorff distance as evaluation metrics, requiring DSC ≥ 0.85, IoU ≥ 0.75, and HD95 ≤ 5mm. When DSC is lower than 0.82, the number of convolutional kernels in each CNN branch is increased by 20%, and the dimension of the hidden layer of the ViL unit is increased to 320. When the proportion of high-frequency feature energy is consistently lower than 12%, the FFT cutoff frequency is fixed at 0.6, and the model parameters are iterated and optimized once every 100 data points. The Adam optimizer with a learning rate of 1e-4 and a decay coefficient of 0.9 is used to minimize the Dice loss function.

[0029] Specifically, the clinical adaptation of the segmentation results in step S6 includes importing the output CTV segmentation mask into the radiotherapy planning system to support overlay display with CT images; after clinicians correct the segmentation boundaries, the corrected labeled data is added to the training set to retrain the model to improve its adaptability to individualized anatomical structures; for sub-centimeter tumors with a diameter <10mm, high-frequency feature enhancement is automatically activated, and the filter cutoff frequency is increased to 0.7 to ensure the segmentation accuracy of small lesions.

[0030] Example 2, please refer to Figure 1 In practical clinical applications, the CViL-UNet-based CTV segmentation method for rectal cancer proposed in this invention specifically includes the following steps: S1: Preprocessing of Rectal Cancer CT Image Data and Preparation of Model Environment: The core of this step is to build a hardware / software environment adapted to the CViL-UNet model, complete the acquisition, cleaning, and format conversion of CT images, ensure that the data meets the model's input requirements, and improve the model's generalization ability through data augmentation. S1.1. Setting up the model hardware deployment environment: Select a computing device with a CPU clock speed of ≥3.0GHz (Intel Core i7-12700K) and a GPU memory of ≥8GB (NVIDIA GeForce RTX 3090), ensuring support for CUDA 11.0 and above; Based on a Windows 10 / Linux Ubuntu 20.04 system, install Python versions 3.8-3.10, configure the PyTorch framework, and install the SimpleITK (for medical image reading), OpenCV (for image processing), and Scikit-image (for data augmentation) dependency libraries; Model parameter initialization: The training iterations are set to 300 epochs, the batch size is 8, and the Adam optimizer is used (initial learning rate 1e-4, decay coefficient 0.9). When the validation set loss does not decrease for 10 consecutive epochs, the learning rate decay strategy (decay coefficient 0.5) is triggered to ensure that the model converges to a stable state. S1.2. Clinical CT Image Data Acquisition: Equipment requirements: A spiral CT scanner with 16 or more slices is required. Scanning parameter settings: tube voltage 120kV, tube current 200-300mA (adjusted according to patient weight; 200mA for patients weighing <50kg, 300mA for patients weighing >70kg), pixel matrix size 512×512, slice thickness 1-3mm (1mm thin slice scanning is preferred for tumor areas), pixel pitch 0.5-1.0mm; Scan range: Covers the rectal mesentery, presacral space, and pelvic lymph node region (from the level of the 3rd sacral vertebra to the anal verge), directly including clinical images that do not require bowel preparation (adapting to actual clinical scenarios and avoiding additional burden on patients); Data format: Images are stored in DICOM format, ensuring they include basic patient information (anonymized to comply with HIPAA privacy guidelines) and scan parameter labels; S1.3. Dataset partitioning: Data screening: Cases with motion artifacts, metal artifacts, or incomplete scanning range on CT images were excluded, and images of 100 patients with locally advanced rectal cancer were finally selected (70 cases in the training set, 20 cases in the validation set, and 10 cases in the test set). Splitting method: The data was randomly split in a 7:2:1 ratio using the sklearn.model_selection.train_test_split function to ensure consistent distribution of tumor stage (T3-T4) and pathological type (mainly adenocarcinoma) across all datasets, thus avoiding data bias. S1.4. Training set data augmentation: Operation tools: Implemented based on the Scikit-image library; Enhancement strategy: Random flipping: 2D slices were flipped horizontally (50% probability) and vertically (30% probability) to simulate differences in patient positioning; Random rotation: Rotate the slice center by ±10° (step size 2°) to avoid excessive dependence of the model on the tumor location; Elastic deformation: The deformation coefficient was set to 0.2 and the mesh spacing to 10×10 to simulate the slight deformation of the anatomical structure caused by intestinal peristalsis; Verification: After enhancement, the tumor area was examined using the SimpleITK visualization tool to ensure that its integrity was not compromised; S1.5. Image Preprocessing and Format Conversion: Noise removal: Gaussian filtering (standard deviation σ = 0.8-1.2, adjusted according to image noise intensity, 1.2 is used when noise is significant) is implemented using the cv2.GaussianBlur function to remove Gaussian noise from CT images; Intensity non-uniformity correction: The N4 bias field correction algorithm (based on SimpleITK.N4BiasFieldCorrectionImageFilter) is used to eliminate image grayscale non-uniformity caused by device scanning deviation; Pixel value normalization: The image pixel values ​​(CT value range -1000~400HU) are normalized to the interval [-1,1] using the formula (pixel-mean) / std, where mean and std are the mean and standard deviation of all pixels in the training set, respectively. Multi-channel 2D input construction: The 3DCT sequence is split into 2D image sets according to the axial slice order. Every 4 consecutive slices form a multi-channel input block (the number of input channels is set to 4, covering the spatial information of the upper and lower adjacent areas of the tumor), and saved as .npy format for later use; S2: Construction of CViL Dual-Branch Feature Extraction Module: This step captures local texture details through CNN branches and models long-range spatial dependencies using ViL units, achieving collaborative extraction of "local-global" features and providing an accurate feature foundation for subsequent CTV segmentation; S2.1. Construction of CNN branch for local feature extraction: Encoding structure design: A 4-layer encoding structure is adopted, based on PyTorch's nn.Conv2d implementation. The parameters of each layer are as follows: Layer 1: 64 3×3 convolutional kernels, stride 1, padding=1, followed by a BatchNorm2d layer and ReLU activation function, output feature map size 256×256×64; Layer 2: 128 3×3 convolutional kernels, stride 1, padding=1, followed by a BatchNorm2d layer and ReLU activation function, output feature map size 128×128×128; Layer 3: 256 3×3 convolutional kernels, stride 1, padding=1, followed by a BatchNorm2d layer and ReLU activation function, output feature map size 64×64×256; Layer 4: 512 3×3 convolutional kernels, stride 1, padding=1, followed by a BatchNorm2d layer and ReLU activation function, output feature map size 32×32×512; Downsampling operation: Each encoding layer is followed by 2×2 max pooling (stride 2, padding=0), implemented using nn.MaxPool2d, which reduces the feature map size while preserving key local features (tumor edge texture); S2.2. Global Feature Extraction ViL Unit Configuration: Structural parameters: Gated recurrent unit (GRU) optimization is implemented based on PyTorch's nn.GRU, with hidden layer dimension set to 256 and time step size set to 4 (consistent with the number of slices in the multi-channel input block in S1.5); Long-range dependency modeling: A bidirectional GRU (bidirectional=True) is used. Forward propagation captures the spatial relationships of slices "from bottom to top", and backward propagation captures the relationships "from top to bottom". The output dimension is 512 (2×256). Feature adaptation: The global features output by the ViL unit are reduced to 256 dimensions using a 1×1 convolutional kernel (nn.Conv2d, 256 output channels) to match the feature dimensions of the CNN branches; S2.3. Dual-branch feature fusion: Dimensional alignment: The 32×32×512 feature map output from layer 4 of the CNN branch is reduced to 32×32×256 using a 1×1 convolutional kernel (256 output channels); Feature concatenation: The torch.cat function is used to concatenate CNN local features (32×32×256) and ViL global features (32×32×256) in the channel dimension (dim=1) to form a 32×32×512 composite feature map for subsequent frequency correction; S3: Frequency Response Correction Implementation: This step prioritizes the extraction of high-frequency features related to tumor margins and microinvasiveness through frequency domain analysis, correcting the energy bias of traditional feature extraction and improving feature discrimination ability; S3.1. Feature Frequency Domain Transformation: Operation tools: Fast Fourier Transform (FFT) implemented based on numpy.fft.fft2; Conversion process: The 32×32×512 composite feature map output by S2.3 is converted to the frequency domain channel by channel to obtain the frequency domain feature matrix (preserving amplitude and phase information); Centralization: The low-frequency components of the frequency domain matrix are shifted to the center using numpy.fft.fftshift to facilitate subsequent filtering operations; S3.2. High-frequency feature separation: Filter configuration: A Butterworth high-pass filter (4th order, cutoff frequency 0.3-0.5) is used, and the filter coefficients are designed using scipy.signal.butter. Filtering operation: Input the centered frequency domain feature matrix into the filter to filter out low-frequency components (uniform gray-level signals of background tissue) and retain high-frequency components (gray-level abrupt changes at the tumor edge and subtle textures in microinvasive areas); S3.3. Evaluation of the proportion of high-frequency characteristic energy: Energy calculation: The energy value of the high-frequency feature is calculated using the formula Energy=sum(abs(Freq_feature)^2), and the energy percentage is obtained by comparing it with the total energy of the original frequency domain features. Adaptive adjustment: If the energy percentage is <15% (indicating insufficient high-frequency characteristics, possibly missing micro-wetting), then increase the cutoff frequency of the Butterworth filter by 0.1-0.2 (adjust from 0.3 to 0.4), and re-execute S3.2 until the energy percentage is ≥15%; S3.4. Spatial Transformation and Feature Fusion: Inverse Fourier Transform: The filtered high-frequency domain features are transformed back into the spatial domain using numpy.fft.ifft2 to obtain a high-frequency spatial domain feature map (32×32×512). Weighted fusion: High-frequency spatial features are fused with the composite feature map of S2.3 using a weighted ratio of 0.6:0.4 (high-frequency features weighted 0.6 to enhance tumor details; composite features weighted 0.4 to preserve global structure). The element-wise multiplication and summation are performed using torch.mul to output the fused feature map (32×32×512). S4: Implementation of Lightweight Dense Door Feature Fusion: This step uses dense gates instead of traditional skip connections to achieve adaptive fusion of features from the multi-scale encoder and decoder, bridging the semantic gap; S4.1. Lightweight Dense Door Construction: Structure design: Consists of two 1×1 convolutional layers and a sigmoid activation function, implemented using PyTorch. Layer 1: 128 1×1 convolutional kernels, stride 1, padding=0, mapping both encoder and decoder features to 128 dimensions; Layer 2: One 1×1 convolutional kernel with stride 1 and padding=0, followed by a Sigmoid activation function, outputting feature weight coefficients in the range of 0-1 (reflecting feature importance); Lightweight optimization: By reducing the number of convolutional kernels (to only 128), the computational cost is reduced while ensuring real-time performance; S4.2. Encoder multi-scale feature upsampling: Feature selection: Select the four layers of encoded features (64-dimensional, 128-dimensional, 256-dimensional, and 512-dimensional) from the CNN branch in S2.1; Upsampling operation: Transposed convolution (nn.ConvTranspose2d, 2×2, stride 2) is used to upsample the features at each scale to the same size as the corresponding layer of the decoder (64-dimensional features are upsampled to 256×256, matching the size of the first layer of the decoder); S4.3. Adaptive Feature Fusion: Weight calculation: The upsampled encoder features and the corresponding decoder features are input into a dense gate to obtain weight coefficients (when the features of the first layer of the decoder and the first layer of the encoder are fused, the weight coefficient is 0.7, indicating that the encoder features are more important); Feature weighting: The encoder features and decoder features are multiplied by weight coefficients using torch.mul, and then summed to obtain the fused features; S4.4. Feature Refinement: For each layer of fused features, refinement is performed using a 3×3 convolutional kernel (nn.Conv2d, with output channels consistent with the decoder level) to eliminate noise in the fused features and output a smooth multi-scale fused feature map. S5: Decoder Feature Reconstruction and CTV Segmentation Output: This step uses a decoder to perform feature upsampling and reconstruction, outputting pixel-level CTV segmentation results and clearly defining the boundaries of tumors and risk regions. S5.1. Decoder Construction: Decoding structure design: A 4-layer decoding structure is adopted, symmetrical to the encoder, and implemented based on PyTorch. Layer 1: 256 3×3 convolutional kernels, stride 1, padding=1, followed by a BatchNorm2d layer and ReLU activation function. The input is the 32×32×512 fused features output from S4.4, and the output is 64×64×256. Layer 2: 128 3×3 convolutional kernels, stride 1, padding=1, followed by a BatchNorm2d layer and ReLU activation function, outputting 128×128×128; Layer 3: 64 3×3 convolutional kernels, stride 1, padding=1, followed by a BatchNorm2d layer and ReLU activation function, outputting 256×256×64; Layer 4: 32 3×3 convolutional kernels, stride 1, padding=1, followed by a BatchNorm2d layer and ReLU activation function, output 512×512×32; Upsampling operation: Each decoding layer is preceded by a 2×2 transposed convolution (nn.ConvTranspose2d, stride 2, padding=0) to enlarge the feature map size; S5.2. Feature Mapping and Probability Output: Channel mapping: The 512×512×32 feature map output from the 4th layer of the decoder is mapped to two channels using a 1×1 convolutional kernel (nn.Conv2d, output channel 2), corresponding to the "CTV region" and the "background region" respectively; Probability calculation: The nn.Softmax(dim=1) function is used to convert the 2-channel features into pixel-level classification probabilities (range 0-1). The higher the probability value, the greater the likelihood that the pixel belongs to the CTV region. S5.3. Binarization Segmentation Mask Generation: Threshold setting: Set the probability threshold to 0.5 (determined through validation set optimization, balancing sensitivity and specificity); Mask generation: Traverse all pixels, mark pixels with a probability > 0.5 as 1 (CTV region), and pixels with a probability ≤ 0.5 as 0 (background region), generating a 512×512 binarized segmentation mask; Boundary optimization: The small holes in the mask are filled by morphological closing operation (cv2.morphologyEx, kernel=3×3 rectangular kernel) to ensure the integrity of the CTV region; S5.4. Time control for segmented reasoning: Hardware acceleration: Enable GPU parallel computing (cuda() function) to load the model and data into GPU memory; Inference optimization: Use torch.no_grad() to disable gradient calculation and reduce redundant operations; Time validation: The segmentation inference time for a single CT image (512×512×30 slices) is ≤30 seconds, meeting the real-time requirements for clinical radiotherapy planning; S6: Segmentation accuracy verification and clinical adaptation: This step verifies segmentation accuracy using quantitative indicators, adjusts model parameters based on clinical needs, and integrates segmentation results with the radiotherapy process to ensure clinical applicability. S6.1. Quantitative evaluation of segmentation accuracy: Evaluation indicators: Three commonly used clinical indicators were used, calculated based on the MedPy.metric library: Dice similarity coefficient (DSC): measures the degree of overlap between the segmentation results and the manual annotations by clinicians, requiring a DSC ≥ 0.85; Intersection over Union (IoU): Measures the percentage of intersection between the segmented region and the real region; an IoU ≥ 0.75 is required. 95% Hausdorff distance (HD95): Measures the maximum distance (in millimeters) between the segment boundary and the true boundary, requiring HD95 ≤ 5mm; Data source: The segmentation results of 10 images in the test set were evaluated using CTV manually drawn by 3 radiation oncologists with the title of associate chief physician or above as the "gold standard". S6.2. Adaptive adjustment of model parameters: Adjusting for low DSC: If the test set DSC < 0.82 (indicating insufficient segmentation overlap), increase the number of convolutional kernels in each layer of the CNN branch by 20% (from 64 to 77 in layer 1), and increase the hidden layer dimension of the ViL unit from 256 to 320, then retrain the model; High-frequency feature deficiency adjustment: If the energy percentage of high-frequency features is consistently <12% (indicating missed detection in micro-infiltration regions), the cutoff frequency of FFT in S3.2 will be fixed at 0.6 to enhance the high-frequency feature extraction capability; Iterative optimization: After processing every 100 clinical data cases, the mean / standard deviation of the training set is recalculated, the pixel normalization parameters are calibrated, and the learning rate of the Adam optimizer is fine-tuned (reduced to 0.8 times the current rate) to ensure that the model adapts to the new clinical data distribution; S6.3. Integration of Segmentation Results with Radiotherapy Planning System (TPS): Format conversion: Convert the binarized segmentation mask (.npy format) to a DICOM-RT structure file (compliant with the DICOM 3.0 standard) using SimpleITK; System Import: Open the Clinical TPS system (Varian Eclipse), load the DICOM-RT file using the "Import Structure" function, and overlay the segmentation mask with the original CT image; Compatibility verification: Ensure that the segmentation mask can be used for dose calculation (volume dose, organ dose statistics) in TPS, with no formatting errors; S6.4. Clinician Corrections and Data Updates: Manual adjustment: Radiation oncologists manually adjust the segmentation mask boundaries in TPS (expanding the CTV range of the presacral space) based on the patient's specific anatomical structure (tumor infiltration range, location of adjacent organs); Data import: The doctor-corrected segmentation mask is paired with the original CT images and added to the training set as "newly labeled data"; Model retraining: After accumulating 20 new labeled data examples, the CViL-UNet model is retrained (100 iterations, initial learning rate 5e-5) to improve the model's adaptability to individualized anatomical structures; S6.5. Sub-centimeter level tumor segmentation optimization: Activation criteria: Determined by the diameter of the circumscribed circle of the tumor region. If the diameter is <10mm (subcentimeter-sized tumor, easily missed), then high-frequency feature enhancement is automatically activated. Parameter adjustment: Increase the cutoff frequency of the Butterworth high-pass filter in S3.2 to 0.7 to enhance feature extraction of small tumor edges; Accuracy verification: The segmentation results of images from 5 patients with sub-centimeter rectal cancer were required to have DSC≥0.80 and HD95≤3mm to ensure the accuracy of segmentation of small lesions.

[0031] Through the above steps, this invention achieves accurate identification of key areas of CTV primary tumor, subclinical spread area, and microinvasive lesions by local-global feature synergy and high-frequency detail enhancement. It solves the pain points of traditional methods that miss microinvasives and misjudge healthy tissue. In terms of scenario adaptability, it can process conventional CT images without bowel preparation, breaking the dependence of traditional methods on ideal image conditions. In terms of clinical value, the automated and real-time segmentation process eliminates the subjectivity and inefficiency caused by manual intervention, while meeting the dual requirements of radiotherapy planning for millimeter-level accuracy and rapid deployment. It fills the technical gap between conventional colorectal segmentation and accurate delineation of radiotherapy CTV, and provides reliable technical support for the precision radiotherapy of locally advanced rectal cancer.

[0032] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.

Claims

1. A CViL-UNet-based method for CTV segmentation of rectal cancer, characterized in that... This includes the following steps: S1. Preprocess the CT image data of rectal cancer, convert the 3DCT sequence into a multi-channel 2D input format, remove image noise and intensity inhomogeneity, and standardize the pixel value range to adapt to the CViL-UNet model input; S2. Construct a CViL dual-branch feature extraction module, extract local texture features of images through a convolutional neural network (CNN), and combine it with a visual LSTM unit to model long-range spatial dependencies, simultaneously capturing fine details of the tumor and global anatomical features; S3. Introduces a frequency response correction module to separate high- and low-frequency components of CT images, prioritizes the extraction of high-frequency features related to tumor margins and microinvasiveness, and corrects the energy bias of traditional feature extraction; S4. Lightweight dense gates are used to replace traditional skip connections, and multi-scale encoder and decoder features are parametrically fused to bridge the semantic gap between the encoding and decoding stages; S5. The fused features are upsampled and reconstructed using a decoder to output pixel-level CTV segmentation results, clearly defining the boundaries of the primary tumor, peritumoral infiltration area, and related risk areas; S6. Based on clinically labeled data, the segmentation results are verified for accuracy, segmentation indicators are calculated and feedback is used to adjust model parameters, optimize the weights of bi-branch feature extraction and the frequency selection threshold, and achieve iterative improvement of segmentation performance.

2. The method for CTV segmentation of rectal cancer based on CViL-UNet according to claim 1, characterized in that... The implementation process of step S1 is as follows: Select conventional abdominal CT scan data with a slice thickness of 1-3 mm and a pixel spacing of 0.5-1.0 mm; use Gaussian filtering with a standard deviation of σ=0.8-1.2 to remove Gaussian noise, and use the N4 bias field correction algorithm to eliminate intensity non-uniformity; normalize the image pixel values ​​to the range of [-1,1], split the 3DCT sequence into a 2D image set according to the axial slice order, and form a multi-channel input block with 3-5 consecutive slices. The number of input channels is set to 4 for later use.

3. The method for CTV segmentation of rectal cancer based on CViL-UNet according to claim 2, characterized in that... In step S2, the convolutional neural network (CNN) branch adopts a 4-layer encoding structure. Each layer contains two 3×3 convolutional kernels, a BatchNorm layer, and a ReLU activation function. The number of convolutional kernels is 64, 128, 256, and 512 respectively. Downsampling is achieved through 2×2 max pooling. The visual LSTM unit has a hidden layer dimension of 256, and the time step is consistent with the number of slices in the multi-channel input block. A gated recurrent unit is used to optimize the efficiency of long-range dependency modeling. Forward and backward spatial information is fused through bidirectional propagation. The dual-branch features are reduced to the same dimension by a 1×1 convolutional kernel and then spliced ​​and fused to form a composite feature map.

4. The method for CTV segmentation of rectal cancer based on CViL-UNet according to claim 3, characterized in that... The implementation process of step S3 is as follows: the output features of the CNN branch are converted to the frequency domain by fast Fourier transform, and the high-frequency components are separated by a Butterworth high-pass filter with a cutoff frequency of 0.3-0.5 and an order of 4; the energy ratio of the high-frequency features is calculated, and when the ratio is less than 15%, the cutoff frequency of the filter is adaptively increased by 0.1-0.2; the selected high-frequency features are converted back to the spatial domain by inverse Fourier transform, and then fused with the global features output by the ViL unit at a weight of 0.6:0.

4.

5. A method for CTV segmentation of rectal cancer based on CViL-UNet according to claim 4, characterized in that... The implementation process of step S4 is as follows: The lightweight dense gate consists of two layers of 1×1 convolution and a sigmoid activation function. The first layer of convolution maps the encoder features and decoder features to 128 dimensions. The second layer outputs feature weight coefficients, ranging from 0 to 1. The encoder features at each scale of 64, 128, 256, and 512 dimensions are upsampled and matched with the corresponding layer dimensions of the decoder. Then, they are multiplied element-wise with the decoder features according to the weight coefficients output by the dense gate to achieve adaptive feature fusion. The fused features are further refined by a 3×3 convolution kernel.

6. A method for CTV segmentation of rectal cancer based on CViL-UNet according to claim 5, characterized in that... The implementation process of step S5 is as follows: The decoder adopts a 4-layer decoding structure, and upsampling is achieved through transposed convolution 2×2. Each layer of the decoding structure contains two 3×3 convolution kernels, a BatchNorm layer and a ReLU activation function. The number of convolution kernels is 256, 128, 64 and 32 respectively. Finally, the features are mapped to two channels, namely the CTV region and the background region, through a 1×1 convolution kernel. The Softmax function is used to output the pixel classification probability. A probability threshold of 0.5 is set. Pixels greater than the threshold are judged as CTV regions. A binarized segmentation mask is output. The segmentation inference time is ≤30 seconds / example.

7. A method for CTV segmentation of rectal cancer based on CViL-UNet according to claim 6, characterized in that... Step S6 uses Dice similarity coefficient, intersection-union ratio, and Hausdorff distance as evaluation metrics, requiring DSC ≥ 0.85, IoU ≥ 0.75, and HD95 ≤ 5mm. When DSC is lower than 0.82, the number of convolutional kernels in each CNN branch is increased by 20%, and the dimension of the hidden layer of the ViL unit is increased to 320. When the proportion of high-frequency feature energy is consistently lower than 12%, the FFT cutoff frequency is fixed at 0.6, and the model parameters are iterated and optimized once every 100 data points. The Adam optimizer with a learning rate of 1e-4 and a decay coefficient of 0.9 is used to minimize the Dice loss function.

8. A method for CTV segmentation of rectal cancer based on CViL-UNet according to claim 7, characterized in that... In step S1, the scanning range of the CT image data covers the mesentery, presacral space and pelvic lymph node region, with a pixel matrix size of 512×512, tube voltage of 120kV and tube current of 200-300mA. The preprocessed data is divided into training set, validation set and test set in a ratio of 7:2:

1. The training set is augmented by horizontal / vertical random flipping, rotation angle of ±10° and elastic deformation coefficient of 0.

2.

9. A method for CTV segmentation of rectal cancer based on CViL-UNet according to claim 8, characterized in that... In step S1, the hardware deployment environment of the CViL-UNet model is a CPU with a clock speed of ≥3.0GHz, a GPU with a memory of ≥8GB, and supports CUDA 11.0 and above. The model is built using the PyTorch framework, with 300 training iterations and a batch size of 8. When the validation set loss does not decrease for 10 consecutive iterations, a learning rate decay strategy with a decay coefficient of 0.5 is adopted.

10. A method for CTV segmentation of rectal cancer based on CViL-UNet according to claim 9, characterized in that... The clinical adaptation of the segmentation results in step S6 includes importing the output CTV segmentation mask into the radiotherapy planning system and supporting overlay display with CT images; after the clinician corrects the segmentation boundary, the corrected labeled data is added to the training set to retrain the model to improve its adaptability to individual anatomical structures; for sub-centimeter tumors with a diameter <10mm, high-frequency feature enhancement is automatically activated and the filter cutoff frequency is increased to 0.7.