A method for image segmentation of hepatobiliary duct and bile duct stones
By fusing multi-scale contextual information and bile duct-stone spatial association through a dual-path collaborative segmentation network, the semantic fragmentation problem in the segmentation of hepatobiliary duct and bile duct stone images is solved, achieving high-precision segmentation results and strong generalization ability, and generating quantitative reports that can be used in clinical practice.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- QINGDAO SCI & TECH UNIV YOUZHI INFORMATION TECH CO LTD
- Filing Date
- 2026-03-06
- Publication Date
- 2026-05-26
AI Technical Summary
Existing technologies suffer from semantic fragmentation in the segmentation of images of hepatobiliary ducts and bile duct stones. Traditional methods rely on manually set parameters and have poor generalization ability. Deep learning models are prone to losing high-level semantics and low-level details when processing fine-grained structures, and lack joint modeling of the spatial relationship between bile ducts and stones, resulting in insufficient segmentation accuracy and reliability.
A dual-path collaborative segmentation network is adopted, including a tubular structure path and a lesion perception path. Multi-scale contextual information is fused through a cross-path feature interaction module to explicitly model the spatial association between bile ducts and stones. Combined with a progressive course learning strategy, the generalization ability of the segmentation model is optimized.
It significantly improves segmentation accuracy in complex pathological conditions, reduces topological breaks and branch omissions, enhances the ability to generalize the identification of various types of stones, and generates structured reports that can be used clinically.
Smart Images

