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.0.6 to 1.0.7

76

dist/index.es.js

@@ -107,5 +107,4 @@ import * as dicomParser from 'dicom-parser';

var _templateObject = taggedTemplateLiteral(['\nposition: relative;\nwidth: 100%;\nheight: 100%;\nuser-select: none;\n'], ['\nposition: relative;\nwidth: 100%;\nheight: 100%;\nuser-select: none;\n']);
var _templateObject2 = taggedTemplateLiteral(['\nposition: absolute;\nbottom: 45px;\nright: 30px;\nwidth: 75px;\nmargin: 0;\ntext-shadow: -1px -1px 0 #000,1px -1px 0 #000,-1px 1px 0 #000,1px 1px 0 #000;\ndd {\n margin: 0;\n}\ndd+dt {\n margin-top: 18px;\n}\n'], ['\nposition: absolute;\nbottom: 45px;\nright: 30px;\nwidth: 75px;\nmargin: 0;\ntext-shadow: -1px -1px 0 #000,1px -1px 0 #000,-1px 1px 0 #000,1px 1px 0 #000;\ndd {\n margin: 0;\n}\ndd+dt {\n margin-top: 18px;\n}\n']);
var _templateObject3 = taggedTemplateLiteral(['\nposition: absolute;\nbottom: 15px;\nleft: 30px;\n'], ['\nposition: absolute;\nbottom: 15px;\nleft: 30px;\n']);
var _templateObject = taggedTemplateLiteral(['\nposition: relative;\nwidth: 100%;\nheight: 100%;\nbackground-color: black;\nuser-select: none;\n'], ['\nposition: relative;\nwidth: 100%;\nheight: 100%;\nbackground-color: black;\nuser-select: none;\n']);
var _templateObject2 = taggedTemplateLiteral(['\nposition: absolute;\nbottom: 45px;\nright: 30px;\nwidth: 75px;\nmargin: 0;\ncolor: white;\ntext-shadow: -1px -1px 0 #000,1px -1px 0 #000,-1px 1px 0 #000,1px 1px 0 #000;\ndd {\n margin: 0;\n}\ndd+dt {\n margin-top: 18px;\n}\n'], ['\nposition: absolute;\nbottom: 45px;\nright: 30px;\nwidth: 75px;\nmargin: 0;\ncolor: white;\ntext-shadow: -1px -1px 0 #000,1px -1px 0 #000,-1px 1px 0 #000,1px 1px 0 #000;\ndd {\n margin: 0;\n}\ndd+dt {\n margin-top: 18px;\n}\n']);

@@ -119,3 +118,2 @@ // cornerstone will mutate the viewport object

var Level = styled('dl')(_templateObject2);
var ErrorText = styled('div')(_templateObject3);

