Trace curve editing method and device, electronic equipment and storage medium
By fitting the closed curves based on the cursor control points and the first control point sequence in real time, generating the real-time closed curve and replacing the curve to be edited, the problems of cumbersome and low efficiency of the tracing curve editing method in the prior art are solved, and a more efficient curve editing process is achieved.
Patent Information
- Application Number
- CN202311307370.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-10
- Publication Date
- 2025-04-11
AI Technical Summary
In the prior art, the tracing curve editing method is cumbersome and inefficient. When the user repeatedly edits, the last editing result will overwrite the next editing result, resulting in a significant increase in operation time.
By acquiring the first control point sequence, the closed curve fitting is performed based on the cursor control point and the first control point sequence in real time, a real-time closed curve is generated, and displayed in real time on the display interface. In response to the determination command entered by the user, replace the closed curve to be edited with the real-time closed curve.
It simplifies the user's operation process, improves the efficiency of curve editing, and avoids the problem of frequent coverage. Users can observe the curve effect in real time and replace it when the requirements are met.
Smart Images

Figure CN119810244A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of ultrasonic image processing, and in particular to a tracing curve editing method and device, electronic equipment and storage medium. Background Art
[0002] In the field of ultrasonic imaging, after acquiring an ultrasonic image of a target object to be observed (which can be any part or tissue in a biological body or any area in any part or tissue, such as a section of a blood vessel), in order to further detect the target object, such as measuring a measurement item of the target object, it is usually necessary to first determine the area where the target object is located. The area where the target object is located can be determined by tracing the edge of the target object. The following uses intravascular ultrasonic imaging technology as an example to describe the technical problems existing in the existing tracing technology.
[0003] Intravascular ultrasound imaging technology is an important method for evaluating the degree of coronary artery disease. By inserting the ultrasound probe of the ultrasound device into the coronary artery for imaging, an ultrasound image containing the coronary artery can be obtained. Then, by measuring the plaque load of the blood vessels on the ultrasound image, the degree of coronary artery disease can be evaluated. This method can provide an important basis for clinical diagnosis and treatment.
[0004] In the process of plaque load calculation, it is necessary to trace the edges of the inner and outer membranes of the blood vessels in the ultrasound image respectively. The tracing methods in the prior art mainly include manual tracing and automatic tracing. The manual tracing method mainly relies on the user's operation. The user can perform tracing operations through an input device, such as a mouse or a trackball. The automatic tracing method mainly relies on a tracing algorithm to automatically perform tracing operations. However, the tracing curves obtained by these two tracing methods deviate from the actual edges of the inner and outer membranes of the blood vessels on the ultrasound image, so the tracing curves need to be edited.
[0005] In the existing trace curve editing method, the original trace curve is directly replaced with a new trace curve. This existing curve editing method is not only cumbersome and inefficient, but also when the user repeatedly adjusts, the next editing result will overwrite the previous editing result, which brings great inconvenience to the user and greatly increases the operation time. Summary of the invention
[0006] The present invention is proposed in view of the above problems. The present invention provides a trace curve editing method, a trace curve editing device, an electronic device and a storage medium.
[0007] According to one aspect of the present invention, a method for editing a tracing curve is provided, comprising: obtaining a first control point sequence, each first control point in the first control point sequence is a control point on a closed curve to be edited, and the closed curve to be edited is a closed tracing curve used to indicate the position of the edge of a target object on an ultrasound image; performing closed curve fitting based on a cursor control point and at least part of the first control points in the first control point sequence in real time to obtain a real-time closed curve, wherein the cursor control point is a point corresponding to the current cursor position on the ultrasound image; displaying an ultrasound image with the real-time closed curve on a display interface in real time; and replacing the closed curve to be edited with the real-time closed curve in response to a first confirmation instruction input by a user.
[0008] Exemplarily, obtaining a first control point sequence includes: obtaining an initial closed curve, the initial closed curve being a closed tracing curve obtained by automatically tracing the edge of a target object on an ultrasound image; determining the curvature of each of a plurality of initial curve points on the initial closed curve; selecting a first control point sequence from the plurality of initial curve points based on the curvature; wherein a first angle between every two adjacent initial curve points in the plurality of initial curve points is less than or equal to a first angle threshold, the first angle being an angle between a line connecting any initial curve point and a target center in every two adjacent initial curve points and a line connecting another initial curve point and the target center, the target center being the center of the ultrasound image or the center of the initial closed curve, and the closed curve to be edited being a closed curve obtained by performing closed curve fitting based on each first control point in the first control point sequence.
[0009] Exemplarily, selecting a first control point sequence from a plurality of initial curve points based on curvature includes: selecting an initial curve point whose curvature is greater than a preset curvature threshold and is a maximum curvature value from the plurality of initial curve points as a second control point to obtain a second control point sequence; wherein the second control point sequence is the first control point sequence, or, selecting the first control point sequence from a plurality of initial curve points based on curvature also includes: determining a first control point sequence based on the second control point sequence, the first control point sequence including at least part of the second control points in the second control point sequence.
[0010] Exemplarily, before determining the first control point sequence based on the second control point sequence, selecting the first control point sequence from a plurality of initial curve points based on curvature further includes: when any of the target situations exists, performing a control point selection operation to determine a new second control point sequence; wherein the target situation includes: the number of second control points in the current second control point sequence is less than the first number, and / or the number of second control points in the current second control point sequence is greater than the second number, and the first number is less than or equal to the second number; wherein the control point selection operation includes: when the number of second control points in the current second control point sequence is less than the first number, For the remaining initial curve points other than the current second control point sequence among the multiple initial curve points, a third number of initial curve points with the largest curvature are selected from the remaining initial curve points, and each second control point in the current second control point sequence and the third number of initial curve points are determined as a new second control point sequence, wherein the third number is equal to the difference between the first number and the number of second control points included in the current second control point sequence; and / or, when the number of second control points in the current second control point sequence is greater than the second number, a second number of second control points with the largest curvature are selected from the current second control point sequence to be determined as a new second control point sequence.
[0011] Exemplarily, determining the first control point sequence based on the second control point sequence includes: performing a control point deletion operation and / or a control point insertion operation on the second control point sequence to obtain a new second control point sequence as the first control point sequence; wherein the control point deletion operation includes: traversing each second control point in the second control point sequence, and for each traversed second control point, performing the following operations: respectively calculating the second angle between the second control point and each remaining second control point in the second control point sequence except the second control point; if the second angle between the second control point and any remaining second control point is less than or equal to a second angle threshold and the second control point is a point with the smallest curvature in the second control point sequence, then The second control point is deleted from the second control point sequence; wherein the second angle is the angle between the line connecting the second control point and the target center and the line connecting the remaining second control points and the target center; wherein the control point insertion operation includes: for any two adjacent second control points in the second control point sequence, sequentially calculating the third angle between the two adjacent second control points; if the third angle is greater than or equal to the third angle threshold, selecting at least one initial curve point located between the two adjacent second control points on the initial closed curve as a new second control point, and adding the new second control point to the second control point sequence; wherein the third angle is the angle between the lines connecting the two adjacent second control points and the target center respectively.
[0012] Exemplarily, among at least one initial curve point and two adjacent second control points, the third angles between every two adjacent control points are equal.
[0013] Exemplarily, obtaining the first control point sequence includes: determining the first control point sequence in response to a control point setting instruction input by a user; wherein the closed curve to be edited is a closed tracing curve obtained by manually tracing each first control point in the first control point sequence.
[0014] Exemplarily, performing closed curve fitting based on the cursor control point and at least part of the first control points in the first control point sequence in real time to obtain a real-time closed curve includes: calculating the target parameters between the cursor control point and each first control point in the first control point sequence in real time; when any one of the target parameters between the cursor control point and any first control point is less than or equal to the corresponding preset parameter threshold, performing closed curve fitting based on the cursor control point and the remaining first control points in the first control point sequence except the first control point to obtain a real-time closed curve; when each of the target parameters between the cursor control point and each first control point is greater than the corresponding preset parameter threshold, performing closed curve fitting based on the cursor control point and the first control point sequence to obtain a real-time closed curve; wherein the target parameters include: a fourth angle between the cursor control point and the first control point, and / or a distance between the cursor control point and the first control point; wherein the fourth angle is the angle between a line connecting the cursor control point and the target center and a line connecting the first control point and the target center, and the target center is the center of the ultrasound image or the center of the closed curve to be edited.
[0015] Exemplarily, the method further includes: in response to a first determination instruction input by a user, replacing the first control point sequence with a control point sequence for generating a real-time closed curve.
[0016] Exemplarily, before performing closed curve fitting based on the cursor control point and at least part of the first control points in the first control point sequence in real time to obtain a real-time closed curve, the method also includes: in response to an editing instruction input by a user, determining that the closed curve to be edited is in an editable state; wherein, the step of performing closed curve fitting based on the cursor control point and at least part of the first control points in the first control point sequence in real time to obtain a real-time closed curve is performed when the closed curve to be edited is in an editable state.
[0017] Exemplarily, in response to the second determination instruction input by the user, it is determined to end the editing of the closed curve to be edited and to make the closed curve to be edited exit the editable state.
[0018] According to another aspect of the present invention, there is also provided a device for editing a traced closed curve, comprising: an acquisition module for acquiring a first control point sequence, wherein each first control point in the first control point sequence is a control point on a closed curve to be edited, and the closed curve to be edited is a closed tracing curve for indicating the position of the edge of a target object on an ultrasound image; a fitting module for performing closed curve fitting based on a cursor control point and at least part of the first control points in the first control point sequence in real time to obtain a real-time closed curve, wherein the cursor control point is a point corresponding to the current cursor position on the ultrasound image; a display module for displaying an ultrasound image with a real-time closed curve on a display interface in real time; and a first replacement module for replacing the closed curve to be edited with the real-time closed curve in response to a first determination instruction input by a user.
[0019] According to another aspect of the present invention, there is also provided an electronic device, comprising a processor and a memory, wherein a computer program is stored in the memory, and the computer program instructions are used to execute the above-mentioned trace curve editing method when the processor runs the computer program.
[0020] According to yet another aspect of the present invention, there is also provided a storage medium storing a computer program / instruction, wherein the computer program / instruction is used to execute the above-mentioned trace curve editing method when running.
[0021] According to the tracing curve editing method, tracing curve editing device, electronic device and storage medium of the embodiment of the present invention, a closed curve can be fitted in real time based on the cursor position and displayed on the display interface, so that the user can view the fitting result of the tracing curve in real time to help the user quickly find a tracing curve that meets the needs. The scheme of displaying a real-time closed curve based on the cursor position does not require the user to specifically set a control point, which can reduce the complexity of the editing operation. In addition, the method replaces the closed curve to be edited with the real-time closed curve after the user enters the first determination instruction. When the user does not enter the first determination instruction, the real-time closed curve is generated and displayed in real time following the cursor position. This scheme, on the basis of ensuring that the user can observe the curve effect in real time, facilitates the user to replace the real-time closed curve when it meets the user's requirements, and avoids frequent coverage of the closed curve to be edited. This scheme can effectively simplify the user's operation process, thereby greatly improving the efficiency of curve editing.
[0022] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] The above and other purposes, features and advantages of the present invention will become more apparent by describing the embodiments of the present invention in more detail in conjunction with the accompanying drawings. The accompanying drawings are used to provide a further understanding of the embodiments of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings, the same reference numerals generally represent the same components or steps.
[0024] Figure 1 A schematic block diagram of a trace curve editing method according to an embodiment of the present invention is shown;
[0025] Figure 2 A schematic diagram showing an initial closed curve and a closed curve to be edited according to an embodiment of the present invention is shown;
[0026] Figure 3 A schematic diagram showing a real-time closed curve and a closed curve to be edited according to an embodiment of the present invention is shown;
[0027] Figure 4 A schematic block diagram of a trace curve editing method according to an embodiment of the present invention is shown;
[0028] Figure 5 A schematic block diagram showing a trace curve editing device according to an embodiment of the present invention; and
[0029] Figure 6 A schematic block diagram of an electronic device according to an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0030] In order to make the purpose, technical scheme and advantages of the present invention more obvious, the exemplary embodiments according to the present invention will be described in detail with reference to the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments of the present invention, and it should be understood that the present invention is not limited to the exemplary embodiments described herein. Based on the embodiments described in the present invention, all other embodiments obtained by those skilled in the art without creative work should fall within the protection scope of the present invention.
[0031] In order to solve the above technical problem, the present invention provides a tracing curve editing method. Figure 1 A schematic block diagram of a trace curve editing method 100 according to an embodiment of the present invention is shown. Figure 1 As shown, the method 100 may include the following steps S110, S120, S130 and S140.
[0032] Step S110, obtaining a first control point sequence, wherein each first control point in the first control point sequence is a control point on a closed curve to be edited, and the closed curve to be edited is a closed tracing curve used to indicate the position of the edge of the target object on the ultrasound image.
[0033] Exemplarily, an electronic device for executing the tracing curve editing method 100 may include a processing device, a display device, an input device, and the like. In the electronic device, the tracing curve editing method 100 may be specifically executed by a processing device. The input device may include, but is not limited to, one or more of the following: a keyboard, a mouse, a touch screen, a touchpad, and the like. The touchpad may be referred to as a control panel. The display device may be used to display the acquired ultrasound image. The ultrasound image may be an image acquired for any target object, such as an intravascular ultrasound image, a musculoskeletal ultrasound image, and the like. The target object may be any specific part or tissue in a biological body or a specific area in any specific part or tissue. In one embodiment of the present invention, the target object is a blood vessel, and the ultrasound image may be an intravascular ultrasound image. The closed curve to be edited may be a closed tracing curve at the location of the edge (inner edge or outer edge) of the blood vessel on the intravascular ultrasound image. The closed curve to be edited may be a closed tracing curve obtained by manual tracing, or a closed tracing curve obtained by automatic tracing, or a closed tracing curve obtained by further processing the closed curve obtained by manual tracing or automatic tracing, for example, a closed tracing curve obtained by smoothing the closed curve obtained by manual tracing, etc. The present invention does not impose any limitation on this.
[0034] Each first control point in the first control point sequence may be a control point on the closed curve to be edited. The first control point sequence may be obtained in any manner. For example, if the closed curve to be edited is a closed tracing curve obtained by manual tracing, then each first control point may be a plurality of control points manually selected by the user for generating the closed curve to be edited. For another example, if the closed curve to be edited is a closed tracing curve obtained by automatic tracing, then each first control point may be a plurality of control points arbitrarily selected by the user on the obtained closed curve to be edited. Each first control point in the first control point sequence may have respective position information, and the position information indicates the position of the corresponding first control point on the ultrasound image. For example, if the image size of the ultrasound image is 1000 pixels × 1000 pixels, if the position information corresponding to the first control point A in the first control point sequence is (100, 100), then it may be indicated that the position of the first control point A on the ultrasound image is the pixel point at the 100th row and the 100th column.
[0035] Step S120 , performing closed curve fitting based on the cursor control point and at least part of the first control points in the first control point sequence in real time to obtain a real-time closed curve, wherein the cursor control point is a point corresponding to the current cursor position on the ultrasound image.
[0036] Exemplarily, the above-mentioned input device may include a mouse or a touchpad. The user may change the position of the cursor in the display interface by moving the position of the mouse or operating the trackball on the touchpad. In this way, when the cursor is at any position on the display interface, there is a point corresponding to the current cursor position on the ultrasound image. The point corresponding to the current cursor position on the ultrasound image may be used as a cursor control point. Exemplarily, a closed curve may be fitted based on the cursor control point and all the first control points in the first control point sequence, or a closed curve may be fitted based on the cursor control point and some of the first control points in the first control point sequence. For example, any one of the two first control points that are closer in the first control point sequence may be discarded. When the cursor position changes, the cursor control point will change in real time with the cursor position, and then the real-time closed curve obtained after the closed curve fitting can be displayed in real time on the display interface.
[0037] In step S120, the closed curve fitting method used may include but is not limited to one or more of the following: least squares curve fitting algorithm, cubic natural spline curve fitting algorithm, Hermite spline curve fitting algorithm, cardinal spline curve fitting algorithm, etc. In one embodiment of the present invention, the Cardinal spline curve fitting algorithm may be used for closed curve fitting.
[0038] Step S130: Displaying the ultrasound image with the real-time closed curve on the display interface in real time.
[0039] For example, based on the obtained real-time closed curve, an ultrasound image with the current real-time closed curve can be displayed in real time on the display interface of the host computer. When the cursor position changes, the real-time closed curve corresponding to the changed cursor position can be displayed in real time on the display interface.
[0040] Step S140: In response to a first determination instruction input by the user, the closed curve to be edited is replaced with the real-time closed curve.
[0041] Exemplarily, the user may input a first determination instruction through an input device. For example, the user may input text information such as "OK" through the keyboard, indicating that the closed curve to be edited is replaced with the current real-time closed curve. For another example, the display interface may include a first determination control, and the user may click the first determination control with the mouse to indicate that the closed curve to be edited is replaced with the current real-time closed curve. In one embodiment of the present invention, the user may input the first determination instruction by clicking the left set button on the touchpad. When the user clicks the left set button on the touchpad, the closed curve to be edited may be replaced with the current real-time closed curve. The electronic device for executing the tracing curve editing method 100 may also include a storage device, and the above-mentioned "replacing the closed curve to be edited with the current real-time closed curve" may be understood as overwriting the closed curve to be edited stored in the storage device with the current real-time closed curve, or deleting the closed curve to be edited stored in the storage device and storing the current real-time closed curve in the storage device.
[0042] According to the above technical solution, a closed curve can be fitted in real time based on the cursor position and displayed on the display interface, so that the user can view the fitting result of the tracing curve in real time to help the user quickly find a tracing curve that meets the needs. The solution of displaying a real-time closed curve based on the cursor position does not require the user to specifically set a control point, which can reduce the complexity of the editing operation. In addition, the method replaces the closed curve to be edited with the real-time closed curve after the user enters the first determination instruction. When the user does not enter the first determination instruction, the real-time closed curve is generated and displayed in real time following the cursor position. This solution, on the basis of ensuring that the user can observe the curve effect in real time, facilitates the user to replace the real-time closed curve when it meets the user's requirements, and avoids frequent coverage of the closed curve to be edited. This solution can effectively simplify the user's operating process, thereby greatly improving the efficiency of curve editing.
[0043] Exemplarily, obtaining a first control point sequence may include: obtaining an initial closed curve, the initial closed curve being a closed tracing curve obtained by automatically tracing the edge of a target object on an ultrasound image; determining the curvature of each of a plurality of initial curve points on the initial closed curve; and selecting a first control point sequence from the plurality of initial curve points based on the curvature; wherein a first angle between every two adjacent initial curve points in the plurality of initial curve points is less than or equal to a first angle threshold, the first angle being an angle between a line connecting any initial curve point and a target center in every two adjacent initial curve points and a line connecting another initial curve point and the target center, the target center being the center of the ultrasound image or the center of the initial closed curve, and the closed curve to be edited being a closed curve obtained by performing closed curve fitting based on each first control point in the first control point sequence.
[0044] Exemplarily, the user can input the automatic tracing instruction through the input device, for example, the user can input the automatic tracing instruction by clicking the "automatic tracing" control on the touch panel. The processing device in the electronic device for executing the tracing curve editing method 100 can automatically generate a closed tracing curve corresponding to the edge of the target object on the ultrasound image in response to the automatic tracing instruction. The closed tracing curve can be used as an initial closed curve. It should be noted that the input method of the above-mentioned automatic tracing instruction is only an example, and the user can also input the automatic tracing instruction in other ways. For example, the user can also input text information such as "automatic tracing" through the keyboard and click the confirmation control to input the automatic tracing instruction. The present invention does not limit this. In addition, the implementation scheme of the user inputting the automatic tracing instruction to control the automatic tracing operation (i.e., generating a closed tracing curve corresponding to the edge of the target object on the ultrasound image) is also only an example, and the electronic device for executing the tracing curve editing method 100 can automatically start to perform the automatic tracing operation after acquiring the ultrasound image.
[0045] Since the initial closed curve generated by automatic tracing is not a spline curve, if the curve is edited directly using the spline curve fitting method in the subsequent curve editing process, the traced curve will undergo instantaneous mutations. In addition, the spline curve fitting itself also requires the control points on the original traced curve. Therefore, the first control point sequence can be determined on the initial closed curve, and then the spline curve fitting is performed based on the first control point sequence to obtain the curve to be edited to replace the initial closed curve obtained by automatic tracing. The subsequent curve editing can be performed based on the curve to be edited. This can avoid the sudden change of the traced curve and improve the accuracy of curve fitting.
[0046] There are multiple initial curve points on the initial closed curve, and the multiple initial curve points are discretely distributed on the initial closed curve. The first angle between any two adjacent initial curve points among the multiple initial curve points may be less than or equal to the first angle threshold. The first angle may be the angle between the lines connecting any two adjacent initial curve points and the target center. The target center is the center of the ultrasound image or the center of the initial closed curve. In one example, if the initial closed curve is located in the middle area of the ultrasound image, then the target center may be the center of the ultrasound image or the center of the initial closed curve; if the initial closed curve is not located in the middle area of the ultrasound image (for example, the initial closed curve is located in the lower left corner area of the ultrasound image), then the target center may be the center of the initial closed curve. The first angle threshold may be set as needed, and it may be any angle greater than 0 degrees (°). Exemplarily, the first angle threshold may be in the range of (0°, 180°]. For example, the first angle threshold θ FTIt may be equal to 60°, 70°, 80° or 90°, etc. In one embodiment of the present invention, the first angle threshold may be equal to 90°. Exemplarily, a plurality of initial curve points may be automatically determined by the above-mentioned processing device on the initial closed curve. After obtaining the initial closed curve, the curvature of each initial curve point on the initial closed curve may be obtained by any curvature calculation method. The curvature calculation method may include but is not limited to one or more of the following: an arc length-based angle estimation (Arc Length-based Angle Estimator, AAE) method, an eigenvector-based angle estimation (Eigenvector-basedAngleEstimator, EAE) method, a Chebyshev fitting curve (CCE) method, and a relative tangent-to-point distance accumulation (RTPDA) method. It is preferable to use the RTPDA method to determine the curvature of the initial curve points. The RTPDA method has high robustness and high computational efficiency.
[0047] The following is an example of solving the curve curvature using the RTPDA method. This method mainly calculates the curvature of a point by calculating the sum of the distances from the tangent line of a point on the curve and all points in the neighborhood (support domain) of the point to the tangent line. The specific calculation steps are as follows:
[0048] ① The curvature of a point on the curve requires the participation of other points in the neighborhood (support domain) of the point, so it is assumed that the point sequence For point (x i ,y i ) has a support domain of radius n, and then solves the point (x i ,y i ) is mainly solved by parameterizing the arc length of the curve to obtain the tangent line equation at point (x i ,y i ) is the direction vector of the tangent line at .
[0049] The calculation to determine the arc length of a point series is as follows:
[0050]
[0051] Where S i = 0, then the point sequence It can be parameterized into two arc length parameter coordinate point lists and (This expression is only to make the arc length variable parameterized to 0 at the target point), and then use the following quadratic polynomial to fit the two arc length point series:
[0052]
[0053] Then, the coefficients α = (α0, α1, α2) and β = (β0, β1, β2) are solved so that x(s) and y(s) are the solutions of the two arc length parameters in the sense of least quadratic fitting, and the following solution is solved by the optimal solution theory:
[0054]
[0055] The respective values are as follows:
[0056]
[0057] ②Solve the tangent vector, using x(s)=a0+a1s+a2s 2 For example, the first-order derivative of the function x(s) at the target parameter point is: Similarly, the first-order derivative of y(s) at the target parameter point can be obtained as:
[0058] So the vector That is, the point (x i ,y i ) is the direction vector of the tangent line at .
[0059] ③From ②, we can know that the point on the curve (x i ,y i ) can be estimated as (α1, β1), then the point sequence in the support domain is Any point (x i+j ,y i+j ) to the tangent line l is:
[0060]
[0061] Then the point series in the domain is supported The distance to the tangent line l is accumulated as:
[0062]
[0063] The Tangent-to-Point Distance Accumulation (TPDA) method is used as a new estimation method for curve curvature. In order to make the calculated TPDA invariant to scale changes and improve the robustness of the algorithm, the following RTPDA is used as the curve curvature:
[0064]
[0065] Based on the curvature of each initial curve point on the obtained initial closed curve, at least some of the initial curve points can be selected as the first control points in the first control point sequence, that is, the first control point sequence is obtained. The scheme for selecting the first control point is arbitrary and can be set as needed. In one embodiment, a curvature threshold value, such as 0.6, can be set in advance, and the initial curve points with a curvature greater than the curvature threshold value are used as the first control points. In another embodiment, some of the initial curve points with the largest curvature can be selected, for example, the four initial curve points with the largest curvature are selected as the first control points. If the distribution of these four initial curve points on the initial closed curve is relatively dense, new initial curve points with a farther distribution can continue to be selected from the initial closed curve as the first control points, so that the distribution of the multiple first control points finally obtained on the initial closed curve is relatively discrete.
[0066] The closed curve to be edited is a closed curve obtained by performing closed curve fitting based on each first control point in the first control point sequence. The closed curve fitting method may include but is not limited to one or more of the following: a least squares curve fitting algorithm, a cubic natural spline curve fitting algorithm, a Hermite spline curve fitting algorithm, a cardinal spline curve fitting algorithm, etc. In one embodiment of the present invention, a Cardinal spline curve fitting algorithm may be used to perform closed curve fitting. Figure 2 FIG. 1 is a schematic diagram showing an initial closed curve and a closed curve to be edited according to an embodiment of the present invention. Figure 2 In the figure, the closed curve represented by the dotted line is the initial closed curve, and the closed curve represented by the solid line is the closed curve to be edited. Figure 2 As shown, A1, A2, A3, A4 and A5 are the first control points selected from the initial closed curve (A6 is a new control point inserted later, which will be described below), and these control points form a first control point sequence. The solid closed curve is the closed curve to be edited obtained after the closed curve fitting is performed on each first control point.
[0067] The closed curve fitting method may include a curve interpolation algorithm. After obtaining the first control point sequence C, a closed curve to be edited may be generated according to the curve interpolation algorithm to replace the initial closed curve. Exemplarily, a cubic natural spline curve fitting algorithm may be used to generate a closed curve to be edited. Since cubic spline curves make a reasonable compromise between flexibility and calculation speed, they are widely used in curve interpolation fitting. Compared with higher-order spline curves, cubic spline curves require less calculation and storage and are more stable; compared with quadratic spline curves, cubic spline curves are more flexible in simulating arbitrary shapes.
[0068] The cubic spline curve is described by a piecewise cubic polynomial. If its parameter is t, the general form of the piecewise cubic spline curve expression is:
[0069] P(t)=B1+B2t+B3t 2 +B4t 3 (0≤t≤1) (8)
[0070] Among them, P(t i )=[x(t i ),y(t i )] is the position vector of a point on the cubic spline curve segment, t i is the parameter variable of the point, x(t i ) and y(t i ) is the coordinate value of the point.
[0071] The n control points on the initial closed curve can generate n curve segments. Each curve segment needs to determine the four unknown coefficients B1, B2, B3 and B4, so four independent conditions need to be set. Different methods of determining the four unknown coefficients will result in different cubic spline curves, the common ones are cubic natural spline curves, Hermite spline curves, Cardinal spline curves, etc.
[0072] In one embodiment of the present invention, a Cardinal spline curve fitting algorithm may be used to perform closed curve fitting. The following uses the Cardinal spline curve as an example to illustrate the cubic spline curve fitting process.
[0073] As mentioned above, calculating the piecewise cubic spline curve requires determining four unknown coefficients, and the four unknown coefficients of the Cardinal spline curve segment are given by four continuous control points, of which the middle two control points are used as the endpoints of the Cardinal spline curve segment, and the other two control points are used to calculate the slopes of the endpoints of the Cardinal spline curve segment. Therefore, the four coefficients of the curve segment expression (2) can be obtained as follows:
[0074]
[0075] Among them, the control point P k and P k+1 The slope P′ k and P′ k+1 With the string P k-1 P k+1 and P k P k+2 Proportional, expressed as:
[0076]
[0077] Among them, the parameter t sIt is the tension parameter, which is used to control the tightness between the Cardinal spline curve segment and the input control point.
[0078] Combining formulas (1)-(3) we can get the polynomial form of the Cardinal spline curve:
[0079]
[0080] Therefore, the coordinates of each point on the cubic spline curve segment can be calculated by formula (4), where s = (1-t s ) / 2.
[0081] The closed curve fitting method used to determine the real-time closed curve in step S120 is similar to the closed curve fitting method used to determine the closed curve to be edited in the above-mentioned implementation principle, and the implementation of step S120 can be understood in conjunction with the description of the closed curve fitting method in this embodiment. The closed curve fitting method used to determine the real-time closed curve in step S120 can be the same as or different from the closed curve fitting method used to determine the closed curve to be edited in the above-mentioned method.
[0082] According to the above technical solution, for the initial closed curve obtained by automatic tracing on the ultrasound image, a first control point sequence is selected based on the curvature of each initial curve point on the initial closed curve. The curvature of each initial curve point on the initial closed curve can determine the changing trend of the curve more accurately. Therefore, the first control point is selected based on the curvature, so that the selected first control point can better reflect the changing trend of the initial closed curve, which in turn helps to make the subsequently determined curve to be edited closer to the initial closed curve. The closed curve obtained by fitting the closed curve based on each first control point in the first control point sequence is used as the closed curve to be edited, which can ensure that the curve is relatively smooth and avoid sudden changes. The above-mentioned scheme of obtaining the first control point sequence under automatic tracing can be automatically implemented by the processing device, which can effectively improve the efficiency of curve editing.
[0083] Exemplarily, selecting a first control point sequence from a plurality of initial curve points based on curvature may include: selecting an initial curve point whose curvature is greater than a preset curvature threshold and is a maximum curvature value from the plurality of initial curve points as a second control point to obtain a second control point sequence; wherein the second control point sequence is the first control point sequence, or, selecting a first control point sequence from a plurality of initial curve points based on curvature may further include: determining a first control point sequence based on the second control point sequence, the first control point sequence including at least part of the second control points in the second control point sequence.
[0084] Exemplarily, the user can pre-set a preset curvature threshold. The preset curvature threshold can be used to screen the initial curve points on the initial closed curve to select some of the initial curve points from the initial closed curve as the second control points. The preset curvature threshold can be set to a value of any size as needed. Exemplarily, the preset curvature threshold can be any value in the range of [0, 1]. For example, the preset curvature threshold can be equal to 0.6, 0.7 or 0.8, etc. In one embodiment of the present invention, the preset curvature threshold can be equal to 0.6. In addition to the preset curvature threshold, the curvature maximum value can also be used as a condition for selecting the first control point from the initial closed curve. Exemplarily, see Figure 2 , the initial curve points selected from the initial closed curve whose curvature is greater than the preset curvature threshold (0.6) and is the maximum curvature value can be A1, A2, A3, A4 and A5 respectively, and these 5 initial curve points can be used as second control points respectively. Exemplarily and not restrictively, the positions of the second control points on the ultrasound image can be used to represent the second control points. For example, if the position of A1 on the ultrasound image is (300, 300), the position of A2 on the ultrasound image is (200, 600), the position of A3 on the ultrasound image is (500, 800), the position of A4 on the ultrasound image is (800, 700), and the position of A5 on the ultrasound image is (750, 200), then the second control point sequence can be obtained as {(300, 300), (200, 600), (500, 800), (800, 700), (750, 200)}.
[0085] In one embodiment, the obtained second control point sequence can be directly used as the first control point sequence in the above embodiment, that is, each first control point in the first control point sequence is the same as each second control point in the second control point sequence. This solution does not require further processing of the second control point sequence, is relatively simple to implement, and is conducive to further improving the efficiency of curve editing. In another embodiment, the first control point sequence can be further determined based on the second control point sequence. For example, any one of the two second control points that are closer in the second control point sequence can be deleted from the second control point sequence, or a new control point can be inserted between the two second control points that are farther apart in the second control point sequence. This solution can further process the second control point sequence to obtain a first control point sequence that can better meet the requirements in terms of position, quantity, etc.
[0086] According to the above technical solution, a point whose curvature is greater than a preset curvature threshold and is a maximum curvature value is selected from the initial closed curve as a second control point to determine a second control point sequence. The second control point sequence can be directly used as the first control point sequence or the first control point can be determined based on the second control point sequence. The trend of the curve is mainly determined by the point with a large curvature change. Therefore, selecting an initial curve point with a large curvature from the initial closed curve as the second control point helps to further improve the degree of closeness between the subsequently fitted curve to be edited and the initial closed curve. In addition, selecting the initial curve point corresponding to the maximum curvature value can avoid the selected initial curve points being too concentrated on a curve segment, which helps to improve the accuracy of curve fitting.
[0087] Exemplarily, before determining the first control point sequence based on the second control point sequence, selecting the first control point sequence from multiple initial curve points based on curvature may also include: when any of the target situations exists, performing a control point selection operation to determine a new second control point sequence.
[0088] In one embodiment, the target situation may include: the number of second control points in the current second control point sequence is less than the first number; wherein the control point selection operation may include: when the number of second control points in the current second control point sequence is less than the first number, for the remaining initial curve points other than the current second control point sequence among the multiple initial curve points, selecting a third number of initial curve points with the largest curvature from the remaining initial curve points, and determining each second control point in the current second control point sequence and the third number of initial curve points as a new second control point sequence, wherein the third number is equal to the difference between the first number and the number of second control points contained in the current second control point sequence.
[0089] Exemplarily, the target situation may include: the number of second control points in the current second control point sequence is less than the first number C min For example, the user can preset the first number C min The size of, for example, the first number C min It can be equal to 3, 4, 5 or 6, or any value greater than 0. In one example, the first number C min Can be equal to 4.
[0090] Below is the first number C minThe description is made by taking 4 as an example. If the number of second control points in the current second control point sequence is less than 4, for example, the number of second control points in the current second control point sequence is 3, then for the remaining initial curve points on the initial closed curve except the current 3 second control points, the third number of points with the largest curvature are selected from the remaining initial curve points. The third number may be equal to the difference between the first number (i.e., 4) and the number of second control points in the current second control point sequence (i.e., 3), that is, the third number is equal to 1. The curvatures of the remaining initial curve points may be arranged in order from large to small or from small to large, and one initial curve point with the largest curvature may be selected from them as a new second control point. Then, each second control point in the current second control point sequence and one new second control point are determined as a new second control point sequence.
[0091] According to the above technical solution, when the number of second control points in the current second control point sequence is less than the first number, some initial curve points are selected from the remaining initial curve points to supplement the second control point sequence. In this way, it is possible to avoid the number of second control points in the second control point sequence being too small, so as to ensure the accuracy of subsequent editing of the traced closed curve.
[0092] In another embodiment, the target situation may include: the number of second control points in the current second control point sequence is greater than the second number, and the first number is less than or equal to the second number; wherein the control point selection operation may include: when the number of second control points in the current second control point sequence is greater than the second number, selecting the second number of second control points with the largest curvature from the current second control point sequence as a new second control point sequence.
[0093] Exemplarily, the target situation may include: the number of second control points in the current second control point sequence is greater than the second number C max Similar to the first number, the user can preset the second number C max The size of the second number C max It can be equal to 7, 8, 9 or 10, or any value greater than 0. In one example, the second number C max Can be equal to 10.
[0094] Next, the second number C max The description is made by taking 10 as an example. If the number of second control points in the current second control point sequence is greater than 10, for example, the number of second control points in the current second control point sequence is 12, then 10 second control points with the largest curvatures can be selected from the current second control point sequence to serve as the second control points in the new second control point sequence.
[0095] According to the above technical solution, when the number of second control points in the current second control point sequence is greater than the second number, some of the second control points are deleted, which can reduce the amount of calculation to a certain extent and improve the efficiency of curve editing.
[0096] In another embodiment, the target situation may include: the number of second control points in the current second control point sequence is less than the first number, and, the number of second control points in the current second control point sequence is greater than the second number, and the first number is less than or equal to the second number; wherein the control point selection operation may include: when the number of second control points in the current second control point sequence is less than the first number, for the remaining initial curve points other than the current second control point sequence among the multiple initial curve points, selecting a third number of initial curve points with the largest curvature from the remaining initial curve points, and determining each second control point and the third number of initial curve points in the current second control point sequence as a new second control point sequence, wherein the third number is equal to the difference between the first number and the number of second control points included in the current second control point sequence; and, when the number of second control points in the current second control point sequence is greater than the second number, selecting the second number of second control points with the largest curvature from the current second control point sequence as a new second control point sequence.
[0097] When the target situation includes: the number of second control points in the current second control point sequence is less than the first number, and the number of second control points in the current second control point sequence is greater than the second number, the second number may be greater than the first number.
[0098] According to the above technical solution, when the number of second control points in the current second control point sequence is less than the first number, some initial curve points are selected from the remaining initial curve points to be added to the second control point sequence, and when the number of second control points in the current second control point sequence is greater than the second number, some second control points are deleted. In this way, it is possible to avoid too few or too many second control points in the second control point sequence, and control the number of second control points within a reasonable range, so as to reduce the amount of calculation while ensuring the accuracy of subsequent editing of the traced closed curve.
[0099] In one embodiment, determining the first control point sequence based on the second control point sequence may include: performing a control point deletion operation on the second control point sequence to obtain a new second control point sequence as the first control point sequence; wherein the control point deletion operation includes: traversing each second control point in the second control point sequence, and for each traversed second control point, performing the following operations: respectively calculating the second angle between the second control point and each remaining second control point in the second control point sequence except the second control point; if the second angle between the second control point and any remaining second control point is less than or equal to a second angle threshold and the second control point is a point with the smallest curvature in the second control point sequence, then deleting the second control point from the second control point sequence; wherein the second angle is the angle between a line connecting the second control point and the target center and a line connecting the remaining second control points and the target center; wherein the target center is the center of the ultrasound image or the center of the initial closed curve.
[0100] The control points in the second control point sequence may be densely distributed, which will cause a certain degree of waste of computing resources. In this case, some densely distributed second control points can be optionally deleted from the second control point sequence. For each second control point in the second control point sequence, a control point deletion operation can be performed to delete some control points in the second control point sequence to obtain a new second control point sequence as the first control point sequence. Exemplarily, the control point deletion operation may include the following steps. Traverse each second control point in the second control point sequence, and perform the following operations for each traversed second control point. For example, for the second control point A1, calculate the second angle θ between the second control point A1 and the second control points A2, A3, A4 and A5 respectively F Among them, the second angle θ F is the angle between the line connecting the second control point and the target center and the line connecting another second control point and the target center. The target center may be the center of the ultrasound image or the center of the initial closed curve.
[0101] Reference Figure 2 , the second included angle between the second control point A1 and the second control point A5 can be expressed as θ F15 If the second included angle θ between the second control point A1 and any second control point among the second control points A2, A3, A4 and A5 is F Less than or equal to the second angle threshold θ FT , and the second control point A1 is the point with the smallest curvature in the second control point sequence, then the second control point A1 can be deleted from the second control point sequence. FT It can be set as needed, and it can be any angle greater than 0°. For example, the second angle threshold θ FTIt can be in the range of (0°, 20°]. For example, the second angle threshold θ FT It can be equal to 8°, 9° or 10°, etc. In one embodiment of the present invention, the second angle threshold θ FT It can be equal to 10°. If the second control point A1 in the second control point sequence is deleted, the second control points included in the new second control point sequence are A2, A3, A4 and A5 respectively. If the second included angle θ between the second control point A1 and any of the second control points A2, A3, A4 and A5 is F Less than or equal to the second angle threshold θ FT , but the second control point A1 is not the point with the smallest curvature in the second control point sequence, then the second control point A1 may not be deleted from the second control point sequence. In a similar manner, each second control point in the second control point sequence may be traversed in sequence to obtain a new second control point sequence.
[0102] According to the above technical solution, by performing a control point deletion operation on the second control point sequence, a new second control point sequence is obtained as the first control point sequence. This solution can avoid the control points in the second control point sequence being too densely distributed, thereby reducing the waste of computing resources.
[0103] In another embodiment, determining the first control point sequence based on the second control point sequence may include: performing a control point insertion operation on the second control point sequence to obtain a new second control point sequence as the first control point sequence; wherein the control point insertion operation includes: for any two adjacent second control points in the second control point sequence, sequentially calculating the third angle between the two adjacent second control points; if the third angle is greater than or equal to a third angle threshold, selecting at least one initial curve point located between the two adjacent second control points on the initial closed curve as a new second control point, and adding the new second control point to the second control point sequence; wherein the third angle is the angle between the lines connecting each of the two adjacent second control points and the target center.
[0104] The distribution of control points in the second control point sequence may be relatively scattered, which may affect the accuracy of subsequent curve fitting. In this case, some new second control points may be optionally inserted into the second control point sequence. For each second control point in the second control point sequence, a new second control point may be inserted between any two adjacent control points in the second control point sequence through a control point insertion operation to obtain a new second control point sequence as the first control point sequence. Exemplarily, the control point insertion operation may include the following steps. For any two adjacent second control points in the second control point sequence, for example Figure 2 The second control point A4 and the second control point A5 shown in FIG. 1 can calculate the third angle θ between the two second control points. S45If the third angle θ S45 Greater than or equal to the third angle threshold θ ST , then at least one initial curve point between two adjacent second control points can be selected from the initial closed curve as a new second control point. S is the angle between the lines connecting two adjacent second control points and the target center. The target center is the center of the ultrasound image or the center of the initial closed curve. The third angle threshold θ ST It can be set as needed, and it can be any angle greater than 0°. For example, the third angle threshold θ ST It can be in the range of [20°, 60°]. For example, the third angle threshold θ ST It can be equal to 50°, 55° or 60°, etc. In one embodiment of the present invention, the third angle threshold θ ST Can be equal to 60°. If the third angle θ S45 If the angle θ between the second control point A4 and the second control point A5 is greater than or equal to 60°, one or more initial curve points between the second control point A4 and the second control point A5 can be arbitrarily selected from the initial closed curve as new second control points. For example, an initial curve point between the second control point A4 and the second control point A5 is selected as a new second control point A6. The new second control point A6 is added to the second control point sequence. That is, the second control points in the new second control point sequence are A1, A2, A3, A4, A5 and A6. In a similar manner, the third angle θ between any two adjacent second control points in the second control point sequence can be calculated in sequence. S , at the third angle θ S Greater than or equal to the third angle threshold θ ST , at least one initial curve point located between two adjacent second control points is selected from the initial closed curve as a new second control point, and the new second control point is added to the second control point sequence.
[0105] According to the above technical solution, by performing control point insertion operation on the second control point sequence, a new second control point sequence is obtained as the first control point sequence. This solution can avoid the control points in the second control point sequence from being too dispersed, thereby improving the accuracy of subsequent curve fitting.
[0106] In another embodiment, determining the first control point sequence based on the second control point sequence includes: performing a control point deletion operation and a control point insertion operation on the second control point sequence to obtain a new second control point sequence as the first control point sequence; wherein the control point deletion operation includes: traversing each second control point in the second control point sequence, and for each traversed second control point, performing the following operations: respectively calculating the second angle between the second control point and each remaining second control point in the second control point sequence except the second control point; if the second angle between the second control point and any remaining second control point is less than or equal to the second angle threshold and the second control point is the point with the smallest curvature in the second control point sequence, Then the second control point is deleted from the second control point sequence; wherein the second angle is the angle between the line connecting the second control point and the target center and the line connecting the remaining second control points and the target center; wherein the control point insertion operation includes: for any two adjacent second control points in the second control point sequence, sequentially calculating the third angle between the two adjacent second control points; if the third angle is greater than or equal to the third angle threshold, selecting at least one initial curve point located between the two adjacent second control points on the initial closed curve as a new second control point, and adding the new second control point to the second control point sequence; wherein the third angle is the angle between the lines connecting the two adjacent second control points and the target center respectively.
[0107] In an embodiment of performing a control point deletion operation and a control point insertion operation on the second control point sequence, the third angle threshold θ ST can be greater than the second angle threshold θ FT .
[0108] According to the above technical solution, by performing control point deletion and control point insertion operations on the second control point sequence, a new second control point sequence is obtained as the first control point sequence. This solution can avoid the control points in the second control point sequence from being too densely distributed or dispersed, thereby reducing the waste of computing resources while improving the accuracy of subsequent curve fitting.
[0109] Exemplarily, among at least one initial curve point and the two adjacent second control points, the third angles between every two adjacent points are equal.
[0110] In one embodiment, when the third angle between any two adjacent second control points is greater than or equal to the third angle threshold, for example Figure 2The second control point A4 and the second control point A5 shown in the figure can select one or more initial curve points at equal angles between the two second control points as new second control points. The selected one or more initial curve points are the inserted new second control points. After inserting the new second control point (i.e. obtaining the new second control point A6), the third angle between the second control point A4 and the second control point A6 is equal to the third angle between the second control point A5 and the second control point A6. Exemplarily, the following formula can be used: c = floor (θ S / θ ST )-1, insert one or more new second control points at equal angles between any two second control points. Where c represents the number of the inserted new second control points (i.e., the at least one selected initial curve point), "floor" represents rounding down, θ S represents the third angle between two adjacent second control points (such as the second control point A4 and the second control point A5) inserted, θ ST Represents the third angle threshold. When the number of the inserted new second control points (i.e., the selected at least one initial curve point) is greater than 1, for the inserted new second control point and the two inserted adjacent second control points (the two adjacent second control points in the second control point sequence before the insertion), the third angles between every two adjacent control points in these control points are equal.
[0111] According to the above technical solution, when the third angle between any two adjacent second control points is greater than or equal to the third angle threshold, by uniformly inserting at least one new second control point between the two second control points, each control point in the obtained new second control point sequence can be discretely distributed, so as to ensure the accuracy of the closed curve obtained after closed curve fitting based on the new second control point sequence (i.e., the first control point sequence).
[0112] Exemplarily, obtaining the first control point sequence may include: determining the first control point sequence in response to a control point setting instruction input by a user; wherein the closed curve to be edited is a closed tracing curve obtained by manually tracing each first control point in the first control point sequence.
[0113] In one embodiment, the user may input a control point setting instruction through an input device. For example, the user may input the coordinates of multiple control points in the control point setting control in sequence through a keyboard, and then the control points corresponding to the coordinates may be determined in sequence on the ultrasound image in the display interface. For another example, the display interface may include a control point setting control, and the user may click the control point setting control through a mouse or a trackball on a touchpad to indicate that the control point is desired to be set. Then, on the ultrasound image displayed on the display interface, the user may move the cursor to the position desired to be set as the control point through a mouse or a trackball on a touchpad and click the left mouse button (or right button) or the left button (or right button) of the trackball to set the point on the ultrasound image corresponding to the current cursor position as the control point. The multiple control points set by the user may be determined as a first control point sequence. The above-mentioned closed curve to be edited may be a closed tracing curve obtained by manually tracing each first control point in the first control point sequence. That is, in the case where the closed curve to be edited is obtained by manual tracing, the control points manually set by the user for generating the closed curve to be edited may be directly used as the first control point sequence. Of course, this scheme is only an example and not a limitation of the present invention. When the closed curve to be edited is obtained by manual tracing, the first control point sequence can also be determined in a similar manner to automatic tracing (i.e., the above-mentioned method of selecting the first control point based on curvature).
[0114] According to the above technical solution, in the case of manual tracing, the control points set by the user can be directly used as the first control point sequence without re-determining the first control point sequence, which can effectively reduce the amount of calculation.
[0115] Exemplarily, performing closed curve fitting based on the cursor control point and at least part of the first control points in the first control point sequence in real time to obtain a real-time closed curve may include: calculating the target parameters between the cursor control point and each first control point in the first control point sequence in real time; when any one of the target parameters between the cursor control point and any first control point is less than or equal to the corresponding preset parameter threshold, performing closed curve fitting based on the cursor control point and the remaining first control points in the first control point sequence except the first control point to obtain a real-time closed curve; when each of the target parameters between the cursor control point and each first control point is greater than the corresponding preset parameter threshold, performing closed curve fitting based on the cursor control point and the first control point sequence to obtain a real-time closed curve; wherein the target parameters may include: a fourth angle between the cursor control point and the first control point, and / or a distance between the cursor control point and the first control point; wherein the fourth angle is the angle between a line connecting the cursor control point and the target center and a line connecting the first control point and the target center, and the target center is the center of the ultrasound image or the center of the closed curve to be edited.
[0116] In one embodiment, step S120 may include the following operations: Calculate the target parameter between the cursor control point and each first control point in the first control point sequence in real time. In one example, the target parameter may include a fourth angle θ between the cursor control point and the first control point. H , the target parameter threshold corresponding to the current target parameter can be represented by the fourth angle threshold. The fourth angle θ H is the angle between the line connecting the cursor control point and the target center and the line connecting the first control point and the target center. The target center has been described in detail in the previous embodiment, and for the sake of brevity, it will not be repeated here. In another example, the target parameter may include the distance d between the cursor control point and the first control point, and the target parameter threshold corresponding to the current target parameter may be a preset distance threshold d. T In yet another example, the target parameter may include a fourth angle θ between the cursor control point and the first control point: H and the distance d between the cursor control point and the first control point. For ease of description and understanding, the target parameter is taken as the fourth angle θ between the cursor control point and the first control point. H Take this as an example for description.
[0117] Figure 3 FIG. 2 shows a schematic diagram of a real-time closed curve and a curve to be edited according to an embodiment of the present invention. Figure 3 As shown, the black closed curve represents the closed curve to be edited, and the gray closed curve represents the real-time closed curve. Control points B1, B2, B3, B4, B5 and B6 respectively represent the first control points in the first control point sequence corresponding to the closed curve to be edited, and point G1 represents the position of the current cursor control point. The fourth angle θ between the cursor control point G1 and each first control point in the first control point sequence is calculated respectively. H When any parameter of the target parameters between the cursor control point and any first control point is less than or equal to the corresponding preset parameter threshold, for example, when the fourth angle θ between the cursor control point G1 and the first control point B6 is H16 Less than or equal to the fourth angle threshold θ HT When the cursor control point G1 is set to the first control point B6, a closed curve fitting can be performed based on the cursor control point G1 and the remaining first control points in the first control point sequence except the first control point B6. That is, a closed curve fitting is performed with the cursor control point G1 and the first control points B1, B2, B3, B4 and B5 to obtain a real-time closed curve. The fourth angle θ between the cursor control point G1 and the first control point B6 is H16 Less than or equal to the fourth angle threshold θ HT, that is, the cursor control point G1 is close to the first control point B6, which means that the user may be inclined to adjust the curve segment where the first control point B6 is located. At this time, you can choose to ignore the first control point B6 on the original curve to be edited, and generate a real-time closed curve based on the cursor control point G1 and the remaining first control points. The real-time closed curve has a greater degree of adjustment on the curve segment where the first control point B6 is located than on the original curve to be edited. The fourth angle threshold θ HT It can be set as needed, and can be any angle greater than or equal to 0°. HT It can be in the range of [0,20°]. For example, the fourth angle threshold θ HT It can be 8°, 9° or 10°, etc. The second angle threshold θ FT and the fourth angle threshold θ HT can be the same or different. In one embodiment of the present invention, the fourth angle threshold θ HT can be equal to 10°. Similarly, if the distance d between the cursor control point G1 and the first control point is 16 Less than or equal to the preset distance threshold d T , then a closed curve fitting can also be performed based on the cursor control point G1 and the remaining five first control points except the first control point B6 to obtain a real-time closed curve. T It can be set as needed, and it can be a value of size, and the present invention is not limited to this. In one embodiment, if the fourth angle θ between the cursor control point G1 and each first control point H are greater than the fourth angle threshold θ HT , and the distance d between the cursor control point G1 and each first control point is greater than the preset distance threshold d T , then a closed curve fitting can be performed based on the cursor control point G1 and all the first control points in the first control point sequence to obtain a real-time closed curve. When each parameter in the target parameters between the cursor control point and each first control point is greater than the corresponding preset parameter threshold, a closed curve fitting is performed based on the cursor control point and the first control point sequence to obtain a real-time closed curve. Each parameter in the target parameters between the cursor control point and each first control point is greater than the corresponding preset parameter threshold, which means that the distance between the cursor control point and all the first control points is far. At this time, directly ignoring the first control point will cause a large change in the closed curve to be edited. Therefore, it can be selected to perform closed curve fitting based on the cursor control point and all the first control points in the first control point sequence to obtain a real-time closed curve.
[0118] According to the above technical solution, in the process of the cursor position changing, some or all of the first control points can be selected in real time according to the fourth angle and / or distance between the cursor control point and the first control point, and combined with the cursor control point to obtain a real-time closed curve. In this way, a real-time closed curve with a good fitting effect can be generated according to the user operation.
[0119] Exemplarily, the method may further include: in response to a first determination instruction input by a user, replacing the first control point sequence with a control point sequence for generating a real-time closed curve.
[0120] If the currently obtained real-time closed curve meets the user's requirements, the user can end the current editing operation of the trace curve by inputting a first determination instruction, such as clicking the right button (or left button) of a mouse or clicking the right button (or left button) of a trackball of a touchpad. In one embodiment, in response to the first determination instruction input by the user, the closed curve to be edited can be replaced with the current real-time closed curve, and the first control point sequence stored in the storage device can be replaced with the control point sequence used to generate the real-time closed curve. The first control point sequence stored in the memory is replaced with the control point sequence used to generate the real-time closed curve, which can be to use the control point sequence used to generate the real-time closed curve to overwrite the first control point sequence stored in the storage device, or to delete the first control point sequence stored in the storage device and store the control point sequence used to generate the real-time closed curve in the storage device. It should be noted that after the replacement, the control point sequence newly stored in the storage device is the new first control point sequence. Similarly, the real-time closed curve newly stored in the storage device is the new curve to be edited. If the user needs to continue editing the curve to be edited, the process may return to step S110 and obtain a new curve to be edited and a first control point sequence stored in the storage device in this step.
[0121] According to the above technical solution, based on the first determination instruction, the first control point sequence can be replaced with a control point sequence for generating a real-time closed curve. In this way, the control point sequence that meets the user's requirements can be saved in time, which is convenient for the user to view or continue editing later.
[0122] Exemplarily, before performing closed curve fitting based on the cursor control point and at least part of the first control points in the first control point sequence in real time to obtain a real-time closed curve, the method may further include: in response to an editing instruction input by a user, determining that the closed curve to be edited is in an editable state; wherein, the step of performing closed curve fitting based on the cursor control point and at least part of the first control points in the first control point sequence in real time to obtain a real-time closed curve is performed when the closed curve to be edited is in an editable state.
[0123] Through the input device, the user can input the editing instruction. After the user inputs the editing instruction, it can be determined that the closed curve to be edited is in an editable state. For example, the user can input "edit" in the text box to make the closed curve to be edited in an editable state. For another example, the user can use the mouse or trackball to place the cursor on the area where the curve to be edited is located and click the left button (or right button) of the mouse or the left button (or right button) of the trackball to make the closed curve to be edited in an editable state. The present invention is not limited to this. The above step S120 is performed when the closed curve to be edited is in an editable state.
[0124] According to the above technical solution, before the closed curve is fitted based on the cursor control point and at least part of the first control points in the first control point sequence in real time to obtain the real-time closed curve, in response to the editing instruction input by the user, it can be determined that the closed curve to be edited is in an editable state. In addition, the step of fitting the closed curve based on the cursor control point and at least part of the first control points in the first control point sequence in real time to obtain the real-time closed curve is performed when the curve to be edited is in an editable state. In this way, it is possible to avoid erroneous operation of the closed curve to be edited due to erroneous touching of the input device.
[0125] Exemplarily, the above-mentioned trace curve editing method may further include: in response to a second determination instruction input by a user, determining to end editing of the closed curve to be edited and making the closed curve to be edited exit an editable state.
[0126] In one embodiment, the user may input a second confirmation instruction to determine to end the editing of the closed curve to be edited and exit the editing state. The display interface may include a second confirmation control, and the user may click the second confirmation control with a mouse to indicate to end the editing of the closed curve to be edited and exit the editable state of the closed curve to be edited. In one embodiment of the present invention, the user may input the second confirmation instruction by clicking the right set button on the touch pad. When the user clicks the right set button on the touch pad, the editing of the closed curve to be edited may be ended and the closed curve to be edited may exit the editable state.
[0127] According to the above technical solution, the editing of the closed curve to be edited can be ended and the editing state can be exited through the second confirmation instruction input by the user. In this way, when the edited closed curve meets the user's needs, the editing can be ended in time and the closed curve to be edited can be exited from the editable state, thereby avoiding the loss of the closed curve that meets the user's needs due to the user's accidental touch of the touchpad or other controls on the display interface.
[0128] Figure 4 FIG. 4 is a schematic flow chart of a trace curve editing method according to an embodiment of the present invention. Figure 4As shown, in step S410, the first control point sequence and the closed curve to be edited can be obtained. Exemplarily, in step S410, the closed curve to be edited can be determined by an automatic tracing method, and the first control point sequence can be obtained from the initial curve points on the closed curve to be edited by using the above-mentioned curvature-based control point selection method. Alternatively, in step S410, the closed curve to be edited can also be determined by a manual tracing method, and the control points set by the user can be used as the first control point sequence. In step S420, the user can enter an editing instruction, and the electronic device receives the editing instruction. For example, the user can use a trackball to left-click on the area where the closed curve to be edited is located to activate the editing of the closed curve to be edited, that is, to make the closed curve to be edited in an editable state. In step S430, the user can move the cursor position, and the electronic device can obtain a real-time closed curve according to the cursor position after the user moves. For example, the user can move the trackball to change the cursor position on the display interface. When the cursor position changes, the display interface can display an ultrasound image with a real-time closed curve and a closed curve to be edited in real time. In step S440, it can be determined whether the user enters a first determination instruction. Step S440 can be executed in real time during the execution of step S430, that is, it can monitor in real time whether the user inputs the first determination instruction. If the current real-time closed curve meets the user's needs, the user can click the left button of the trackball to input the first determination instruction. When the first determination instruction input by the user is received, step S450 can be executed. In step S450, the curve to be edited and the first control point sequence can be updated, that is, the closed curve to be edited can be replaced with the current real-time closed curve, and the first control point sequence corresponding to the closed curve to be edited can be replaced with the control point sequence corresponding to the real-time closed curve. If the user does not enter the first determination instruction, the real-time closed curve can continue to be generated based on the cursor position. In addition, step S460 can also be executed. In step S460, it can be determined whether the user enters an end instruction (it can be understood that the end instruction can be the second determination instruction in the previous embodiment). Figure 4 The execution order of the steps shown is only an example. Step S460 can be executed in real time during the execution of step S430, that is, it can monitor in real time whether the user inputs an end instruction. For example, the user can click the right button of the trackball to input an end instruction. Once the electronic device receives the end instruction input by the user, step S470 can be executed to end the editing of the curve to be edited. It can be understood that the above steps S430, S440 and S450 can be repeatedly executed until the end instruction is received.
[0129] According to another aspect of the present invention, a trace curve editing device is also provided. Figure 5 FIG. 4 is a schematic diagram showing a trace curve editing device 500 according to an embodiment of the present invention. Figure 5As shown, the apparatus 500 may include an acquisition module 510 , a fitting module 520 , a display module 530 and a first replacement module 540 .
[0130] The acquisition module 510 is used to acquire a first control point sequence, each first control point in the first control point sequence is a control point on a closed curve to be edited, and the closed curve to be edited is a closed tracing curve used to indicate the edge position of the target object on the ultrasound image.
[0131] The fitting module 520 is used to perform closed curve fitting based on the cursor control point and at least part of the first control points in the first control point sequence in real time to obtain a real-time closed curve, wherein the cursor control point is the point corresponding to the current cursor position on the ultrasound image.
[0132] The display module 530 is used to display the ultrasound image with the real-time closed curve on the display interface in real time.
[0133] The first replacement module 540 is configured to replace the to-be-edited closed curve with the real-time closed curve in response to a first determination instruction input by the user.
[0134] A person skilled in the art may understand the specific implementation scheme and beneficial effects of the above-mentioned tracing curve editing device by reading the above-mentioned description of the tracing curve editing method, and for the sake of brevity, they will not be described in detail here.
[0135] According to yet another aspect of the present invention, an electronic device is provided. Figure 6 FIG. 2 shows a schematic block diagram of an electronic device according to an embodiment of the present invention. Figure 6 As shown, the electronic device 600 includes a processor 610 and a memory 620. The memory 620 stores a computer program. When the computer program instructions are executed by the processor 610, they are used to execute the above-mentioned trace curve editing method.
[0136] According to another aspect of the present invention, a storage medium is provided, which stores a computer program / instruction. The storage medium may include, for example, a storage component of a tablet computer, a hard disk of a personal computer, an erasable programmable read-only memory (EPROM), a portable read-only memory (CD-ROM), a USB memory, or any combination of the above storage media. The storage medium may be any combination of one or more computer-readable storage media. The computer program / instruction is used by a processor to execute the above-mentioned trace curve editing method when it is running.
[0137] A person skilled in the art may understand the specific implementation scheme of the electronic device and storage medium by reading the above description of the trace curve editing method, which will not be described here for brevity.
[0138] Although example embodiments have been described herein with reference to the accompanying drawings, it should be understood that the above example embodiments are merely exemplary and are not intended to limit the scope of the present invention thereto. Various changes and modifications may be made therein by one of ordinary skill in the art without departing from the scope and spirit of the present invention. All such changes and modifications are intended to be included within the scope of the present invention as required by the appended claims.
[0139] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0140] In the several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of the units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed.
[0141] In the description provided herein, a large number of specific details are described. However, it is understood that embodiments of the present invention can be practiced without these specific details. In some instances, well-known methods, structures and techniques are not shown in detail so as not to obscure the understanding of this description.
[0142] Similarly, it should be understood that in order to streamline the present invention and help understand one or more of the various inventive aspects, in the description of the exemplary embodiments of the present invention, the various features of the present invention are sometimes grouped together into a single embodiment, figure, or description thereof. However, the method of the present invention should not be interpreted as reflecting the following intention: the claimed invention requires more features than the features explicitly stated in each claim. More specifically, as reflected in the corresponding claims, the inventive point is that the corresponding technical problem can be solved with less than all the features of a single disclosed embodiment. Therefore, the claims following the specific embodiment are hereby expressly incorporated into the specific embodiment, wherein each claim itself serves as a separate embodiment of the present invention.
[0143] It will be understood by those skilled in the art that, except for mutually exclusive features, all features disclosed in this specification (including the accompanying claims, abstracts and drawings) and all processes or units of any method or device disclosed in this specification may be combined in any combination. Unless otherwise expressly stated, each feature disclosed in this specification (including the accompanying claims, abstracts and drawings) may be replaced by an alternative feature that provides the same, equivalent or similar purpose.
[0144] In addition, those skilled in the art will appreciate that, although some embodiments described herein include certain features included in other embodiments but not other features, the combination of features of different embodiments is meant to be within the scope of the present invention and form different embodiments. For example, in the claims, any one of the claimed embodiments may be used in any combination.
[0145] The various component embodiments of the present invention can be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. It should be understood by those skilled in the art that a microprocessor or a digital signal processor (DSP) can be used in practice to implement some or all of the functions of some modules in the trace curve editing device according to an embodiment of the present invention. The present invention can also be implemented as a device program (e.g., a computer program and a computer program product) for executing part or all of the methods described herein. Such a program for implementing the present invention can be stored on a computer-readable medium, or can have the form of one or more signals. Such a signal can be downloaded from an Internet website, or provided on a carrier signal, or provided in any other form.
[0146] It should be noted that the above embodiments illustrate the present invention rather than limit it, and that those skilled in the art may devise alternative embodiments without departing from the scope of the appended claims. In the claims, any reference symbol between brackets shall not be construed as a limitation on the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "one" or "an" preceding an element does not exclude the presence of a plurality of such elements. The present invention may be implemented by means of hardware comprising a number of different elements and by means of a suitably programmed computer. In a unit claim enumerating a number of devices, several of these devices may be embodied by the same hardware item. The use of the words first, second, and third, etc., does not indicate any order. These words may be interpreted as names.
[0147] The above is only a specific embodiment of the present invention or an explanation of a specific embodiment, and the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. The protection scope of the present invention shall be based on the protection scope of the claims.
Claims
1. A trace curve editing method, comprising: Acquire a first control point sequence, wherein each first control point in the first control point sequence is a control point on a closed curve to be edited, and the closed curve to be edited is a closed tracing curve used to indicate a position of an edge of a target object on an ultrasound image; Performing closed curve fitting based on a cursor control point and at least part of the first control points in the first control point sequence in real time to obtain a real-time closed curve, wherein the cursor control point is a point corresponding to a current cursor position on the ultrasound image; Displaying the ultrasound image with the real-time closed curve on a display interface in real time; In response to a first determination instruction input by a user, the to-be-edited closed curve is replaced with the real-time closed curve.
2. The method of claim 1, wherein: The step of obtaining a first control point sequence comprises: Acquire an initial closed curve, where the initial closed curve is a closed tracing curve obtained by automatically tracing the edge of the target object on the ultrasound image; Determining the curvature of each of a plurality of initial curve points on the initial closed curve; selecting the first sequence of control points from the plurality of initial curve points based on the curvature; Among them, a first angle between every two adjacent initial curve points among the multiple initial curve points is less than or equal to a first angle threshold, the first angle is the angle between a line connecting any initial curve point among every two adjacent initial curve points and a target center and a line connecting another initial curve point and the target center, the target center is the center of the ultrasound image or the center of the initial closed curve, and the closed curve to be edited is a closed curve obtained by performing closed curve fitting based on each first control point in the first control point sequence.
3. The method of claim 2, wherein: The selecting the first control point sequence from the plurality of initial curve points based on the curvature comprises: Selecting an initial curve point whose curvature is greater than a preset curvature threshold and is a maximum curvature value from the multiple initial curve points as a second control point to obtain a second control point sequence; The second control point sequence is the first control point sequence, or the selecting the first control point sequence from the multiple initial curve points based on the curvature also includes: determining the first control point sequence based on the second control point sequence, and the first control point sequence includes at least part of the second control points in the second control point sequence.
4. The method of claim 3, wherein: Before determining the first control point sequence based on the second control point sequence, selecting the first control point sequence from the plurality of initial curve points based on the curvature further includes: When any of the target situations exists, performing a control point selection operation to determine a new second control point sequence; The target situation includes: the number of second control points in the current second control point sequence is less than the first number, and / or the number of second control points in the current second control point sequence is greater than the second number, and the first number is less than or equal to the second number; The control point selection operation includes: When the number of second control points in the current second control point sequence is less than the first number, for the remaining initial curve points in the plurality of initial curve points except the current second control point sequence, a third number of initial curve points with the largest curvature are selected from the remaining initial curve points, and each second control point in the current second control point sequence and the third number of initial curve points are determined as a new second control point sequence, wherein the third number is equal to the difference between the first number and the number of second control points included in the current second control point sequence; and / or, When the number of second control points in the current second control point sequence is greater than the second number, a second number of second control points with the largest curvature is selected from the current second control point sequence to be determined as a new second control point sequence.
5. The method of claim 3, wherein: The determining the first control point sequence based on the second control point sequence comprises: performing a control point deletion operation and / or a control point insertion operation on the second control point sequence to obtain a new second control point sequence as the first control point sequence; The control point deletion operation includes: Traverse each second control point in the second control point sequence, and for each traversed second control point, perform the following operations: respectively calculating second included angles between the second control point and each remaining second control point in the second control point sequence except the second control point; If the second included angle between the second control point and any remaining second control point is less than or equal to the second angle threshold and the second control point is a point with the smallest curvature in the second control point sequence, then the second control point is deleted from the second control point sequence; The second angle is the angle between the line connecting the second control point and the target center and the line connecting the remaining second control points and the target center; Wherein, the control point insertion operation includes: For any two adjacent second control points in the second control point sequence, sequentially calculating a third angle between the two adjacent second control points; If the third angle is greater than or equal to a third angle threshold, selecting at least one initial curve point between the two adjacent second control points on the initial closed curve as a new second control point, and adding the new second control point to the second control point sequence; The third angle is the angle between the lines connecting the two adjacent second control points and the target center.
6. The method of claim 5, wherein: Among the at least one initial curve point and the two adjacent second control points, the third angles between every two adjacent points are equal.
7. The method of claim 1, wherein: The step of obtaining a first control point sequence comprises: In response to a control point setting instruction input by a user, determining the first control point sequence; The closed curve to be edited is a closed tracing curve obtained by manually tracing each first control point in the first control point sequence.
8. The method according to any one of claims 1 to 7, wherein: The step of fitting a closed curve based on the cursor control point and at least part of the first control points in the first control point sequence in real time to obtain a real-time closed curve includes: Calculating in real time the target parameters between the cursor control point and each first control point in the first control point sequence; When any parameter of the target parameters between the cursor control point and any first control point is less than or equal to the corresponding preset parameter threshold, performing closed curve fitting based on the cursor control point and the remaining first control points in the first control point sequence except the first control point, so as to obtain the real-time closed curve; When each parameter of the target parameters between the cursor control point and each first control point is greater than the corresponding preset parameter threshold, performing closed curve fitting based on the cursor control point and the first control point sequence to obtain the real-time closed curve; Wherein, the target parameters include: a fourth angle between the cursor control point and the first control point, and / or a distance between the cursor control point and the first control point; wherein, the fourth angle is the angle between a line connecting the cursor control point and the target center and a line connecting the first control point and the target center, and the target center is the center of the ultrasound image or the center of the closed curve to be edited.
9. The method according to any one of claims 1 to 7, wherein: The method further comprises: In response to the first determination instruction input by the user, the first control point sequence is replaced with a control point sequence used to generate the real-time closed curve.
10. The method according to any one of claims 1 to 7, wherein: Before performing closed curve fitting based on the cursor control point and at least part of the first control points in the first control point sequence in real time to obtain a real-time closed curve, the method further includes: In response to an editing instruction input by a user, determining that the closed curve to be edited is in an editable state; The step of fitting a closed curve based on the cursor control point and at least part of the first control points in the first control point sequence in real time to obtain a real-time closed curve is performed when the closed curve to be edited is in an editable state.
11. The method of claim 10, wherein: The method further comprises: In response to a second determination instruction input by the user, it is determined to end editing of the closed curve to be edited and to make the closed curve to be edited exit the editable state.
12. A closed curve editing device, comprising: an acquisition module, configured to acquire a first control point sequence, wherein each first control point in the first control point sequence is a control point on a closed curve to be edited, and the closed curve to be edited is a closed tracing curve used to indicate a position of an edge of a target object on an ultrasound image; a fitting module, configured to perform closed curve fitting based on a cursor control point and at least part of the first control points in the first control point sequence in real time to obtain a real-time closed curve, wherein the cursor control point is a point corresponding to a current cursor position on the ultrasound image; A display module, used for displaying the ultrasound image with the real-time closed curve on a display interface in real time; The first replacement module is used to replace the to-be-edited closed curve with the real-time closed curve in response to a first determination instruction input by a user.
13. An electronic device, comprising a processor and a memory, wherein a computer program is stored in the memory, and when the computer program instructions are executed by the processor, the method for editing a traced closed curve according to any one of claims 1 to 11 is executed.
14. A storage medium storing a computer program / instruction, wherein the computer program / instruction is used to execute the method for editing a traced closed curve according to any one of claims 1 to 11 when running.