Figure CN122089760A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of medical image processing technology, specifically relating to a method for image segmentation of hepatobiliary ducts and bile duct stones. Background Technology
[0002] Medical image analysis plays a crucial role in the diagnosis and treatment of hepatobiliary diseases, especially in the detection and preoperative planning of hepatobiliary duct and bile duct stones. Accurate image segmentation directly determines the accuracy of subsequent clinical decisions and the effectiveness of surgical interventions. With the widespread application of multimodal medical imaging technologies such as computed tomography (CT), magnetic resonance imaging (MRI), and ultrasound, acquiring high-resolution, high-contrast images of the hepatobiliary region has become routine. However, accurately extracting the hepatobiliary duct structure and its internal stone regions from complex, low-contrast, blurred-boundary medical images that are easily interfered with by adjacent tissues remains a long-standing core challenge in the field of medical image processing.
[0003] In recent years, deep learning-based semantic segmentation methods have made significant progress in medical image analysis. Convolutional neural networks and their variants have been widely used for the automatic segmentation of organs and lesions. However, their application in the special anatomical structure of the hepatobiliary duct still faces many bottlenecks. On the one hand, the diameter of bile ducts is generally small, especially at the terminal branches, often falling below the spatial resolution limit of imaging equipment, resulting in sparse effective supervision signals. On the other hand, the density range of bile duct stones is extremely wide, manifesting as high-density calcification, isodense mixed type, and even low-density cholesterol type, exhibiting drastically different imaging characteristics under different imaging modalities. This makes it difficult for a single modality or general segmentation architecture to meet the recognition needs of various types of stones.
[0004] Existing technologies for image segmentation of hepatobiliary ducts and bile duct stones have several shortcomings: First, traditional thresholding, region growing, or level set methods heavily rely on manually set parameters, are sensitive to image quality, have poor generalization ability, and cannot adapt to data distribution shifts caused by different devices, scanning protocols, and patient groups. Second, while mainstream deep learning segmentation models such as U-Net and its derivatives perform well in overall organ segmentation, their encoder-decoder architecture is prone to losing the precise correspondence between high-level semantics and low-level details when processing fine-grained tubular structures, leading to topological fragmentation of bile ducts. Furthermore, existing methods generally treat bile ducts and stones as independent targets, ignoring their strong anatomical coupling and pathological dependence, and failing to construct a joint modeling mechanism to utilize the indicative role of stone location on bile duct deformation or the constraining role of bile duct orientation on stone localization. Finally, publicly available high-quality annotated datasets of hepatobiliary ducts and stones are extremely scarce. The annotation process requires experienced radiologists to spend a significant amount of time and involves complex three-dimensional continuous slice correction, leading to model training prone to overfitting or bias accumulation, making stable deployment in real clinical scenarios difficult. These shortcomings collectively restrict the accuracy and reliability of intelligent auxiliary diagnostic systems for hepatobiliary diseases. There is an urgent need for an image segmentation method that can deeply integrate multi-scale contextual information, explicitly model the spatial relationship between bile ducts and stones, and possess strong generalization capabilities to overcome current technical bottlenecks and provide solid technical support for precision medicine. Summary of the Invention
[0005] The purpose of this invention is to provide an image segmentation method for hepatobiliary ducts and bile duct stones, so as to solve the problem of semantic fragmentation caused by the independent processing of bile duct and stone segmentation tasks in the prior art.
[0006] To solve the above-mentioned technical problems, the present invention provides the following technical solution:
[0007] A method for image segmentation of hepatobiliary ducts and bile duct stones includes the following steps:
[0008] Step S1: Obtain raw medical image data containing the liver and gallbladder regions, and preprocess the raw medical image data to generate standardized three-dimensional image volume data;
[0009] Step S2: Construct and train a dual-path collaborative segmentation network. The dual-path collaborative segmentation network includes a tubular structure path for extracting bile duct structural features and a lesion perception path for extracting stone region features. The two paths fuse information through a cross-path feature interaction module.
[0010] Step S3: Input the standardized 3D image volume data into the trained dual-path collaborative segmentation network, extract multi-scale contextual features through the tubular structure path and generate an initial bile duct segmentation probability map, and at the same time extract multi-modal enhancement features through the lesion perception path and generate an initial stone segmentation probability map.
[0011] Step S4: Using the cross-path feature interaction module, the initial bile duct segmentation probability map and the initial stone segmentation probability map are spatially correlated to generate a collaborative feature map containing bile duct-stone coupling constraint information.
[0012] Step S5: Based on the collaborative feature map, the final refined bile duct segmentation result and stone segmentation result are reconstructed through the decoder network, and a three-dimensional segmentation mask is output.
[0013] Preferably, the preprocessing of the original medical image data in step S1 includes the following operations: isotropic resampling of the input CT, MRI, or ultrasound images to unify the voxel size to a preset resolution; using an intensity normalization algorithm based on histogram matching to map the image grayscale values under different scanning devices and protocols to a standardized intensity range; applying a three-dimensional nonlocal mean filtering algorithm to denoise the images while preserving the edge information of the hepatobiliary ducts and stones; and finally, aligning the images to a standard anatomical space coordinate system through a three-dimensional affine transformation to generate standardized three-dimensional image volume data.
[0014] Furthermore, the dual-path collaborative segmentation network constructed in step S2 employs a three-dimensional densely connected encoder for its tubular structure path. This encoder consists of multiple densely connected blocks stacked together, each containing multiple convolutional layers, and the output of each layer is concatenated with the features of all subsequent layers. The output of the densely connected encoder is connected to a multi-scale hollow spatial pyramid pooling module, which is used to extract contextual information under different receptive fields in parallel to capture the bile duct branch topology from coarse to fine.
[0015] In addition, the lesion perception path employs a three-dimensional residual encoder with an attention-gated mechanism. The attention-gated mechanism is integrated into the skip connections of the encoder to adaptively suppress background tissue features that are irrelevant to the stone region and enhance local lesion features that are related to stone density and texture. The deep features of the residual encoder are input into a feature pyramid network to fuse semantic information at different levels and generate multimodal enhancement features that are discriminative for both low-contrast cholesterol stones and high-density calcified stones.
[0016] Preferably, the cross-path feature interaction module in step S2 specifically performs the following operations: First, it receives the initial bile duct segmentation probability map from the tubular structure path. Initial stone segmentation probability map from lesion perception pathway Then, calculate a spatial correlation weight matrix. Each element of the matrix The probability is determined by the joint likelihood of the bile duct probability value and the stone probability value at the corresponding location, and the calculation formula is as follows: ,in For the Sigmoid function, and The parameters are learnable. Finally, the deep feature maps of the two paths are weighted and fused using the spatial correlation weight matrix to generate a collaborative feature map, which encodes the spatial prior knowledge that stones may cause local dilation or obstruction of the bile duct.
[0017] Furthermore, the decoder network in step S5 comprises two parallel branches: a bile duct reconstruction branch and a stone reconstruction branch; each branch consists of multiple upsampled convolutional layers and skip connections, which respectively receive shallow high-resolution features from the corresponding encoder path and collaborative feature maps from the cross-path feature interaction module; the bile duct reconstruction branch applies a constraint based on topological continuity loss to the final output layer, which encourages the segmented bile duct structure to maintain connectivity and penalizes breaks and isolated points; the stone reconstruction branch applies a constraint based on morphological prior to the final output layer, which encourages the stone segmentation region to have a compact morphology and suppresses excessively scattered noise points.
[0018] Furthermore, the training process of the dual-path collaborative segmentation network adopts a progressive course learning strategy. Specifically, in the first training stage, a large number of public abdominal organ segmentation datasets with coarse bile duct annotations are used to pre-train the tubular structure paths, enabling them to learn common tubular anatomical features. In the second training stage, a small-scale but precisely annotated private dataset of hepatobiliary ducts and stones is used, with the frozen tubular structure paths as feature extractors, focusing on training the lesion perception path and cross-path feature interaction module. In the third training stage, the entire network is unfrozen, and end-to-end fine-tuning is performed using a joint loss function, which is composed of a weighted sum of the Dice loss for bile duct segmentation, the Focal loss for stone segmentation, the topological continuity loss, and the morphological prior loss.
[0019] Preferably, after outputting the three-dimensional segmentation mask in step S5, the method further includes a post-processing step S6: applying a three-dimensional skeletonization algorithm to the refined bile duct segmentation results to extract the centerline of the bile duct structure, and calculating quantitative parameters such as bile duct diameter, branch angle, and stone obstruction location based on the centerline; applying three-dimensional connected component analysis to the refined stone segmentation results to mark the volume, spatial location, and bile duct branch to which each independent stone belongs, and generating a structured quantitative report.
[0020] Compared with the prior art, the beneficial technical effects of the present invention are as follows:
[0021] 1. By designing a dual-path collaborative segmentation network, the bile duct structure segmentation and stone lesion segmentation tasks are decoupled and jointly optimized. The cross-path feature interaction module is used to explicitly model the strong coupling relationship between the two in the anatomical space, which overcomes the semantic fragmentation problem caused by the independent processing of the two in existing methods, and significantly improves the segmentation accuracy in complex pathological conditions such as bile duct deformation or obstruction caused by stones.
[0022] 2. The tubular structure path adopts a combination of a three-dimensional dense connection encoder and a multi-scale void space pyramid pooling module, which can effectively capture multi-scale contextual information and topological structure of slender and tortuous bile ducts, enhance the model's ability to perceive weak signals at the end of the bile duct and branch connections, and reduce topological breaks and branch omissions.
[0023] 3. The lesion perception pathway integrates an attention gating mechanism and a feature pyramid network, which can adaptively focus on stone areas of different densities and contrasts, suppress background interference from liver parenchyma, blood vessels, etc., and improve the generalized recognition ability of various types of stones such as high-density calcified type, isodense mixed type and low-density cholesterol type.
[0024] 4. The introduced progressive learning strategy effectively alleviates the model overfitting problem caused by the scarcity of high-quality labeled data. By using a large amount of coarsely labeled public data to pre-train a general feature extractor, and then using a small amount of precisely labeled data to fine-tune specific task modules, the model performance is steadily improved and strong generalization ability is achieved under the condition of limited data.
[0025] 5. The complete post-processing workflow can automatically extract clinically relevant quantitative parameters from the segmentation results, such as bile duct diameter, stone volume and location, and directly generate a structured report that can be used for preoperative planning, thereby improving the clinical applicability and auxiliary diagnostic efficiency of the method. Attached Figure Description
[0026] Figure 1 This is a schematic diagram of the overall technical architecture of the image segmentation method for hepatobiliary duct and bile duct stones proposed in this invention.
[0027] Figure 2 This is a schematic diagram of the core principle framework of the dual-path collaborative segmentation network in this invention. Detailed Implementation
[0028] The features and exemplary embodiments of various aspects of the present invention will now be described in detail. To make the objectives, technical solutions, and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are merely intended to explain the present invention and not to limit the present invention. For those skilled in the art, the present invention can be practiced without some of these specific details. The following description of the embodiments is merely to provide a better understanding of the present invention by illustrating examples of the invention.
[0029] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes the element.
[0030] In the embodiments of the present invention, the same reference numerals denote the same components, and for the sake of brevity, detailed descriptions of the same components are omitted in different embodiments. It should be understood that the thickness, length, width, and other dimensions of various components in the embodiments of the present invention shown in the accompanying drawings, as well as the overall thickness, length, width, and other dimensions of the integrated device, are merely illustrative and should not constitute any limitation on the present invention; the term "multiple" in the present invention refers to two or more (including two).
[0031] To further illustrate the technical means and effects adopted by the present invention to achieve the intended purpose, the specific embodiments according to the present invention will be described in detail below with reference to the accompanying drawings and preferred embodiments.
[0032] Example 1
[0033] In hepatobiliary surgery, clinical diagnosis and preoperative planning often require surgeons to accurately assess the anatomical structure of the hepatobiliary system and the distribution, size, and number of stones within the bile ducts based on abdominal computed tomography (CT) scans or magnetic resonance imaging (MRI) images. Traditional manual delineation methods are time-consuming and labor-intensive, and limited by the surgeon's subjective experience and visual fatigue, making it difficult to guarantee the consistency and repeatability of segmentation results. Especially in complex cases where stones cause local dilation, tortuosity, or complete obstruction of the bile ducts, the boundary between the stones and the bile duct wall is blurred. Existing automated segmentation methods often misidentify stones as thickened bile duct walls or dilated bile ducts as areas of stone accumulation, leading to topological breaks or semantic confusion in the segmentation results, failing to provide reliable three-dimensional quantitative evidence for clinical decision-making. This invention aims to solve the above-mentioned technical challenges through a dual-path collaborative segmentation method that deeply integrates prior knowledge of bile duct anatomy and characteristics of stone lesions.
[0034] See Figure 1 This method first performs step S1, which involves acquiring and preprocessing raw medical image data containing the hepatobiliary region to generate standardized three-dimensional image volume data. Specifically, the system retrieves CT plain or enhanced scan sequences of the patient's abdomen, or magnetic resonance pancreatobiliary imaging sequences, from the hospital's image archiving and communication system. These raw data are typically stored in a medical digital imaging and communication standard format, containing a series of two-dimensional slice images and their corresponding metadata such as spatial location, slice thickness, and pixel spacing. The first step of preprocessing is isotropic resampling of the raw images. Due to the varying parameter settings of different scanning devices, the original voxel sizes may differ in the transverse, sagittal, and coronal directions; for example, the common anisotropic voxel size is 0.7 mm x 0.7 mm x 5.0 mm. This embodiment uses a three-dimensional bilinear interpolation algorithm to uniformly resample the voxel sizes in all directions to a preset isotropic resolution of 0.5 mm x 0.5 mm x 0.5 mm. This operation eliminates structural distortion caused by sampling differences, providing a regular input for subsequent three-dimensional convolution operations.
[0035] The second step in preprocessing is intensity normalization. Different manufacturers, models, and scanning protocols can lead to significant differences in the grayscale value range of the same tissue in an image. This embodiment employs an intensity normalization algorithm based on histogram matching. First, a standard grayscale histogram of the liver parenchyma region is statistically derived from a large amount of normal hepatobiliary CT data as a reference. Then, for each input image to be processed, its liver region grayscale histogram is calculated, and a nonlinear transformation function maps the shape of the input image's histogram to the shape of the reference histogram. This transformation function is solved by minimizing the difference in the cumulative distribution function between the two histograms. After this step, the grayscale values of all input images are mapped to a standardized intensity range, for example, from -1000 HJ units to 1000 HJ units, where typical values for liver parenchyma are concentrated around 50 HJ units, bile is approximately 0 HJ units, and high-density calcified stones can exceed 500 HJ units. This normalization effectively reduces intensity variations introduced by different scanning conditions, improving the model's generalization ability to data from different sources.
[0036] The third step in preprocessing is image denoising. Medical images, especially low-dose CT or MRI images, often contain interference such as quantum noise and physiological motion artifacts. This embodiment uses a three-dimensional nonlocal mean filtering algorithm for denoising. This algorithm does not smooth individual pixels, but rather searches the entire three-dimensional image volume for all pixel blocks with similar structures to the current pixel block, updating the current pixel value by calculating the weighted average of these similar blocks. The weights are determined by the Gaussian weighted Euclidean distance between two pixel blocks; the smaller the distance, the greater the weight. The core advantage of this algorithm is that it can effectively suppress noise while perfectly preserving high-frequency details such as fine bile duct walls and sharp edges of gallstones, avoiding the edge blurring problems caused by traditional Gaussian filtering or median filtering. The filtering window size is set to 7 x 7 x 7 voxels, and the search window is set to 21 x 21 x 21 voxels.
[0037] The final step in preprocessing is spatial normalization. To eliminate variations in liver spatial position and orientation caused by differences in body position and respiratory phase among different patients, this embodiment aligns the preprocessed image to a predefined standard anatomical coordinate system using a three-dimensional affine transformation. This standard coordinate system is established based on an atlas containing a large number of normal liver anatomical structures. Specifically, an image registration algorithm based on mutual information is used to register the current patient's image with the standard atlas using a rigid-affine transformation, solving for a transformation matrix containing 12 parameters: translation, rotation, scaling, and shearing. This transformation matrix is then applied to resample the patient image to the standard space. This generates standardized three-dimensional image volume data with uniform size, standard intensity, suppressed noise, and spatial alignment, with dimensions, for example, 320 x 320 x 256 voxels, which serves as the direct input to the subsequent segmentation network.
[0038] See Figure 2 The core of this method lies in the dual-path collaborative segmentation network constructed and trained in step S2. This network contains two functionally specialized paths: a tubular structure path and a lesion perception path, which collaborate deeply through a cross-path feature interaction module. The core task of the tubular structure path is to accurately segment the meandering bile duct tree structure. Its encoder part employs a three-dimensional densely connected encoder. This encoder consists of four densely connected blocks stacked sequentially, each containing four three-dimensional convolutional layers, followed by a batch normalization layer and a modified linear unit activation function. The core mechanism of dense connectivity is that the output of each convolutional layer is not only passed to the next layer but also cascaded with the input of all subsequent convolutional layers in terms of channel dimension. For example, the input feature map of the first densely connected block has 32 channels; after passing through its four internal convolutional layers, the output feature map has 32 plus 4 multiplied by 32, which equals 160 channels. This dense connectivity promotes feature reuse, alleviates the gradient vanishing problem, and enables the network to learn features more efficiently from limited labeled data.
[0039] To capture the bile duct's structure—characterized by a dramatic diameter variation from its main trunk to its distal end and complex branching topology—a multi-scale dilated spatial pyramid pooling module is connected after the densely connected encoder. This module deploys four parallel branches, each containing a 3D dilated convolutional layer with dilation rates of 1, 6, 12, and 18, respectively. The convolution with a dilation rate of 1 (standard convolution) has the smallest receptive field, used to capture local details of the bile duct wall; convolutions with progressively increasing dilation rates have exponentially expanded receptive fields, capable of perceiving broader contextual information, used to understand the connections between the bile duct trunk and branches, as well as the global distribution of the entire bile duct tree. The output feature maps from these four branches are concatenated along the channel dimension, and then subjected to a 1x1x1 convolution for channel dimensionality reduction and feature fusion. In this way, the path can simultaneously utilize local details and global context to generate multi-scale contextual features highly sensitive to the bile duct topology and output an initial bile duct segmentation probability map, where the value of each voxel represents the probability of it belonging to a bile duct structure.
[0040] The lesion perception pathway focuses on identifying lesions caused by stones within the bile duct. Its encoder employs a 3D residual encoder with an attention-gated mechanism. This encoder also contains four residual blocks, each consisting of two 3D convolutional layers. The input is directly added to the output of the second convolutional layer via a shortcut connection to optimize gradient flow. The attention-gated mechanism is integrated into the skip connections before encoder downsampling. Specifically, the feature map to be passed from the shallow layers of the encoder to the decoder is first processed through an attention gate. This attention gate uses the high-level semantic features upsampled from the previous decoder layer as the gating signal, concatenates it with the current encoder features, and then passes it through a convolutional layer and a sigmoid activation function to generate a spatial attention weight map with values between 0 and 1. This weight map is multiplied element-wise with the original encoder features, adaptively enhancing feature responses related to the stone region, such as the bright spots of high-density calcified stones on CT images or the weak signal loss of low-density cholesterol stones on MRI images; while suppressing feature responses from background tissues such as liver parenchyma and intrahepatic vessels. This mechanism enables the network to focus on the lesion, overcoming the difficulty of identification caused by the low contrast between the stone and the background tissue.
[0041] To further enhance the discriminative power for various types of stones, a feature pyramid network is integrated after the deep layers of the residual encoder. This network fuses features from different levels of the encoder through a top-down path and lateral connections. Deep features contain rich semantic information, capable of distinguishing between "stones" and "non-stones"; shallow features contain high-resolution spatial information, enabling precise location of stone boundaries. The feature pyramid network upsamples the deep features and adds them to the corresponding shallow features, thereby generating multimodal enhanced features with both strong semantic discriminative power and high spatial accuracy, and outputs an initial stone segmentation probability map.
[0042] Step S3 inputs the preprocessed, standardized 3D image volume data simultaneously into the previously trained tubular structure path and lesion perception path. The data flows through the encoders and feature enhancement modules of both paths, generating initial bile duct segmentation probability maps and initial stone segmentation probability maps in parallel. These two probability maps form the basis for subsequent collaborative optimization.
[0043] Step S4 uses the cross-path feature interaction module to perform spatial correlation modeling on the two initial probability maps. This module first receives the initial bile duct segmentation probability map from the tubular structure path. Initial stone segmentation probability map from lesion perception pathway These two probability maps have the same spatial dimensions. The core of the module is calculating a spatial correlation weight matrix. Each element of the matrix Characterizes the position in three-dimensional space The probability of bile duct structures coexisting with stones is determined by the joint likelihood of the probability values of the bile duct and the stone at that location. The calculation formula is:
[0044]
[0045] in, For the Sigmoid function, This is the initial bile duct segmentation probability map of the self-tubular structure path. The initial stone segmentation probability map is derived from the lesion perception path, where i and j represent location coordinates. The linear weighted sum is mapped to a range of 0 to 1. and These are parameters automatically learned during network training to balance the influence of prior bile duct knowledge and evidence of gallstones on association weights. For example, when the probability of bile duct involvement is high but the probability of gallstones is low at a certain location, the weights... The probability may still be higher because the stone may be located within the bile duct lumen; conversely, if the probability of a stone in a certain location is high but the probability in the bile duct is low, the weighting is lower. This will be inhibited because gallstones are almost always located inside the bile duct. The weight matrix is calculated. Then, the feature maps are weighted and summed channel by channel with the deep feature maps output by the two path encoders to achieve feature modulation and fusion, ultimately generating a collaborative feature map. This feature map not only contains the original features extracted from each path, but also encodes key anatomical-pathological coupling constraint information such as "local dilation of the bile duct caused by stones" or "complete obstruction of the upstream bile duct due to stones leading to non-visualization".
[0046] Step S5, based on the generated collaborative feature map, reconstructs the final refined bile duct segmentation result and stone segmentation result through a decoder network containing two parallel branches. The bile duct reconstruction branch and the stone reconstruction branch are symmetrically structured, each containing four upsampling stages. Each stage first performs trilinear interpolation upsampling on the input feature map, doubling its spatial size; then, it performs skip connections with shallow high-resolution feature maps from corresponding levels of the two paths, specifically concatenating them along the channel dimension; finally, it performs feature fusion and refinement through several 3D convolutional layers. Shallow features from the tubular structure path provide fine-grained localization information of the bile duct edges, shallow features from the lesion perception path provide details of the stone boundaries, while the collaborative feature map from the cross-path feature interaction module provides global semantic and spatial relationship guidance.
[0047] In the final output layer of the bile duct reconstruction branch, in addition to using the Sigmoid function to output the probability that each voxel belongs to a bile duct, an additional constraint based on topological continuity loss is applied. This loss function quantifies the difference in topological structure by calculating the Hausdorff distance between the 3D skeleton of the segmentation result and the ground truth labeled skeleton. It encourages the network to maintain the connectivity of the bile duct structure predicted by the network and imposes a significant penalty on broken or isolated tubular segments in the prediction results, thereby ensuring that the segmented bile duct tree is an anatomically reasonable continuous structure.
[0048] In the final output layer of the stone reconstruction branch, a constraint based on morphological priors is applied. This loss function combines priors on the compactness and sphericity of the segmented regions. It calculates the ratio of the predicted 3D convex hull volume of the stone region to the actual volume, and the ratio of its surface area to the surface area of an equal-volume sphere. This loss function encourages the segmented stone regions to tend towards a compact, clumpy morphology, suppressing erroneous predictions that are overly dispersed, granular, or noisy, resulting in segmentation results that better match the common morphologies of stones observed in clinical practice.
[0049] The training of the entire dual-path collaborative segmentation network employs a progressive learning strategy, divided into three stages. In the first stage, a publicly available large-scale abdominal organ segmentation dataset is used. This dataset contains coarse segmentation annotations of organs such as the liver and gallbladder from thousands of CT scans, although the bile duct annotations may not be finely detailed. In this stage, only the tubular structure path is trained to learn common tubular anatomical features, while the parameters of the lesion-aware path and cross-path interaction module are randomly initialized but not used in training. The loss function uses only the Dice loss for bile duct segmentation. In the second stage, a small-scale private dataset of hepatobiliary ducts and stones, precisely annotated by senior radiologists and collected by our hospital, is used. This dataset may contain only one hundred to two hundred cases. In this stage, the parameters of the tubular structure path trained in the first stage are frozen and used as a fixed feature extractor. The focus is on training the lesion-aware path and cross-path feature interaction module, with the loss function including the Focal loss for stone segmentation and the initial collaborative constraint loss. In the third stage, all parameters of the entire network are unfrozen, and end-to-end fine-tuning is performed using the private dataset. The final joint loss function consists of a weighted sum of four parts: Dice loss for bile duct segmentation, Focal loss for stone segmentation, topological continuity loss, and morphological prior loss. The weight coefficients are determined through a grid search based on the magnitude and importance of each loss term; for example, they can be set to 1.0, 0.8, 0.5, and 0.3. This progressive strategy fully utilizes publicly available data, alleviating the bottleneck of scarce high-quality labeled data and enabling the model to robustly learn task-specific knowledge.
[0050] Step S6 is the post-processing and quantization analysis step. The refined bile duct segmentation 3D binary mask output from step S5 is used to iteratively erode voxels using a 3D thinning algorithm until a centerline of single-pixel width is obtained, i.e., the bile duct skeleton. Based on this centerline, the local bile duct diameter at each centerline point can be calculated by creating a cross-section perpendicular to the centerline at that point and calculating the equivalent circle diameter of the segmentation mask on that cross-section. By statistically analyzing the diameters of all points, the diameter distribution of the bile duct tree can be obtained. Simultaneously, analyzing the branch points of the centerline allows for the measurement of branch angles. By spatially associating the stone segmentation mask with the bile duct centerline and the segmentation mask, the bile duct branch where each stone is located can be automatically determined, and the path length from the stone obstruction point to the common bile duct opening can be accurately calculated.
[0051] For the refined stone segmentation results, a three-dimensional connected component analysis algorithm based on 26 adjacency relationships was applied to mark each individual stone cluster. For each connected component, the number of voxels it contains was calculated, and multiplied by the volume of a single voxel to obtain the precise volume of the stone. Simultaneously, the three-dimensional centroid coordinates of the connected component were calculated as the spatial location of the stone. Finally, the system automatically filled all the above quantitative parameters, including the total length of the bile duct, average diameter, diameter at the point of maximum dilation, number of stones, volume of each stone, location, and branch, into a structured report template, generating a quantitative analysis report that can be directly used for preoperative clinical assessment and surgical planning.
[0052] Example 2
[0053] When the application of this invention is extended to ultrasound imaging, its data characteristics and challenges differ from those of CT or MRI. Ultrasound images typically have higher noise levels, lower contrast, and significant acoustic shadowing and reverberation artifacts, placing higher demands on the automatic segmentation of bile ducts and stones. This embodiment will illustrate the specific adaptation and implementation of the method in this scenario.
[0054] In the preprocessing stage of step S1, adjustments are made to suit the characteristics of the ultrasound images. The acquired raw data is the volumetric data from a 3D ultrasound scan. Isotropic resampling is still performed, but the preset resolution may be adjusted to 0.3 mm x 0.3 mm x 0.3 mm to accommodate the higher inherent resolution of ultrasound. The intensity normalization algorithm needs to be replaced with one more suitable for ultrasound, such as a normalization method based on tissue attenuation compensation, to mitigate the signal attenuation caused by increased depth. Noise reduction is performed using a nonlocal mean filter variant more suitable for ultrasound speckle noise, or combined with a wavelet thresholding denoising algorithm, to better preserve small strong echo points of stones while removing speckle noise. Spatial normalization still uses affine transformation, but the standard atlas for registration needs to be replaced with a standard hepatobiliary spatial atlas constructed based on 3D ultrasound data from healthy volunteers.
[0055] In step S2, the network architecture remains unchanged, but the input channels and some parameters need to be adapted. Since ultrasound images are typically single-channel grayscale images, the number of network input channels is set to 1. The attention gating mechanism in the lesion perception path is particularly important in this scenario because it is needed to strongly suppress the rich texture background and artifacts in the ultrasound image, focusing on the linear hyperechoic features of the bile duct wall or the strong echoes with acoustic shadowing of the stones. The feature pyramid network needs to enhance the utilization of shallow features to address the problem that the stone boundaries in the ultrasound image may be blurred due to acoustic shadowing.
[0056] The parameters in the calculation formula of the cross-path feature interaction module in step S4 and The initial values or learning process may require specific initialization for the different manifestations of bile ducts and stones in ultrasound images. In ultrasound, the strong echoes and posterior acoustic shadows of stones are strongly correlated features, and the module needs to learn the specific spatial relationship pattern between "strong echo points + posterior fan-shaped acoustic shadows" and the anechoic cavity of the bile duct.
[0057] In the decoder network of step S5, the weights of the topological continuity loss and morphological prior loss may need to be adjusted to address the issue that the continuity of the bile duct in the ultrasound image is more easily interrupted by noise; the morphological prior loss can incorporate constraints on the morphology of the acoustic shadow region behind the stone.
[0058] The network training strategy also employs a progressive learning approach. The public dataset used in the first stage of pre-training requires finding or constructing a dataset containing abdominal ultrasound images and rough annotations of the bile ducts. The private datasets used in the second and third stages require specifically collected and precisely annotated bile ducts and stones in hepatobiliary ultrasound images. Due to the greater difficulty of ultrasound annotation and the potential for smaller datasets, the strategy of freezing the pre-trained feature extractor in the second stage is crucial to fully utilize the general edge and texture features learned from the large dataset.
[0059] In the post-processing of step S6, to address the issue that the bile duct segmentation boundaries in ultrasound images may not be as clear as those in CT scans, a moderate morphological closure operation can be performed on the bile duct segmentation mask before extracting the centerline using skeletonization to fill small gaps and ensure the continuity of the centerline. When calculating the stone volume, it is important to note that the acoustic shadowing region may be segmented as part of the stone. Morphological analysis or intensity threshold-based post-processing is needed to distinguish the acoustic shadowing region from the main stone body to obtain a more accurate stone volume measurement.
[0060] The above are merely preferred embodiments of the present invention and are not intended to limit the present invention in any way. Although the present invention has been disclosed above with reference to preferred embodiments, it is not intended to limit the present invention. Any person skilled in the art can make some modifications or alterations to the above-disclosed technical content to create equivalent embodiments without departing from the scope of the present invention. Any simple modifications, equivalent changes and alterations made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the scope of the present invention.
[0061] The above are merely preferred embodiments of the present invention and are not intended to limit the scope of protection of the present invention. Therefore, all equivalent changes made in accordance with the structure, shape, and principle of the present invention should be covered within the scope of protection of the present invention.
Claims
1. A method for image segmentation of hepatobiliary ducts and bile duct stones, characterized in that, The method includes the following steps: Step S1: Obtain raw medical image data containing the liver and gallbladder regions, and preprocess the raw medical image data to generate standardized three-dimensional image volume data; Step S2: Construct and train a dual-path collaborative segmentation network. The dual-path collaborative segmentation network includes a tubular structure path for extracting bile duct structural features and a lesion perception path for extracting stone region features. The two paths fuse information through a cross-path feature interaction module. Step S3: Input the standardized 3D image volume data into the trained dual-path collaborative segmentation network, extract multi-scale contextual features through the tubular structure path and generate an initial bile duct segmentation probability map, and at the same time extract multi-modal enhancement features through the lesion perception path and generate an initial stone segmentation probability map. Step S4: Using the cross-path feature interaction module, the initial bile duct segmentation probability map and the initial stone segmentation probability map are spatially correlated to generate a collaborative feature map containing bile duct-stone coupling constraint information. Step S5: Based on the collaborative feature map, the final refined bile duct segmentation result and stone segmentation result are reconstructed through the decoder network, and a three-dimensional segmentation mask is output.
2. The image segmentation method for hepatobiliary duct and bile duct stones according to claim 1, characterized in that, The preprocessing of the raw medical image data in step S1 includes the following operations: isotropic resampling of the input CT, MRI or ultrasound images to unify the voxel size to a preset resolution; and using an intensity normalization algorithm based on histogram matching to map the image grayscale values under different scanning devices and protocols to a standardized intensity range. A three-dimensional nonlocal mean filtering algorithm is applied to denoise the image while preserving the edge information of the hepatobiliary ducts and stones. The image is aligned to the standard anatomical space coordinate system through a three-dimensional affine transformation to generate standardized three-dimensional image volume data.
3. The image segmentation method for hepatobiliary duct and bile duct stones according to claim 1, characterized in that, The dual-path collaborative segmentation network constructed in step S2 uses a three-dimensional densely connected encoder for its tubular structure path. This encoder is composed of multiple densely connected blocks stacked together. Each densely connected block contains multiple convolutional layers, and the output of each layer is concatenated with the features of all subsequent layers. The output of the densely connected encoder is connected to a multi-scale hollow spatial pyramid pooling module to extract contextual information under different receptive fields in parallel, so as to capture the bile duct branch topology from coarse to fine.
4. The image segmentation method for hepatobiliary duct and bile duct stones according to claim 1, characterized in that, The dual-path collaborative segmentation network constructed in step S2 employs a three-dimensional residual encoder with an attention-gated mechanism for its lesion perception path. The attention-gated mechanism is integrated into the skip connections of the encoder to adaptively suppress background tissue features unrelated to the stone region and enhance local lesion features related to stone density and texture. The deep features of the residual encoder are input into a feature pyramid network to fuse semantic information at different levels and generate multimodal enhancement features that are discriminative for both low-contrast cholesterol stones and high-density calcified stones.
5. The image segmentation method for hepatobiliary duct and bile duct stones according to claim 1, characterized in that, The cross-path feature interaction module in step S2 specifically performs the following operations: First, it receives the initial bile duct segmentation probability map from the tubular structure path. Initial stone segmentation probability map from lesion perception pathway ; Then, a spatial correlation weight matrix is calculated. Each element of the matrix The probability of bile duct and gallstone at the corresponding location is determined by the joint likelihood. Finally, the deep feature maps of the two paths are weighted and fused and modulated using the spatial correlation weight matrix to generate a collaborative feature map.
6. The image segmentation method for hepatobiliary duct and bile duct stones according to claim 1, characterized in that, In step S3, the training process of the dual-path collaborative segmentation network adopts a progressive course learning strategy. Specifically, in the first training stage, a large number of public abdominal organ segmentation datasets with coarse bile duct annotations are used to pre-train the tubular structure paths. In the second training stage, a small-scale but precisely annotated private dataset of hepatobiliary ducts and stones is used, with the frozen tubular structure paths as feature extractors, to focus on training the lesion perception path and cross-path feature interaction module. In the third training phase, the entire network is unfrozen, and end-to-end fine-tuning is performed using a joint loss function. The joint loss function consists of a weighted sum of the Dice loss for bile duct segmentation, the Focal loss for stone segmentation, the topological continuity loss, and the morphological prior loss.
7. The image segmentation method for hepatobiliary duct and bile duct stones according to claim 1, characterized in that, The decoder network in step S5 contains two parallel branches: a bile duct reconstruction branch and a stone reconstruction branch, which reconstruct the final refined bile duct segmentation result and stone segmentation result, respectively. Each branch consists of multiple upsampling convolutional layers and skip connections. The skip connections receive shallow high-resolution features from the corresponding encoder path and collaborative feature maps from the cross-path feature interaction module, respectively.
8. The image segmentation method for hepatobiliary duct and bile duct stones according to claim 7, characterized in that, The bile duct reconstruction branch applies a constraint based on topological continuity loss to the final output layer. This loss function quantifies the difference in topological structure by calculating the Hausdorff distance between the 3D skeleton of the segmentation result and the real labeled skeleton. The loss function encourages the network to maintain the connectivity of the bile duct structure predicted by the network and imposes a significant penalty on broken or isolated tubular segments in the prediction results to ensure that the segmented bile duct tree is an anatomically reasonable continuous structure.
9. The image segmentation method for hepatobiliary duct and bile duct stones according to claim 7, characterized in that, The stone reconstruction branch applies a morphological prior constraint to the final output layer. This loss function combines the compactness and sphericity priors of the segmented region. It calculates the ratio of the predicted three-dimensional convex hull volume of the stone region to the actual volume, as well as the ratio of its surface area to the surface area of a sphere of equal volume. This loss function encourages the segmented stone region to tend towards a compact, clumpy morphology, and suppresses erroneous predictions that are overly dispersed, sand-like, or noisy, making the segmentation results more consistent with the common morphology of stones observed in clinical practice.
10. The image segmentation method for hepatobiliary duct and bile duct stones according to claim 1, characterized in that, The method further includes a post-processing step S6: applying a three-dimensional skeletonization algorithm to the refined bile duct segmentation results, extracting the centerline of the bile duct structure, and calculating quantitative parameters such as bile duct diameter, branch angle, and stone obstruction location based on the centerline; The refined stone segmentation results are analyzed using three-dimensional connected domain analysis to mark the volume, spatial location, and bile duct branch to which each individual stone belongs, generating a structured quantitative report.