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:
1 parent
af68db0c09
commit
b93a677ef3
121 files changed
+14151
-35046
No files matched your search
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"extends": [
|
||||
"react-app",
|
||||
"eslint:recommended",
|
||||
"plugin:react/recommended"
|
||||
],
|
||||
"parser": "babel-eslint",
|
||||
"env": {
|
||||
"jest": true
|
||||
},
|
||||
"settings": {
|
||||
"react": {
|
||||
"version": "detect",
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
build
|
||||
dist
|
||||
node_modules
|
||||
yarn.lock
|
||||
|
||||
@@ -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
|
||||
@@ -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'
|
||||
]
|
||||
|
||||
@@ -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
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
-39
@@ -1,39 +0,0 @@
|
||||
import OHIF from 'ohif-core';
|
||||
import { api } from 'dicomweb-client';
|
||||
|
||||
const { plugins, utils } = OHIF;
|
||||
const { PLUGIN_TYPES } = plugins;
|
||||
|
||||
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 = {
|
||||
id: 'DicomMicroscopySopClassHandlerPlugin',
|
||||
type: PLUGIN_TYPES.SOP_CLASS_HANDLER,
|
||||
sopClassUids: [SOP_CLASS_UIDS.VL_WHOLE_SLIDE_MICROSCOPY_IMAGE_STORAGE],
|
||||
getDisplaySetFromSeries(series, study) {
|
||||
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!
|
||||
|
||||
return {
|
||||
plugin: 'microscopy',
|
||||
displaySetInstanceUid: utils.guid(),
|
||||
dicomWebClient,
|
||||
sopInstanceUid: instance.getSOPInstanceUID(),
|
||||
seriesInstanceUid: series.getSeriesInstanceUID(),
|
||||
studyInstanceUid: study.getStudyInstanceUID()
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
export default DicomMicrscopySopClassHandlerPlugin;
|
||||
-83
@@ -1,83 +0,0 @@
|
||||
import React, { Component } from 'react';
|
||||
import { api } from 'dicom-microscopy-viewer';
|
||||
|
||||
const microscopyViewer = api.VLWholeSlideMicroscopyImageViewer;
|
||||
|
||||
class DicomMicroscopyViewport extends Component {
|
||||
state = {
|
||||
error: null
|
||||
};
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
this.container = React.createRef();
|
||||
}
|
||||
|
||||
// install the microscopy renderer into the web page.
|
||||
// you should only do this once.
|
||||
installOpenLayersRenderer(container, displaySet) {
|
||||
const dicomWebClient = displaySet.dicomWebClient;
|
||||
|
||||
const searchInstanceOptions = {
|
||||
studyInstanceUID: displaySet.studyInstanceUid,
|
||||
seriesInstanceUID: displaySet.seriesInstanceUid
|
||||
};
|
||||
|
||||
dicomWebClient
|
||||
.searchForInstances(searchInstanceOptions)
|
||||
.then(instances => {
|
||||
const promises = [];
|
||||
for (let i = 0; i < instances.length; i++) {
|
||||
const sopInstanceUID = instances[i]['00080018']['Value'][0];
|
||||
const retrieveInstanceOptions = {
|
||||
studyInstanceUID: displaySet.studyInstanceUid,
|
||||
seriesInstanceUID: displaySet.seriesInstanceUid,
|
||||
sopInstanceUID
|
||||
};
|
||||
|
||||
const promise = dicomWebClient
|
||||
.retrieveInstanceMetadata(retrieveInstanceOptions)
|
||||
.then(metadata => {
|
||||
const imageType = metadata[0]['00080008']['Value'];
|
||||
if (imageType[2] === 'VOLUME') {
|
||||
return metadata[0];
|
||||
}
|
||||
});
|
||||
promises.push(promise);
|
||||
}
|
||||
return Promise.all(promises);
|
||||
})
|
||||
.then(metadata => {
|
||||
metadata = metadata.filter(m => m);
|
||||
|
||||
const viewer = new microscopyViewer({
|
||||
client: dicomWebClient,
|
||||
metadata
|
||||
});
|
||||
|
||||
viewer.render({ container });
|
||||
});
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
const { studies, displaySet } = this.props.viewportData;
|
||||
|
||||
this.installOpenLayersRenderer(this.container.current, displaySet);
|
||||
}
|
||||
|
||||
render() {
|
||||
const style = { width: '100%', height: '100%' };
|
||||
return (
|
||||
<div className={'DicomMicroscopyViewer'} style={style}>
|
||||
{this.state.error ? (
|
||||
<h2>{JSON.stringify(this.state.error)}</h2>
|
||||
) : (
|
||||
<div ref={this.container} />
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default DicomMicroscopyViewport;
|
||||
-80
@@ -1,80 +0,0 @@
|
||||
import React, { Component } from "react";
|
||||
import dicomParser from 'dicom-parser';
|
||||
import TypedArrayProp from './TypedArrayProp';
|
||||
|
||||
// TODO: Should probably use dcmjs for this
|
||||
const SOP_CLASS_UIDS = {
|
||||
ENCAPSULATED_PDF: '1.2.840.10008.5.1.4.1.1.104.1'
|
||||
};
|
||||
|
||||
class DicomPDFViewport extends Component {
|
||||
state = {
|
||||
fileURL: null,
|
||||
error: null
|
||||
};
|
||||
|
||||
static propTypes = {
|
||||
byteArray: TypedArrayProp.uint8,
|
||||
};
|
||||
|
||||
renderPDF = (dataSet) => {
|
||||
debugger;
|
||||
const sopClassUid = dataSet.string('x00080016');
|
||||
|
||||
if (sopClassUid !== SOP_CLASS_UIDS.ENCAPSULATED_PDF) {
|
||||
throw new Error('This is not a DICOM-encapsulated PDF');
|
||||
}
|
||||
|
||||
const fileTag = dataSet.elements.x00420011;
|
||||
const offset = fileTag.dataOffset;
|
||||
const remainder = offset + fileTag.length;
|
||||
const pdfByteArray = dataSet.byteArray.slice(offset, remainder);
|
||||
const PDF = new Blob([pdfByteArray], {type: 'application/pdf'});
|
||||
const fileURL = URL.createObjectURL(PDF);
|
||||
|
||||
this.setState({
|
||||
fileURL
|
||||
});
|
||||
}
|
||||
|
||||
parseByteArray = (byteArray) => {
|
||||
const options = {
|
||||
untilTag: ''
|
||||
};
|
||||
|
||||
let dataSet;
|
||||
|
||||
try {
|
||||
dataSet = dicomParser.parseDicom(byteArray, options);
|
||||
} catch(error) {
|
||||
this.setState({
|
||||
error
|
||||
});
|
||||
}
|
||||
|
||||
return dataSet
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
const dataSet = this.parseByteArray(this.props.byteArray);
|
||||
|
||||
this.renderPDF(dataSet);
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div className={'DicomPDFViewport'} style={{width: '100%', height: '100%'}}>
|
||||
{this.state.fileURL &&
|
||||
<object data={this.state.fileURL} type="application/pdf" width="100%" height="100%">
|
||||
</object>
|
||||
}
|
||||
{this.state.error &&
|
||||
<h2>{JSON.stringify(this.state.error)}</h2>
|
||||
}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export default DicomPDFViewport;
|
||||
-32
@@ -1,32 +0,0 @@
|
||||
import OHIF from "ohif-core";
|
||||
|
||||
const { plugins, utils } = OHIF;
|
||||
const { PLUGIN_TYPES } = plugins;
|
||||
|
||||
// TODO: Should probably use dcmjs for this
|
||||
const SOP_CLASS_UIDS = {
|
||||
ENCAPSULATED_PDF: '1.2.840.10008.5.1.4.1.1.104.1'
|
||||
};
|
||||
|
||||
const OHIFDicomPDFSopClassHandlerPlugin = {
|
||||
id: 'OHIFDicomPDFSopClassHandlerPlugin',
|
||||
type: PLUGIN_TYPES.SOP_CLASS_HANDLER,
|
||||
sopClassUids: [
|
||||
SOP_CLASS_UIDS.ENCAPSULATED_PDF
|
||||
],
|
||||
getDisplaySetFromSeries(series, study) {
|
||||
const instance = series.getFirstInstance();
|
||||
|
||||
return {
|
||||
plugin: 'pdf',
|
||||
displaySetInstanceUid: utils.guid(),
|
||||
wadoRoot: study.getData().wadoRoot,
|
||||
wadoUri: instance.getData().wadouri,
|
||||
sopInstanceUid: instance.getSOPInstanceUID(),
|
||||
seriesInstanceUid: series.getSeriesInstanceUID(),
|
||||
studyInstanceUid: study.getStudyInstanceUID()
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export default OHIFDicomPDFSopClassHandlerPlugin;
|
||||
-77
@@ -1,77 +0,0 @@
|
||||
import React, { Component } from "react";
|
||||
import PropTypes from "prop-types";
|
||||
import OHIF from 'ohif-core';
|
||||
import OHIFComponentPlugin from '../OHIFComponentPlugin.js';
|
||||
import DicomPDFViewport from './DicomPDFViewport';
|
||||
|
||||
const { DICOMWeb } = OHIF;
|
||||
|
||||
class OHIFDicomPDFViewportPlugin extends Component {
|
||||
static propTypes = {
|
||||
studies: PropTypes.object,
|
||||
displaySet: PropTypes.object,
|
||||
viewportIndex: PropTypes.number,
|
||||
};
|
||||
|
||||
state = {
|
||||
byteArray: null,
|
||||
error: null
|
||||
}
|
||||
|
||||
static id = 'DicomPDFViewportPlugin';
|
||||
|
||||
static init() {
|
||||
console.log('DicomPDFViewportPlugin init()');
|
||||
}
|
||||
|
||||
static destroy() {
|
||||
console.log('DicomPDFViewportPlugin destroy()');
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
const { displaySet } = this.props.viewportData;
|
||||
const { studyInstanceUid, seriesInstanceUid, sopInstanceUid, wadoRoot, wadoUri } = displaySet;
|
||||
|
||||
this.retrieveDicomData(studyInstanceUid, seriesInstanceUid, sopInstanceUid, wadoRoot, wadoUri).then(byteArray => {
|
||||
this.setState({
|
||||
byteArray
|
||||
});
|
||||
}, error => {
|
||||
this.setState({
|
||||
error
|
||||
});
|
||||
|
||||
throw new Error(error);
|
||||
});
|
||||
}
|
||||
|
||||
retrieveDicomData(studyInstanceUid, seriesInstanceUid, sopInstanceUid, wadoRoot, wadoUri) {
|
||||
// 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()
|
||||
}).then(response => response.arrayBuffer()).then(arraybuffer => {
|
||||
debugger;
|
||||
return new Uint8Array(arraybuffer);
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
const { id, init, destroy } = OHIFDicomPDFViewportPlugin;
|
||||
const pluginProps = { id, init, destroy };
|
||||
|
||||
return (
|
||||
<OHIFComponentPlugin {...pluginProps}>
|
||||
{this.state.byteArray && <DicomPDFViewport byteArray={this.state.byteArray}/>}
|
||||
{this.state.error &&
|
||||
<h2>{JSON.stringify(this.state.error)}</h2>
|
||||
}
|
||||
</OHIFComponentPlugin>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export default OHIFDicomPDFViewportPlugin;
|
||||
-137
@@ -1,137 +0,0 @@
|
||||
// https://github.com/facebook/prop-types/issues/69
|
||||
|
||||
export const TypedArrayProp = {
|
||||
any: (props, propName, componentName) => {
|
||||
let obj = props[propName];
|
||||
if (!(obj instanceof Float64Array ||
|
||||
obj instanceof Float32Array ||
|
||||
obj instanceof Int32Array ||
|
||||
obj instanceof Int16Array ||
|
||||
obj instanceof Int8Array ||
|
||||
obj instanceof Uint32Array ||
|
||||
obj instanceof Uint16Array ||
|
||||
obj instanceof Uint8Array ||
|
||||
obj instanceof Uint8ClampedArray)) {
|
||||
return new Error(
|
||||
'Invalid prop `' + propName + '` supplied to' +
|
||||
' `' + componentName + '`. Expected a typed array.'
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
float64: (props, propName, componentName) => {
|
||||
if (!(props[propName] instanceof Float64Array)) {
|
||||
return new Error(
|
||||
'Invalid prop `' + propName + '` supplied to' +
|
||||
' `' + componentName + '`. Expected a Float64Array.'
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
float32: (props, propName, componentName) => {
|
||||
if (!(props[propName] instanceof Float32Array)) {
|
||||
return new Error(
|
||||
'Invalid prop `' + propName + '` supplied to' +
|
||||
' `' + componentName + '`. Expected a Float32Array.'
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
float: (props, propName, componentName) => {
|
||||
if (!(props[propName] instanceof Float64Array ||
|
||||
props[propName] instanceof Float32Array)) {
|
||||
return new Error(
|
||||
'Invalid prop `' + propName + '` supplied to' +
|
||||
' `' + componentName + '`. Expected a Float32Array or Float64Array.'
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
int32: (props, propName, componentName) => {
|
||||
if (!(props[propName] instanceof Int32Array)) {
|
||||
return new Error(
|
||||
'Invalid prop `' + propName + '` supplied to' +
|
||||
' `' + componentName + '`. Expected an Int32Array.'
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
int16: (props, propName, componentName) => {
|
||||
if (!(props[propName] instanceof Int16Array)) {
|
||||
return new Error(
|
||||
'Invalid prop `' + propName + '` supplied to' +
|
||||
' `' + componentName + '`. Expected an In16Array.'
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
int8: (props, propName, componentName) => {
|
||||
if (!(props[propName] instanceof Int8Array)) {
|
||||
return new Error(
|
||||
'Invalid prop `' + propName + '` supplied to' +
|
||||
' `' + componentName + '`. Expected an Int8Array.'
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
int: (props, propName, componentName) => {
|
||||
if (!(props[propName] instanceof Int32Array ||
|
||||
props[propName] instanceof Int16Array ||
|
||||
props[propName] instanceof Int8Array)) {
|
||||
return new Error(
|
||||
'Invalid prop `' + propName + '` supplied to' +
|
||||
' `' + componentName + '`. Expected an Int32Array, In16Array, or Int8Array.'
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
uint32: (props, propName, componentName) => {
|
||||
if (!(props[propName] instanceof Uint32Array)) {
|
||||
return new Error(
|
||||
'Invalid prop `' + propName + '` supplied to' +
|
||||
' `' + componentName + '`. Expected a Uint32Array.'
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
uint16: (props, propName, componentName) => {
|
||||
if (!(props[propName] instanceof Uint16Array)) {
|
||||
return new Error(
|
||||
'Invalid prop `' + propName + '` supplied to' +
|
||||
' `' + componentName + '`. Expected a Uint16Array.'
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
uint8: (props, propName, componentName) => {
|
||||
if (!(props[propName] instanceof Uint8Array)) {
|
||||
return new Error(
|
||||
'Invalid prop `' + propName + '` supplied to' +
|
||||
' `' + componentName + '`. Expected a Uint8Array.'
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
uint8clamped: (props, propName, componentName) => {
|
||||
if (!(props[propName] instanceof Uint8ClampedArray)) {
|
||||
return new Error(
|
||||
'Invalid prop `' + propName + '` supplied to' +
|
||||
' `' + componentName + '`. Expected a Uint8ClampedArray.'
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
uint: (props, propName, componentName) => {
|
||||
if (!(props[propName] instanceof Uint32Array ||
|
||||
props[propName] instanceof Uint16Array ||
|
||||
props[propName] instanceof Uint8Array ||
|
||||
props[propName] instanceof Uint8ClampedArray)) {
|
||||
return new Error(
|
||||
'Invalid prop `' + propName + '` supplied to' +
|
||||
' `' + componentName + '`. Expected a Uint32Array, Uint16Array, Uint8Array, or Uint8ClampedArray.'
|
||||
);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export { TypedArrayProp as default };
|
||||
@@ -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 @@
|
||||
export default '84c949f2e68036ef488e09e05aed890a47e1a161';
|
||||
export default '298749821742198987421'
|
||||
@@ -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"
|
||||
|
||||
Reference in new issue
Block a user