feat(hp priors): Study comparison hanging protocol (#3579)

This commit is contained in:
Bill Wallace authored and GitHub committed 2023-08-16 10:15:12 -04:00
1 parent ecbe7c56e0
commit 53c16b928f
13 files changed
+337 -45

No files matched your search

@@ -1,4 +1,5 @@
import hpMNGrid from './hpMNGrid';
import hpMNCompare from './hpCompare';
const defaultProtocol = {
id: 'default',
@@ -6,7 +7,6 @@ const defaultProtocol = {
// Don't store this hanging protocol as it applies to the currently active
// display set by default
// cacheId: null,
hasUpdatedPriorsInformation: false,
name: 'Default',
createdDate: '2021-02-23T19:22:08.894Z',
modifiedDate: '2023-04-01',
@@ -108,6 +108,11 @@ function getHangingProtocolModule() {
name: hpMNGrid.id,
protocol: hpMNGrid,
},
// Create a MxN comparison hanging protocol available by default
{
name: hpMNCompare.id,
protocol: hpMNCompare,
},
];
}
+193
View File
@@ -0,0 +1,193 @@
import { Types } from '@ohif/core';
const defaultDisplaySetSelector = {
studyMatchingRules: [
{
// The priorInstance is a study counter that indicates what position this study is in
// and the value comes from the options parameter.
attribute: 'studyInstanceUIDsIndex',
from: 'options',
required: true,
constraint: {
equals: { value: 0 },
},
},
],
seriesMatchingRules: [
{
attribute: 'numImageFrames',
constraint: {
greaterThan: { value: 0 },
},
},
// This display set will select the specified items by preference
// It has no affect if nothing is specified in the URL.
{
attribute: 'isDisplaySetFromUrl',
weight: 10,
constraint: {
equals: true,
},
},
],
};
const priorDisplaySetSelector = {
studyMatchingRules: [
{
// The priorInstance is a study counter that indicates what position this study is in
// and the value comes from the options parameter.
attribute: 'studyInstanceUIDsIndex',
from: 'options',
required: true,
constraint: {
equals: { value: 1 },
},
},
],
seriesMatchingRules: [
{
attribute: 'numImageFrames',
constraint: {
greaterThan: { value: 0 },
},
},
// This display set will select the specified items by preference
// It has no affect if nothing is specified in the URL.
{
attribute: 'isDisplaySetFromUrl',
weight: 10,
constraint: {
equals: true,
},
},
],
};
const currentDisplaySet = {
id: 'defaultDisplaySetId',
};
const priorDisplaySet = {
id: 'priorDisplaySetId',
};
const currentViewport0 = {
viewportOptions: {
toolGroupId: 'default',
allowUnmatchedView: true,
},
displaySets: [currentDisplaySet],
};
const currentViewport1 = {
...currentViewport0,
displaySets: [
{
...currentDisplaySet,
matchedDisplaySetsIndex: 1,
},
],
};
const priorViewport0 = {
...currentViewport0,
displaySets: [priorDisplaySet],
};
const priorViewport1 = {
...priorViewport0,
displaySets: [
{
...priorDisplaySet,
matchedDisplaySetsIndex: 1,
},
],
};
/**
* This hanging protocol can be activated on the primary mode by directly
* referencing it in a URL or by directly including it within a mode, e.g.:
* `&hangingProtocolId=@ohif/mnGrid` added to the viewer URL
* It is not included in the viewer mode by default.
*/
const hpMNCompare: Types.HangingProtocol.Protocol = {
id: '@ohif/hpCompare',
description: 'Compare two studies in various layouts',
name: 'Compare Two Studies',
numberOfPriorsReferenced: 1,
protocolMatchingRules: [
{
id: 'Two Studies',
weight: 1000,
attribute: 'StudyInstanceUID',
// The 'from' attribute says where to get the 'attribute' value from. In this case
// prior means the second study in the study list.
from: 'prior',
required: true,
constraint: {
notNull: true,
},
},
],
toolGroupIds: ['default'],
displaySetSelectors: {
defaultDisplaySetId: defaultDisplaySetSelector,
priorDisplaySetId: priorDisplaySetSelector,
},
defaultViewport: {
viewportOptions: {
viewportType: 'stack',
toolGroupId: 'default',
allowUnmatchedView: true,
},
displaySets: [
{
id: 'defaultDisplaySetId',
matchedDisplaySetsIndex: -1,
},
],
},
stages: [
{
name: '2x2',
stageActivation: {
enabled: {
minViewportsMatched: 4,
},
},
viewportStructure: {
layoutType: 'grid',
properties: {
rows: 2,
columns: 2,
},
},
viewports: [
currentViewport0,
priorViewport0,
currentViewport1,
priorViewport1,
],
},
{
name: '2x1',
stageActivation: {
enabled: {
minViewportsMatched: 2,
},
},
viewportStructure: {
layoutType: 'grid',
properties: {
rows: 1,
columns: 2,
},
},
viewports: [currentViewport0, priorViewport0],
},
],
};
export default hpMNCompare;
-1
View File
@@ -7,7 +7,6 @@ import { Types } from '@ohif/core';
* It is not included in the viewer mode by default.
*/
const hpMN: Types.HangingProtocol.Protocol = {
hasUpdatedPriorsInformation: false,
id: '@ohif/mnGrid',
description: 'Has various hanging protocol grid layouts',
name: '2x2',