Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@lunit/insight-viewer

Package Overview
Dependencies
Maintainers
1
Versions
128
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lunit/insight-viewer - npm Package Compare versions

Comparing version 1.2.3 to 1.2.5

8

CHANGELOG.kr.md

@@ -7,2 +7,10 @@ # Changelog

## [1.2.5] - 2019-07-17
### Changed
- Window Width / Center를 정수로 제한
- ModalityLUT의 firstValueMapped 값을 확인하여 올바르지 않을 경우 무시
### Fixed
- Window Center로 음수값을 허용
## [1.2.3] - 2019-05-22

@@ -9,0 +17,0 @@ ### Changed

161

dist/index.es.js

@@ -138,15 +138,15 @@ import * as dicomParser from 'dicom-parser';

var wrapperStyle = {
position: 'relative',
width: '100%',
height: '100%',
backgroundColor: 'black',
userSelect: 'none'
position: "relative",
width: "100%",
height: "100%",
backgroundColor: "black",
userSelect: "none"
};
var infoStyle = {
position: 'absolute',
bottom: '45px',
right: '30px',
width: '75px',
color: 'white',
textShadow: '-1px -1px 0 #000,1px -1px 0 #000,-1px 1px 0 #000,1px 1px 0 #000'
position: "absolute",
bottom: "45px",
right: "30px",
width: "75px",
color: "white",
textShadow: "-1px -1px 0 #000,1px -1px 0 #000,-1px 1px 0 #000,1px 1px 0 #000"
};

@@ -181,2 +181,5 @@

image.voiLUT = undefined; // remove VOI LUT for 'adjust' functionality
if (image.modalityLUT && typeof image.modalityLUT.firstValueMapped !== "number") {
image.modalityLUT = undefined;
}
var defaultViewport = getDefaultViewportForImage(_this.element, image);

@@ -195,3 +198,3 @@ var initialScale = defaultViewport.scale;

}));
typeof _this.props.onLoadImage === 'function' && _this.props.onLoadImage(image);
typeof _this.props.onLoadImage === "function" && _this.props.onLoadImage(image);
});

