feat(vtk): Enable vtk extension (still very much work-in-progress)
This commit is contained in:
1 parent
932fcea446
commit
ec51cb7a6c
24 files changed
+1697
-253
No files matched your search
@@ -22,4 +22,5 @@ yarn-debug.log*
|
||||
yarn-error.log*
|
||||
.idea
|
||||
|
||||
yalc.lock
|
||||
yalc.lock
|
||||
.yalc
|
||||
@@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2019 Open Health Imaging Foundation
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -1,31 +0,0 @@
|
||||
# react-vtkjs-viewport
|
||||
|
||||
> VTK.js image viewport component for React
|
||||
|
||||
[](https://www.npmjs.com/package/react-vtkjs-viewport)
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
npm install --save react-vtkjs-viewport
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```jsx
|
||||
import React, { Component } from 'react'
|
||||
|
||||
import CornerstoneViewport from 'react-cornerstone-viewport'
|
||||
|
||||
class Example extends Component {
|
||||
render () {
|
||||
return (
|
||||
<CornerstoneViewport />
|
||||
)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
MIT © [OHIF](https://github.com/OHIF)
|
||||
@@ -1,55 +0,0 @@
|
||||
{
|
||||
"name": "react-vtkjs-viewport",
|
||||
"version": "0.0.6-76b678ec",
|
||||
"description": "VTK.js image viewport component for React",
|
||||
"author": "OHIF Contributors",
|
||||
"license": "MIT",
|
||||
"repository": "OHIF/react-vtkjs-viewport",
|
||||
"main": "dist/index.js",
|
||||
"engines": {
|
||||
"node": ">=8",
|
||||
"npm": ">=5"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "webpack --progress --colors --mode development",
|
||||
"build:release": "webpack --progress --colors --mode production",
|
||||
"start": "webpack --watch --progress --colors --mode development",
|
||||
"prepare": "npm run build:release",
|
||||
"predeploy": "cd example && npm install && npm run build:release",
|
||||
"prepublishOnly": "npm run build:release",
|
||||
"deploy": "gh-pages -d example/build",
|
||||
"generateStaticSite": "./generateStaticSite.sh"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^15.0.0 || ^16.0.0",
|
||||
"react-dom": "^15.0.0 || ^16.0.0"
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"pre-commit": "lint-staged"
|
||||
}
|
||||
},
|
||||
"lint-staged": {
|
||||
"src/**/*.{js,jsx,json,css}": [
|
||||
"prettier --single-quote --write",
|
||||
"git add"
|
||||
]
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": "react-app"
|
||||
},
|
||||
"browserslist": [
|
||||
">0.2%",
|
||||
"not dead",
|
||||
"not ie <= 11",
|
||||
"not op_mini all"
|
||||
],
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"dependencies": {
|
||||
"cornerstone-core": "^2.2.8",
|
||||
"cornerstone-math": "^0.1.8",
|
||||
"vtk.js": "^8.3.11"
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
76b678ec6a9c889ca68231a62fd71346
|
||||
@@ -20,8 +20,6 @@
|
||||
},
|
||||
"peerDependencies": {
|
||||
"cornerstone-core": "^2.2.8",
|
||||
"cornerstone-math": "^0.1.8",
|
||||
"cornerstone-tools": "^3.1.0",
|
||||
"cornerstone-wado-image-loader": "^2.2.3",
|
||||
"dcmjs": "^0.3.6",
|
||||
"dicom-parser": "^1.8.3",
|
||||
@@ -54,7 +52,7 @@
|
||||
"prettier": "^1.15.3",
|
||||
"react": "^16.6.3",
|
||||
"react-dom": "^16.6.3",
|
||||
"react-viewerbase": "^0.2.10",
|
||||
"react-viewerbase": "^0.2.11",
|
||||
"rollup": "^1.1.2",
|
||||
"rollup-plugin-babel": "^4.2.0",
|
||||
"rollup-plugin-commonjs": "^9.2.0",
|
||||
@@ -90,6 +88,6 @@
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.2.0",
|
||||
"classnames": "^2.2.6",
|
||||
"react-vtkjs-viewport": "file:.yalc/react-vtkjs-viewport"
|
||||
"react-vtkjs-viewport": "^0.0.7"
|
||||
}
|
||||
}
|
||||
@@ -57,6 +57,12 @@ export default {
|
||||
commonjs({
|
||||
include: ['node_modules/**', '.yalc/**'],
|
||||
namedExports: {
|
||||
'node_modules/react-vtkjs-viewport/dist/index.js': [
|
||||
'getImageData',
|
||||
'loadImageData',
|
||||
'VTKViewport',
|
||||
'VTKMPRViewport',
|
||||
],
|
||||
'.yalc/react-vtkjs-viewport/dist/index.js': [
|
||||
'getImageData',
|
||||
'loadImageData',
|
||||
|
||||
@@ -3,6 +3,7 @@ import { ToolbarSection } from 'react-viewerbase';
|
||||
import OHIF from 'ohif-core'
|
||||
|
||||
const { setToolActive } = OHIF.redux.actions;
|
||||
const Icons = 'icons.svg';
|
||||
|
||||
const mapStateToProps = state => {
|
||||
const activeButton = state.tools.buttons.find(tool => tool.active === true);
|
||||
@@ -12,8 +13,7 @@ const mapStateToProps = state => {
|
||||
command: 'Rotate',
|
||||
type: 'tool',
|
||||
text: 'Rotate',
|
||||
iconClasses: 'fa fa-rotate',
|
||||
//svgUrl: `${Icons}#icon-tools-stack-scroll`,
|
||||
svgUrl: `${Icons}#3d-rotate`,
|
||||
active: true
|
||||
}],
|
||||
activeCommand: 'Rotate'
|
||||
|
||||
@@ -131,22 +131,27 @@ class OHIFVTKViewport extends Component {
|
||||
frameIndex
|
||||
);
|
||||
|
||||
let imageDataObject;
|
||||
let labelmapDataObject;
|
||||
let doneLoadingCallback;
|
||||
let callbacks;
|
||||
|
||||
switch (sopClassUid) {
|
||||
case SOP_CLASSES.SEGMENTATION_STORAGE:
|
||||
throw new Error("Not yet implemented");
|
||||
|
||||
const data = handleSegmentationStorage(stack.imageIds, displaySetInstanceUid, cornerstone);
|
||||
const imageDataObject = data.referenceDataObject;
|
||||
const labelmapDataObject = data.labelmapDataObject;
|
||||
imageDataObject = data.referenceDataObject;
|
||||
labelmapDataObject = data.labelmapDataObject;
|
||||
|
||||
const doneLoadingCallback = () => {
|
||||
doneLoadingCallback = () => {
|
||||
resolve({
|
||||
data: imageDataObject.vtkImageData,
|
||||
labelmap: labelmapDataObject
|
||||
});
|
||||
};
|
||||
|
||||
const callbacks = [
|
||||
callbacks = [
|
||||
doneLoadingCallback
|
||||
];
|
||||
|
||||
@@ -154,14 +159,14 @@ class OHIFVTKViewport extends Component {
|
||||
|
||||
break;
|
||||
default:
|
||||
const imageDataObject = getImageData(stack.imageIds, displaySetInstanceUid, cornerstone);
|
||||
const doneLoadingCallback = () => {
|
||||
imageDataObject = getImageData(stack.imageIds, displaySetInstanceUid, cornerstone);
|
||||
doneLoadingCallback = () => {
|
||||
resolve({
|
||||
data: imageDataObject.vtkImageData,
|
||||
});
|
||||
};
|
||||
|
||||
const callbacks = [
|
||||
callbacks = [
|
||||
doneLoadingCallback
|
||||
];
|
||||
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import OHIF from 'ohif-core';
|
||||
import cornerstone from 'cornerstone-core';
|
||||
import cornerstoneTools from 'cornerstone-tools';
|
||||
import * as dcmjs from 'dcmjs';
|
||||
|
||||
const { StackManager } = OHIF.utils;
|
||||
|
||||
@@ -6849,10 +6849,10 @@ react-transition-group@^2.0.0, react-transition-group@^2.2.0:
|
||||
prop-types "^15.6.2"
|
||||
react-lifecycles-compat "^3.0.4"
|
||||
|
||||
react-viewerbase@^0.2.10:
|
||||
version "0.2.10"
|
||||
resolved "https://registry.yarnpkg.com/react-viewerbase/-/react-viewerbase-0.2.10.tgz#b6b6ec12b5568982d13b0a9733312fd39b68e121"
|
||||
integrity sha512-daTLjCW4natY7cPatA/4AGyRanu+PyREYt5qI0YRRwCFtIcZTFnCYfZWX9hn6oXmbHiO5ceHzwa9i4x7oCEfkw==
|
||||
react-viewerbase@^0.2.11:
|
||||
version "0.2.11"
|
||||
resolved "https://registry.yarnpkg.com/react-viewerbase/-/react-viewerbase-0.2.11.tgz#1015bb6c2876b2ce1a40dece8d614f7266d9fcb1"
|
||||
integrity sha512-s2Nr3VSjANIvalhTPKn2CUoHzDpKiHl81BYYEFdcAt20chTmpBRlH6J6uQ7rrxpO8Iz3OblpWinNJf9+6E0pDg==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.2.0"
|
||||
classnames "^2.2.6"
|
||||
@@ -6865,12 +6865,14 @@ react-viewerbase@^0.2.10:
|
||||
react-dnd-html5-backend "^7.0.2"
|
||||
react-with-direction "^1.3.0"
|
||||
|
||||
"react-vtkjs-viewport@file:.yalc/react-vtkjs-viewport":
|
||||
version "0.0.5-d97d50b1"
|
||||
react-vtkjs-viewport@^0.0.7:
|
||||
version "0.0.7"
|
||||
resolved "https://registry.yarnpkg.com/react-vtkjs-viewport/-/react-vtkjs-viewport-0.0.7.tgz#8fcb3adfc6609d6e3fc6d5af94d59cb1ec4426c0"
|
||||
integrity sha512-rlum/DCr5hwX4CcWXOG4HuMeD3c5ebU7eWhQRhetfcmljatCMt1oKctt+JLqllvSrpzr8lHpRG95Ek2KH12JEA==
|
||||
dependencies:
|
||||
cornerstone-core "^2.2.8"
|
||||
cornerstone-math "^0.1.8"
|
||||
vtk.js "^8.3.10"
|
||||
vtk.js "^8.3.11"
|
||||
|
||||
react-with-direction@^1.3.0:
|
||||
version "1.3.0"
|
||||
@@ -8710,10 +8712,10 @@ vfile@^3.0.0:
|
||||
unist-util-stringify-position "^1.0.0"
|
||||
vfile-message "^1.0.0"
|
||||
|
||||
vtk.js@^8.3.10:
|
||||
version "8.3.10"
|
||||
resolved "https://registry.yarnpkg.com/vtk.js/-/vtk.js-8.3.10.tgz#d5f99940ea46b7f54de49bce3482b9afb7c3ca83"
|
||||
integrity sha512-pF71oKAjfMNKiP3RNw49dgT3Y50zSwAfCqM4Z1+ggx+So8Nf/0XZZe7I8SV+t/QntX8NaSzvbRDxG/fqnRrZ8w==
|
||||
vtk.js@^8.3.11:
|
||||
version "8.3.15"
|
||||
resolved "https://registry.yarnpkg.com/vtk.js/-/vtk.js-8.3.15.tgz#060b355c1a811229ec0e43ef69b63915d0e1da8e"
|
||||
integrity sha512-mbsajcTnRgIGmWtcSdGqzYLdrRVrLE7YjdNcvDybLM9JNTVXEngHzeWuNZGYqklPAGcCsckaZ3FzYqu/EH4UBA==
|
||||
dependencies:
|
||||
base64-js "1.2.1"
|
||||
blueimp-md5 "2.10.0"
|
||||
|
||||
Reference in new issue
Block a user