diff --git a/Sources/config/glanceProxyConfig.js b/Sources/config/glanceProxyConfig.js index 0f130ba0..711ec452 100644 --- a/Sources/config/glanceProxyConfig.js +++ b/Sources/config/glanceProxyConfig.js @@ -35,6 +35,29 @@ function activateOnCreate(def) { // ---------------------------------------------------------------------------- +function createDefaultView(classFactory, ui) { + return activateOnCreate( + createProxyDefinition(classFactory, ui, [ + { + type: 'application', + link: 'AnnotationOpacity', + property: 'annotationOpacity', + }, + { + type: 'application', + link: 'OrientationAxesVisibility', + property: 'orientationAxesVisibility', + }, + { + type: 'application', + link: 'OrientationAxesPreset', + property: 'presetToOrientationAxes', + }, + ]) + ); +} + +// ---------------------------------------------------------------------------- export default { definitions: { Proxy: { @@ -106,71 +129,11 @@ export default { Glyph: createProxyDefinition(vtkGlyphRepresentationProxy, proxyUI.Glyph), }, Views: { - View3D: activateOnCreate( - createProxyDefinition(vtkView, proxyUI.View3D, [ - { link: 'AnnotationOpacity', property: 'annotationOpacity' }, - { - link: 'OrientationAxesVisibility', - property: 'orientationAxesVisibility', - }, - { - link: 'OrientationAxesPreset', - property: 'presetToOrientationAxes', - }, - ]) - ), - View2D: activateOnCreate( - createProxyDefinition(vtk2DView, proxyUI.View2D, [ - { link: 'AnnotationOpacity', property: 'annotationOpacity' }, - { - link: 'OrientationAxesVisibility', - property: 'orientationAxesVisibility', - }, - { - link: 'OrientationAxesPreset', - property: 'presetToOrientationAxes', - }, - ]) - ), - View2D_X: activateOnCreate( - createProxyDefinition(vtk2DView, proxyUI.View2D, [ - { link: 'AnnotationOpacity', property: 'annotationOpacity' }, - { - link: 'OrientationAxesVisibility', - property: 'orientationAxesVisibility', - }, - { - link: 'OrientationAxesPreset', - property: 'presetToOrientationAxes', - }, - ]) - ), - View2D_Y: activateOnCreate( - createProxyDefinition(vtk2DView, proxyUI.View2D, [ - { link: 'AnnotationOpacity', property: 'annotationOpacity' }, - { - link: 'OrientationAxesVisibility', - property: 'orientationAxesVisibility', - }, - { - link: 'OrientationAxesPreset', - property: 'presetToOrientationAxes', - }, - ]) - ), - View2D_Z: activateOnCreate( - createProxyDefinition(vtk2DView, proxyUI.View2D, [ - { link: 'AnnotationOpacity', property: 'annotationOpacity' }, - { - link: 'OrientationAxesVisibility', - property: 'orientationAxesVisibility', - }, - { - link: 'OrientationAxesPreset', - property: 'presetToOrientationAxes', - }, - ]) - ), + View3D: createDefaultView(vtkView, proxyUI.View3D), + View2D: createDefaultView(vtk2DView, proxyUI.View2D), + View2D_X: createDefaultView(vtk2DView, proxyUI.View2D), + View2D_Y: createDefaultView(vtk2DView, proxyUI.View2D), + View2D_Z: createDefaultView(vtk2DView, proxyUI.View2D), }, }, representations: { diff --git a/Sources/externals/ITKReader/ITKImageReader.js b/Sources/externals/ITKReader/ITKImageReader.js deleted file mode 100644 index f68f6b4c..00000000 --- a/Sources/externals/ITKReader/ITKImageReader.js +++ /dev/null @@ -1,67 +0,0 @@ -import macro from 'vtk.js/Sources/macro'; -import ITKHelper from 'vtk.js/Sources/Common/DataModel/ITKHelper'; - -import readImageArrayBuffer from 'itk/readImageArrayBuffer'; - -const { convertItkToVtkImage } = ITKHelper; - -// ---------------------------------------------------------------------------- -// vtkITKImageReader methods -// ---------------------------------------------------------------------------- - -function vtkITKImageReader(publicAPI, model) { - // Set our className - model.classHierarchy.push('vtkITKImageReader'); - - // Returns a promise to signal when image is ready - publicAPI.parseAsArrayBuffer = (arrayBuffer) => { - if (!arrayBuffer || arrayBuffer === model.rawDataBuffer) { - return Promise.resolve(); - } - - model.rawDataBuffer = arrayBuffer; - - return readImageArrayBuffer(arrayBuffer, model.fileName).then( - (itkImage) => { - const imageData = convertItkToVtkImage(itkImage); - model.output[0] = imageData; - - publicAPI.modified(); - } - ); - }; - - publicAPI.requestData = (inData, outData) => { - publicAPI.parseAsArrayBuffer(model.rawDataBuffer, model.fileName); - }; -} - -// ---------------------------------------------------------------------------- -// Object factory -// ---------------------------------------------------------------------------- - -const DEFAULT_VALUES = { - fileName: '', -}; - -// ---------------------------------------------------------------------------- - -export function extend(publicAPI, model, initialValues = {}) { - Object.assign(model, DEFAULT_VALUES, initialValues); - - // Build VTK API - macro.obj(publicAPI, model); - macro.algo(publicAPI, model, 0, 1); - macro.setGet(publicAPI, model, ['fileName']); - - // vtkITKImageReader methods - vtkITKImageReader(publicAPI, model); -} - -// ---------------------------------------------------------------------------- - -export const newInstance = macro.newInstance(extend, 'vtkITKImageReader'); - -// ---------------------------------------------------------------------------- - -export default { newInstance, extend }; diff --git a/Sources/externals/ITKReader/index.js b/Sources/externals/ITKReader/index.js index 3d48a6b2..96fd6400 100644 --- a/Sources/externals/ITKReader/index.js +++ b/Sources/externals/ITKReader/index.js @@ -1,6 +1,9 @@ +import vtkITKImageReader from 'vtk.js/Sources/IO/Misc/ITKImageReader'; + import extensionToIO from 'itk/extensionToIO'; +import readImageArrayBuffer from 'itk/readImageArrayBuffer'; -import vtkITKImageReader from './ITKImageReader'; +vtkITKImageReader.setReadImageArrayBufferFromITK(readImageArrayBuffer); export const extensions = Array.from( new Set(Object.keys(extensionToIO).map((ext) => ext.toLowerCase())) @@ -22,7 +25,6 @@ export function registerToGlance(Glance) { export default { extensions, - vtkITKImageReader, registerToGlance, }; diff --git a/package-lock.json b/package-lock.json index d58e999a..1e7848cf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -450,6 +450,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/add-dom-event-listener/-/add-dom-event-listener-1.0.2.tgz", "integrity": "sha1-j67SxBAIchzxEdodMNmVuFvkK+0=", + "dev": true, "requires": { "object-assign": "4.1.1" } @@ -716,7 +717,8 @@ "asap": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", - "integrity": "sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY=" + "integrity": "sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY=", + "dev": true }, "asn1": { "version": "0.2.3", @@ -1610,6 +1612,7 @@ "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", + "dev": true, "requires": { "core-js": "2.5.3", "regenerator-runtime": "0.11.1" @@ -1618,7 +1621,8 @@ "core-js": { "version": "2.5.3", "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.3.tgz", - "integrity": "sha1-isw4NFgk8W2DZbfJtCWRaOjtYD4=" + "integrity": "sha1-isw4NFgk8W2DZbfJtCWRaOjtYD4=", + "dev": true } } }, @@ -2786,6 +2790,7 @@ "version": "1.2.6", "resolved": "https://registry.npmjs.org/component-classes/-/component-classes-1.2.6.tgz", "integrity": "sha1-xkI5TDYYpNiwuJGe/Mu9kw5c1pE=", + "dev": true, "requires": { "component-indexof": "0.0.3" } @@ -2799,7 +2804,8 @@ "component-indexof": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/component-indexof/-/component-indexof-0.0.3.tgz", - "integrity": "sha1-EdCRMSI5648yyPJa6csAL/6NPCQ=" + "integrity": "sha1-EdCRMSI5648yyPJa6csAL/6NPCQ=", + "dev": true }, "compressible": { "version": "2.0.13", @@ -3245,6 +3251,7 @@ "version": "1.4.1", "resolved": "https://registry.npmjs.org/css-animation/-/css-animation-1.4.1.tgz", "integrity": "sha1-W4gTEl3g+7uwu+G0cq6EIhRpt6g=", + "dev": true, "requires": { "babel-runtime": "6.26.0", "component-classes": "1.2.6" @@ -3882,7 +3889,8 @@ "dom-align": { "version": "1.6.7", "resolved": "https://registry.npmjs.org/dom-align/-/dom-align-1.6.7.tgz", - "integrity": "sha512-FrHttKVCqdHaDyVjygY+8kRhcNOJEdvAkc2ltppJUz71ekgpzIOuLgsOIKVqzdETI2EocmW2DzF+uP365qcR5Q==" + "integrity": "sha512-FrHttKVCqdHaDyVjygY+8kRhcNOJEdvAkc2ltppJUz71ekgpzIOuLgsOIKVqzdETI2EocmW2DzF+uP365qcR5Q==", + "dev": true }, "dom-converter": { "version": "0.1.4", @@ -4089,6 +4097,7 @@ "version": "0.1.12", "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.12.tgz", "integrity": "sha1-U4tm8+5izRq1HsMjgp0flIDHS+s=", + "dev": true, "requires": { "iconv-lite": "0.4.19" } @@ -5068,6 +5077,7 @@ "version": "0.8.16", "resolved": "https://registry.npmjs.org/fbjs/-/fbjs-0.8.16.tgz", "integrity": "sha1-XmdDL1UNxBtXK/VYR7ispk5TN9s=", + "dev": true, "requires": { "core-js": "1.2.7", "isomorphic-fetch": "2.2.1", @@ -5081,7 +5091,8 @@ "core-js": { "version": "1.2.7", "resolved": "https://registry.npmjs.org/core-js/-/core-js-1.2.7.tgz", - "integrity": "sha1-ZSKUwUZR2yj6k70tX/KYOk8IxjY=" + "integrity": "sha1-ZSKUwUZR2yj6k70tX/KYOk8IxjY=", + "dev": true } } }, @@ -7209,7 +7220,8 @@ "iconv-lite": { "version": "0.4.19", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz", - "integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ==" + "integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ==", + "dev": true }, "icss-replace-symbols": { "version": "1.1.0", @@ -7995,7 +8007,8 @@ "is-stream": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", - "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=" + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", + "dev": true }, "is-subset": { "version": "0.1.1", @@ -8084,6 +8097,7 @@ "version": "2.2.1", "resolved": "https://registry.npmjs.org/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz", "integrity": "sha1-YRrhrPFPXoH3KVB0coGf6XM1WKk=", + "dev": true, "requires": { "node-fetch": "1.7.3", "whatwg-fetch": "2.0.3" @@ -8131,7 +8145,8 @@ "js-tokens": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", - "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=" + "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", + "dev": true }, "js-yaml": { "version": "3.7.0", @@ -8612,7 +8627,8 @@ "lodash._getnative": { "version": "3.9.1", "resolved": "https://registry.npmjs.org/lodash._getnative/-/lodash._getnative-3.9.1.tgz", - "integrity": "sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U=" + "integrity": "sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U=", + "dev": true }, "lodash._reinterpolate": { "version": "3.0.0", @@ -8650,17 +8666,20 @@ "lodash.isarguments": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz", - "integrity": "sha1-L1c9hcaiQon/AGY7SRwdM4/zRYo=" + "integrity": "sha1-L1c9hcaiQon/AGY7SRwdM4/zRYo=", + "dev": true }, "lodash.isarray": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/lodash.isarray/-/lodash.isarray-3.0.4.tgz", - "integrity": "sha1-eeTriMNqgSKvhvhEqpvNhRtfu1U=" + "integrity": "sha1-eeTriMNqgSKvhvhEqpvNhRtfu1U=", + "dev": true }, "lodash.keys": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-3.1.2.tgz", "integrity": "sha1-TbwEcrFWvlCgsoaFXRvQsMZWCYo=", + "dev": true, "requires": { "lodash._getnative": "3.9.1", "lodash.isarguments": "3.1.0", @@ -8726,6 +8745,7 @@ "version": "1.3.1", "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.3.1.tgz", "integrity": "sha1-0aitM/qc4OcT1l/dCsi3SNR4yEg=", + "dev": true, "requires": { "js-tokens": "3.0.2" } @@ -9371,6 +9391,7 @@ "version": "1.7.3", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-1.7.3.tgz", "integrity": "sha512-NhZ4CsKx7cYm2vSrBAr2PvFOe6sWDf0UYLRqA6svUYg7+/TSfVAu49jYC4BvQ4Sms9SZgdqGBgroqfDhJdTyKQ==", + "dev": true, "requires": { "encoding": "0.1.12", "is-stream": "1.1.0" @@ -9623,7 +9644,8 @@ "object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", + "dev": true }, "object-copy": { "version": "0.1.0", @@ -10079,8 +10101,7 @@ "paraviewweb": "3.0.13", "rc-dropdown": "2.1.0", "rc-progress": "2.2.5", - "shelljs": "0.7.8", - "vtk.js": "6.3.14" + "shelljs": "0.7.8" } }, "paraviewweb": { @@ -16534,6 +16555,7 @@ "version": "7.3.1", "resolved": "https://registry.npmjs.org/promise/-/promise-7.3.1.tgz", "integrity": "sha512-nolQXZ/4L+bP/UGlkfaIujX9BKxGwmQ9OT4mOt5yvy8iK1h3wqTEJCijzGANTCCl9nWjY41juyAn2K3Q1hLLTg==", + "dev": true, "requires": { "asap": "2.0.6" } @@ -16554,6 +16576,7 @@ "version": "15.6.0", "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.6.0.tgz", "integrity": "sha1-zq8IMCL8RrSjX2nhPvda7Q1jmFY=", + "dev": true, "requires": { "fbjs": "0.8.16", "loose-envify": "1.3.1", @@ -16794,6 +16817,7 @@ "version": "2.3.5", "resolved": "https://registry.npmjs.org/rc-align/-/rc-align-2.3.5.tgz", "integrity": "sha512-V1AN/gMNiJ3vOzbY/H3CTxhzYH+Ri2KlsEpo1SN8/SYmI4I/ZfQpScFAgmERuIGcLStA2sOEeBNVpH2FaOd2hA==", + "dev": true, "requires": { "babel-runtime": "6.26.0", "dom-align": "1.6.7", @@ -16805,6 +16829,7 @@ "version": "2.4.4", "resolved": "https://registry.npmjs.org/rc-animate/-/rc-animate-2.4.4.tgz", "integrity": "sha512-DjJLTUQj7XKKcuS8cczN0uOLfuSmgrVXFGieP1SZc87xUUTFGh8B/KjNmEtlfvxkSrSuVfb2rrEPER4SqKUtEA==", + "dev": true, "requires": { "babel-runtime": "6.26.0", "css-animation": "1.4.1", @@ -16815,6 +16840,7 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/rc-dropdown/-/rc-dropdown-2.1.0.tgz", "integrity": "sha512-M+4/Fusiti/tZaD2TvfD7iNWNe448TGsv/xevdrWLnW7/2lYJCPFwpKUvu0Jk7lYeviOIx9bWZ3oSXs99TtX9A==", + "dev": true, "requires": { "babel-runtime": "6.26.0", "prop-types": "15.6.0", @@ -16836,6 +16862,7 @@ "version": "2.2.5", "resolved": "https://registry.npmjs.org/rc-progress/-/rc-progress-2.2.5.tgz", "integrity": "sha1-5h0FRL+dQgjlujL8UJYhWef5UqM=", + "dev": true, "requires": { "babel-runtime": "6.26.0", "prop-types": "15.6.0" @@ -16861,6 +16888,7 @@ "version": "2.3.4", "resolved": "https://registry.npmjs.org/rc-trigger/-/rc-trigger-2.3.4.tgz", "integrity": "sha512-xPhda3SfGWHywEbVJu2VxpWg99ELStzNPcdnxb7lZ9XwUnHjUeX9KCaIbJa9GUuoVHx3mQP1s2m3ttIB8aashQ==", + "dev": true, "requires": { "babel-runtime": "6.26.0", "prop-types": "15.6.0", @@ -16873,6 +16901,7 @@ "version": "4.4.0", "resolved": "https://registry.npmjs.org/rc-util/-/rc-util-4.4.0.tgz", "integrity": "sha512-PIWw9VBjLc2m4GZBPxMFT3QaOIMQ0PdzMjAs02nQ3RSPDt6oLzZ+rMBzN1AxcNkkpBbz0Zmdg3llZGzYraWFew==", + "dev": true, "requires": { "add-dom-event-listener": "1.0.2", "babel-runtime": "6.26.0", @@ -16884,6 +16913,7 @@ "version": "0.2.2", "resolved": "https://registry.npmjs.org/shallowequal/-/shallowequal-0.2.2.tgz", "integrity": "sha1-HjL9W8q2rWiKSBLLDMBO/HXHAU4=", + "dev": true, "requires": { "lodash.keys": "3.1.2" } @@ -17083,7 +17113,8 @@ "regenerator-runtime": { "version": "0.11.1", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", - "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==" + "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==", + "dev": true }, "regenerator-transform": { "version": "0.10.1", @@ -17793,7 +17824,8 @@ "setimmediate": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", - "integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU=" + "integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU=", + "dev": true }, "setprototypeof": { "version": "1.1.0", @@ -19723,7 +19755,8 @@ "ua-parser-js": { "version": "0.7.17", "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.17.tgz", - "integrity": "sha512-uRdSdu1oA1rncCQL7sCj8vSyZkgtL7faaw9Tc9rZ3mGgraQ7+Pdx7w5mnOSF3gw9ZNG6oc+KXfkon3bKuROm0g==" + "integrity": "sha512-uRdSdu1oA1rncCQL7sCj8vSyZkgtL7faaw9Tc9rZ3mGgraQ7+Pdx7w5mnOSF3gw9ZNG6oc+KXfkon3bKuROm0g==", + "dev": true }, "uglify-js": { "version": "3.3.12", @@ -20283,9 +20316,9 @@ } }, "vtk.js": { - "version": "6.3.14", - "resolved": "https://registry.npmjs.org/vtk.js/-/vtk.js-6.3.14.tgz", - "integrity": "sha512-t2WxOdjJn3novF1isoJxn/0oWhMTApHsypmOacmX3ZovXgYmljzHbZMuJ+zAy5ZYG0QHOgPDoT+ZvBwAYn3zPg==", + "version": "6.4.7", + "resolved": "https://registry.npmjs.org/vtk.js/-/vtk.js-6.4.7.tgz", + "integrity": "sha512-bcSYPe0Kfoijs0CkgtyrM+GnpMLeYlXXHL7kQk26YX/0uP/ZaHtFmYSJVBFYcAnqbi+J7EpJkpjbHJ+sYEjivQ==", "requires": { "base64-js": "1.2.1", "blueimp-md5": "2.10.0", @@ -21005,7 +21038,8 @@ "whatwg-fetch": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-2.0.3.tgz", - "integrity": "sha1-nITsLc9oGH/wC8ZOEnS0QhduHIQ=" + "integrity": "sha1-nITsLc9oGH/wC8ZOEnS0QhduHIQ=", + "dev": true }, "whet.extend": { "version": "0.9.9", diff --git a/package.json b/package.json index 4a943358..a26d7be3 100644 --- a/package.json +++ b/package.json @@ -18,10 +18,8 @@ "mout": "1.0.0", "normalize.css": "^8.0.0", "paraviewweb": "3.0.13", - "rc-dropdown": "^2.1.0", - "rc-progress": "^2.2.5", "shelljs": "0.7.8", - "vtk.js": "6.3.14" + "vtk.js": "6.4.7" }, "devDependencies": { "@fortawesome/fontawesome-free-webfonts": "^1.0.4", @@ -33,6 +31,8 @@ "kw-web-suite": "5.0.1", "lodash": "^4.17.4", "postcss-variables": "1.1.1", + "rc-dropdown": "^2.1.0", + "rc-progress": "^2.2.5", "rc-tabs": "^9.2.4", "react": "16.1.1", "react-dom": "16.1.1",