@@ -234,8 +237,8 @@ } catch (err) {

if (_this.props.controlState.mouseMode === 'adjust') {
if (_this.props.controlState.mouseMode === "adjust") {
_this.setState(produce(function (draft) {
draft.viewport.voi.windowWidth = Math.max(draft.viewport.voi.windowWidth + dx * 2, 1);
draft.viewport.voi.windowCenter = Math.max(draft.viewport.voi.windowCenter + dy * 2, 1);
draft.viewport.voi.windowWidth = Math.round(Math.max(draft.viewport.voi.windowWidth + dx * 2, 1));
draft.viewport.voi.windowCenter = Math.round(draft.viewport.voi.windowCenter + dy * 2);
}));
} else if (_this.props.controlState.mouseMode === 'pan') {
} else if (_this.props.controlState.mouseMode === "pan") {
_this.setState(produce(function (draft) {

@@ -294,3 +297,3 @@ draft.viewport.translation.x += dx / draft.viewport.scale;

_this.onError = function (err) {
typeof _this.props.onError === 'function' && _this.props.onError(err);
typeof _this.props.onError === "function" && _this.props.onError(err);
};

@@ -301,5 +304,5 @@ return _this;

createClass(Viewer, [{
key: 'componentDidMount',
key: "componentDidMount",
value: function componentDidMount() {
this.element.addEventListener('cornerstoneimagerendered', this.onImageRendered);
this.element.addEventListener("cornerstoneimagerendered", this.onImageRendered);
if (this.props.imageId) {

@@ -310,3 +313,3 @@ this.loadImage(this.props.imageId);

}, {
key: 'componentDidUpdate',
key: "componentDidUpdate",
value: function componentDidUpdate(prevProps, prevState) {

@@ -325,7 +328,7 @@ if (!this.props.imageId) {

}, {
key: 'componentWillUnmount',
key: "componentWillUnmount",
value: function componentWillUnmount() {
var element = this.element;
if (element) {
element.removeEventListener('cornerstoneimagerendered', this.onImageRendered);
element.removeEventListener("cornerstoneimagerendered", this.onImageRendered);
disable(element);

@@ -335,3 +338,3 @@ }

}, {
key: 'render',
key: "render",
value: function render() {

@@ -355,21 +358,27 @@ var _this2 = this;

React.createElement(
'div',
_extends({ style: wrapperStyle
"div",
_extends({
style: wrapperStyle
}, uiHandlers, {
ref: function ref(element) {
_this2.element = element;
} }),
React.createElement(ReactResizeDetector, { handleWidth: true, handleHeight: true, onResize: this.onResize }),
React.createElement('canvas', { className: 'cornerstone-canvas' }),
}
}),
React.createElement(ReactResizeDetector, {
handleWidth: true,
handleHeight: true,
onResize: this.onResize
}),
React.createElement("canvas", { className: "cornerstone-canvas" }),
this.props.children,
this.props.imageId && React.createElement(
'div',
"div",
{ style: infoStyle },
React.createElement(
'div',
"div",
null,
'Zoom'
"Zoom"
),
React.createElement(
'div',
"div",
null,

@@ -379,10 +388,10 @@ zoom

React.createElement(
'div',
"div",
null,
'WW/WL'
"WW/WL"
),
React.createElement(
'div',
"div",
null,
ww + '/' + wl
ww + "/" + wl
)

@@ -394,3 +403,3 @@ )

}], [{
key: 'getDerivedStateFromProps',
key: "getDerivedStateFromProps",
value: function getDerivedStateFromProps(nextProps, prevState) {

@@ -455,3 +464,3 @@ return produce(prevState, function (draft) {

var arrowY = vectorY * Math.max(16 * scale, 4);
var scaledLineWidth = Math.max(6 * scale, 1);
var scaledLineWidth = Math.max(8 * scale, 1);

@@ -484,3 +493,3 @@ ctx.save();

// text
ctx.font = scaledLineWidth * 8 + "px proximanova_semibold, sans-serif";
ctx.font = scaledLineWidth * 10 + "px proximanova_semibold, sans-serif";
ctx.strokeStyle = "black";

@@ -551,3 +560,3 @@ ctx.lineWidth = scaledLineWidth / 3 * 2;

_ref3$thickness = _ref3.thickness,
thickness = _ref3$thickness === undefined ? 6 : _ref3$thickness;
thickness = _ref3$thickness === undefined ? 8 : _ref3$thickness;

@@ -631,3 +640,3 @@ var scaledThickness = Math.max(thickness * scale, 1);

_this.pixelCanvas = document.createElement('canvas');
_this.pixelCanvas = document.createElement("canvas");
_this.heatmap = null;

@@ -641,3 +650,3 @@ _this._prepareHeatmap = _this._prepareHeatmap.bind(_this);

createClass(Heatmap, [{
key: 'componentDidUpdate',
key: "componentDidUpdate",
value: function componentDidUpdate(prevProps, prevState) {

@@ -664,19 +673,21 @@ if (this.props.enabledElement !== prevProps.enabledElement || this.props.posMap !== prevProps.posMap || this.props.threshold !== prevProps.threshold) {

}, {
key: 'render',
key: "render",
value: function render() {
var _this2 = this;
return React.createElement('canvas', { ref: function ref(canvas) {
return React.createElement("canvas", {
ref: function ref(canvas) {
_this2.drawingCanvas = canvas;
},
style: {
position: 'absolute',
position: "absolute",
top: 0,
left: 0,
width: '100%',
height: '100%'
} });
width: "100%",
height: "100%"
}
});
}
}, {
key: '_prepareHeatmap',
key: "_prepareHeatmap",
value: function _prepareHeatmap(posMap, threshold) {

@@ -687,3 +698,3 @@ var heatmapWidth = posMap[0].length;

this.drawingCanvas.height = heatmapHeight;
var heatmapImageData = this.drawingCanvas.getContext('2d').createImageData(heatmapWidth, heatmapHeight);
var heatmapImageData = this.drawingCanvas.getContext("2d").createImageData(heatmapWidth, heatmapHeight);
var pixels = heatmapImageData.data;

@@ -715,3 +726,3 @@ var offset = void 0,

}, {
key: '_redraw',
key: "_redraw",
value: function _redraw(enabledElement) {

@@ -723,3 +734,3 @@ if (!this.heatmap) {

this.drawingCanvas.height = this.drawingCanvas.offsetHeight;
var ctx = this.drawingCanvas.getContext('2d');
var ctx = this.drawingCanvas.getContext("2d");
ctx.save();

@@ -730,3 +741,3 @@ var heatmapImageData = this.heatmap.heatmapImageData;

this.pixelCanvas.height = heatmapImageData.height;
this.pixelCanvas.getContext('2d').putImageData(heatmapImageData, 0, 0);
this.pixelCanvas.getContext("2d").putImageData(heatmapImageData, 0, 0);
setToPixelCoordinateSystem(enabledElement, ctx);

@@ -753,5 +764,5 @@ var imageWidth = enabledElement.image.width;

}, {
key: '_clear',
key: "_clear",
value: function _clear() {
var ctx = this.drawingCanvas.getContext('2d');
var ctx = this.drawingCanvas.getContext("2d");
ctx.clearRect(0, 0, this.drawingCanvas.offsetWidth, this.drawingCanvas.offsetHeight);

@@ -770,4 +781,3 @@ }

viewport = _ref.viewport;
return React.createElement(Heatmap, _extends({}, props, {
enabledElement: enabledElement, viewport: viewport }));
return React.createElement(Heatmap, _extends({}, props, { enabledElement: enabledElement, viewport: viewport }));
}

@@ -822,3 +832,3 @@ );

_this.pixelCanvas.height = imageData.height;
_this.pixelCanvas.getContext('2d').putImageData(imageData, 0, 0);
_this.pixelCanvas.getContext("2d").putImageData(imageData, 0, 0);

@@ -829,4 +839,4 @@ _this.drawingCanvas.width = _this.drawingCanvas.offsetWidth;

var glassY = clientY - MAGNIFIER_SIZE / 2;
var ctx = _this.drawingCanvas.getContext('2d');
ctx.fillStyle = 'black';
var ctx = _this.drawingCanvas.getContext("2d");
ctx.fillStyle = "black";
if (fliped) {

@@ -840,3 +850,3 @@ ctx.scale(-1, 1);

}, _this._clear = function () {
var ctx = _this.drawingCanvas.getContext('2d');
var ctx = _this.drawingCanvas.getContext("2d");
ctx.clearRect(0, 0, _this.drawingCanvas.width, _this.drawingCanvas.height);

@@ -848,8 +858,8 @@ ctx.clearRect(0, 0, -_this.drawingCanvas.width, _this.drawingCanvas.height);

createClass(Magnify, [{
key: 'componentDidMount',
key: "componentDidMount",
value: function componentDidMount() {
this.pixelCanvas = document.createElement('canvas');
this.pixelCanvas = document.createElement("canvas");
}
}, {
key: 'componentWillReceiveProps',
key: "componentWillReceiveProps",
value: function componentWillReceiveProps(nextProps) {

@@ -863,3 +873,3 @@ this._clear();

}, {
key: 'componentWillUnmount',
key: "componentWillUnmount",
value: function componentWillUnmount() {

@@ -869,16 +879,18 @@ this.pixelCanvas = null;

}, {
key: 'render',
key: "render",
value: function render() {
var _this2 = this;
return React.createElement('canvas', { ref: function ref(canvas) {
return React.createElement("canvas", {
ref: function ref(canvas) {
_this2.drawingCanvas = canvas;
},
style: {
position: 'absolute',
position: "absolute",
top: 0,
left: 0,
width: '100%',
height: '100%'
} });
width: "100%",
height: "100%"
}
});
}

@@ -899,4 +911,7 @@ }]);

return React.createElement(Magnify, _extends({}, props, {
enabledElement: enabledElement, pageX: pageX, pageY: pageY,
fliped: viewport.hflip }));
enabledElement: enabledElement,
pageX: pageX,
pageY: pageY,
fliped: viewport.hflip
}));
}

@@ -903,0 +918,0 @@ );

@@ -143,15 +143,15 @@ 'use strict';

var wrapperStyle = {
position: 'relative',
width: '100%',
height: '100%',
backgroundColor: 'black',
userSelect: 'none'
position: "relative",
width: "100%",
height: "100%",
backgroundColor: "black",
userSelect: "none"
};
var infoStyle = {
position: 'absolute',
bottom: '45px',
right: '30px',
width: '75px',
color: 'white',
textShadow: '-1px -1px 0 #000,1px -1px 0 #000,-1px 1px 0 #000,1px 1px 0 #000'
position: "absolute",
bottom: "45px",
right: "30px",
width: "75px",
color: "white",
textShadow: "-1px -1px 0 #000,1px -1px 0 #000,-1px 1px 0 #000,1px 1px 0 #000"
};

@@ -186,2 +186,5 @@

image.voiLUT = undefined; // remove VOI LUT for 'adjust' functionality
if (image.modalityLUT && typeof image.modalityLUT.firstValueMapped !== "number") {
image.modalityLUT = undefined;
}
var defaultViewport = cornerstone.getDefaultViewportForImage(_this.element, image);

@@ -200,3 +203,3 @@ var initialScale = defaultViewport.scale;

}));
typeof _this.props.onLoadImage === 'function' && _this.props.onLoadImage(image);
typeof _this.props.onLoadImage === "function" && _this.props.onLoadImage(image);
});

@@ -239,8 +242,8 @@ } catch (err) {

if (_this.props.controlState.mouseMode === 'adjust') {
if (_this.props.controlState.mouseMode === "adjust") {
_this.setState(produce__default(function (draft) {
draft.viewport.voi.windowWidth = Math.max(draft.viewport.voi.windowWidth + dx * 2, 1);
draft.viewport.voi.windowCenter = Math.max(draft.viewport.voi.windowCenter + dy * 2, 1);
draft.viewport.voi.windowWidth = Math.round(Math.max(draft.viewport.voi.windowWidth + dx * 2, 1));
draft.viewport.voi.windowCenter = Math.round(draft.viewport.voi.windowCenter + dy * 2);
}));
} else if (_this.props.controlState.mouseMode === 'pan') {
} else if (_this.props.controlState.mouseMode === "pan") {
_this.setState(produce__default(function (draft) {

@@ -299,3 +302,3 @@ draft.viewport.translation.x += dx / draft.viewport.scale;

_this.onError = function (err) {
typeof _this.props.onError === 'function' && _this.props.onError(err);
typeof _this.props.onError === "function" && _this.props.onError(err);
};

@@ -306,5 +309,5 @@ return _this;

createClass(Viewer, [{
key: 'componentDidMount',
key: "componentDidMount",
value: function componentDidMount() {
this.element.addEventListener('cornerstoneimagerendered', this.onImageRendered);
this.element.addEventListener("cornerstoneimagerendered", this.onImageRendered);
if (this.props.imageId) {

@@ -315,3 +318,3 @@ this.loadImage(this.props.imageId);

}, {
key: 'componentDidUpdate',
key: "componentDidUpdate",
value: function componentDidUpdate(prevProps, prevState) {

@@ -330,7 +333,7 @@ if (!this.props.imageId) {

}, {
key: 'componentWillUnmount',
key: "componentWillUnmount",
value: function componentWillUnmount() {
var element = this.element;
if (element) {
element.removeEventListener('cornerstoneimagerendered', this.onImageRendered);
element.removeEventListener("cornerstoneimagerendered", this.onImageRendered);
cornerstone.disable(element);

@@ -340,3 +343,3 @@ }

}, {
key: 'render',
key: "render",
value: function render() {

@@ -360,21 +363,27 @@ var _this2 = this;

React.createElement(
'div',
_extends({ style: wrapperStyle
"div",
_extends({
style: wrapperStyle
}, uiHandlers, {
ref: function ref(element) {
_this2.element = element;
} }),
React.createElement(ReactResizeDetector, { handleWidth: true, handleHeight: true, onResize: this.onResize }),
React.createElement('canvas', { className: 'cornerstone-canvas' }),
}
}),
React.createElement(ReactResizeDetector, {
handleWidth: true,
handleHeight: true,
onResize: this.onResize
}),
React.createElement("canvas", { className: "cornerstone-canvas" }),
this.props.children,
this.props.imageId && React.createElement(
'div',
"div",
{ style: infoStyle },
React.createElement(
'div',
"div",
null,
'Zoom'
"Zoom"
),
React.createElement(
'div',
"div",
null,

@@ -384,10 +393,10 @@ zoom

React.createElement(
'div',
"div",
null,
'WW/WL'
"WW/WL"
),
React.createElement(
'div',
"div",
null,
ww + '/' + wl
ww + "/" + wl
)

@@ -399,3 +408,3 @@ )

}], [{
key: 'getDerivedStateFromProps',
key: "getDerivedStateFromProps",
value: function getDerivedStateFromProps(nextProps, prevState) {

@@ -460,3 +469,3 @@ return produce__default(prevState, function (draft) {

var arrowY = vectorY * Math.max(16 * scale, 4);
var scaledLineWidth = Math.max(6 * scale, 1);
var scaledLineWidth = Math.max(8 * scale, 1);

@@ -489,3 +498,3 @@ ctx.save();

// text
ctx.font = scaledLineWidth * 8 + "px proximanova_semibold, sans-serif";
ctx.font = scaledLineWidth * 10 + "px proximanova_semibold, sans-serif";
ctx.strokeStyle = "black";

@@ -556,3 +565,3 @@ ctx.lineWidth = scaledLineWidth / 3 * 2;

_ref3$thickness = _ref3.thickness,
thickness = _ref3$thickness === undefined ? 6 : _ref3$thickness;
thickness = _ref3$thickness === undefined ? 8 : _ref3$thickness;

@@ -636,3 +645,3 @@ var scaledThickness = Math.max(thickness * scale, 1);

_this.pixelCanvas = document.createElement('canvas');
_this.pixelCanvas = document.createElement("canvas");
_this.heatmap = null;

@@ -646,3 +655,3 @@ _this._prepareHeatmap = _this._prepareHeatmap.bind(_this);

createClass(Heatmap, [{
key: 'componentDidUpdate',
key: "componentDidUpdate",
value: function componentDidUpdate(prevProps, prevState) {

@@ -669,19 +678,21 @@ if (this.props.enabledElement !== prevProps.enabledElement || this.props.posMap !== prevProps.posMap || this.props.threshold !== prevProps.threshold) {

}, {
key: 'render',
key: "render",
value: function render() {
var _this2 = this;
return React.createElement('canvas', { ref: function ref(canvas) {
return React.createElement("canvas", {
ref: function ref(canvas) {
_this2.drawingCanvas = canvas;
},
style: {
position: 'absolute',
position: "absolute",
top: 0,
left: 0,
width: '100%',
height: '100%'
} });
width: "100%",
height: "100%"
}
});
}
}, {
key: '_prepareHeatmap',
key: "_prepareHeatmap",
value: function _prepareHeatmap(posMap, threshold) {

@@ -692,3 +703,3 @@ var heatmapWidth = posMap[0].length;

this.drawingCanvas.height = heatmapHeight;
var heatmapImageData = this.drawingCanvas.getContext('2d').createImageData(heatmapWidth, heatmapHeight);
var heatmapImageData = this.drawingCanvas.getContext("2d").createImageData(heatmapWidth, heatmapHeight);
var pixels = heatmapImageData.data;

@@ -720,3 +731,3 @@ var offset = void 0,

}, {
key: '_redraw',
key: "_redraw",
value: function _redraw(enabledElement) {

@@ -728,3 +739,3 @@ if (!this.heatmap) {

this.drawingCanvas.height = this.drawingCanvas.offsetHeight;
var ctx = this.drawingCanvas.getContext('2d');
var ctx = this.drawingCanvas.getContext("2d");
ctx.save();

@@ -735,3 +746,3 @@ var heatmapImageData = this.heatmap.heatmapImageData;

this.pixelCanvas.height = heatmapImageData.height;
this.pixelCanvas.getContext('2d').putImageData(heatmapImageData, 0, 0);
this.pixelCanvas.getContext("2d").putImageData(heatmapImageData, 0, 0);
cornerstone.setToPixelCoordinateSystem(enabledElement, ctx);

@@ -758,5 +769,5 @@ var imageWidth = enabledElement.image.width;

}, {
key: '_clear',
key: "_clear",
value: function _clear() {
var ctx = this.drawingCanvas.getContext('2d');
var ctx = this.drawingCanvas.getContext("2d");
ctx.clearRect(0, 0, this.drawingCanvas.offsetWidth, this.drawingCanvas.offsetHeight);

@@ -775,4 +786,3 @@ }

viewport = _ref.viewport;
return React.createElement(Heatmap, _extends({}, props, {
enabledElement: enabledElement, viewport: viewport }));
return React.createElement(Heatmap, _extends({}, props, { enabledElement: enabledElement, viewport: viewport }));
}

@@ -827,3 +837,3 @@ );

_this.pixelCanvas.height = imageData.height;
_this.pixelCanvas.getContext('2d').putImageData(imageData, 0, 0);
_this.pixelCanvas.getContext("2d").putImageData(imageData, 0, 0);

@@ -834,4 +844,4 @@ _this.drawingCanvas.width = _this.drawingCanvas.offsetWidth;

var glassY = clientY - MAGNIFIER_SIZE / 2;
var ctx = _this.drawingCanvas.getContext('2d');
ctx.fillStyle = 'black';
var ctx = _this.drawingCanvas.getContext("2d");
ctx.fillStyle = "black";
if (fliped) {

@@ -845,3 +855,3 @@ ctx.scale(-1, 1);

}, _this._clear = function () {
var ctx = _this.drawingCanvas.getContext('2d');
var ctx = _this.drawingCanvas.getContext("2d");
ctx.clearRect(0, 0, _this.drawingCanvas.width, _this.drawingCanvas.height);

@@ -853,8 +863,8 @@ ctx.clearRect(0, 0, -_this.drawingCanvas.width, _this.drawingCanvas.height);

createClass(Magnify, [{
key: 'componentDidMount',
key: "componentDidMount",
value: function componentDidMount() {
this.pixelCanvas = document.createElement('canvas');
this.pixelCanvas = document.createElement("canvas");
}
}, {
key: 'componentWillReceiveProps',
key: "componentWillReceiveProps",
value: function componentWillReceiveProps(nextProps) {

@@ -868,3 +878,3 @@ this._clear();

}, {
key: 'componentWillUnmount',
key: "componentWillUnmount",
value: function componentWillUnmount() {

@@ -874,16 +884,18 @@ this.pixelCanvas = null;

}, {
key: 'render',
key: "render",
value: function render() {
var _this2 = this;
return React.createElement('canvas', { ref: function ref(canvas) {
return React.createElement("canvas", {
ref: function ref(canvas) {
_this2.drawingCanvas = canvas;
},
style: {
position: 'absolute',
position: "absolute",
top: 0,
left: 0,
width: '100%',
height: '100%'
} });
width: "100%",
height: "100%"
}
});
}

@@ -904,4 +916,7 @@ }]);

return React.createElement(Magnify, _extends({}, props, {
enabledElement: enabledElement, pageX: pageX, pageY: pageY,
fliped: viewport.hflip }));
enabledElement: enabledElement,
pageX: pageX,
pageY: pageY,
fliped: viewport.hflip
}));
}

@@ -908,0 +923,0 @@ );

{
"name": "@lunit/insight-viewer",
"version": "1.2.3",
"version": "1.2.5",
"description": "A React component for DICOM images",

@@ -5,0 +5,0 @@ "author": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc