UNPKG

itk-viewer-bootstrap-ui

Version:

[![npm version](https://badge.fury.io/js/itk-viewer-bootstrap-ui.svg)](https://badge.fury.io/js/itk-viewer-bootstrap-ui) ![react-bootstrap version](https://img.shields.io/badge/React%20Bootstap-%3E=1.6.1-brightgreen.svg) [![Documentation Status](https://r

26 lines (21 loc) 621 B
function applyWindowLevelReset(context, { data }) { const actorContext = context.images.actorContext.get(data.name) const component = actorContext.selectedComponent const bounds = actorContext.colorRangeBounds.get(component) const wMax = bounds[1] - bounds[0] const lMin = bounds[0] const level = wMax / 2 + lMin const width = wMax const newRange = () => { return [level - width / 2, level + width / 2] } context.service.send({ type: 'IMAGE_COLOR_RANGE_CHANGED', data: { name: data.name, component, range: newRange() } }) } export default applyWindowLevelReset