refactor(@ohif/extension-vtk): Update VTK extension to add basic MPR functionality
This commit is contained in:
1 parent
04e00fad20
commit
9573f67132
13 files changed
+3161
-3900
No files matched your search
@@ -1,5 +1,5 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { VTKMPRViewport } from 'react-vtkjs-viewport';
|
||||
import { View2D } from 'react-vtkjs-viewport';
|
||||
import OHIF from 'ohif-core';
|
||||
|
||||
const {
|
||||
@@ -17,7 +17,7 @@ const mapStateToProps = (state, ownProps) => {
|
||||
}
|
||||
|
||||
// If this is the active viewport, enable prefetching.
|
||||
const { viewportIndex } = ownProps; //.viewportData;
|
||||
const { viewportIndex } = ownProps;
|
||||
const isActive = viewportIndex === state.viewports.activeViewportIndex;
|
||||
const viewportSpecificData =
|
||||
state.viewports.viewportSpecificData[viewportIndex] || {};
|
||||
@@ -31,7 +31,7 @@ const mapStateToProps = (state, ownProps) => {
|
||||
...pluginDetails,
|
||||
activeTool: activeButton && activeButton.command,
|
||||
...dataFromStore,
|
||||
enableStackPrefetch: isActive,
|
||||
enableStackPrefetch: isActive
|
||||
};
|
||||
};
|
||||
|
||||
@@ -45,17 +45,44 @@ const mapDispatchToProps = (dispatch, ownProps) => {
|
||||
|
||||
setViewportSpecificData: data => {
|
||||
dispatch(setViewportSpecificData(viewportIndex, data));
|
||||
},
|
||||
|
||||
clearViewportSpecificData: () => {
|
||||
dispatch(clearViewportSpecificData(viewportIndex));
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
const mergeProps = (propsFromState, propsFromDispatch, ownProps) => {
|
||||
const { afterCreation } = propsFromState;
|
||||
const { setViewportSpecificData } = propsFromDispatch;
|
||||
|
||||
const props = {
|
||||
...propsFromState,
|
||||
...propsFromDispatch,
|
||||
...ownProps,
|
||||
/**
|
||||
* Our component sets up the underlying dom element on "componentDidMount"
|
||||
* for use with VTK.
|
||||
*
|
||||
* The onCreated prop passes back an Object containing many of the internal
|
||||
* components of the VTK scene. We can grab a reference to these here, to
|
||||
* make playing with VTK's native methods easier.
|
||||
*
|
||||
* A similar approach is taken with the Cornerstone extension.
|
||||
*/
|
||||
onCreated: api => {
|
||||
// Store the API details for later
|
||||
//setViewportSpecificData({ vtkApi: api });
|
||||
|
||||
if (afterCreation && typeof afterCreation === 'function') {
|
||||
afterCreation(api);
|
||||
}
|
||||
}
|
||||
};
|
||||
return props;
|
||||
};
|
||||
|
||||
const ConnectedVTKViewport = connect(
|
||||
mapStateToProps,
|
||||
//mapDispatchToProps
|
||||
)(VTKMPRViewport);
|
||||
mapDispatchToProps,
|
||||
mergeProps
|
||||
)(View2D);
|
||||
|
||||
export default ConnectedVTKViewport;
|
||||
Reference in new issue
Block a user