fix(viewport): Initial blank image on SR/SEG initial display (#3304)

* fix: Blank display area on initial DICOM SR load

* Docs

* Fix a NPE
This commit is contained in:
Bill Wallace 2023-04-05 17:26:51 -04:00 committed by GitHub
parent 45a34ae0fe
commit d3da969d23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 97 additions and 17 deletions

View File

@ -0,0 +1,78 @@
import { Types } from '@ohif/core';
const srProtocol: Types.HangingProtocol.Protocol = {
id: '@ohif/sr',
// Don't store this hanging protocol as it applies to the currently active
// display set by default
// cacheId: null,
hasUpdatedPriorsInformation: false,
name: 'SR Key Images',
// Just apply this one when specifically listed
protocolMatchingRules: [],
toolGroupIds: ['default'],
// -1 would be used to indicate active only, whereas other values are
// the number of required priors referenced - so 0 means active with
// 0 or more priors.
numberOfPriorsReferenced: 0,
// Default viewport is used to define the viewport when
// additional viewports are added using the layout tool
defaultViewport: {
viewportOptions: {
viewportType: 'stack',
toolGroupId: 'default',
allowUnmatchedView: true,
},
displaySets: [
{
id: 'srDisplaySetId',
matchedDisplaySetsIndex: -1,
},
],
},
displaySetSelectors: {
srDisplaySetId: {
seriesMatchingRules: [
{
attribute: 'Modality',
constraint: {
equals: 'SR',
},
},
],
},
},
stages: [
{
name: 'SR Key Images',
viewportStructure: {
layoutType: 'grid',
properties: {
rows: 1,
columns: 1,
},
},
viewports: [
{
viewportOptions: { allowUnmatchedView: true },
displaySets: [
{
id: 'srDisplaySetId',
},
],
},
],
},
],
};
function getHangingProtocolModule() {
return [
{
name: srProtocol.id,
protocol: srProtocol,
},
];
}
export default getHangingProtocolModule;
export { srProtocol };

View File

@ -1,8 +1,11 @@
import React from 'react';
import getSopClassHandlerModule from './getSopClassHandlerModule';
import getHangingProtocolModule, {
srProtocol,
} from './getHangingProtocolModule';
import onModeEnter from './onModeEnter';
import commandsModule from './commandsModule';
import init from './init';
import getCommandsModule from './commandsModule';
import preRegistration from './init';
import { id } from './id.js';
import toolNames from './tools/toolNames';
import hydrateStructuredReport from './utils/hydrateStructuredReport';
@ -31,9 +34,7 @@ const dicomSRExtension = {
id,
onModeEnter,
preRegistration({ servicesManager, configuration = {} }) {
init({ servicesManager, configuration });
},
preRegistration,
/**
*
@ -54,14 +55,11 @@ const dicomSRExtension = {
return [{ name: 'dicom-sr', component: ExtendedOHIFCornerstoneSRViewport }];
},
getCommandsModule({ servicesManager, commandsManager, extensionManager }) {
return commandsModule({
servicesManager,
commandsManager,
extensionManager,
});
},
getCommandsModule,
getSopClassHandlerModule,
getHangingProtocolModule,
// Include dynmically computed values such as toolNames not known till instantiation
getUtilityModule({ servicesManager }) {
return [
{
@ -75,4 +73,6 @@ const dicomSRExtension = {
};
export default dicomSRExtension;
export { hydrateStructuredReport };
// Put static exports here so they can be type checked
export { hydrateStructuredReport, srProtocol };

View File

@ -390,8 +390,9 @@ const OHIFCornerstoneViewport = React.memo(props => {
initialImageIndex
);
storePresentation();
// The presentation state will have been stored previously by closing
// a viewport. Otherwise, this viewport will be unchanged and the
// presentation information will be directly carried over.
const {
lutPresentationStore,
positionPresentationStore,

View File

@ -200,11 +200,12 @@ function ViewerViewportGrid(props) {
}
updatedViewports.forEach(vp => {
vp.viewportOptions ||= {};
const { orientation, viewportType } = vp.viewportOptions;
let initialImageOptions;
// For initial imageIndex to hang be careful for the volume viewport
if (viewportType === 'stack') {
if (viewportType === 'stack' || !viewportType) {
initialImageOptions = {
index: imageIndex,
};
@ -227,7 +228,7 @@ function ViewerViewportGrid(props) {
}
}
vp.viewportOptions['initialImageOptions'] = initialImageOptions;
vp.viewportOptions.initialImageOptions = initialImageOptions;
});
viewportGridService.setDisplaySetsForViewports(updatedViewports);