Refactor extensions interface (#344)

* Added container class for plugins that care for registration of submodules

* Added extensions manager that cares for adding modules to store

* Make extensions require less knowledge of internal extension management

* Reformatting

* Update generateStaticSite to use ohif-viewer, remove old OHIFViewer-react folder

* Add yarn.lock so Netlify knows to use Yarn

* Fix for copying static site folder

* Try to fix netlify build which is stuck uploading

* Try to fix static site deployment

* Try to fix static site deployment again

* Try to fix static site deployment one more time

* Extracted pdf plugin into external package

* Removed some unused dependencies

* Published pdf extension to npm registry

* Added external microscopy extension (work in progress)

* Extraction of microscopy plugin working now

* Added microscopy extension npm package to package.json

* Increase ohif-core version

* update yarn.lock

* Fix error in readme

* Fix authentication error in pdf plugin

* Remove readme, update packages, add redirect for netlify

* netlify test

* netlify test 2

* netlify test 2, forgot to add new redirects file

* Use public dicom server for demo

* Another netlify try

* Another netlify try 2

* Another netlify try 3

* Another netlify try 4
This commit is contained in:
Sandra authored and Erik Ziegler committed 2019-02-02 11:10:56 +00:00
1 parent af68db0c09
commit b93a677ef3
121 files changed
+14151 -35046

No files matched your search

@@ -0,0 +1,14 @@
{
"presets": [
["@babel/preset-env", {
"targets": {
"ie": "11"
}
}],
"@babel/preset-react"
],
"plugins": [
"@babel/plugin-proposal-class-properties",
"@babel/plugin-transform-runtime"
]
}
@@ -0,0 +1,9 @@
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
@@ -0,0 +1,16 @@
{
"extends": [
"react-app",
"eslint:recommended",
"plugin:react/recommended"
],
"parser": "babel-eslint",
"env": {
"jest": true
},
"settings": {
"react": {
"version": "detect",
},
},
}
@@ -0,0 +1,23 @@
# See https://help.github.com/ignore-files/ for more about ignoring files.
# dependencies
node_modules
# builds
build
dist
.rpt2_cache
# misc
.DS_Store
.env
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.idea
@@ -0,0 +1,3 @@
{
"singleQuote": true
}
@@ -0,0 +1,4 @@
language: node_js
node_js:
- 9
- 8
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2018 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.
@@ -0,0 +1,88 @@
{
"name": "ohif-dicom-microscopy-extension",
"version": "0.0.3",
"description": "OHIF extension for Dicom Microscopy",
"author": "OHIF",
"license": "MIT",
"repository": "OHIF/Viewers",
"main": "dist/index.js",
"module": "dist/index.es.js",
"jsnext:main": "dist/index.es.js",
"engines": {
"node": ">=8",
"npm": ">=5"
},
"scripts": {
"build": "rollup -c",
"start": "rollup -c -w",
"lint": "eslint -c .eslintrc --fix src && prettier --single-quote --write src/**/*.{js,jsx,json,css}"
},
"peerDependencies": {
"react": "^15.0.0 || ^16.0.0",
"react-dom": "^15.0.0 || ^16.0.0"
},
"devDependencies": {
"@babel/core": "^7.2.2",
"@babel/plugin-external-helpers": "^7.2.0",
"@babel/plugin-proposal-class-properties": "^7.2.3",
"@babel/plugin-transform-runtime": "^7.2.0",
"@babel/preset-env": "^7.2.3",
"@babel/preset-react": "^7.0.0",
"@svgr/rollup": "^4.1.0",
"babel-eslint": "^9.0.0",
"cross-env": "^5.2.0",
"eslint": "5.6.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-node": "^8.0.0",
"eslint-plugin-promise": "^4.0.1",
"eslint-plugin-react": "^7.11.1",
"gh-pages": "^2.0.1",
"husky": "^1.3.1",
"lint-staged": "^8.1.0",
"lodash.clonedeep": "^4.5.0",
"prettier": "^1.15.3",
"react": "^16.6.3",
"react-dom": "^16.6.3",
"react-scripts": "^2.1.2",
"rollup": "^0.68.2",
"rollup-plugin-babel": "^4.2.0",
"rollup-plugin-commonjs": "^9.2.0",
"rollup-plugin-node-builtins": "^2.1.2",
"rollup-plugin-node-resolve": "^4.0.0",
"rollup-plugin-peer-deps-external": "^2.2.0",
"rollup-plugin-postcss": "^1.6.3",
"rollup-plugin-url": "^2.1.0",
"stylelint": "^9.9.0",
"stylelint-config-recommended": "^2.1.0",
"stylus": "^0.54.5"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"src/**/*.{js,jsx,json,css}": [
"prettier --single-quote --write",
"git add"
]
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
],
"files": [
"dist"
],
"dependencies": {
"@babel/runtime": "^7.2.0",
"classnames": "^2.2.6",
"dicom-microscopy-viewer": "^0.2.0",
"dicomweb-client": "^0.4.1",
"lodash.isequal": "^4.5.0",
"ohif-core": "^0.2.3",
"prop-types": "^15.6.2"
}
}
@@ -0,0 +1,57 @@
import babel from 'rollup-plugin-babel'
import commonjs from 'rollup-plugin-commonjs'
import external from 'rollup-plugin-peer-deps-external'
import postcss from 'rollup-plugin-postcss'
import resolve from 'rollup-plugin-node-resolve'
import url from 'rollup-plugin-url'
import svgr from '@svgr/rollup'
import pkg from './package.json'
// Deal with https://github.com/rollup/rollup-plugin-commonjs/issues/297
import builtins from 'rollup-plugin-node-builtins';
export default {
input: 'src/index.js',
output: [
{
file: pkg.main,
format: 'umd',
name: 'ohif-dicom-pdf-extension',
sourcemap: true,
exports: 'named',
globals: {
'react': 'React',
'react-dom': 'ReactDOM'
}
},
{
file: pkg.module,
format: 'es',
sourcemap: true
}
],
plugins: [
builtins(),
external(),
postcss({
modules: false
}),
url(),
svgr(),
babel({
exclude: 'node_modules/**',
plugins: [ '@babel/external-helpers' ],
externalHelpers: true,
runtimeHelpers: true
}),
resolve(),
commonjs({
include: 'node_modules/**',
namedExports: {
'node_modules/dicom-microscopy-viewer/build/dicom-microscopy-viewer.js': [
'api'
]
}
})
],
external: ['hammerjs']
}
@@ -1,5 +1,4 @@
import OHIF from 'ohif-core';
import { api } from 'dicomweb-client';
const { plugins, utils } = OHIF;
const { PLUGIN_TYPES } = plugins;
@@ -8,20 +7,12 @@ const SOP_CLASS_UIDS = {
VL_WHOLE_SLIDE_MICROSCOPY_IMAGE_STORAGE: '1.2.840.10008.5.1.4.1.1.77.1.6'
};
const dwc = api.DICOMwebClient;
const DicomMicrscopySopClassHandlerPlugin = {
const DicomMicrscopySopClassHandler = {
id: 'DicomMicroscopySopClassHandlerPlugin',
type: PLUGIN_TYPES.SOP_CLASS_HANDLER,
sopClassUids: [SOP_CLASS_UIDS.VL_WHOLE_SLIDE_MICROSCOPY_IMAGE_STORAGE],
getDisplaySetFromSeries(series, study) {
getDisplaySetFromSeries(series, study, dicomWebClient) {
const instance = series.getFirstInstance();
const headers = OHIF.DICOMWeb.getAuthorizationHeader();
const dicomWebClient = new dwc({
url: study.getData().wadoRoot,
headers
});
// Note: We are passing the dicomweb client into each viewport!
@@ -36,4 +27,4 @@ const DicomMicrscopySopClassHandlerPlugin = {
}
};
export default DicomMicrscopySopClassHandlerPlugin;
export default DicomMicrscopySopClassHandler;
@@ -0,0 +1,27 @@
import DicomMicroscopyViewport from './DicomMicroscopyViewport.js';
import DicomMicroscopySopClassHandler from './DicomMicroscopySopClassHandler.js';
export default class OHIFDicomMicroscopyExtension {
/**
* Extension ID is a unique id, might be used for namespacing extension specific redux actions/reducers (?)
*/
getExtensionId() {
return 'microscopy';
}
getViewportModule() {
return DicomMicroscopyViewport;
}
getSopClassHandler() {
return DicomMicroscopySopClassHandler;
}
getPanelModule() {
return null;
}
getToolbarModule() {
return null;
}
}
@@ -0,0 +1,7 @@
import OHIFDicomMicroscopyExtension from './OHIFDicomMicroscopyExtension.js';
export {
OHIFDicomMicroscopyExtension
};
export default OHIFDicomMicroscopyExtension;
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,14 @@
{
"presets": [
["@babel/preset-env", {
"targets": {
"ie": "11"
}
}],
"@babel/preset-react"
],
"plugins": [
"@babel/plugin-proposal-class-properties",
"@babel/plugin-transform-runtime"
]
}
@@ -0,0 +1,9 @@
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
@@ -0,0 +1,16 @@
{
"extends": [
"react-app",
"eslint:recommended",
"plugin:react/recommended"
],
"parser": "babel-eslint",
"env": {
"jest": true
},
"settings": {
"react": {
"version": "detect",
},
},
}
@@ -0,0 +1,23 @@
# See https://help.github.com/ignore-files/ for more about ignoring files.
# dependencies
node_modules
# builds
build
dist
.rpt2_cache
# misc
.DS_Store
.env
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.idea
@@ -0,0 +1,3 @@
{
"singleQuote": true
}
@@ -0,0 +1,4 @@
language: node_js
node_js:
- 9
- 8
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2018 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.
@@ -0,0 +1,86 @@
{
"name": "ohif-dicom-pdf-extension",
"version": "0.0.3",
"description": "OHIF extension for Dicom PDF",
"author": "OHIF",
"license": "MIT",
"repository": "OHIF/Viewers",
"main": "dist/index.js",
"module": "dist/index.es.js",
"jsnext:main": "dist/index.es.js",
"engines": {
"node": ">=8",
"npm": ">=5"
},
"scripts": {
"build": "rollup -c",
"start": "rollup -c -w",
"lint": "eslint -c .eslintrc --fix src && prettier --single-quote --write src/**/*.{js,jsx,json,css}"
},
"peerDependencies": {
"react": "^15.0.0 || ^16.0.0",
"react-dom": "^15.0.0 || ^16.0.0"
},
"devDependencies": {
"@babel/core": "^7.2.2",
"@babel/plugin-external-helpers": "^7.2.0",
"@babel/plugin-proposal-class-properties": "^7.2.3",
"@babel/plugin-transform-runtime": "^7.2.0",
"@babel/preset-env": "^7.2.3",
"@babel/preset-react": "^7.0.0",
"@svgr/rollup": "^4.1.0",
"babel-eslint": "^9.0.0",
"cross-env": "^5.2.0",
"eslint": "5.6.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-node": "^8.0.0",
"eslint-plugin-promise": "^4.0.1",
"eslint-plugin-react": "^7.11.1",
"gh-pages": "^2.0.1",
"husky": "^1.3.1",
"lint-staged": "^8.1.0",
"lodash.clonedeep": "^4.5.0",
"prettier": "^1.15.3",
"react": "^16.6.3",
"react-dom": "^16.6.3",
"react-scripts": "^2.1.2",
"rollup": "^0.68.2",
"rollup-plugin-babel": "^4.2.0",
"rollup-plugin-commonjs": "^9.2.0",
"rollup-plugin-node-builtins": "^2.1.2",
"rollup-plugin-node-resolve": "^4.0.0",
"rollup-plugin-peer-deps-external": "^2.2.0",
"rollup-plugin-postcss": "^1.6.3",
"rollup-plugin-url": "^2.1.0",
"stylelint": "^9.9.0",
"stylelint-config-recommended": "^2.1.0",
"stylus": "^0.54.5"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"src/**/*.{js,jsx,json,css}": [
"prettier --single-quote --write",
"git add"
]
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
],
"files": [
"dist"
],
"dependencies": {
"@babel/runtime": "^7.2.0",
"classnames": "^2.2.6",
"lodash.isequal": "^4.5.0",
"ohif-core": "^0.2.3",
"prop-types": "^15.6.2"
}
}
@@ -0,0 +1,50 @@
import babel from 'rollup-plugin-babel'
import commonjs from 'rollup-plugin-commonjs'
import external from 'rollup-plugin-peer-deps-external'
import postcss from 'rollup-plugin-postcss'
import resolve from 'rollup-plugin-node-resolve'
import url from 'rollup-plugin-url'
import svgr from '@svgr/rollup'
import pkg from './package.json'
// Deal with https://github.com/rollup/rollup-plugin-commonjs/issues/297
import builtins from 'rollup-plugin-node-builtins';
export default {
input: 'src/index.js',
output: [
{
file: pkg.main,
format: 'umd',
name: 'ohif-dicom-pdf-extension',
sourcemap: true,
exports: 'named',
globals: {
'react': 'React',
'react-dom': 'ReactDOM'
}
},
{
file: pkg.module,
format: 'es',
sourcemap: true
}
],
plugins: [
builtins(),
external(),
postcss({
modules: false
}),
url(),
svgr(),
babel({
exclude: 'node_modules/**',
plugins: [ '@babel/external-helpers' ],
externalHelpers: true,
runtimeHelpers: true
}),
resolve(),
commonjs()
],
external: ['hammerjs']
}
@@ -0,0 +1,15 @@
import React from 'react';
import PropTypes from "prop-types";
function OHIFComponentPlugin(props) {
return (<React.Fragment>{props.children}</React.Fragment>);
}
OHIFComponentPlugin.propTypes = {
id: PropTypes.string.isRequired,
init: PropTypes.func.isRequired,
destroy: PropTypes.func.isRequired,
children: PropTypes.node
};
export default OHIFComponentPlugin;
@@ -0,0 +1,27 @@
import OHIFDicomPDFViewport from './OHIFDicomPDFViewport.js';
import OHIFDicomPDFSopClassHandler from './OHIFDicomPDFSopClassHandler.js';
export default class OHIFDicomPDFExtension {
/**
* Extension ID is a unique id, might be used for namespacing extension specific redux actions/reducers (?)
*/
getExtensionId() {
return 'pdf';
}
getViewportModule() {
return OHIFDicomPDFViewport;
}
getSopClassHandler() {
return OHIFDicomPDFSopClassHandler;
}
getPanelModuleDefinition() {
return null;
}
getToolbarModuleDefinition() {
return null;
}
}
@@ -8,13 +8,14 @@ const SOP_CLASS_UIDS = {
ENCAPSULATED_PDF: '1.2.840.10008.5.1.4.1.1.104.1'
};
const OHIFDicomPDFSopClassHandlerPlugin = {
const OHIFDicomPDFSopClassHandler = {
id: 'OHIFDicomPDFSopClassHandlerPlugin',
type: PLUGIN_TYPES.SOP_CLASS_HANDLER,
sopClassUids: [
SOP_CLASS_UIDS.ENCAPSULATED_PDF
],
getDisplaySetFromSeries(series, study) {
getDisplaySetFromSeries(series, study, dicomWebClient, authorizationHeaders) {
debugger;
const instance = series.getFirstInstance();
return {
@@ -24,9 +25,10 @@ const OHIFDicomPDFSopClassHandlerPlugin = {
wadoUri: instance.getData().wadouri,
sopInstanceUid: instance.getSOPInstanceUID(),
seriesInstanceUid: series.getSeriesInstanceUID(),
studyInstanceUid: study.getStudyInstanceUID()
studyInstanceUid: study.getStudyInstanceUID(),
authorizationHeaders: authorizationHeaders
};
}
}
export default OHIFDicomPDFSopClassHandlerPlugin;
export default OHIFDicomPDFSopClassHandler;
@@ -1,12 +1,12 @@
import React, { Component } from "react";
import PropTypes from "prop-types";
import OHIF from 'ohif-core';
import OHIFComponentPlugin from '../OHIFComponentPlugin.js';
import OHIFComponentPlugin from './OHIFComponentPlugin.js';
import DicomPDFViewport from './DicomPDFViewport';
const { DICOMWeb } = OHIF;
class OHIFDicomPDFViewportPlugin extends Component {
class OHIFDicomPDFViewport extends Component {
static propTypes = {
studies: PropTypes.object,
displaySet: PropTypes.object,
@@ -18,21 +18,21 @@ class OHIFDicomPDFViewportPlugin extends Component {
error: null
}
static id = 'DicomPDFViewportPlugin';
static id = 'DicomPDFViewportPDF';
static init() {
console.log('DicomPDFViewportPlugin init()');
console.log('DicomPDFViewport init()');
}
static destroy() {
console.log('DicomPDFViewportPlugin destroy()');
console.log('DicomPDFViewport destroy()');
}
componentDidMount() {
const { displaySet } = this.props.viewportData;
const { studyInstanceUid, seriesInstanceUid, sopInstanceUid, wadoRoot, wadoUri } = displaySet;
const { studyInstanceUid, seriesInstanceUid, sopInstanceUid, wadoRoot, wadoUri, authorizationHeaders} = displaySet;
this.retrieveDicomData(studyInstanceUid, seriesInstanceUid, sopInstanceUid, wadoRoot, wadoUri).then(byteArray => {
this.retrieveDicomData(studyInstanceUid, seriesInstanceUid, sopInstanceUid, wadoRoot, wadoUri, authorizationHeaders).then(byteArray => {
this.setState({
byteArray
});
@@ -45,21 +45,20 @@ class OHIFDicomPDFViewportPlugin extends Component {
});
}
retrieveDicomData(studyInstanceUid, seriesInstanceUid, sopInstanceUid, wadoRoot, wadoUri) {
retrieveDicomData(studyInstanceUid, seriesInstanceUid, sopInstanceUid, wadoRoot, wadoUri, authorizationHeaders) {
// TODO: Passing in a lot of data we aren't using
// TODO: Authorization header depends on the server. If we ever have multiple servers
// we will need to figure out how / when to pass this information in.
return fetch(wadoUri, {
headers: DICOMWeb.getAuthorizationHeader()
headers: authorizationHeaders
}).then(response => response.arrayBuffer()).then(arraybuffer => {
debugger;
return new Uint8Array(arraybuffer);
});
}
render() {
const { id, init, destroy } = OHIFDicomPDFViewportPlugin;
const { id, init, destroy } = OHIFDicomPDFViewport;
const pluginProps = { id, init, destroy };
return (
@@ -73,5 +72,4 @@ class OHIFDicomPDFViewportPlugin extends Component {
}
}
export default OHIFDicomPDFViewportPlugin;
export default OHIFDicomPDFViewport;
@@ -0,0 +1,7 @@
import OHIFDicomPDFExtension from './OHIFDicomPDFExtension.js';
export {
OHIFDicomPDFExtension
};
export default OHIFDicomPDFExtension;
File diff suppressed because it is too large. Load diff
+16
View File
@@ -0,0 +1,16 @@
{
"extends": [
"react-app",
"eslint:recommended",
"plugin:react/recommended"
],
"parser": "babel-eslint",
"env": {
"jest": true
},
"settings": {
"react": {
"version": "detect",
},
},
}
+1
View File
@@ -1,3 +1,4 @@
build
dist
node_modules
yarn.lock
+1 -1
View File
@@ -6,6 +6,7 @@ Disclaimer: Work in Progress
1. `yarn install`
1. `yarn start`
1. `Go to http://localhost:5000`
To user another DICOMWeb endpoint, adapt index.js
@@ -16,7 +17,6 @@ Please refer to the example in the example directory. To set the DICOMWeb endpoi
### Build
1. `yarn install`
1. `yarn build`
1. `Go to http://localhost:5000`
### Run the example
1. `cd example`
@@ -0,0 +1,12 @@
server {
listen 80;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
File diff suppressed because it is too large. Load diff
@@ -24,6 +24,7 @@
crossorigin="anonymous">
<title>OHIF Standalone Viewer</title>
<base href="http://localhost:5000/">
</head>
<body>
@@ -35,7 +36,7 @@
<!-- Load React. -->
<!-- Note: when deploying, replace "development.js" with "production.min.js". -->
<script src="https://unpkg.com/react@16/umd/react.development.js" crossorigin></script>
<script src="https://unpkg.com/react@16/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
<!--<script crossorigin src="https://unpkg.com/react@16/umd/react.production.min.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.production.min.js"></script>!-->
@@ -52,14 +53,13 @@
window.process = process;
</script>
<!--<script src="https://unpkg.com/ohif-viewer/dist/index.umd.js" crossorigin></script>!-->
<script src="/deps/index.umd.js" crossorigin></script>
<script src="deps/index.umd.js" crossorigin></script>
<!--<script src="/node_modules/ohif-viewer/dist/index.umd.js" crossorigin></script>!-->
<!-- Load our React component. -->
<script>
var props = {
"routerBasename": "http://localhost:5000",
"servers": {
var props = {"routerBasename": "/", rootUrl: "http://localhost:5000"};
/* props.servers = {
"dicomWeb": [{
"name": "DCM4CHEE",
"wadoUriRoot": "https://cancer.crowds-cure.org/dcm4chee-arc/aets/DCM4CHEE/wado",
@@ -87,7 +87,7 @@
"client_id": "crowds-cure-cancer"
}
}]
};
}; */
</script>
<script>
'use strict';
@@ -103,7 +103,7 @@
/* Example config without OIDC */
// Try going to:
// http://localhost:5000/viewer/1.3.6.1.4.1.14519.5.2.1.1706.4996.216859690032335293073513900362
/* props.servers = {
props.servers = {
"dicomWeb": [
{
"name": "DCM4CHEE",
@@ -119,7 +119,7 @@
}
}
]
}; */
};
/*
@@ -1,3 +0,0 @@
yarn run build
cd example
yarn install
+5 -4
View File
@@ -9,7 +9,7 @@
"browser": "dist/index.umd.js",
"module": "dist/index.es.js",
"jsnext:main": "dist/index.es.js",
"homepage": "http://localhost:3000",
"homepage": "http://localhost:5000",
"engines": {
"node": ">=8",
"npm": ">=5"
@@ -29,7 +29,7 @@
"details": "npm run version && npm run sha",
"prep": "npm run details && npm run copy:webworkers",
"start": "npm run prep && cross-env PORT=5000 react-scripts start",
"start:debug": "npm run prep && cross-env PORT=5000 react-scripts start"
"start:debug": "cross-env PORT=5000 react-scripts start"
},
"peerDependencies": {
"react": "^15.0.0 || ^16.0.0",
@@ -100,12 +100,13 @@
"cornerstone-tools": "3.0.0-b.1512",
"cornerstone-wado-image-loader": "^2.2.3",
"dcmjs": "^0.3.0",
"dicom-microscopy-viewer": "^0.2.0",
"dicom-parser": "^1.8.3",
"dicomweb-client": "^0.4.1",
"hammerjs": "^2.0.8",
"lodash.isequal": "^4.5.0",
"ohif-core": "^0.2.0",
"ohif-core": "^0.2.3",
"ohif-dicom-microscopy-extension": "^0.0.3",
"ohif-dicom-pdf-extension": "^0.0.3",
"oidc-client": "^1.6.1",
"prop-types": "^15.6.2",
"react-bootstrap-modal": "^4.2.0",
@@ -62,9 +62,6 @@ export default {
'node_modules/redux-oidc/dist/redux-oidc.js': [
'reducer', 'CallbackComponent', 'loadUser', 'OidcProvider', 'createUserManager'
],
'node_modules/dicom-microscopy-viewer/build/dicom-microscopy-viewer.js': [
'api'
],
'node_modules/dicomweb-client/build/dicomweb-client.js': [
'api'
]
+14 -40
View File
@@ -9,10 +9,8 @@ import ui from './redux/ui.js';
import OHIFStandaloneViewer from './OHIFStandaloneViewer';
import OHIFCornerstoneViewportPlugin from './connectedComponents/OHIFCornerstoneViewportPlugin/OHIFCornerstoneViewportPlugin.js';
import WhiteLabellingContext from './WhiteLabellingContext';
import OHIFDicomPDFViewportPlugin from './connectedComponents/OHIFDicomPDFViewportPlugin/OHIFDicomPDFViewportPlugin.js';
import OHIFDicomPDFSopClassHandlerPlugin from './connectedComponents/OHIFDicomPDFViewportPlugin/OHIFDicomPDFSopClassHandlerPlugin.js';
import DicomMicroscopySopClassHandlerPlugin from './connectedComponents/DicomMicroscopyPlugin/DicomMicroscopySopClassHandlerPlugin.js';
import DicomMicroscopyViewport from './connectedComponents/DicomMicroscopyPlugin/DicomMicroscopyViewport.js';
import OHIFDicomPDFExtension from 'ohif-dicom-pdf-extension';
import OHIFDicomMicroscopyExtension from 'ohif-dicom-microscopy-extension';
import { loadState, saveState } from './redux/localStorageState.js';
import {
loadUser,
@@ -21,6 +19,7 @@ import {
reducer as oidcReducer
} from 'redux-oidc';
import cornerstoneWADOImageLoader from 'cornerstone-wado-image-loader';
import ExtensionManager from './ExtensionManager';
//import Icons from "./images/icons.svg"
@@ -109,46 +108,20 @@ const buttonsAction = OHIF.redux.actions.setAvailableButtons(defaultButtons);
store.dispatch(buttonsAction);
const { plugins } = OHIF;
const { PLUGIN_TYPES } = plugins;
const cornerstonePluginAction = OHIF.redux.actions.addPlugin({
id: 'cornerstone',
type: 'viewport',
component: OHIFCornerstoneViewportPlugin
});
const pdfPluginAction = OHIF.redux.actions.addPlugin({
id: 'pdf',
type: PLUGIN_TYPES.VIEWPORT,
component: OHIFDicomPDFViewportPlugin
});
const pdfPluginActionSopClass = OHIF.redux.actions.addPlugin({
id: 'pdf_sopClassHandler',
type: PLUGIN_TYPES.SOP_CLASS_HANDLER,
component: OHIFDicomPDFSopClassHandlerPlugin
});
const microscopyPluginAction = OHIF.redux.actions.addPlugin({
id: 'microscopy',
type: PLUGIN_TYPES.VIEWPORT,
component: DicomMicroscopyViewport
});
const microscopyPluginActionPluginActionSopClass = OHIF.redux.actions.addPlugin(
{
id: 'microscopy_sopClassHandler',
type: PLUGIN_TYPES.SOP_CLASS_HANDLER,
component: DicomMicroscopySopClassHandlerPlugin
}
);
store.dispatch(cornerstonePluginAction);
store.dispatch(pdfPluginAction);
store.dispatch(pdfPluginActionSopClass);
store.dispatch(microscopyPluginAction);
store.dispatch(microscopyPluginActionPluginActionSopClass);
/** TODO: extensions should be passed in as prop as soon as we have the extensions as separate packages and then registered by ExtensionsManager */
let extensions = [
new OHIFDicomPDFExtension(),
new OHIFDicomMicroscopyExtension()
];
ExtensionManager.registerExtensions(store, extensions);
// TODO[react] Use a provider when the whole tree is React
window.store = store;
@@ -212,6 +185,7 @@ class App extends Component {
servers: PropTypes.object,
oidc: PropTypes.array,
routerBasename: PropTypes.string,
rootUrl: PropTypes.string,
userManager: PropTypes.object,
location: PropTypes.object
};
@@ -225,7 +199,7 @@ class App extends Component {
this.userManager = handleOIDC(this.props.oidc);
handleServers(this.props.servers);
handleWebWorkerInit(this.props.routerBasename);
handleWebWorkerInit(this.props.rootUrl);
}
render() {
@@ -235,7 +209,7 @@ class App extends Component {
return (
<Provider store={store}>
<OidcProvider store={store} userManager={userManager}>
<BrowserRouter>
<BrowserRouter basename={this.props.routerBasename}>
<WhiteLabellingContext.Provider value={this.props.whiteLabelling}>
<OHIFStandaloneViewer userManager={userManager} />
</WhiteLabellingContext.Provider>
@@ -247,7 +221,7 @@ class App extends Component {
return (
<Provider store={store}>
<BrowserRouter>
<BrowserRouter basename={this.props.routerBasename}>
<WhiteLabellingContext.Provider value={this.props.whiteLabelling}>
<OHIFStandaloneViewer />
</WhiteLabellingContext.Provider>
@@ -0,0 +1,38 @@
import OHIF from 'ohif-core';
export default class ExtensionManager {
static registerExtensions(store, extensions) {
extensions.forEach(extension => {
ExtensionManager.registerExtension(store, extension);
});
}
static registerExtension(store, extension) {
/**
* TODO:
* - Use this function for checking extensions definition and throw errors early/ignore extension if format is not conformant or any required stuff is missing
* - Check uniqueness of extension id
* - Id Management: SopClassHandlers currently refer to viewport module by id; setting the extension id as viewport module id is a workaround for now
* - Add loading of panel and toolbar modules */
let viewportModule = extension.getViewportModule();
let sopClassHandler = extension.getSopClassHandler();
if (viewportModule) {
store.dispatch(
OHIF.redux.actions.addPlugin({
id: extension.getExtensionId(),
type: 'viewport',
component: viewportModule
})
);
}
if (sopClassHandler) {
store.dispatch(
OHIF.redux.actions.addPlugin({
id: extension.getExtensionId() + '_sopClass_handler',
type: 'sopClassHandler',
component: sopClassHandler
})
);
}
}
}
+36 -29
View File
@@ -8,9 +8,11 @@ import ReactDOM from 'react-dom';
export { App };
var routerBasename = 'http://localhost:5000';
var rootUrl = 'http://localhost:5000';
var routerBasename = '/';
var props = {
routerBasename: routerBasename
routerBasename: routerBasename,
rootUrl: rootUrl
};
/*
@@ -18,39 +20,44 @@ Example config with OIDC
*/
// Uncomment the next two blocks, comment out the config without OIDC
// Try going to:
// http://localhost:5000/viewer/1.2.276.0.7230010.3.1.2.0.94237.1537373823.634387 //PDF
// http://localhost:5000/viewer/1.3.6.1.4.1.25403.345050719074.3824.20170126082328.1
// http://ohif-viewer-react.s3-website-us-east-1.amazonaws.com/viewer/1.3.6.1.4.1.25403.345050719074.3824.20170126082328.1
/*props.servers = {
"dicomWeb": [{
"name": "DCM4CHEE",
"wadoUriRoot": "https://cancer.crowds-cure.org/dcm4chee-arc/aets/DCM4CHEE/wado",
"qidoRoot": "https://cancer.crowds-cure.org/dcm4chee-arc/aets/DCM4CHEE/rs",
"wadoRoot": "https://cancer.crowds-cure.org/dcm4chee-arc/aets/DCM4CHEE/rs",
"qidoSupportsIncludeField": true,
"imageRendering": "wadors",
"thumbnailRendering": "wadors",
"requestOptions": {
"requestFromBrowser": true
props.servers = {
dicomWeb: [
{
name: 'DCM4CHEE',
wadoUriRoot:
'https://cancer.crowds-cure.org/dcm4chee-arc/aets/DCM4CHEE/wado',
qidoRoot: 'https://cancer.crowds-cure.org/dcm4chee-arc/aets/DCM4CHEE/rs',
wadoRoot: 'https://cancer.crowds-cure.org/dcm4chee-arc/aets/DCM4CHEE/rs',
qidoSupportsIncludeField: true,
imageRendering: 'wadors',
thumbnailRendering: 'wadors',
requestOptions: {
requestFromBrowser: true
}
}
]
};
props.oidc = [{
"authServerUrl": "https://cancer.crowds-cure.org/auth/realms/dcm4che",
"authRedirectUri": routerBasename + '/callback',
"postLogoutRedirectUri": routerBasename + '/logout-redirect.html',
"clientId": "crowds-cure-cancer",
"responseType": "id_token token",
"scope": "email profile openid",
"revokeAccessTokenOnSignout": true,
"extraQueryParams": {
"kc_idp_hint": "crowds-cure-cancer-auth0-oidc",
"client_id": "crowds-cure-cancer"
props.oidc = [
{
authServerUrl: 'https://cancer.crowds-cure.org/auth/realms/dcm4che',
authRedirectUri: rootUrl + '/callback',
postLogoutRedirectUri: rootUrl + '/logout-redirect.html',
clientId: 'crowds-cure-cancer',
responseType: 'id_token token',
scope: 'email profile openid',
revokeAccessTokenOnSignout: true,
extraQueryParams: {
kc_idp_hint: 'crowds-cure-cancer-auth0-oidc',
client_id: 'crowds-cure-cancer'
}
}];*/
}
];
props.servers = {
/* props.servers = {
dicomWeb: [
{
name: 'DCM4CHEE',
@@ -71,14 +78,14 @@ props.servers = {
props.oidc = [
{
authServerUrl: 'https://k8s-testing.ohif.org/auth/realms/dcm4che',
authRedirectUri: routerBasename + '/callback',
postLogoutRedirectUri: routerBasename + '/logout-redirect.html',
authRedirectUri: rootUrl + '/callback',
postLogoutRedirectUri: rootUrl + '/logout-redirect.html',
clientId: 'ohif-viewer',
responseType: 'id_token token',
scope: 'email profile openid',
revokeAccessTokenOnSignout: true
}
];
]; */
/* Example config without OIDC */
// Try going to:
+1 -1
View File
@@ -1 +1 @@
export default '84c949f2e68036ef488e09e05aed890a47e1a161';
export default '298749821742198987421'
+40 -5
View File
@@ -2964,7 +2964,7 @@ cornerstone-core@^2.2.8:
resolved "https://registry.yarnpkg.com/cornerstone-core/-/cornerstone-core-2.2.8.tgz#5f10c65c80f8efa7623ee1dd5c9a9d4605f5467c"
integrity sha512-iJrmfXy1nvM4ZLTJawif2VYBPq8APQ1GYjRbUZAJPNqPYmfYfKWkToVyf9o/i8GMl81op7xLJ4ib3ZMSINKjjQ==
cornerstone-math@^0.1.7, cornerstone-math@^0.1.8:
cornerstone-math@^0.1.6, cornerstone-math@^0.1.7, cornerstone-math@^0.1.8:
version "0.1.8"
resolved "https://registry.yarnpkg.com/cornerstone-math/-/cornerstone-math-0.1.8.tgz#68ab1f9e4fdcd7c5cb23a0d2eb4263f9f894f1c5"
integrity sha512-x7NEQHBtVG7j1yeyj/aRoKTpXv1Vh2/H9zNLMyqYJDtJkNng8C4Q8M3CgZ1qer0Yr7eVq2x+Ynmj6kfOm5jXKw==
@@ -2977,6 +2977,13 @@ cornerstone-tools@3.0.0-b.1512:
"@babel/runtime" "7.1.2"
cornerstone-math "^0.1.7"
cornerstone-tools@^2.4.0:
version "2.4.0"
resolved "https://registry.yarnpkg.com/cornerstone-tools/-/cornerstone-tools-2.4.0.tgz#e8136d41b6140c8299a06296918b1eb6f99ea5d7"
integrity sha512-M0UcnqSnN8cUhjTnr+om0621yYOiL1rPP+LK5VsMqe1R3yKvfePZhSwhNjw8j4+qVXvliPsfcA7NwsvtOBOaOA==
dependencies:
cornerstone-math "^0.1.6"
cornerstone-wado-image-loader@^2.2.3:
version "2.2.3"
resolved "https://registry.yarnpkg.com/cornerstone-wado-image-loader/-/cornerstone-wado-image-loader-2.2.3.tgz#2d4c06b5c87cd9198b52906c48e2d9dd145de986"
@@ -8209,12 +8216,16 @@ octal@^1.0.0:
resolved "https://registry.yarnpkg.com/octal/-/octal-1.0.0.tgz#63e7162a68efbeb9e213588d58e989d1e5c4530b"
integrity sha1-Y+cWKmjvvrniE1iNWOmJ0eXEUws=
ohif-core@^0.1.9:
version "0.1.9"
resolved "https://registry.yarnpkg.com/ohif-core/-/ohif-core-0.1.9.tgz#66cc3243d45a56b3dfd9f352b96b2b77f0df43eb"
integrity sha512-ghW1IMhTYAcIkD1Ft2N88bqbApskH8Hbutp9b+mKVEQofSKVkN/Osu1KkvEx6PTSSbp0BcY9iSVF+/9wj6Z5wA==
ohif-core@^0.2.3:
version "0.2.3"
resolved "https://registry.yarnpkg.com/ohif-core/-/ohif-core-0.2.3.tgz#2eea4806f44dd98740afe4fec6fb2a038c496197"
integrity sha512-wBfZOxmRhrkDPFlmoADzxeuNlGiZGa2azbFkpUosxW+8yciuwmOvh21e0bd3uwAkotinrItWihnRR9gz8bG2DA==
dependencies:
"@babel/runtime" "^7.2.0"
cornerstone-core "^2.2.8"
cornerstone-math "^0.1.7"
cornerstone-tools "^2.4.0"
dicom-parser "^1.8.3"
dicomweb-client "^0.4.1"
isomorphic-base64 "^1.0.2"
jquery "^3.3.1"
@@ -8223,6 +8234,30 @@ ohif-core@^0.1.9:
lodash.merge "^4.6.1"
validate.js "^0.12.0"
ohif-dicom-microscopy-extension@^0.0.3:
version "0.0.3"
resolved "https://registry.yarnpkg.com/ohif-dicom-microscopy-extension/-/ohif-dicom-microscopy-extension-0.0.3.tgz#b6ef36100ed991422b23d25f1f7d011010853973"
integrity sha512-y63l27D33eHrlo4hUpKFs2n/rxojRh6EB7AVaGDvCYFpbEMFarnOkWg56wIKtIBfg+gyB02W1wWF67P6sckzjw==
dependencies:
"@babel/runtime" "^7.2.0"
classnames "^2.2.6"
dicom-microscopy-viewer "^0.2.0"
dicomweb-client "^0.4.1"
lodash.isequal "^4.5.0"
ohif-core "^0.2.3"
prop-types "^15.6.2"
ohif-dicom-pdf-extension@^0.0.3:
version "0.0.3"
resolved "https://registry.yarnpkg.com/ohif-dicom-pdf-extension/-/ohif-dicom-pdf-extension-0.0.3.tgz#057a096d4c599ce0f4036a56f20dc135cbb70b6f"
integrity sha512-JiK0XYJjfHHJiaiBi8NANsIo4NkRuWG6OTlslWUpjeL+E44COrVBuU3+fD+8lWzN2kTOHNuzbRLFgP70/W73Jw==
dependencies:
"@babel/runtime" "^7.2.0"
classnames "^2.2.6"
lodash.isequal "^4.5.0"
ohif-core "^0.2.3"
prop-types "^15.6.2"
oidc-client@^1.6.1:
version "1.6.1"
resolved "https://registry.yarnpkg.com/oidc-client/-/oidc-client-1.6.1.tgz#76a7f24ad7fb5342269b6cae895bb32e1e27e785"