Background technology
The definition of vector graphics: vector image, be also referred to as OO image or drawing image, on mathematics, be defined as a series of points that connect by line.Graphic element in the vector file is called object.Each object all is an entity that has a style of one's own, and it has attributes such as color, shape, profile, size and screen position.Since each object all is an entity that has a style of one's own, just can when keep its original sharpness and flexibility, repeatedly move and change its attribute, and can not influence other object in the legend.These characteristics make the program based on vector be specially adapted to legend and three-dimensional modeling, because they require to create and to operate single object usually.Drawing based on vector is irrelevant with resolution.This means that they can be shown on the output device by highest resolution.
The file layout of polar plot has SWF, SVG, WMF, EMF, EPS, DXF totally six kinds of file layouts; This paper instance uses the DXF file layout; The DXF file layout is the vector file form among the AutoCAD; Be the actual industrial standard of polar plot form now, it is with ASCII character mode storage file (format standard of redaction is supported with the binary mode storage file simultaneously), aspect performance figure big or small very accurately.The DXF file can be by many software transfers or output, and the expansion of its file is called " .dxf ".
The problem that on medical image, shows vector graphics.Because the medical science DICOM image of standard is a vector graphics, and the joint prosthesis of orthopaedics also is the vector graphics of the industrial DXF form of standard.If two kinds of images are simultaneously displayed on a coordinate system the inside; Just can help the doctor to confirm that before operation operation needs the size and the model of the joint prosthesis of use; Accelerate the speed of operation, shorten the time of operation, reduce patient simultaneously because the sum of errors risk that the displacement joint prosthesis brings.
When carrying out joint prosthesis implantation or replacement operation, the doctor often will push bloody musculature aside, and dependence experience is then judged the size and the model of required joint prosthesis.The problem that such operation brings is exactly that the doctor has extended the time of performing the operation in the selection of constantly carrying out joint prosthesis model and size, has also increased the risk of operation simultaneously.In order to reduce this time of by virtue of experience changing joint prosthesis; The orthopaedics DICOM image of taking before can patient being performed the operation is put together with the joint prosthesis vector graphics that meets the DXF form of industrial standard and is shown, helps the doctor before operation, to confirm the size and the model of joint prosthesis accurately.
Existing and the most akin implementation of the present invention: the doctor becomes film with patient's orthopaedics DICOM image print, is placed on the special-purpose lamp box, uses survey instruments such as ruler and set square simultaneously and confirms that needs replace the size and the model of joint prosthesis.
The shortcoming of prior art is conspicuous, doctor's trouble that operates not only, but also need to calculate a lot of parameters.
Summary of the invention
The present invention provides a kind of method that on medical image, shows vector graphics; After using method of the present invention; The doctor can be presented under the same coordinate system through the joint prosthesis industry template file with medical science DICOM image and the DXF form that meets industrial standard, and through the operations such as mobile and rotation of joint prosthesis figure being carried out the coupling of accurate model and size.So not only convenient but also quick, greatly facilitate the type selecting of doctor to joint prosthesis, doctor's operation has been played the effect of auxiliary and plan.
The present invention solves the problems of the technologies described above the technical scheme that is adopted to be:
A kind of method that on medical image, shows vector graphics is characterized in that may further comprise the steps:
A. set up unified coordinate system;
B. in coordinate system, load medical image;
C. in coordinate system, load vector graphics, vector graphics is presented on the medical image;
D. medical image pixel f (x
i, y
i) (0≤i<N) coordinate in coordinate system is (x
i, y
i), wherein N is the number of medical image pixel; Vector graphics is at the image pixel f of coordinate system
1(x1
i, y1
i) (coordinate of 0≤i<N1) is (x1
i, y1
i), wherein N1 is the number of vector graphics at the image pixel of coordinate system; According to the coordinate of medical image pixel, obtain the size of the border rectangle in medical image zone, the border rectangle has with the coordinate system Far Left left, rightmost right, top top and the bottommost bottom of the image-region that is reference; Four attributes of this border rectangle are obtained by following formula respectively:
left=min{x
0,x
1,...,x
N-1};
right=max{x
0,x
1,...,x
N-1};
top=max{y
0,y
1,...,y
N-1};
bottom=min{y
0,y
1,...,y
N-1};
Wherein N is the number of the image pixel in the rectangle of border, the border rectangle of medical image be (left, right, top, bottom), the border rectangle of vector graphics is (left
1, right
1, top
1, bottom
1);
E. the center that obtains this rectangle by the border rectangle of medical image is:
The center that is obtained this rectangle by the border rectangle of vector graphics is:
After medical image was moved, the moving method step of vector graphics was following:
E1. the distance that move in coordinate system relative to former rectangular centre at the center of obtaining the new border rectangle of medical image for (x, y),
E2. when the distance that moves is not 0, the border rectangle mobile phase of vector graphics with distance,
E3. in the rectangle of the border of new vector graphics, show new vector graphics;
F. during the medical image convergent-divergent, the center of medical image border rectangle does not change, and medical image convergent-divergent rate is α, and the distance of the central point of the border rectangle of vector graphics and the border rectangle of medical image is:
New distance is after the convergent-divergent:
s
1=α*s
The angle β at the center of former vector graphics and the center of medical image is:
The center of the border rectangle of then new vector graphics is:
Can obtain the border rectangle of new vector graphics after former vector graphics border rectangle calculates in the same way, in the rectangle of the border of new vector graphics, draw new vector graphics.
Embodiment
According to accompanying drawing and embodiment the present invention is done further explain below:
The polar plot of DICOM image and DXF form be based upon with the current window be under the reference frame two not under the jurisdiction of each other with two width of cloth images that intersect.The DXF image is presented on the DICOM image.
In order to measure the size of bone, we are through loading polar plot, and the polar plot that loads moved and rotate bone next and that will undergo surgery mate.For the result who makes coupling is convenient to observe with more accurate, we have increased the same moved further and synchronous zoom function of DICOM image and polar plot.
We suppose DICOM image pixel f (x
i, y
i) (0≤i<N) coordinate in the client area is (x
i, y
i), wherein N is the number of medical image pixel.Suppose that the DXF polar plot that loads is presented at the image pixel f of client area
1(x1
i, y1
i) (coordinate of 0≤i<N1) is (x1
i, y1
i), wherein N1 is the number of vector graphics at the image pixel of coordinate system.
According to the coordinate of image pixel, we can obtain the size of the border rectangle of image-region.The hypothetical boundary rectangle has left, right, top and four attributes of bottom, and representing respectively with the client area coordinate system is Far Left, rightmost, top and the bottommost of the image-region of reference.As shown in Figure 1.
Four attributes of this border rectangle are obtained by following formula respectively:
left=min{x
0,x
1,...,x
N-1}.
right=max{x
0,x
1,...,x
N-1}.
top=max{y
0,y
1,...,y
N-1}.
bottom=min{y
0,y
1,...,y
N-1}.
Wherein N is the number of the image pixel in the rectangle of border.The border rectangle of DICOM image be (left, right, top, bottom), the border rectangle of DXF vector image is (left
1, right
1, top
1, bottom
1).
We by the center that the border rectangle of original DICOM image obtains this rectangle are:
We by the center that the border rectangle of original DFX image obtains this rectangle are:
After mouse drag DICOM image is moved, the distance that move relative to former rectangular centre at the center of new border rectangle for (x, y).When we judge mobile distance is not after 0, the border rectangle mobile phase of DXF image distance (direction is also identical, and we distinguish direction with sign) together.Through calculating, we show new DXF figure in new border rectangle.
In the time of image zoom, the center of image boundary rectangle does not change.Suppose that DICOM image zoom rate is α, the distance of the central point of the border rectangle of DFX image and the border rectangle of DICOM image is:
New distance is after the convergent-divergent: s
1=α * s
Be shown in the following figure, the angle β at the center of the center of former DXF image and DICOM image is:
The center of the border rectangle of then new DXF image is:
Can obtain new border rectangle after former DXF border rectangle calculates in the same way, draw new DXF image in new border rectangle class.Then we can realize the synchronous convergent-divergent of DXF image and DICOM image.
The orthopaedics image file is read in the internal memory from disk, in the main display window of screen, show the image that loads.In this process; Calling the LoadFromFile function is loaded into the orthopaedics image the internal memory from disk; And the image of load is presented at the screen main window, when main window showed, employed function was the OnPaint among the VC; Promptly in this function, the dc (contextual devices) that calls main window comes display image.After being loaded into internal memory from disk image, keep the pointer pImg of load image, use to treat the back.
The operating process of instantiation:
The image of needs is loaded into, be presented in the main window.
After showing the orthopaedics image, select corresponding orthopaedics template according to the different parts of health, this instance uses the DXF file layout.
Selected with LoadFromFile vector file to be loaded into the internal memory from disk after the template; Then the view data in the internal memory is presented on the basic display unit; In procedure for displaying; Employed function is the OnPaint among the VC, and promptly in this function, the dc (contextual devices) that calls the thumbnail window shows the template of loading.Load the back and preserve the address pDxfImg of view data in internal memory, supply later step to use.
Basic display unit shows as shown in Figure 3 after having loaded polar plot.
After having loaded polar plot, the user just can begin to adjust the position of polar plot in the orthopaedics image, matees through operations such as moving, rotate, amplification is dwindled.If the user thinks that the polar plot that loads can't well mate with the orthopaedics image all the time, can earlier former polar plot be deleted from display, reselect other polar plot then, till obtaining satisfied result.The employed function of delete procedure is the OnPaint among the VC, in this function, calls the dc (contextual devices) of thumbnail window, wipes former polar plot.In this example, we have defined a type LAutoCadDXF, this class definition some interfaces, like SetPosition, SetRatio, accomplish operation to vector graphics, as shown in Figure 4.
The pDxfImg vector image data pointer that the front is preserved passes to the LAutoCadDXF class, can operate the polar plot object of loading.
For can be on the orthopaedics image operating vector figure easily, also to respond window message, just can make polar plot along with corresponding adjustment is made in user's operation, the concrete operations flow process is following:
Response left mouse button is pressed message OnLButtonDown in polar plot; When left mouse button is pressed; This moment, polar plot got into mobile status (as shown in Figure 5), and (ShowMousePosX ShowMousePosY) supplies later step to use with polar plot viewing area oldRect to write down mouse coordinates.
Response mouse mobile messaging OnMouseMove in polar plot; The mouse coordinates parameter x, the y that pass over through OnMouseMove; With the mouse coordinates (ShowMousePosX that preserves in the step 1; ShowMousePosY) calculate displacement offsetX, the offsetY of mouse in directions X and Y direction; Calculate the new viewing area newRect of polar plot through the oldRect in the step a) and the offsetX, the offsetY that calculate, the interface SetPosition in type of the calling LAutoCadDXF class is provided with the new display position of polar plot.
The OnRButtonDown message that response right mouse button is pressed in polar plot, this moment, polar plot got into rotation status (as shown in Figure 6), calculated angle of inclination npreAngle through mouse coordinates and polar plot centre coordinate, kept this value and supplied later step to use.The concrete method of calculating angle is:
Mouse coordinates is oldPtX, oldPtY when supposing to press right mouse button; This coordinate is the coordinate in the polar plot coordinate system; Be converted into screen coordinate so also will call ClientToScreen; Obtain polar plot zone pRect through GetWindowRect after the coordinate conversion, obtain coordinate centerX, the centerY of polar plot center in screen thus, centerX=in the Windows system (pRect.right+pRect.left)/2; CenterY=(pRect.top+pRect.bottom)/2 can obtain npreAngle=arctan ((oldPtY-centerY)/oldPtX-centerX)) through trigonometric function then
Response OnMouseMove message in the mouse moving process; Calculate angle of inclination ncurAngle through mouse coordinates and polar plot centre coordinate, calculate the same step a) of method of angle, the npreAngle of ncurAngle and front preservation is subtracted each other obtain anglec of rotation angle; Call the SetAngle clock-face diagram then; Polar plot can move and rotates along with mouse, decontrols right mouse button, and polar plot stops the rotation.
Response mouse roller message OnMouseWheel in polar plot; Rolling distance through mouse roller calculates amplification (dwindling) coefficient nRatio; Concrete computing method genju passes to orthopaedics image and vector image simultaneously with coefficient, calls explicit function and shows the image that amplifies after (dwindling), as for polar plot; Calling interface SetRatio gets final product, and this moment, polar plot dwindled (like Fig. 7, shown in 8) along with the orthopaedics image amplifies together.
Those skilled in the art do not break away from essence of the present invention and spirit; Can there be the various deformation scheme to realize the present invention; The above is merely the preferable feasible embodiment of the present invention; Be not so limit to interest field of the present invention, the equivalent structure that all utilizations instructions of the present invention and accompanying drawing content are done changes, and all is contained within the interest field of the present invention.