forked from cornerstonejs/cornerstone
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetToPixelCoordinateSystem.js
More file actions
32 lines (27 loc) · 1.18 KB
/
Copy pathsetToPixelCoordinateSystem.js
File metadata and controls
32 lines (27 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/**
* This module contains a function that will set the canvas context to the pixel coordinates system
* making it easy to draw geometry on the image
*/
(function (cornerstone) {
"use strict";
/**
* Sets the canvas context transformation matrix to the pixel coordinate system. This allows
* geometry to be driven using the canvas context using coordinates in the pixel coordinate system
* @param ee
* @param context
* @param scale optional scaler to apply
*/
function setToPixelCoordinateSystem(enabledElement, context, scale)
{
if(enabledElement === undefined) {
throw "setToPixelCoordinateSystem: parameter enabledElement must not be undefined";
}
if(context === undefined) {
throw "setToPixelCoordinateSystem: parameter context must not be undefined";
}
var transform = cornerstone.internal.calculateTransform(enabledElement, scale);
context.setTransform(transform.m[0],transform.m[1],transform.m[2],transform.m[3],transform.m[4],transform.m[5],transform.m[6]);
}
// Module exports
cornerstone.setToPixelCoordinateSystem = setToPixelCoordinateSystem;
}(cornerstone));