Disclosure of Invention
The embodiment of the application provides a method and a device for determining a blood vessel center line and a readable storage medium, so as to solve the problem that time and labor are wasted when a blood vessel is named by adopting a method in the prior art.
In order to solve the above problem, in a first aspect, an embodiment of the present invention provides a method for determining a centerline of a blood vessel, including: acquiring a blood vessel image; extracting a first central line of each blood vessel in the blood vessel image, wherein the first central line comprises a first starting point, an intersection point and a segmentation line; constructing an undirected graph according to the first starting point, the intersection point and the segmentation line; determining each connected component of the undirected graph; determining each subgraph in each connected component, wherein each subgraph comprises at least one vertex, and when each subgraph comprises a plurality of vertices, at least two connecting paths exist between any two vertices in the subgraph; for each connected component, constructing a spanning tree by taking a subgraph including a first starting point as a root node, taking a subgraph not including the first starting point as a child node and a leaf node and taking a connecting line between the subgraphs as an edge; acquiring at least one designated point selected by a user aiming at the vessel with the standby name; when the designated point does not include the second starting point, a first path from the root node to the designated point is determined in the spanning tree, and a second central line of the standby name vessel is obtained.
Optionally, determining each subgraph in each connected component includes: determining each key edge of the connected component, wherein the key edges are used for indicating a unique path between two mutually connected vertexes in the connected component; and determining at least one vertex connected with each key edge and a connecting line between the vertices as a subgraph.
Optionally, when the node through which the first path passes includes a subgraph of a plurality of vertices, after determining the first path from the root node to the specified point in the spanning tree, the method further includes: when the designated point exists in the sub-graph, a second path passing through a third starting point, a first end point and the designated point of the sub-graph is determined in the sub-graph, and the second path has no loop; and combining the first path and the second path to obtain a second central line of the standby name vessel.
Optionally, the method for determining the centerline of the blood vessel further comprises: when no appointed point exists in the subgraph, a third path passing through a fourth starting point and a second ending point of the subgraph is determined in the subgraph, and the third path has no loop; and combining the first path and the third path to obtain a second central line of the standby name vessel.
Optionally, determining a second path in the sub-graph, the second path passing through a third starting point, the first end point and the designated point of the sub-graph, includes: a second path is determined in the sub-graph using traversal, which passes through a third start point, the first end point, and the designated point of the sub-graph.
Optionally, the method for determining the centerline of the blood vessel further comprises: and when the designated point comprises a second starting point, taking the second starting point as a root node of the spanning tree, returning to execute the step of constructing the spanning tree by taking the subgraph comprising the first starting point as the root node, taking the subgraph not comprising the first starting point as a child node and a leaf node and taking a connecting line between the subgraphs as an edge for each connected component.
Optionally, the method for determining the centerline of the blood vessel further comprises: and when the second starting point is not a leaf node, adding a virtual leaf node connected with the second starting point, taking the virtual leaf node as a root node of the spanning tree, returning to execute the step of constructing the spanning tree by taking the subgraph which does not comprise the first starting point as a child node and the leaf node and taking a connecting line between the subgraphs as an edge for each connected component.
According to a second aspect, the present invention provides a device for determining a centerline of a blood vessel, including: a first acquisition unit for acquiring a blood vessel image; the extraction unit is used for extracting a first central line of each blood vessel in the blood vessel image, wherein the first central line comprises a first starting point, an intersection point and a segmentation line; the first construction unit is used for constructing an undirected graph according to a first starting point, a junction point and a segmentation line; a first determination unit configured to determine each connected component of the undirected graph; the second determining unit is used for determining each subgraph in each connected component, each subgraph comprises at least one vertex, and when each subgraph comprises a plurality of vertices, at least two connecting paths exist between any two vertices in the subgraph; the second construction unit is used for constructing a spanning tree by taking a subgraph including the first starting point as a root node, taking a subgraph not including the first starting point as a child node and a leaf node and taking a connecting line between the subgraphs as an edge for each connected component; the second acquisition unit is used for acquiring at least one designated point selected by a user aiming at the standby name blood vessel; and a third determining unit, configured to determine a first path from the root node to the designated point in the spanning tree when the designated point does not include the second starting point, and obtain a second centerline of the first-order vessel.
In a third aspect, an embodiment of the present invention provides a computer, including: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executable by the at least one processor to cause the at least one processor to perform a method of determining a vessel centerline as in the first aspect or any of the embodiments of the first aspect.
In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, where computer instructions are stored, and the computer instructions are configured to cause a computer to execute the method for determining a blood vessel centerline according to the first aspect or any implementation manner of the first aspect.
The method, the device and the readable storage medium for determining the center line of the blood vessel provided by the embodiment of the invention acquire the blood vessel image; extracting a first central line of each blood vessel in the blood vessel image, wherein the first central line comprises a first starting point, an intersection point and a segmentation line; constructing an undirected graph according to the first starting point, the intersection point and the segmentation line; determining each connected component of the undirected graph; determining each subgraph in each connected component, wherein each subgraph comprises at least one vertex, and when each subgraph comprises a plurality of vertices, at least two connecting paths exist between any two vertices in the subgraph; for each connected component, constructing a spanning tree by taking a subgraph including a first starting point as a root node, taking a subgraph not including the first starting point as a child node and a leaf node and taking a connecting line between the subgraphs as an edge; acquiring at least one designated point selected by a user aiming at the vessel with the standby name; when the appointed point does not comprise a second starting point, a first path from the root node to the appointed point is determined in the spanning tree to obtain a second center line of the blood vessel with the ready name, so that the first center line of each blood vessel in the blood vessel image is converted from a complex graph structure into a tree structure comprising a plurality of subgraphs, when at least one appointed point selected by a user for the blood vessel to be named is obtained, a proper path can be found in the tree structure to obtain the second center line of the blood vessel with the ready name, and the second center line of the blood vessel to be named can be simply and quickly determined; and the subgraph is set as the node of the tree structure, so that only one spanning tree needs to be established for one connected component, and the calculation amount can be reduced when the second central line of the blood vessel to be named is determined.
The foregoing description is only an overview of the technical solutions of the present application, and the present application can be implemented according to the content of the description in order to make the technical means of the present application more clearly understood, and the following detailed description of the present application is given in order to make the above and other objects, features, and advantages of the present application more clearly understandable.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
An embodiment of the present invention provides a method for determining a blood vessel centerline, as shown in fig. 1, including:
s101, obtaining a blood vessel image; specifically, the obtained blood vessel images include at least images of blood vessels to be named, and in the present embodiment, a head and neck artery blood vessel image is taken as an example for description, but not limited thereto, and other blood vessel images are also applicable.
S102, extracting a first central line of each blood vessel in the blood vessel image, wherein the first central line comprises a first starting point, an intersection point and a segmentation line; specifically, a skeleton extraction algorithm may be used to extract a first centerline of each blood vessel in the blood vessel image. The first centerline may include a first origin or a plurality of first origins, and when the first centerline includes a plurality of first origins, the first centerline is indicated to have a plurality of disconnected blood vessels. The first center line may include one intersection and one segment line, and may include a plurality of intersections and a plurality of segment lines. The first starting point is the center point of the lowest end of the blood vessel. The junction is the center point of the junction of the blood vessels. The segmentation line is a connection line of the center points of the segmented vessels.
S103, constructing an undirected graph according to the first starting point, the intersection point and the segmentation line; specifically, an undirected graph may be constructed with the first starting point and the intersection point as vertices and the segment line as a connecting line between the vertices. The constructed undirected graph can be as shown in fig. 2.
S104, determining each connected component of the undirected graph; specifically, for an undirected graph as shown in FIG. 2, two connected components are included.
S105, determining each subgraph in each connected component, wherein each subgraph comprises at least one vertex, and when each subgraph comprises a plurality of vertices, at least two connecting paths exist between any two vertices in each subgraph; specifically, subgraphs in each connected component can be determined by adopting a tarjan algorithm of a classical graph theory. For an undirected graph as shown in fig. 2, one of the connected components may comprise 7 subgraphs as shown in fig. 3. The subgraph may be a single vertex, or may be a plurality of vertices and connecting lines between the vertices.
S106, for each connected component, constructing a spanning tree by taking a subgraph including a first starting point as a root node, taking a subgraph not including the first starting point as a child node and a leaf node and taking a connecting line between the subgraphs as an edge; specifically, each subgraph can be regarded as an independent node, and then a spanning tree algorithm is used to construct a spanning tree by taking the subgraph comprising the first starting point as a root node. For each subgraph in fig. 3, a spanning tree may be constructed by taking the subgraph including the first starting point as a root node, taking the subgraph not including the first starting point as a child node and a leaf node, and taking a connecting line between the subgraphs as an edge, as shown in fig. 4 and fig. 5.
S107, acquiring at least one designated point selected by a user aiming at the blood vessel with the standby name; in particular, the user may choose at least one specified point for the vessel to be named.
And S108, when the designated point does not comprise the second starting point, determining a first path from the root node to the designated point in the spanning tree, and obtaining a second central line of the standby name vessel. Specifically, the second starting point is different from the first starting point, and is a new starting point selected by the user again. Since the tree structure is characterized by having only one path from the root node to any given point on the tree, when the given point selected by the user does not include the second starting point, only one first path from the root node to the given point can be determined in the spanning tree.
The method, the device and the readable storage medium for determining the center line of the blood vessel provided by the embodiment of the invention acquire the blood vessel image; extracting a first central line of each blood vessel in the blood vessel image, wherein the first central line comprises a first starting point, an intersection point and a segmentation line; constructing an undirected graph according to the first starting point, the intersection point and the segmentation line; determining each connected component of the undirected graph; determining each subgraph in each connected component, wherein each subgraph comprises at least one vertex, and when each subgraph comprises a plurality of vertices, at least two connecting paths exist between any two vertices in the subgraph; for each connected component, constructing a spanning tree by taking a subgraph including a first starting point as a root node, taking a subgraph not including the first starting point as a child node and a leaf node and taking a connecting line between the subgraphs as an edge; acquiring at least one designated point selected by a user aiming at the vessel with the standby name; when the appointed point does not comprise a second starting point, a first path from the root node to the appointed point is determined in the spanning tree to obtain a second center line of the blood vessel with the ready name, so that the first center line of each blood vessel in the blood vessel image is converted from a complex graph structure into a tree structure comprising a plurality of subgraphs, when at least one appointed point selected by a user for the blood vessel to be named is obtained, a proper path can be found in the tree structure to obtain the second center line of the blood vessel with the ready name, and the second center line of the blood vessel to be named can be simply and quickly determined; and the subgraph is set as the node of the tree structure, so that only one spanning tree needs to be established for one connected component, and the calculation amount can be reduced when the second central line of the blood vessel to be named is determined.
In an alternative embodiment, in step S105, determining each subgraph in each connected component includes: determining each key edge of the connected component, wherein the key edges are used for indicating a unique path between two mutually connected vertexes in the connected component; and determining at least one vertex connected with each key edge and a connecting line between the vertices as a subgraph.
Specifically, when determining each subgraph in each connected component, it may be obtained by determining each key edge in the connected component. The critical edge satisfies that if the connecting line is cut off, the original connected component is split into two connected components, that is, the critical edge is used for indicating a unique path between two mutually connected vertexes in the connected components.
By determining the key edges of the connected components, sub-graphs in the connected components can be determined quickly.
In an optional embodiment, when the node through which the first path passes includes a subgraph of a plurality of vertices, after determining the first path from the root node to the specified point in the spanning tree, the method further includes: when the designated point exists in the sub-graph, a second path passing through a third starting point, a first end point and the designated point of the sub-graph is determined in the sub-graph, and the second path has no loop; and combining the first path and the second path to obtain a second central line of the standby name vessel. When no appointed point exists in the subgraph, a third path passing through a fourth starting point and a second ending point of the subgraph is determined in the subgraph, and the third path has no loop; and combining the first path and the third path to obtain a second central line of the standby name vessel.
Specifically, the nodes passed by the first path include a root node and child nodes. When the node passed by the first path includes a subgraph of a plurality of vertices, as shown in fig. 6, the solid dots are the vertices of the subgraph, and the hollow dots are the designated points. Since there are many connecting lines in the subgraph composed of many vertices, it is necessary to determine the second path in the subgraph. In the subgraph, since the order of passing through the middle vertexes is unknown and no solution is possible, the second path can be determined by means of brute force search and setting an upper limit of the number of searches. Thus, if a specified point is present in the subgraph, a second path can be determined in the subgraph that is loop-free and passes through the third starting point, the first end point and the specified point of the subgraph by using the traversal method. By combining the first path and the second path, the second centerline of the artery with the first artery can be obtained. As shown in fig. 7, the sub-graph in the example finds the second path through 4 traversals.
If the specified point does not exist in the subgraph, a third path which is not a loop and passes through a fourth starting point and a second ending point of the subgraph can be determined in the subgraph by using a traversal method, and the first path and the third path are combined to reach a second central line of the artery with the first name.
Because the size of the sub-graph is limited, and a user generally does not select too many designated points in the sub-graph, the second path or the third path can be quickly found by using a traversal method under the general condition.
In an alternative embodiment, the method for determining the vessel centerline further comprises: and when the designated point comprises a second starting point, taking the second starting point as a root node of the spanning tree, returning to execute the step of constructing the spanning tree by taking the subgraph comprising the first starting point as the root node, taking the subgraph not comprising the first starting point as a child node and a leaf node and taking a connecting line between the subgraphs as an edge for each connected component.
Specifically, when the user specifies the second starting point, the spanning tree may be reconstructed with the second starting point as the root node of the spanning tree.
When the designated point comprises a second starting point, the spanning tree is reconstructed by taking the second starting point as a root node of the spanning tree, and the spanning tree which takes the second starting point selected by the user as the root node can be obtained, so that when the first path is determined, the second starting point is taken as the starting point of the first path, the first path of the standby name blood vessel at different starting points can be constructed, and the setting requirements of the user on different starting points are met.
In an alternative embodiment, the method for determining the vessel centerline further comprises: and when the second starting point is not a leaf node, adding a virtual leaf node connected with the second starting point, taking the virtual leaf node as a root node of the spanning tree, returning to execute the step of constructing the spanning tree by taking the subgraph which does not comprise the first starting point as a child node and the leaf node and taking a connecting line between the subgraphs as an edge for each connected component.
Specifically, when the second starting point selected by the user is not a leaf node, a virtual leaf node connected to the second starting point may be added, and the spanning tree is reconstructed by using the virtual leaf node as a root node of the spanning tree.
The spanning tree is reconstructed by adding a virtual leaf node linking the second starting point, taking the virtual leaf node as the root node of the spanning tree, so that the spanning tree is still suitable for determining the second central line of the blood vessel.
The present invention also provides a device for determining a centerline of a blood vessel, as shown in fig. 8, including: a first acquisition unit 201 for acquiring a blood vessel image; the detailed description of the specific implementation manner is given in step S101 in the above embodiments, and is not repeated herein.
An extracting unit 202, configured to extract a first center line of each blood vessel in the blood vessel image, where the first center line includes a first starting point, an intersection point, and a segmentation line; the detailed description of the specific implementation manner is given in step S102 in the above embodiments, and is not repeated herein.
The first construction unit is used for constructing an undirected graph according to a first starting point, a junction point and a segmentation line; the detailed description of the specific implementation manner is given in step S103 in the above embodiments, and is not repeated herein.
A first determination unit configured to determine each connected component of the undirected graph; the detailed description of the specific implementation manner is given in step S104 in the above embodiments, and is not repeated herein.
The second determining unit is used for determining each subgraph in each connected component, each subgraph comprises at least one vertex, and when each subgraph comprises a plurality of vertices, at least two connecting paths exist between any two vertices in the subgraph; the detailed description of the specific implementation manner is given in step S105 in the above embodiments, and is not repeated herein.
The second construction unit is used for constructing a spanning tree by taking a subgraph including the first starting point as a root node, taking a subgraph not including the first starting point as a child node and a leaf node and taking a connecting line between the subgraphs as an edge for each connected component; the detailed description of the specific implementation manner is given in step S106 in the above embodiments, and is not repeated herein.
The second acquisition unit is used for acquiring at least one designated point selected by a user aiming at the standby name blood vessel; the detailed description of the specific implementation manner is given in step S107 in the above embodiments, and is not repeated herein.
And a third determining unit, configured to determine a first path from the root node to the designated point in the spanning tree when the designated point does not include the second starting point, and obtain a second centerline of the first-order vessel. The detailed description of the specific implementation manner is given in step S108 in the above embodiments, and is not repeated herein.
The device for determining the center line of the blood vessel provided by the embodiment of the invention obtains the blood vessel image; extracting a first central line of each blood vessel in the blood vessel image, wherein the first central line comprises a first starting point, an intersection point and a segmentation line; constructing an undirected graph according to the first starting point, the intersection point and the segmentation line; determining each connected component of the undirected graph; determining each subgraph in each connected component, wherein each subgraph comprises at least one vertex, and when each subgraph comprises a plurality of vertices, at least two connecting paths exist between any two vertices in the subgraph; for each connected component, constructing a spanning tree by taking a subgraph including a first starting point as a root node, taking a subgraph not including the first starting point as a child node and a leaf node and taking a connecting line between the subgraphs as an edge; acquiring at least one designated point selected by a user aiming at the vessel with the standby name; when the appointed point does not comprise a second starting point, a first path from the root node to the appointed point is determined in the spanning tree to obtain a second center line of the blood vessel with the ready name, so that the first center line of each blood vessel in the blood vessel image is converted from a complex graph structure into a tree structure comprising a plurality of subgraphs, when at least one appointed point selected by a user for the blood vessel to be named is obtained, a proper path can be found in the tree structure to obtain the second center line of the blood vessel with the ready name, and the second center line of the blood vessel to be named can be simply and quickly determined; and the subgraph is set as the node of the tree structure, so that only one spanning tree needs to be established for one connected component, and the calculation amount can be reduced when the second central line of the blood vessel to be named is determined.
Based on the same inventive concept as the method for determining a blood vessel centerline in the previous embodiment, the present invention also provides a computer having a computer program stored thereon, which when executed by a processor implements the steps of any one of the methods for determining a blood vessel centerline as described above.
Where in fig. 9 a bus architecture (represented by bus 300), bus 300 may include any number of interconnected buses and bridges, bus 300 linking together various circuits including one or more processors, represented by processor 302, and memory, represented by memory 304. The bus 300 may also link together various other circuits such as peripherals, voltage regulators, power management circuits, and the like, which are well known in the art, and therefore, will not be described any further herein. A bus interface 306 provides an interface between the bus 300 and the receiver 301 and transmitter 303. The receiver 301 and the transmitter 303 may be the same element, i.e., a transceiver, providing a means for communicating with various other apparatus over a transmission medium.
The processor 302 is responsible for managing the bus 300 and general processing, and the memory 304 may be used for storing data used by the processor 302 in performing operations.
Based on the same inventive concept as the method of determining a blood vessel centerline in the foregoing embodiments, the present invention also provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of:
acquiring a blood vessel image; extracting a first central line of each blood vessel in the blood vessel image, wherein the first central line comprises a first starting point, an intersection point and a segmentation line; constructing an undirected graph according to the first starting point, the intersection point and the segmentation line; determining each connected component of the undirected graph; determining each subgraph in each connected component, wherein each subgraph comprises at least one vertex, and when each subgraph comprises a plurality of vertices, at least two connecting paths exist between any two vertices in the subgraph; for each connected component, constructing a spanning tree by taking a subgraph including a first starting point as a root node, taking a subgraph not including the first starting point as a child node and a leaf node and taking a connecting line between the subgraphs as an edge; acquiring at least one designated point selected by a user aiming at the vessel with the standby name; when the designated point does not include the second starting point, a first path from the root node to the designated point is determined in the spanning tree, and a second central line of the standby name vessel is obtained.
In a specific implementation, when the program is executed by a processor, any method step in the first embodiment may be further implemented.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable information processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable information processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable information processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable information processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.