fix: 🐛 Disable seg panel when data for seg unavailable (#1732)
* Add disable state for invalid data * fix: 🐛 Disable seg panel when data for seg unavailable We need to gracefully handle errors if data for segmentation is unavailable and disable the segmentation panel ✅ Closes: #1728 * Bump dcmjs version dcmjs * @ohif/core: ^0.12.2 → ^0.13.0 * @ohif/extension-cornerstone: ^0.12.3 → ^0.13.0 * @ohif/extension-dicom-html: ^0.12.3 → ^0.13.0 * @ohif/extension-dicom-rt: ^0.12.3 → ^0.13.0 * @ohif/extension-dicom-segmentation: ^0.12.2 → ^0.13.0 * @ohif/extension-vtk: ^0.12.2 → ^0.13.0 * @ohif/viewer: ^0.12.2 → ^0.13.0 * Remove error barrier * Fix e2e Co-authored-by: James Petts <jamesapetts@gmail.com>
This commit is contained in:
parent
b7d47383c5
commit
698e900b85
@ -36,7 +36,7 @@
|
|||||||
"cornerstone-math": "^0.1.8",
|
"cornerstone-math": "^0.1.8",
|
||||||
"cornerstone-tools": "4.15.1",
|
"cornerstone-tools": "4.15.1",
|
||||||
"cornerstone-wado-image-loader": "^3.1.0",
|
"cornerstone-wado-image-loader": "^3.1.0",
|
||||||
"dcmjs": "^0.12.3",
|
"dcmjs": "0.13.0",
|
||||||
"dicom-parser": "^1.8.3",
|
"dicom-parser": "^1.8.3",
|
||||||
"hammerjs": "^2.0.8",
|
"hammerjs": "^2.0.8",
|
||||||
"prop-types": "^15.6.2",
|
"prop-types": "^15.6.2",
|
||||||
|
|||||||
@ -29,7 +29,7 @@
|
|||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@ohif/core": "^0.50.0",
|
"@ohif/core": "^0.50.0",
|
||||||
"dcmjs": "^0.12.3",
|
"dcmjs": "0.13.0",
|
||||||
"prop-types": "^15.6.2",
|
"prop-types": "^15.6.2",
|
||||||
"react": "^16.8.6",
|
"react": "^16.8.6",
|
||||||
"react-dom": "^16.8.6"
|
"react-dom": "^16.8.6"
|
||||||
|
|||||||
@ -31,7 +31,7 @@
|
|||||||
"@ohif/core": "^0.50.0",
|
"@ohif/core": "^0.50.0",
|
||||||
"cornerstone-core": "^2.2.8",
|
"cornerstone-core": "^2.2.8",
|
||||||
"cornerstone-tools": "4.15.1",
|
"cornerstone-tools": "4.15.1",
|
||||||
"dcmjs": "^0.12.3",
|
"dcmjs": "0.13.0",
|
||||||
"prop-types": "^15.6.2",
|
"prop-types": "^15.6.2",
|
||||||
"react": "^16.8.6",
|
"react": "^16.8.6",
|
||||||
"react-dom": "^16.8.6"
|
"react-dom": "^16.8.6"
|
||||||
|
|||||||
@ -31,7 +31,7 @@
|
|||||||
"@ohif/core": "^0.50.0",
|
"@ohif/core": "^0.50.0",
|
||||||
"cornerstone-core": "^2.2.8",
|
"cornerstone-core": "^2.2.8",
|
||||||
"cornerstone-tools": "4.15.1",
|
"cornerstone-tools": "4.15.1",
|
||||||
"dcmjs": "^0.12.2",
|
"dcmjs": "0.13.0",
|
||||||
"prop-types": "^15.6.2",
|
"prop-types": "^15.6.2",
|
||||||
"react": "^16.8.6",
|
"react": "^16.8.6",
|
||||||
"react-dom": "^16.8.6"
|
"react-dom": "^16.8.6"
|
||||||
|
|||||||
@ -8,6 +8,11 @@
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.dcmseg-segmentation-panel.disabled {
|
||||||
|
opacity: 0.6;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
.dcmseg-segmentation-panel h3 {
|
.dcmseg-segmentation-panel h3 {
|
||||||
padding-left: 20px;
|
padding-left: 20px;
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
|
|||||||
@ -77,7 +77,8 @@ const SegmentationPanel = ({
|
|||||||
labelmapList: [],
|
labelmapList: [],
|
||||||
segmentList: [],
|
segmentList: [],
|
||||||
cachedSegmentsProperties: [],
|
cachedSegmentsProperties: [],
|
||||||
isLoading: false
|
isLoading: false,
|
||||||
|
isDisabled: true
|
||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -139,39 +140,45 @@ const SegmentationPanel = ({
|
|||||||
const refreshSegmentations = useCallback(() => {
|
const refreshSegmentations = useCallback(() => {
|
||||||
const module = cornerstoneTools.getModule('segmentation');
|
const module = cornerstoneTools.getModule('segmentation');
|
||||||
const activeViewport = viewports[activeIndex];
|
const activeViewport = viewports[activeIndex];
|
||||||
const studyMetadata = studyMetadataManager.get(
|
|
||||||
activeViewport.StudyInstanceUID
|
const isDisabled = !activeViewport || !activeViewport.StudyInstanceUID;
|
||||||
);
|
if (!isDisabled) {
|
||||||
const firstImageId = studyMetadata.getFirstImageId(
|
const studyMetadata = studyMetadataManager.get(
|
||||||
activeViewport.displaySetInstanceUID
|
activeViewport.StudyInstanceUID
|
||||||
);
|
|
||||||
const brushStackState = module.state.series[firstImageId];
|
|
||||||
if (brushStackState) {
|
|
||||||
const labelmap3D =
|
|
||||||
brushStackState.labelmaps3D[brushStackState.activeLabelmapIndex];
|
|
||||||
const labelmapList = getLabelmapList(
|
|
||||||
brushStackState,
|
|
||||||
firstImageId,
|
|
||||||
activeViewport
|
|
||||||
);
|
);
|
||||||
const segmentList = getSegmentList(
|
const firstImageId = studyMetadata.getFirstImageId(
|
||||||
labelmap3D,
|
activeViewport.displaySetInstanceUID
|
||||||
firstImageId,
|
|
||||||
brushStackState
|
|
||||||
);
|
);
|
||||||
setState(state => ({
|
const brushStackState = module.state.series[firstImageId];
|
||||||
...state,
|
if (brushStackState) {
|
||||||
brushStackState,
|
const labelmap3D =
|
||||||
selectedSegmentation: brushStackState.activeLabelmapIndex,
|
brushStackState.labelmaps3D[brushStackState.activeLabelmapIndex];
|
||||||
labelmapList,
|
const labelmapList = getLabelmapList(
|
||||||
segmentList,
|
brushStackState,
|
||||||
}));
|
firstImageId,
|
||||||
} else {
|
activeViewport
|
||||||
setState(state => ({
|
);
|
||||||
...state,
|
const segmentList = getSegmentList(
|
||||||
labelmapList: [],
|
labelmap3D,
|
||||||
segmentList: [],
|
firstImageId,
|
||||||
}));
|
brushStackState
|
||||||
|
);
|
||||||
|
setState(state => ({
|
||||||
|
...state,
|
||||||
|
brushStackState,
|
||||||
|
selectedSegmentation: brushStackState.activeLabelmapIndex,
|
||||||
|
labelmapList,
|
||||||
|
segmentList,
|
||||||
|
isDisabled
|
||||||
|
}));
|
||||||
|
} else {
|
||||||
|
setState(state => ({
|
||||||
|
...state,
|
||||||
|
labelmapList: [],
|
||||||
|
segmentList: [],
|
||||||
|
isDisabled
|
||||||
|
}));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, [
|
}, [
|
||||||
viewports,
|
viewports,
|
||||||
@ -181,7 +188,7 @@ const SegmentationPanel = ({
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
refreshSegmentations();
|
refreshSegmentations();
|
||||||
}, [viewports, activeIndex, state.selectedSegmentation, activeContexts, state.isLoading]);
|
}, [viewports, activeIndex, isOpen, state.selectedSegmentation, activeContexts, state.isLoading]);
|
||||||
|
|
||||||
/* Handle open/closed panel behaviour */
|
/* Handle open/closed panel behaviour */
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -507,7 +514,7 @@ const SegmentationPanel = ({
|
|||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return (
|
return (
|
||||||
<div className="dcmseg-segmentation-panel">
|
<div className={`dcmseg-segmentation-panel ${state.isDisabled && 'disabled'}`}>
|
||||||
<Icon
|
<Icon
|
||||||
className="cog-icon"
|
className="cog-icon"
|
||||||
name="cog"
|
name="cog"
|
||||||
|
|||||||
@ -24,7 +24,7 @@ export default {
|
|||||||
return toolbarModule;
|
return toolbarModule;
|
||||||
},
|
},
|
||||||
getPanelModule({ commandsManager, api, servicesManager }) {
|
getPanelModule({ commandsManager, api, servicesManager }) {
|
||||||
const { UINotificationService } = servicesManager;
|
const { UINotificationService } = servicesManager.services;
|
||||||
|
|
||||||
const ExtendedSegmentationPanel = props => {
|
const ExtendedSegmentationPanel = props => {
|
||||||
const { activeContexts } = api.hooks.useAppContext();
|
const { activeContexts } = api.hooks.useAppContext();
|
||||||
|
|||||||
@ -35,7 +35,7 @@
|
|||||||
"cornerstone-core": "^2.2.8",
|
"cornerstone-core": "^2.2.8",
|
||||||
"cornerstone-tools": "4.15.1",
|
"cornerstone-tools": "4.15.1",
|
||||||
"cornerstone-wado-image-loader": "^3.1.0",
|
"cornerstone-wado-image-loader": "^3.1.0",
|
||||||
"dcmjs": "^0.12.2",
|
"dcmjs": "0.13.0",
|
||||||
"dicom-parser": "^1.8.3",
|
"dicom-parser": "^1.8.3",
|
||||||
"i18next": "^17.0.3",
|
"i18next": "^17.0.3",
|
||||||
"i18next-browser-languagedetector": "^3.0.1",
|
"i18next-browser-languagedetector": "^3.0.1",
|
||||||
|
|||||||
@ -39,7 +39,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "^7.5.5",
|
"@babel/runtime": "^7.5.5",
|
||||||
"ajv": "^6.10.0",
|
"ajv": "^6.10.0",
|
||||||
"dcmjs": "^0.12.2",
|
"dcmjs": "0.13.0",
|
||||||
"dicomweb-client": "^0.6.0",
|
"dicomweb-client": "^0.6.0",
|
||||||
"immer": "6.0.2",
|
"immer": "6.0.2",
|
||||||
"isomorphic-base64": "^1.0.2",
|
"isomorphic-base64": "^1.0.2",
|
||||||
|
|||||||
@ -52,7 +52,7 @@ describe('OHIF Study List', function() {
|
|||||||
//Wait result list to be displayed
|
//Wait result list to be displayed
|
||||||
cy.waitStudyList();
|
cy.waitStudyList();
|
||||||
cy.get('@searchResult').should($list => {
|
cy.get('@searchResult').should($list => {
|
||||||
expect($list.length).to.be.eq(15); // TODO: Where are you hiding MISTER^MR?
|
expect($list.length).to.be.eq(16); // TODO: Where are you hiding MISTER^MR?
|
||||||
expect($list).to.contain('MR');
|
expect($list).to.contain('MR');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -147,7 +147,7 @@ describe('OHIF Study List', function() {
|
|||||||
//Wait result list to be displayed
|
//Wait result list to be displayed
|
||||||
cy.waitStudyList();
|
cy.waitStudyList();
|
||||||
cy.get('@searchResult').should($list => {
|
cy.get('@searchResult').should($list => {
|
||||||
expect($list.length).to.be.eq(15); // TODO: Where are you hiding MISTER^MR?
|
expect($list.length).to.be.eq(16); // TODO: Where are you hiding MISTER^MR?
|
||||||
expect($list).to.contain('MR');
|
expect($list).to.contain('MR');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -67,7 +67,7 @@
|
|||||||
"cornerstone-math": "^0.1.8",
|
"cornerstone-math": "^0.1.8",
|
||||||
"cornerstone-tools": "4.15.1",
|
"cornerstone-tools": "4.15.1",
|
||||||
"cornerstone-wado-image-loader": "^3.1.0",
|
"cornerstone-wado-image-loader": "^3.1.0",
|
||||||
"dcmjs": "^0.12.2",
|
"dcmjs": "0.13.0",
|
||||||
"dicom-parser": "^1.8.3",
|
"dicom-parser": "^1.8.3",
|
||||||
"dicomweb-client": "^0.4.4",
|
"dicomweb-client": "^0.4.4",
|
||||||
"hammerjs": "^2.0.8",
|
"hammerjs": "^2.0.8",
|
||||||
|
|||||||
@ -6534,10 +6534,10 @@ dateformat@^3.0.0:
|
|||||||
resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-3.0.3.tgz#a6e37499a4d9a9cf85ef5872044d62901c9889ae"
|
resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-3.0.3.tgz#a6e37499a4d9a9cf85ef5872044d62901c9889ae"
|
||||||
integrity sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q==
|
integrity sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q==
|
||||||
|
|
||||||
dcmjs@^0.12.2:
|
dcmjs@0.13.0:
|
||||||
version "0.12.2"
|
version "0.13.0"
|
||||||
resolved "https://registry.yarnpkg.com/dcmjs/-/dcmjs-0.12.2.tgz#1c16e19c27ff43202abc7cd25c5ecd6d8bf7672e"
|
resolved "https://registry.yarnpkg.com/dcmjs/-/dcmjs-0.13.0.tgz#16310a137a0fe800ccb2d4751a28cf023765f347"
|
||||||
integrity sha512-B7cEVCfDi3mOLKoBYUMYy+6COjLZhtKaesNpq5XNA4IbEH4EJYVweJfiI9gsR5hypv9LAPg72xG/xrbqjy8TgQ==
|
integrity sha512-U+qGwlnkG8vwDKB4R7ryqQUtWQM1JHMKMBw5+Oy8wcPxS+vDmaRTqIcAItMh1DcZ0ia8RN0VI5TBVCOJl7GVhA==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@babel/polyfill" "^7.8.3"
|
"@babel/polyfill" "^7.8.3"
|
||||||
"@babel/runtime" "^7.8.4"
|
"@babel/runtime" "^7.8.4"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user