Merge branch 'master' of github.com:OHIF/Viewers into feature/extensions-panels-and-docs
# Conflicts: # extensions/ohif-vtk-extension/src/ConnectedToolbarSection.js # src/App.js
This commit is contained in:
commit
1af09f1fad
24 files changed
+5778
-6061
No files matched your search
@@ -48,10 +48,6 @@ const mapDispatchToProps = (dispatch, ownProps) => {
|
||||
dispatch(setViewportSpecificData(viewportIndex, data));
|
||||
},
|
||||
|
||||
clearViewportSpecificData: () => {
|
||||
dispatch(clearViewportSpecificData(viewportIndex));
|
||||
},
|
||||
|
||||
/**
|
||||
* Our component "enables" the underlying dom element on "componentDidMount"
|
||||
* It listens for that event, and then emits the enabledElement. We can grab
|
||||
|
||||
@@ -56,31 +56,60 @@ class OHIFCornerstoneViewport extends Component {
|
||||
StackManager.clearStacks();
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain the CornerstoneTools Stack for the specified display set.
|
||||
*
|
||||
* @param {Object[]} studies
|
||||
* @param {String} studyInstanceUid
|
||||
* @param {String} displaySetInstanceUid
|
||||
* @param {String} [sopInstanceUid]
|
||||
* @param {Number} [frameIndex=1]
|
||||
* @return {Object} CornerstoneTools Stack
|
||||
*/
|
||||
static getCornerstoneStack(
|
||||
studies,
|
||||
studyInstanceUid,
|
||||
displaySetInstanceUid,
|
||||
sopInstanceUid,
|
||||
frameIndex
|
||||
frameIndex = 0
|
||||
) {
|
||||
if (!studies || !studies.length) {
|
||||
throw new Error('Studies not provided.');
|
||||
}
|
||||
|
||||
if (!studyInstanceUid) {
|
||||
throw new Error('StudyInstanceUID not provided.')
|
||||
}
|
||||
|
||||
if (!displaySetInstanceUid) {
|
||||
throw new Error('StudyInstanceUID not provided.')
|
||||
}
|
||||
|
||||
// Create shortcut to displaySet
|
||||
const study = studies.find(
|
||||
study => study.studyInstanceUid === studyInstanceUid
|
||||
);
|
||||
|
||||
if (!study) {
|
||||
throw new Error('Study not found.');
|
||||
}
|
||||
|
||||
const displaySet = study.displaySets.find(set => {
|
||||
return set.displaySetInstanceUid === displaySetInstanceUid;
|
||||
});
|
||||
|
||||
if (!displaySet) {
|
||||
throw new Error('Display Set not found.');
|
||||
}
|
||||
|
||||
// Get stack from Stack Manager
|
||||
const storedStack = StackManager.findOrCreateStack(study, displaySet);
|
||||
|
||||
// Clone the stack here so we don't mutate it
|
||||
const stack = Object.assign({}, storedStack);
|
||||
stack.currentImageIdIndex = frameIndex;
|
||||
|
||||
if (frameIndex !== undefined) {
|
||||
stack.currentImageIdIndex = frameIndex;
|
||||
} else if (sopInstanceUid) {
|
||||
if (sopInstanceUid) {
|
||||
const index = stack.imageIds.findIndex(imageId => {
|
||||
const sopCommonModule = cornerstone.metaData.get(
|
||||
'sopCommonModule',
|
||||
@@ -96,10 +125,8 @@ class OHIFCornerstoneViewport extends Component {
|
||||
if (index > -1) {
|
||||
stack.currentImageIdIndex = index;
|
||||
} else {
|
||||
stack.currentImageIdIndex = 0;
|
||||
console.warn('SOPInstanceUID provided was not found in specified DisplaySet');
|
||||
}
|
||||
} else {
|
||||
stack.currentImageIdIndex = 0;
|
||||
}
|
||||
|
||||
return stack;
|
||||
|
||||
Reference in new issue
Block a user