2019-12-11 13:14:01 -03:00
|
|
|
import { connect } from 'react-redux';
|
|
|
|
|
import Viewer from './Viewer.js';
|
|
|
|
|
import OHIF from '@ohif/core';
|
2019-02-13 16:18:46 +01:00
|
|
|
|
|
|
|
|
const { setTimepoints, setMeasurements } = OHIF.redux.actions;
|
2019-02-04 20:46:15 -05:00
|
|
|
|
2019-12-11 13:14:01 -03:00
|
|
|
const getActiveServer = servers => {
|
|
|
|
|
const isActive = a => a.active === true;
|
|
|
|
|
return servers.servers.find(isActive);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const mapStateToProps = state => {
|
|
|
|
|
const { viewports, servers } = state;
|
2019-07-04 14:09:13 -04:00
|
|
|
return {
|
2019-12-11 13:14:01 -03:00
|
|
|
viewports: viewports.viewportSpecificData,
|
|
|
|
|
activeViewportIndex: viewports.activeViewportIndex,
|
|
|
|
|
activeServer: getActiveServer(servers),
|
2019-07-04 14:09:13 -04:00
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2019-02-04 20:46:15 -05:00
|
|
|
const mapDispatchToProps = dispatch => {
|
|
|
|
|
return {
|
|
|
|
|
onTimepointsUpdated: timepoints => {
|
2019-02-13 16:18:46 +01:00
|
|
|
dispatch(setTimepoints(timepoints));
|
2019-02-04 20:46:15 -05:00
|
|
|
},
|
|
|
|
|
onMeasurementsUpdated: measurements => {
|
2019-02-13 16:18:46 +01:00
|
|
|
dispatch(setMeasurements(measurements));
|
2019-12-11 13:14:01 -03:00
|
|
|
},
|
2019-02-04 20:46:15 -05:00
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const ConnectedViewer = connect(
|
2019-07-04 14:09:13 -04:00
|
|
|
mapStateToProps,
|
2019-02-04 20:46:15 -05:00
|
|
|
mapDispatchToProps
|
|
|
|
|
)(Viewer);
|
|
|
|
|
|
|
|
|
|
export default ConnectedViewer;
|