forked from cornerstonejs/cornerstone
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetPixels.js
More file actions
21 lines (19 loc) · 1.11 KB
/
Copy pathgetPixels.js
File metadata and controls
21 lines (19 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import { getEnabledElement } from './enabledElements.js';
import getStoredPixels from './getStoredPixels.js';
import getModalityLUT from './internal/getModalityLUT.js';
/**
* Retrieves an array of pixels from a rectangular region with modality LUT transformation applied
*
* @param {HTMLElement} element The DOM element enabled for Cornerstone
* @param {Number} x The x coordinate of the top left corner of the sampling rectangle in image coordinates
* @param {Number} y The y coordinate of the top left corner of the sampling rectangle in image coordinates
* @param {Number} width The width of the of the sampling rectangle in image coordinates
* @param {Number} height The height of the of the sampling rectangle in image coordinates
* @returns {Array} The modality pixel value of the pixels in the sampling rectangle
*/
export default function (element, x, y, width, height) {
const storedPixels = getStoredPixels(element, x, y, width, height);
const ee = getEnabledElement(element);
const mlutfn = getModalityLUT(ee.image.slope, ee.image.intercept, ee.viewport.modalityLUT);
return storedPixels.map(mlutfn);
}