Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat mammo hanging protocol #4445

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions extensions/cornerstone/src/getHangingProtocolModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { only3D } from './hps/only3D';
import { primary3D } from './hps/primary3D';
import { primaryAxial } from './hps/primaryAxial';
import { frameView } from './hps/frameView';
import { mgCC, mgMLO } from './hps/mammo';

function getHangingProtocolModule() {
return [
Expand Down Expand Up @@ -41,6 +42,14 @@ function getHangingProtocolModule() {
name: frameView.id,
protocol: frameView,
},
{
name: mgCC.id,
protocol: mgCC,
},
{
name: mgMLO.id,
protocol: mgMLO,
},
];
}

Expand Down
57 changes: 57 additions & 0 deletions extensions/cornerstone/src/hps/mammo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
export const mgCC = {
id: 'mgCC',
name: 'mammo-cc',
imageLoadStrategy: 'interleaveTopToBottom',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leave the image load strategy out now - it is better handled with the progressive loading.

protocolMatchingRules: [
{ attribute: 'ModalitiesInStudy', constraint: { contains: ['MG', 'DX'] } },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, this probably needs a better rule so it doesn't trigger too often. We really need to add a way to have a constraint X and constraint Y or X2 and Y2. DX is probably too aggressive by itself

],
displaySetSelectors: {
isRCC: {
seriesMatchingRules: [
{ weight: 1, attribute: 'isRCC', constraint: { equals: { value: true } } },
],
},
isLCC: {
seriesMatchingRules: [
{ weight: 1, attribute: 'isLCC', constraint: { equals: { value: true } } },
],
},
},
stages: [
{
name: 'default',
viewportStructure: { layoutType: 'grid', properties: { rows: 1, columns: 2 } },
viewports: [{ displaySets: [{ id: 'isRCC' }] }, { displaySets: [{ id: 'isLCC' }] }],
},
],
numberOfPriorsReferenced: -1,
};

export const mgMLO = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason you aren't using the view code matcher? See mammoDisplaySetSElectors
The code looks like:
const LCCSeriesMatchingRules = [
{
weight: 10,
attribute: 'ViewCode',
constraint: {
contains: 'SCT:399162004',
},
},
{
weight: 5,
attribute: 'PatientOrientation',
constraint: {
contains: 'L',
},
},
{
weight: 20,
attribute: 'SeriesDescription',
constraint: {
contains: 'L CC',
},
},
];

id: 'mgMLO',
name: 'mammo-mlo',
imageLoadStrategy: 'interleaveTopToBottom',
protocolMatchingRules: [
{ attribute: 'ModalitiesInStudy', constraint: { contains: ['MG', 'DX'] } },
],
displaySetSelectors: {
isRMLO: {
seriesMatchingRules: [
{ weight: 1, attribute: 'isRMLO', constraint: { equals: { value: true } } },
],
},
isLMLO: {
seriesMatchingRules: [
{ weight: 1, attribute: 'isLMLO', constraint: { equals: { value: true } } },
],
},
},
stages: [
{
name: 'default',
viewportStructure: { layoutType: 'grid', properties: { rows: 1, columns: 2 } },
viewports: [{ displaySets: [{ id: 'isRMLO' }] }, { displaySets: [{ id: 'isLMLO' }] }],
},
],
numberOfPriorsReferenced: -1,
};
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import * as HangingProtocol from '../../types/HangingProtocol';
import { isDisplaySetFromUrl, sopInstanceLocation } from './custom-attribute/isDisplaySetFromUrl';
import numberOfDisplaySetsWithImages from './custom-attribute/numberOfDisplaySetsWithImages';
import seriesDescriptionsFromDisplaySets from './custom-attribute/seriesDescriptionsFromDisplaySets';
import isMammoPos from './custom-attribute/isMammoPos';
import uuidv4 from '../../utils/uuidv4';

type Protocol = HangingProtocol.Protocol | HangingProtocol.ProtocolGenerator;
Expand Down Expand Up @@ -110,6 +111,22 @@ export default class HangingProtocolService extends PubSubService {
description: 'Number of displays sets with images',
callback: numberOfDisplaySetsWithImages,
},
isRCC: {
name: 'is rcc',
callback: displaySet => isMammoPos(displaySet, 'R', 'CC'),
},
isLCC: {
name: 'is lcc',
callback: displaySet => isMammoPos(displaySet, 'L', 'CC'),
},
isRMLO: {
name: 'is rmlo',
callback: displaySet => isMammoPos(displaySet, 'R', 'MLO'),
},
isLMLO: {
name: 'is lmlo',
callback: displaySet => isMammoPos(displaySet, 'L', 'MLO'),
},
};
listeners = {};
registeredImageLoadStrategies = {};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
export default function isMammoPos(displaySet: any, pos: 'R' | 'L', type: 'CC' | 'MLO') {
const instanceTags = displaySet.instances[0];
const viewCode = instanceTags.ViewCodeSequence?.[0]?.CodeValue;
const laterality =
instanceTags.ImageLaterality ||
instanceTags.Laterality ||
instanceTags.SharedFunctionalGroupsSequence?.[0]?.FrameAnatomySequence?.[0]?.FrameLaterality;

const typeToCodeMap = {
CC: 'R-10242',
MLO: 'R-10226',
};

return laterality === pos && viewCode === typeToCodeMap[type];
}