Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 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 | 693x 693x 693x | import getTransform from './getTransform';
import { Point2, CPUFallbackEnabledElement } from '../../../../types';
/**
* Converts a point in the canvas coordinate system to the pixel coordinate system
* system. This can be used to reset tools' image coordinates after modifications
* have been made in canvas space (e.g. moving a tool by a few cm, independent of
* image resolution).
*
* @param element - The Cornerstone element within which the input point lies
* @param pt - The input point in the canvas coordinate system
*
* @returns The transformed point in the pixel coordinate system
*/
export default function (
enabledElement: CPUFallbackEnabledElement,
pt: Point2
): Point2 {
const transform = getTransform(enabledElement);
transform.invert();
return transform.transformPoint(pt);
}
|