LEADTOOLS Support
Medical
Medical SDK Questions
how to display measurement unit programmatically
This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Wednesday, June 18, 2008 12:31:01 AM(UTC)
Groups: Registered
Posts: 53
Hello,
I am using Leadtool V.15 and medicalviewer demo as my sample....I would like get the measurement unit programmatically..
Dim x1 as integer
Dim x2as integer
Dim y1 as integer
Dim y2 as integer
Step1: In mousedown event I stored
X1=e.X and Y1 =e.Y
Step2: In mouseup event I stored
X2=e.X and Y2 =e.Y
Step3:
Formula for converting Pixel to Cm is
LengthCM =
LenghtPixels * 2.54 / DPI
I have calculated LenghtPixels =Abs(X2-X1)*Abs(Y2-Y1) and
for DPI I have used R_Viewer.ImageDpiX value ....
is it correct?????
My code for calculating CM ....
Private Sub _medicalViewer_CustomPaint(ByVal sender As Object, ByVal e As MedicalViewerPaintEventArgs)
e.Graphics.SmoothingMode = Drawing2D.SmoothingMode.AntiAlias
e.Graphics.DrawLine(Pens.Red, x1, y1, x2, y2)
_image = _medicalViewer.Cells(0).Image
Dim pixel As Integer = Abs(x2 - x1) * Abs(y2 - y1)
Dim image1 As RasterImage = _medicalViewer.Cells(0).Image
R_Viewer.Image = image1
Dim LengthCM As Integer = CType(((CType(pixel, Single) * 2.54) / CType(R_Viewer.ImageDpiX, Single)), Integer)
MsgBox("LengthCM=" & (LengthCM / 10))
_medicalViewer.Invalidate()
End Sub
Problem :
1cm value is showing wrongly .
2.While I draw the next Line ,the first line which was drawn already disappears why? what should i add for consecutive drawing line one after another...
Please solve this probs...
Thanks in advance
Sakthi
#2
Posted
:
Wednesday, June 18, 2008 9:11:38 AM(UTC)
Groups: Registered, Tech Support, Administrators
Posts: 764
1.
Your distance calculation is incorrect. Here's an explanation of getting the distance between two points:
http://www.purplemath.com/modules/distform.htm
2.
The Graphics object in the CustomPaint event's MedicalViewerPaintEventArgs is used for painting once on top of the viewer. Therefore, none of the lines or objects you draw onto it will be permanent. If you are trying to paint multiple lines, you will need to keep track of them and paint them sequentially. One way to do this would be to make your own Line class and keep an array or LinkedList of Lines and in the CustomPaint event, loop through and draw all of the lines you have added.
LEADTOOLS Support
Medical
Medical SDK Questions
how to display measurement unit programmatically
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.