ohif-core --> @ohif/core

This commit is contained in:
dannyrb committed 2019-08-06 23:56:44 -04:00
1 parent 8c5bd55f88
commit 755da173ea
36 files changed
+547 -522

No files matched your search

+7 -7
View File
@@ -1,6 +1,6 @@
import OHIF from 'ohif-core';
import { View2D } from 'react-vtkjs-viewport';
import { connect } from 'react-redux';
import OHIF from "@ohif/core";
import { View2D } from "react-vtkjs-viewport";
import { connect } from "react-redux";
const { setViewportActive, setViewportSpecificData } = OHIF.redux.actions;
@@ -24,7 +24,7 @@ const mapStateToProps = (state, ownProps) => {
// Hopefully this doesn't break anything under the hood for this one
// activeTool: activeButton && activeButton.command,
...dataFromStore,
enableStackPrefetch: isActive,
enableStackPrefetch: isActive
};
};
@@ -38,7 +38,7 @@ const mapDispatchToProps = (dispatch, ownProps) => {
setViewportSpecificData: data => {
dispatch(setViewportSpecificData(viewportIndex, data));
},
}
};
};
@@ -63,10 +63,10 @@ const mergeProps = (propsFromState, propsFromDispatch, ownProps) => {
// Store the API details for later
//setViewportSpecificData({ vtkApi: api });
if (afterCreation && typeof afterCreation === 'function') {
if (afterCreation && typeof afterCreation === "function") {
afterCreation(api);
}
},
}
};
return props;
};
+29 -29
View File
@@ -1,16 +1,16 @@
import React, { Component } from 'react';
import { getImageData, loadImageData } from 'react-vtkjs-viewport';
import React, { Component } from "react";
import { getImageData, loadImageData } from "react-vtkjs-viewport";
import ConnectedVTKViewport from './ConnectedVTKViewport';
import LoadingIndicator from './LoadingIndicator.js';
import OHIF from 'ohif-core';
import PropTypes from 'prop-types';
import cornerstone from 'cornerstone-core';
import handleSegmentationStorage from './handleSegmentationStorage.js';
import vtkDataArray from 'vtk.js/Sources/Common/Core/DataArray';
import vtkImageData from 'vtk.js/Sources/Common/DataModel/ImageData';
import vtkVolume from 'vtk.js/Sources/Rendering/Core/Volume';
import vtkVolumeMapper from 'vtk.js/Sources/Rendering/Core/VolumeMapper';
import ConnectedVTKViewport from "./ConnectedVTKViewport";
import LoadingIndicator from "./LoadingIndicator.js";
import OHIF from "@ohif/core";
import PropTypes from "prop-types";
import cornerstone from "cornerstone-core";
import handleSegmentationStorage from "./handleSegmentationStorage.js";
import vtkDataArray from "vtk.js/Sources/Common/Core/DataArray";
import vtkImageData from "vtk.js/Sources/Common/DataModel/ImageData";
import vtkVolume from "vtk.js/Sources/Rendering/Core/Volume";
import vtkVolumeMapper from "vtk.js/Sources/Rendering/Core/VolumeMapper";
const { StackManager } = OHIF.utils;
@@ -24,7 +24,7 @@ cornerstone.metaData.addProvider(
StackManager.setMetadataProvider(metadataProvider);
const SOP_CLASSES = {
SEGMENTATION_STORAGE: '1.2.840.10008.5.1.4.1.1.66.4',
SEGMENTATION_STORAGE: "1.2.840.10008.5.1.4.1.1.66.4"
};
const specialCaseHandlers = {};
@@ -42,7 +42,7 @@ const volumeCache = {};
*/
function createLabelMapImageData(backgroundImageData) {
const labelMapData = vtkImageData.newInstance(
backgroundImageData.get('spacing', 'origin', 'direction')
backgroundImageData.get("spacing", "origin", "direction")
);
labelMapData.setDimensions(backgroundImageData.getDimensions());
labelMapData.computeTransforms();
@@ -50,7 +50,7 @@ function createLabelMapImageData(backgroundImageData) {
const values = new Uint8Array(backgroundImageData.getNumberOfPoints());
const dataArray = vtkDataArray.newInstance({
numberOfComponents: 1, // labelmap with single component
values,
values
});
labelMapData.getPointData().setScalars(dataArray);
@@ -61,24 +61,24 @@ class OHIFVTKViewport extends Component {
state = {
volumes: null,
paintFilterLabelMapImageData: null,
paintFilterBackgroundImageData: null,
paintFilterBackgroundImageData: null
};
static propTypes = {
studies: PropTypes.object,
displaySet: PropTypes.object,
viewportIndex: PropTypes.number,
children: PropTypes.node,
children: PropTypes.node
};
static id = 'OHIFVTKViewport';
static id = "OHIFVTKViewport";
static init() {
console.log('OHIFVTKViewport init()');
console.log("OHIFVTKViewport init()");
}
static destroy() {
console.log('OHIFVTKViewport destroy()');
console.log("OHIFVTKViewport destroy()");
StackManager.clearStacks();
}
@@ -109,7 +109,7 @@ class OHIFVTKViewport extends Component {
} else if (sopInstanceUid) {
const index = stack.imageIds.findIndex(imageId => {
const sopCommonModule = cornerstone.metaData.get(
'sopCommonModule',
"sopCommonModule",
imageId
);
if (!sopCommonModule) {
@@ -151,7 +151,7 @@ class OHIFVTKViewport extends Component {
switch (sopClassUid) {
case SOP_CLASSES.SEGMENTATION_STORAGE:
throw new Error('Not yet implemented');
throw new Error("Not yet implemented");
const data = handleSegmentationStorage(
stack.imageIds,
@@ -164,7 +164,7 @@ class OHIFVTKViewport extends Component {
return loadImageData(imageDataObject).then(() => {
return {
data: imageDataObject.vtkImageData,
labelmap: labelmapDataObject,
labelmap: labelmapDataObject
};
});
default:
@@ -172,7 +172,7 @@ class OHIFVTKViewport extends Component {
return loadImageData(imageDataObject).then(() => {
return {
data: imageDataObject.vtkImageData,
data: imageDataObject.vtkImageData
};
});
}
@@ -201,12 +201,12 @@ class OHIFVTKViewport extends Component {
displaySetInstanceUid,
sopClassUids,
sopInstanceUid,
frameIndex,
frameIndex
} = displaySet;
if (sopClassUids.length > 1) {
console.warn(
'More than one SOPClassUid in the same series is not yet supported.'
"More than one SOPClassUid in the same series is not yet supported."
);
}
@@ -230,7 +230,7 @@ class OHIFVTKViewport extends Component {
this.setState({
volumes: [volumeActor],
paintFilterBackgroundImageData: data,
paintFilterLabelMapImageData: labelmap,
paintFilterLabelMapImageData: labelmap
});
}
@@ -260,12 +260,12 @@ class OHIFVTKViewport extends Component {
childrenWithProps = this.props.children.map((child, index) => {
return React.cloneElement(child, {
viewportIndex: this.props.viewportIndex,
key: index,
key: index
});
});
}
const style = { width: '100%', height: '100%', position: 'relative' };
const style = { width: "100%", height: "100%", position: "relative" };
return (
<>
@@ -1,7 +1,7 @@
import * as dcmjs from 'dcmjs';
import * as dcmjs from "dcmjs";
import OHIF from 'ohif-core';
import { api } from 'dicomweb-client';
import OHIF from "@ohif/core";
import { api } from "dicomweb-client";
const { StackManager } = OHIF.utils;
@@ -57,14 +57,14 @@ function retrieveDicomData(
) {
const config = {
url: wadoRoot,
headers: DICOMWeb.getAuthorizationHeader(),
headers: DICOMWeb.getAuthorizationHeader()
};
const dicomWeb = new api.DICOMwebClient(config);
const options = {
studyInstanceUID,
seriesInstanceUID,
sopInstanceUID,
sopInstanceUID
};
return dicomWeb.retrieveInstance(options);
@@ -117,7 +117,7 @@ async function handleSegmentationStorage(
if (displaySets.length > 1) {
console.warn(
'More than one display set with the same seriesInstanceUid. This is not supported yet...'
"More than one display set with the same seriesInstanceUid. This is not supported yet..."
);
}
@@ -125,7 +125,7 @@ async function handleSegmentationStorage(
const imageIds = referenceDisplaySet.images.map(image => image.getImageId());
if (!results) {
throw new Error('Fractional segmentations are not supported');
throw new Error("Fractional segmentations are not supported");
}
const cachedStack = StackManager.findOrCreateStack(
@@ -137,13 +137,13 @@ async function handleSegmentationStorage(
return {
referenceDataObject,
labelmapDataObject,
labelmapDataObject
};
return {
studyInstanceUid,
displaySetInstanceUid,
stack,
stack
};
}
@@ -1,4 +1,4 @@
import { redux } from 'ohif-core';
import { redux } from "@ohif/core";
const { setViewportLayoutAndData } = redux.actions;