UNPKG

@cornerstonejs/core

Version:
19 lines (18 loc) 690 B
import { VOILUTFunctionType } from '../enums/index.js'; import { toLowHighRange } from './windowLevel.js'; export default function getVOIRangeFromWindowLevel(windowWidth, windowCenter, voiLUTFunction = VOILUTFunctionType.LINEAR) { let center; let width; if (typeof windowCenter === 'number' && typeof windowWidth === 'number') { center = windowCenter; width = windowWidth; } else if (Array.isArray(windowCenter) && Array.isArray(windowWidth)) { center = windowCenter[0]; width = windowWidth[0]; } if (center === undefined || width === undefined) { return; } return toLowHighRange(width, center, voiLUTFunction); }