The LEADTOOLS HTML5 and JavaScript SDKs are a powerful collection of JavaScript libraries and RESTful Web Services that enable web developers to create zero footprint, cross-platform applications with document and medical imaging functionality. Developers can target desktop PCs and mobile devices such as iPad, iPhone, Android and more, for more information refer to LEADTOOLS HTML5 Browser Support, with a single application featuring robust image display and processing, support for mouse and multi-touch gestures.
Web developers can use LEADTOOLS HTML5 Annotations to provide zero footprint, cross-platform image annotation and markup applications usable on any browser or device that supports HTML5 including Internet Explorer, Firefox, Chrome, iOS, Android and more.
The LEADTOOLS HTML5 DICOM Viewer combine JavaScript libraries and RESTful Web Services to create a zero footprint, platform-independent web application for displaying DICOM images from any PACS. This OEM-ready, fully customizable website is perfect for any developer who needs fast, lightweight DICOM viewing without sacrificing any features healthcare professionals need.
Several LEADTOOLS SDKs offer imaging and recognition functionality in the form of RESTful and SOAP Web services that are designed to be easily accessed by any application for a platform independent solution.
RESTful Web Services provide a simple JSON interface for HTML5 / JavaScript applications. Developers using high level environments such as .NET, Silverlight, Java and more can utilize LEADTOOLS SOAP Web Services for more advanced options and features.
All LEADTOOLS JavaScript libraries include the TypeScript definition files (.d.ts) required to develop HTML5/JavaScript application using Microsoft TypeScript technology.
The LEADTOOLS JavaScript libraries use an object module similar to the Microsoft .NET or Java object class library.
The following members are available in each LEADTOOLS type In addition to the other properties and methods described in the members page.
Type refers to the LEADTOOLS type, such as lt.Controls.ImageViewer. All the functions listed below are "static" methods that must be called directly on the type itself and not an instance of the type.
Type.prototype
Registers a new LEADTOOLS namespace
name: String containing the fully qualified name of the namespace. Must not be omitted or null
No return value
Refer to the sample source code at the end of this document.
Registers a new LEADTOOLS class type
name: String containing the fully qualified type name (namespace.name). Must not be omitted or null.
baseType: Base type. Can be omitted or null if the class does not derive from a LEADTOOLS base class.
interfaceType: Interface type implemented by the class. Can be omitted or null if the class does not implement a LEADTOOLS interface
No return value
Refer to the sample source code at the end of this document.
Registers a new LEADTOOLS class type
name: String containing the fully qualified namespace name. Must not be omitted or null
No return value
Registers a new LEADTOOLS enumeration.
name: String containing the fully qualified enumeration name. Must not be omitted or null
flags: true if the members of this enumuration can be OR'ed together, otherwise; false. Treated as false if omitted or null
No return value
Initializes the base class of a LEADTOOLS derived class from the constructor.
instance: The derived class instance. In almost all cases, this can be set to 'this'. Must not be omitted or null
args: An array containing the arguments to pass to the base class. Can be mitted or null if the base class constructor does not required other arguments.
If you derive a new class from a LEADTOOLS class, then you must call this method in your constructor to initialize the base class.
No return value
Refer to the sample source code at the end of this document.
Calls a function from the base class of a LEADTOOLS derived class
instance: The derived class instance. In almost all cases, this can be set to 'this'. Must not be omitted or null
name: String containing the name of the function to call. Must not be omitted or null
args: An array containing the arguments to pass to the base class method. Can be omitted or null if the base class constructor does not have arguments.
The return value from the base method (if any)
Refer to the sample source code at the end of this document.
Gets the base type of this type
None
The base type.
// This will show 'lt.Controls.ImageViewerInteractiveMode' since ImageViewerPanZoomInteractiveMode
// derives from ImageViewerInteractiveMode
alert(lt.Controls.ImageViewerPanZoomInteractiveMode.get_baseType().get_fullName());
Returns the full name (namespace.name) of this type
None
The fully qualified name of the type
// This will show 'lt.Controls.ImageViewerPanZoomInteractiveMode'
alert(lt.Controls.ImageViewerPanZoomInteractiveMode.get_fullName());
Returns the name of this type
None
The fully qualified name of the type
// This will show 'ImageViewerPanZoomInteractiveMode'
alert(lt.Controls.ImageViewerPanZoomInteractiveMode.get_name());
Determines if the specified object is an instance of this class or one of its derived classes.
Instance: object instance to check.
True if the specified object is an instance of this class or one of its derived classes, otherwise; false.
var instance = new lt.Controls.ImageViewerPanZoomInteractiveMode();
// This will show true, same type
alert(lt.Controls.ImageViewerPanZoomInteractiveMode.isInstanceOfType(instance));
// This will show true, derived type
alert(lt.Controls.ImageViewerInteractiveMode.isInstanceOfType(instance));
instance = new lt.LeadPointD();
// This will show false
< span>
This example shows how to create a class that derives from ImageViewerInteractiveMode to implement rotate when the user clicks and drags the viewer.
<!DOCTYPE html>
<html>
<head>
<title>Rotate Interactive Mode</title>
<link href="example.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="Leadtools.js"></script>
<script type="text/javascript" src="Leadtools.Controls.js"></script>
<script type="text/javascript" src="example.js"></script>
</head>
<body onload="run()">
<div id="controlsDiv">
<div>
<label for="interactiveModeSelect">Interactive mode:</label>
<select id="interactiveModeSelect">
<option>PanZoom</option>
<option>Rotate</option>
</select>
<input id="testButton" type="button" value="Test"/>
</div>
</div>
<div>
<textarea name="debugTextArea" cols="80" rows="10"></textarea>
<input type="button" id="debugClearButton" value="Clear" />
</div>
<div id="imageViewerDiv"/>
</body>
</html>
html, body
{
margin: 0px;
padding: 0px;
min-height: 100%;
height: 100%;
overflow: hidden;
overflow: hidden;
background: white;
font-family: helvetica;
font-size: 10pt;
-ms-touch-action: none;
-webkit-user-select: none;
-webkit-text-size-adjust: none;
}
#imageViewerDiv
{
border: 1px solid #000000;
background-color: #7F7F7F;
width: 400px;
height: 400px;
}
'use strict';
// Register our namespaceType.registerNamespace('demo');
// RotateInteractiveModeEventArgs begin
// Data for our custom event
// ctordemo.RotateInteractiveModeEventArgs = function
// Since we are deriving from a LEADTOOLS type, we need to call initializeBase
demo_RotateInteractiveModeEventArgs(rotateAngle) {
demo.RotateInteractiveModeEventArgs.initializeBase(this);
this._rotateAngle = rotateAngle;
}demo.RotateInteractiveModeEventArgs.prototype = {
// function to return the rotate angle
get_rotateAngle: function () {
return this._rotateAngle;
}
};
// Define our propertiesObject.defineProperty(demo.RotateInteractiveModeEventArgs.prototype, 'rotateAngle', { get:
// Register this class
demo.RotateInteractiveModeEventArgs.prototype.get_rotateAngle, enumerable: true, configurable: true });
// RotateInteractiveModeEventArgs end
demo.RotateInteractiveModeEventArgs.registerClass('demo.RotateInteractiveModeEventArgs', lt.LeadEventArgs);
// RotateInteractiveMode begin
// Class that derives from a LEADTOOLS lt.Controls.ImageViewerInteractiveMode classdemo.RotateInteractiveMode = function demo_RotateInteractiveMode() {
// Create our event
demo.RotateInteractiveMode.initializeBase(this);
this._rotate = lt.LeadEvent.create(this, 'rotate');
// Event handlers
this._dragStartedHandler = null;
this._dragDeltaHandler = null;
this._dragCompletedHandler = null;
}
demo.RotateInteractiveMode.prototype = {
// We must provide an implementation for nameget_name: function () {
return 'Rotate';
},
// Our event
get_rotate: function () {
return this._rotate;
},
start: function (viewer) {
// Call the base class Start method demo.RotateInteractiveMode.callBaseMethod(this, 'start', [viewer]);
// Subscribe to the dragStarted, dragDelta and dragCompleted events
var service = this.interactiveService;
var _this = this;
this._dragStartedHandler = service.dragStarted.add(function (sender, e) {
_this.dragStarted(sender, e);
});
this._dragDeltaHandler = service.dragDelta.add(function (sender, e) {
_this.dragDelta(sender, e);
});
this._dragCompletedHandler = service.dragCompleted.add(function (sender, e) {
_this.dragCompleted(sender, e);
});
},
// Called when the mode is stopped
stop: function (viewer) {
// Check if we have started
if (this.isStarted) {
// Unsubscribe from the events
var service = this.interactiveService;
service.dragStarted.remove(this._dragStartedHandler);
service.dragDelta.remove(this._dragDeltaHandler);
service.dragCompleted.remove(this._dragCompletedHandler);
// Call the base class Stop method
demo.RotateInteractiveMode.callBaseMethod(this, 'stop', [viewer]);
}
},
// Called when the user starts a drag operation
dragStarted: function (sender, e) {
// This will check if the mouse button (if any) is correct and if we are on top of the image
if (this.canStartWork(e)) {
// Inform whomever is listening that we have started working
this.onWorkStarted(lt.LeadEventArgs.empty);
}
},
// Called when the user is dragging
dragDelta: function (sender, e) {
// If we are not working (for example, the user has clicked the mouse outside the image) then
// nothing to do
if (!this.isWorking) {
return;
}
// Perform our operation. Get the change of the drag then increase
// or decrease the current rotation angle depending on the direction
var viewer = this.imageViewerControl;
// this is a lt.LeadPointD object
var change = e.change;
var delta = 2;
var oldRotateAngle = viewer.rotateAngle;
if (change.x > 0) {
viewer.rotateAngle = viewer.rotateAngle - delta;
} else if (change.x < 0) {
viewer.rotateAngle = viewer.rotateAngle + delta;
}
if (viewer.rotateAngle != oldRotateAngle) {
// The rotate angle has changed, fire our event
this._rotate.invoke(this, new demo.RotateInteractiveModeEventArgs(viewer.rotateAngle));
}
},
// Called when the user stops dragging
dragCompleted: function (sender, e) {
// If we are working, signal completion
if (this.isWorking) {
this.onWorkCompleted(lt.LeadEventArgs.empty);
}
}
};
// Define our properties
Object.defineProperty(demo.RotateInteractiveMode.prototype, 'name', { get: demo.RotateInteractiveMode.prototype.get_name, enumerable: true, configurable: true });
Object.defineProperty(demo.RotateInteractiveMode.prototype, 'rotate', { get: demo.RotateInteractiveMode.prototype.get_rotate, enumerable: true, configurable: true });
// Register this class
demo.RotateInteractiveMode.registerClass('demo.RotateInteractiveMode', lt.Controls.ImageViewerInteractiveMode);
// RotateInteractiveMode end
function run() {
// Create the viewer
var imageViewerCreateOptions = new lt.Controls.ImageViewerCreateOptions('imageViewerDiv', 'myViewer');
var viewer = new lt.Controls.ImageViewer(imageViewerCreateOptions);
// Create a new instance of our custom interactive mode
var rotateInteractiveMode = new demo.RotateInteractiveMode();
// Subscribe to our custom event
var rotateEventHandler = rotateInteractiveMode.rotate.add(function (sender, e) {
console.log('Rotate angle: ' + e.rotateAngle);
});
// Set up interactive modes, pan zoom and our custom rotate mode
var interactiveModes = [
new lt.Controls.ImageViewerPanZoomInteractiveMode(),
rotateInteractiveMode
];
var interactiveModeSelect = document.getElementById('interactiveModeSelect');
interactiveModeSelect.addEventListener('change', function () {
viewer.defaultInteractiveMode = interactiveModes[interactiveModeSelect.selectedIndex];
if (demo.RotateInteractiveMode.isInstanceOfType(viewer.defaultInteractiveMode)) {
alert('rotate');
} else if (lt.Controls.ImageViewerPanZoomInteractiveMode.isInstanceOfType(viewer.defaultInteractiveMode)) {
alert('pan zoom');
}
}, false);
viewer.defaultInteractiveMode = interactiveModes[0];
// Finally, set an image into the viewer (change this to a valid URL)
viewer.imageUrl = 'http://example/image.jpg';
}
Leadtools | Introduction | Getting Started | JavaScript |
Leadtools.Annotations.Automation | Introduction | Getting Started | JavaScript |
Leadtools.Annotations.Core | Introduction | Getting Started | JavaScript |
Leadtools.Annotations.Designers | Introduction | Getting Started | JavaScript |
Leadtools.Annotations.Rendering | Introduction | Getting Started | JavaScript |
Leadtools.Controls | Introduction | Getting Started | JavaScript |
Leadtools.Controls.Medical | Introduction | Getting Started | JavaScript |
Introduction - Leadtools JavaScript
Introduction - Leadtools.Annotations.Automation JavaScript
Introduction - Leadtools.Annotations.Core JavaScript
Introduction - Leadtools.Annotations.Designers JavaScript
Introduction - Leadtools.Annotations.Rendering JavaScript
Introduction - Leadtools.Controls JavaScript
Introduction - Leadtools.Controls.Medical JavaScript