Sets the ruler calibration scale.
AnnContainerMapper.prototype.calibrate = function(sourceLength, sourceUnit, destinationLength, destinationUnit)
calibrate(sourceLength: LeadLengthD, sourceUnit: AnnUnit, destinationLength: LeadLengthD, destinationUnit: AnnUnit): void;
sourceLength
Known source length value
sourceUnit
Units of sourceLength
destinationLength
What the destination length must be
destinationUnit
Units of destinationUnit
This method will use the parameters to calculate a new value for CalibrationScale. This value is used afterwards by all the existing ruler and new ruler objects created in this container.
Calibrating a ruler means assigning a specific length to it. For example, on a digital X-ray of a hand, you may draw an annotation ruler object along one of the fingers. You know that this distance is supposed to be exactly 6.5 cm. Using the new calibration functionality you can calibrate this ruler, all existing rulers, and all newly created rulers so that they would precisely measure this distance to be 6.5 cm. This is accomplished by first drawing a ruler on the container till it matches exactly the length of the finger - ignoring the values shown - then using Calibrate as shown in the example.
This example will draw a ruler with a length that is assumed is 6.5cm, it then uses Calibrate to set the mapper calibration scale.
example: function SiteLibrary_DefaultPage$example() {
// Add a ruler with a length of 1 inch to the container
var container = this._automation.get_container();
var inch = 720;
var rulerObj = new lt.Annotations.Core.AnnPolyRulerObject();
rulerObj.get_points().add(lt.LeadPointD.create(1 * inch, 1 * inch));
rulerObj.get_points().add(lt.LeadPointD.create(2 * inch, 1 * inch));
rulerObj.set_stroke(lt.Annotations.Core.AnnStroke.create(lt.Annotations.Core.AnnSolidColorBrush.create("red"), lt.LeadLengthD.create(1)));
rulerObj.set_showGauge(true);
rulerObj.set_showTickMarks(true);
rulerObj.set_measurementUnit(lt.Annotations.Core.AnnUnit.inch);
container.get_children().add(rulerObj);
// Show the ruler
this._automation.invalidate(lt.LeadRectD.get_empty());
alert("Ruler to calibrate, length is 1 inch");
// Get the length of the ruler
var point1 = rulerObj.get_points().get_item(0);
var point2 = rulerObj.get_points().get_item(1);
var length = Math.sqrt(Math.pow(Math.abs(point2.get_x() - point1.get_x()), 2) + Math.pow(Math.abs(point2.get_y() - point1.get_y()), 2));
// Calibrate the container mapper
container.get_mapper().calibrate(
lt.LeadLengthD.create(length), // Source length
lt.Annotations.Core.AnnUnit.unit, // Source unit (container units)
lt.LeadLengthD.create(6.5), // Destination length
lt.Annotations.Core.AnnUnit.centimeter); // Destination unit
// Use the Centimeters as the measurement unit in the ruler
rulerObj.set_measurementUnit(lt.Annotations.Core.AnnUnit.centimeter);
// Now rulerObj should show 6.5 Centimeter as its length
this._automation.invalidate(lt.LeadRectD.get_empty());
alert("Calibrated, length is 6.5 cm");
},
Products |
Support |
Feedback: calibrate Method (AnnContainerMapper) - Leadtools.Annotations.Core |
Introduction |
Help Version 19.0.2017.3.21
|
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.