@@ -139,2 +137,27 @@ var Viewer = function (_React$Component) {

};
_this.loadImage = function (imageId) {
try {
disable(_this.element);
enable(_this.element);
loadImage(_this.props.imageId).then(function (image) {
image.voiLUT = undefined; // remove VOI LUT for 'adjust' functionality
var defaultViewport = getDefaultViewportForImage(_this.element, image);
var initialScale = defaultViewport.scale;
if (initialScale >= 1) {
defaultViewport.scale = 1;
}
displayImage(_this.element, image, defaultViewport);
_this.setState(produce(function (draft) {
draft.enabledElement = getEnabledElement(_this.element);
draft.image = image;
draft.viewport = defaultViewport;
draft.defaultViewport = defaultViewport;
draft.minScale = defaultViewport.scale;
}));
});
} catch (err) {
_this.onError(err);
console.error(err);
}
};
_this.onImageRendered = function (event) {

@@ -229,2 +252,5 @@ return _this.setState({

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

@@ -234,13 +260,8 @@ }

createClass(Viewer, [{
key: 'componentDidCatch',
value: function componentDidCatch(error, info) {
this.setState({
errorMsg: error.message
});
console.error(error);
}
}, {
key: 'componentDidMount',
value: function componentDidMount() {
this.element.addEventListener('cornerstoneimagerendered', this.onImageRendered);
if (this.props.imageId) {
this.loadImage(this.props.imageId);
}
}

@@ -250,4 +271,2 @@ }, {

value: function componentDidUpdate(prevProps, prevState) {
var _this2 = this;
if (!this.props.imageId) {

@@ -259,21 +278,3 @@ disable(this.element);

if (prevProps.imageId !== this.props.imageId) {
disable(this.element);
enable(this.element);
loadImage(this.props.imageId).then(function (image) {
image.voiLUT = undefined; // remove VOI LUT for 'adjust' functionality
var defaultViewport = getDefaultViewportForImage(_this2.element, image);
var initialScale = defaultViewport.scale;
if (initialScale >= 1) {
defaultViewport.scale = 1;
}
displayImage(_this2.element, image, defaultViewport);
_this2.setState(produce(function (draft) {
draft.enabledElement = getEnabledElement(_this2.element);
draft.image = image;
draft.viewport = defaultViewport;
draft.defaultViewport = defaultViewport;
draft.minScale = defaultViewport.scale;
draft.errorMsg = null;
}));
});
this.loadImage(this.props.imageId);
} else if (prevState.viewport !== this.state.viewport) {

@@ -295,3 +296,3 @@ setViewport(this.element, this.state.viewport);

value: function render() {
var _this3 = this;
var _this2 = this;

@@ -316,3 +317,3 @@ var zoom = this.state.viewport.scale.toFixed(2);

innerRef: function innerRef(element) {
_this3.element = element;
_this2.element = element;
} }),

@@ -345,7 +346,2 @@ React.createElement(ReactResizeDetector, { handleWidth: true, handleHeight: true, onResize: this.onResize }),

)
),
this.state.errorMsg && React.createElement(
ErrorText,
null,
this.state.errorMsg
)

@@ -352,0 +348,0 @@ )

@@ -112,5 +112,4 @@ 'use strict';

var _templateObject = taggedTemplateLiteral(['\nposition: relative;\nwidth: 100%;\nheight: 100%;\nuser-select: none;\n'], ['\nposition: relative;\nwidth: 100%;\nheight: 100%;\nuser-select: none;\n']);
var _templateObject2 = taggedTemplateLiteral(['\nposition: absolute;\nbottom: 45px;\nright: 30px;\nwidth: 75px;\nmargin: 0;\ntext-shadow: -1px -1px 0 #000,1px -1px 0 #000,-1px 1px 0 #000,1px 1px 0 #000;\ndd {\n margin: 0;\n}\ndd+dt {\n margin-top: 18px;\n}\n'], ['\nposition: absolute;\nbottom: 45px;\nright: 30px;\nwidth: 75px;\nmargin: 0;\ntext-shadow: -1px -1px 0 #000,1px -1px 0 #000,-1px 1px 0 #000,1px 1px 0 #000;\ndd {\n margin: 0;\n}\ndd+dt {\n margin-top: 18px;\n}\n']);
var _templateObject3 = taggedTemplateLiteral(['\nposition: absolute;\nbottom: 15px;\nleft: 30px;\n'], ['\nposition: absolute;\nbottom: 15px;\nleft: 30px;\n']);
var _templateObject = taggedTemplateLiteral(['\nposition: relative;\nwidth: 100%;\nheight: 100%;\nbackground-color: black;\nuser-select: none;\n'], ['\nposition: relative;\nwidth: 100%;\nheight: 100%;\nbackground-color: black;\nuser-select: none;\n']);
var _templateObject2 = taggedTemplateLiteral(['\nposition: absolute;\nbottom: 45px;\nright: 30px;\nwidth: 75px;\nmargin: 0;\ncolor: white;\ntext-shadow: -1px -1px 0 #000,1px -1px 0 #000,-1px 1px 0 #000,1px 1px 0 #000;\ndd {\n margin: 0;\n}\ndd+dt {\n margin-top: 18px;\n}\n'], ['\nposition: absolute;\nbottom: 45px;\nright: 30px;\nwidth: 75px;\nmargin: 0;\ncolor: white;\ntext-shadow: -1px -1px 0 #000,1px -1px 0 #000,-1px 1px 0 #000,1px 1px 0 #000;\ndd {\n margin: 0;\n}\ndd+dt {\n margin-top: 18px;\n}\n']);

@@ -124,3 +123,2 @@ // cornerstone will mutate the viewport object

var Level = styled('dl')(_templateObject2);
var ErrorText = styled('div')(_templateObject3);

@@ -144,2 +142,27 @@ var Viewer = function (_React$Component) {

};
_this.loadImage = function (imageId) {
try {
cornerstone.disable(_this.element);
cornerstone.enable(_this.element);
cornerstone.loadImage(_this.props.imageId).then(function (image) {
image.voiLUT = undefined; // remove VOI LUT for 'adjust' functionality
var defaultViewport = cornerstone.getDefaultViewportForImage(_this.element, image);
var initialScale = defaultViewport.scale;
if (initialScale >= 1) {
defaultViewport.scale = 1;
}
cornerstone.displayImage(_this.element, image, defaultViewport);
_this.setState(produce__default(function (draft) {
draft.enabledElement = cornerstone.getEnabledElement(_this.element);
draft.image = image;
draft.viewport = defaultViewport;
draft.defaultViewport = defaultViewport;
draft.minScale = defaultViewport.scale;
}));
});
} catch (err) {
_this.onError(err);
console.error(err);
}
};
_this.onImageRendered = function (event) {

@@ -234,2 +257,5 @@ return _this.setState({

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

@@ -239,13 +265,8 @@ }

createClass(Viewer, [{
key: 'componentDidCatch',
value: function componentDidCatch(error, info) {
this.setState({
errorMsg: error.message
});
console.error(error);
}
}, {
key: 'componentDidMount',
value: function componentDidMount() {
this.element.addEventListener('cornerstoneimagerendered', this.onImageRendered);
if (this.props.imageId) {
this.loadImage(this.props.imageId);
}
}

@@ -255,4 +276,2 @@ }, {

value: function componentDidUpdate(prevProps, prevState) {
var _this2 = this;
if (!this.props.imageId) {

@@ -264,21 +283,3 @@ cornerstone.disable(this.element);

if (prevProps.imageId !== this.props.imageId) {
cornerstone.disable(this.element);
cornerstone.enable(this.element);
cornerstone.loadImage(this.props.imageId).then(function (image) {
image.voiLUT = undefined; // remove VOI LUT for 'adjust' functionality
var defaultViewport = cornerstone.getDefaultViewportForImage(_this2.element, image);
var initialScale = defaultViewport.scale;
if (initialScale >= 1) {
defaultViewport.scale = 1;
}
cornerstone.displayImage(_this2.element, image, defaultViewport);
_this2.setState(produce__default(function (draft) {
draft.enabledElement = cornerstone.getEnabledElement(_this2.element);
draft.image = image;
draft.viewport = defaultViewport;
draft.defaultViewport = defaultViewport;
draft.minScale = defaultViewport.scale;
draft.errorMsg = null;
}));
});
this.loadImage(this.props.imageId);
} else if (prevState.viewport !== this.state.viewport) {

@@ -300,3 +301,3 @@ cornerstone.setViewport(this.element, this.state.viewport);

value: function render() {
var _this3 = this;
var _this2 = this;

@@ -321,3 +322,3 @@ var zoom = this.state.viewport.scale.toFixed(2);

innerRef: function innerRef(element) {
_this3.element = element;
_this2.element = element;
} }),

@@ -350,7 +351,2 @@ React.createElement(ReactResizeDetector, { handleWidth: true, handleHeight: true, onResize: this.onResize }),

)
),
this.state.errorMsg && React.createElement(
ErrorText,
null,
this.state.errorMsg
)

@@ -357,0 +353,0 @@ )

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

@@ -19,2 +19,3 @@ "author": {

"start": "rollup -c -w",
"standard": "standard",
"prepare": "yarn run build",

@@ -24,2 +25,5 @@ "predeploy": "cd example && yarn install && yarn run build",

},
"standard": {
"parser": "babel-eslint"
},
"dependencies": {

@@ -66,3 +70,4 @@ "cornerstone-core": "^2.2.4",

"rollup-plugin-postcss": "^1.1.0",
"rollup-plugin-url": "^1.3.0"
"rollup-plugin-url": "^1.3.0",
"standard": "^12.0.1"
},

@@ -69,0 +74,0 @@ "files": [

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