formatting

This commit is contained in:
dannyrb 2019-06-20 23:17:07 -04:00
parent aa250a9210
commit ec9ea8b761
10 changed files with 58 additions and 57 deletions

View File

@ -24,7 +24,7 @@ const mapStateToProps = (state, ownProps) => {
// Hopefully this doesn't break anything under the hood for this one // Hopefully this doesn't break anything under the hood for this one
// activeTool: activeButton && activeButton.command, // activeTool: activeButton && activeButton.command,
...dataFromStore, ...dataFromStore,
enableStackPrefetch: isActive enableStackPrefetch: isActive,
}; };
}; };
@ -38,7 +38,7 @@ const mapDispatchToProps = (dispatch, ownProps) => {
setViewportSpecificData: data => { setViewportSpecificData: data => {
dispatch(setViewportSpecificData(viewportIndex, data)); dispatch(setViewportSpecificData(viewportIndex, data));
} },
}; };
}; };
@ -66,7 +66,7 @@ const mergeProps = (propsFromState, propsFromDispatch, ownProps) => {
if (afterCreation && typeof afterCreation === 'function') { if (afterCreation && typeof afterCreation === 'function') {
afterCreation(api); afterCreation(api);
} }
} },
}; };
return props; return props;
}; };

View File

@ -1,5 +1,5 @@
.imageViewerLoadingIndicator { .imageViewerLoadingIndicator {
color: #91B9CD; color: #91b9cd;
} }
.loadingIndicator { .loadingIndicator {

View File

@ -1,17 +1,18 @@
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import './LoadingIndicator.css'; import './LoadingIndicator.css';
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
class LoadingIndicator extends PureComponent { class LoadingIndicator extends PureComponent {
static propTypes = { static propTypes = {
percentComplete: PropTypes.number.isRequired, percentComplete: PropTypes.number.isRequired,
error: PropTypes.object error: PropTypes.object,
}; };
static defaultProps = { static defaultProps = {
percentComplete: 0, percentComplete: 0,
error: null error: null,
}; };
render() { render() {

View File

@ -1,17 +1,16 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import PropTypes from 'prop-types';
import OHIF from 'ohif-core';
import cornerstone from 'cornerstone-core';
import { getImageData, loadImageData } from 'react-vtkjs-viewport'; 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 vtkVolume from 'vtk.js/Sources/Rendering/Core/Volume';
import vtkVolumeMapper from 'vtk.js/Sources/Rendering/Core/VolumeMapper'; import vtkVolumeMapper from 'vtk.js/Sources/Rendering/Core/VolumeMapper';
import vtkImageData from 'vtk.js/Sources/Common/DataModel/ImageData';
import vtkDataArray from 'vtk.js/Sources/Common/Core/DataArray';
import ConnectedVTKViewport from './ConnectedVTKViewport';
import handleSegmentationStorage from './handleSegmentationStorage.js';
import LoadingIndicator from './LoadingIndicator.js';
const { StackManager } = OHIF.utils; const { StackManager } = OHIF.utils;
@ -25,7 +24,7 @@ cornerstone.metaData.addProvider(
StackManager.setMetadataProvider(metadataProvider); StackManager.setMetadataProvider(metadataProvider);
const SOP_CLASSES = { 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 = {}; const specialCaseHandlers = {};
@ -51,7 +50,7 @@ function createLabelMapImageData(backgroundImageData) {
const values = new Uint8Array(backgroundImageData.getNumberOfPoints()); const values = new Uint8Array(backgroundImageData.getNumberOfPoints());
const dataArray = vtkDataArray.newInstance({ const dataArray = vtkDataArray.newInstance({
numberOfComponents: 1, // labelmap with single component numberOfComponents: 1, // labelmap with single component
values values,
}); });
labelMapData.getPointData().setScalars(dataArray); labelMapData.getPointData().setScalars(dataArray);
@ -62,14 +61,14 @@ class OHIFVTKViewport extends Component {
state = { state = {
volumes: null, volumes: null,
paintFilterLabelMapImageData: null, paintFilterLabelMapImageData: null,
paintFilterBackgroundImageData: null paintFilterBackgroundImageData: null,
}; };
static propTypes = { static propTypes = {
studies: PropTypes.object, studies: PropTypes.object,
displaySet: PropTypes.object, displaySet: PropTypes.object,
viewportIndex: PropTypes.number, viewportIndex: PropTypes.number,
children: PropTypes.node children: PropTypes.node,
}; };
static id = 'OHIFVTKViewport'; static id = 'OHIFVTKViewport';
@ -165,7 +164,7 @@ class OHIFVTKViewport extends Component {
return loadImageData(imageDataObject).then(() => { return loadImageData(imageDataObject).then(() => {
return { return {
data: imageDataObject.vtkImageData, data: imageDataObject.vtkImageData,
labelmap: labelmapDataObject labelmap: labelmapDataObject,
}; };
}); });
default: default:
@ -173,7 +172,7 @@ class OHIFVTKViewport extends Component {
return loadImageData(imageDataObject).then(() => { return loadImageData(imageDataObject).then(() => {
return { return {
data: imageDataObject.vtkImageData data: imageDataObject.vtkImageData,
}; };
}); });
} }
@ -202,7 +201,7 @@ class OHIFVTKViewport extends Component {
displaySetInstanceUid, displaySetInstanceUid,
sopClassUids, sopClassUids,
sopInstanceUid, sopInstanceUid,
frameIndex frameIndex,
} = displaySet; } = displaySet;
if (sopClassUids.length > 1) { if (sopClassUids.length > 1) {
@ -231,7 +230,7 @@ class OHIFVTKViewport extends Component {
this.setState({ this.setState({
volumes: [volumeActor], volumes: [volumeActor],
paintFilterBackgroundImageData: data, paintFilterBackgroundImageData: data,
paintFilterLabelMapImageData: labelmap paintFilterLabelMapImageData: labelmap,
}); });
} }
@ -261,7 +260,7 @@ class OHIFVTKViewport extends Component {
childrenWithProps = this.props.children.map((child, index) => { childrenWithProps = this.props.children.map((child, index) => {
return React.cloneElement(child, { return React.cloneElement(child, {
viewportIndex: this.props.viewportIndex, viewportIndex: this.props.viewportIndex,
key: index key: index,
}); });
}); });
} }

View File

@ -3,7 +3,7 @@ import {
vtkInteractorStyleMPRSlice, vtkInteractorStyleMPRSlice,
vtkInteractorStyleMPRWindowLevel, vtkInteractorStyleMPRWindowLevel,
vtkSVGCrosshairsWidget, vtkSVGCrosshairsWidget,
vtkSVGWidgetManager vtkSVGWidgetManager,
} from 'react-vtkjs-viewport'; } from 'react-vtkjs-viewport';
import setMPRLayout from './utils/setMPRLayout.js'; import setMPRLayout from './utils/setMPRLayout.js';
@ -230,7 +230,7 @@ const actions = {
api.svgWidgetManager = svgWidgetManager; api.svgWidgetManager = svgWidgetManager;
api.svgWidgets = { api.svgWidgets = {
crosshairsWidget crosshairsWidget,
}; };
switch (index) { switch (index) {
@ -255,49 +255,49 @@ const actions = {
renderWindow.render(); renderWindow.render();
}); });
} },
}; };
const definitions = { const definitions = {
axial: { axial: {
commandFn: actions.axial, commandFn: actions.axial,
storeContexts: ['viewports'], storeContexts: ['viewports'],
options: {} options: {},
}, },
coronal: { coronal: {
commandFn: actions.coronal, commandFn: actions.coronal,
storeContexts: ['viewports'], storeContexts: ['viewports'],
options: {} options: {},
}, },
sagittal: { sagittal: {
commandFn: actions.sagittal, commandFn: actions.sagittal,
storeContexts: ['viewports'], storeContexts: ['viewports'],
options: {} options: {},
}, },
enableRotateTool: { enableRotateTool: {
commandFn: actions.enableRotateTool, commandFn: actions.enableRotateTool,
storeContexts: ['viewports'], storeContexts: ['viewports'],
options: {} options: {},
}, },
enableCrosshairsTool: { enableCrosshairsTool: {
commandFn: actions.enableCrosshairsTool, commandFn: actions.enableCrosshairsTool,
storeContexts: ['viewports'], storeContexts: ['viewports'],
options: {} options: {},
}, },
enableLevelTool: { enableLevelTool: {
commandFn: actions.enableLevelTool, commandFn: actions.enableLevelTool,
storeContexts: ['viewports'], storeContexts: ['viewports'],
options: {} options: {},
}, },
mpr2d: { mpr2d: {
commandFn: actions.mpr2d, commandFn: actions.mpr2d,
storeContexts: ['viewports'], storeContexts: ['viewports'],
options: {}, options: {},
context: 'VIEWER' context: 'VIEWER',
} },
}; };
export default { export default {
definitions, definitions,
defaultContext: 'ACTIVE_VIEWPORT::VTK' defaultContext: 'ACTIVE_VIEWPORT::VTK',
}; };

View File

@ -1,5 +1,6 @@
import OHIF from 'ohif-core';
import * as dcmjs from 'dcmjs'; import * as dcmjs from 'dcmjs';
import OHIF from 'ohif-core';
import { api } from 'dicomweb-client'; import { api } from 'dicomweb-client';
const { StackManager } = OHIF.utils; const { StackManager } = OHIF.utils;
@ -56,14 +57,14 @@ function retrieveDicomData(
) { ) {
const config = { const config = {
url: wadoRoot, url: wadoRoot,
headers: DICOMWeb.getAuthorizationHeader() headers: DICOMWeb.getAuthorizationHeader(),
}; };
const dicomWeb = new api.DICOMwebClient(config); const dicomWeb = new api.DICOMwebClient(config);
const options = { const options = {
studyInstanceUID, studyInstanceUID,
seriesInstanceUID, seriesInstanceUID,
sopInstanceUID sopInstanceUID,
}; };
return dicomWeb.retrieveInstance(options); return dicomWeb.retrieveInstance(options);
@ -136,13 +137,13 @@ async function handleSegmentationStorage(
return { return {
referenceDataObject, referenceDataObject,
labelmapDataObject labelmapDataObject,
}; };
return { return {
studyInstanceUid, studyInstanceUid,
displaySetInstanceUid, displaySetInstanceUid,
stack stack,
}; };
} }

View File

@ -18,7 +18,7 @@ export default {
}, },
getCommandsModule() { getCommandsModule() {
return commandsModule; return commandsModule;
} },
}; };
loadLocales(); loadLocales();

View File

@ -1,6 +1,6 @@
const TOOLBAR_BUTTON_TYPES = { const TOOLBAR_BUTTON_TYPES = {
COMMAND: 'command', COMMAND: 'command',
SET_TOOL_ACTIVE: 'setToolActive' SET_TOOL_ACTIVE: 'setToolActive',
}; };
const definitions = [ const definitions = [
@ -11,7 +11,7 @@ const definitions = [
// //
type: TOOLBAR_BUTTON_TYPES.SET_TOOL_ACTIVE, type: TOOLBAR_BUTTON_TYPES.SET_TOOL_ACTIVE,
commandName: 'enableCrosshairsTool', commandName: 'enableCrosshairsTool',
commandOptions: {} commandOptions: {},
}, },
{ {
id: 'WWWC', id: 'WWWC',
@ -20,7 +20,7 @@ const definitions = [
// //
type: TOOLBAR_BUTTON_TYPES.SET_TOOL_ACTIVE, type: TOOLBAR_BUTTON_TYPES.SET_TOOL_ACTIVE,
commandName: 'enableLevelTool', commandName: 'enableLevelTool',
commandOptions: {} commandOptions: {},
}, },
{ {
id: 'Rotate', id: 'Rotate',
@ -29,11 +29,11 @@ const definitions = [
// //
type: TOOLBAR_BUTTON_TYPES.SET_TOOL_ACTIVE, type: TOOLBAR_BUTTON_TYPES.SET_TOOL_ACTIVE,
commandName: 'enableRotateTool', commandName: 'enableRotateTool',
commandOptions: {} commandOptions: {},
} },
]; ];
export default { export default {
definitions, definitions,
defaultContext: 'ACTIVE_VIEWPORT::VTK' defaultContext: 'ACTIVE_VIEWPORT::VTK',
}; };

View File

@ -11,14 +11,14 @@ export default function setMPRLayout(displaySet) {
for (let i = 0; i < numViewports; i++) { for (let i = 0; i < numViewports; i++) {
viewports.push({ viewports.push({
height: `${100 / rows}%`, height: `${100 / rows}%`,
width: `${100 / columns}%` width: `${100 / columns}%`,
}); });
viewportSpecificData[i] = displaySet; viewportSpecificData[i] = displaySet;
viewportSpecificData[i].plugin = 'vtk'; viewportSpecificData[i].plugin = 'vtk';
} }
const layout = { const layout = {
viewports viewports,
}; };
const viewportIndices = [0, 1, 2]; const viewportIndices = [0, 1, 2];
@ -42,8 +42,8 @@ export default function setMPRLayout(displaySet) {
if (apis.every(a => !!a)) { if (apis.every(a => !!a)) {
resolve(apis); resolve(apis);
} }
} },
} },
}; };
updatedViewports = setSingleLayoutData( updatedViewports = setSingleLayoutData(

View File

@ -19,8 +19,8 @@ export default function setViewportToVTK(
mode: 'mpr', // TODO: not used mode: 'mpr', // TODO: not used
afterCreation: api => { afterCreation: api => {
resolve(api); resolve(api);
} },
} },
}; };
const updatedViewports = setSingleLayoutData( const updatedViewports = setSingleLayoutData(