Skip to content

IDC-1215: CCC uni/bidirectional annotations to Cornerstone tool state #81

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

Merged
merged 7 commits into from
Apr 22, 2021
Merged
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
2 changes: 1 addition & 1 deletion extensions/cornerstone/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"cornerstone-math": "^0.1.8",
"cornerstone-tools": "^4.20.1",
"cornerstone-wado-image-loader": "^3.1.0",
"dcmjs": "0.18.4",
"dcmjs": "0.18.6",
"dicom-parser": "^1.8.3",
"hammerjs": "^2.0.8",
"prop-types": "^15.6.2",
Expand Down
2 changes: 1 addition & 1 deletion extensions/dicom-html/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
},
"peerDependencies": {
"@ohif/core": "^0.50.0",
"dcmjs": "0.18.5",
"dcmjs": "0.18.6",
"prop-types": "^15.6.2",
"react": "^16.8.6",
"react-dom": "^16.8.6"
Expand Down
2 changes: 1 addition & 1 deletion extensions/dicom-rt/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"@ohif/core": "^0.50.0",
"cornerstone-core": "^2.2.8",
"cornerstone-tools": "^4.20.1",
"dcmjs": "0.18.5",
"dcmjs": "0.18.6",
"gl-matrix": "^3.3.0",
"prop-types": "^15.6.2",
"react": "^16.8.6",
Expand Down
2 changes: 1 addition & 1 deletion extensions/dicom-segmentation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"@ohif/core": "^0.50.0",
"cornerstone-core": "^2.2.8",
"cornerstone-tools": "^4.20.1",
"dcmjs": "0.18.5",
"dcmjs": "0.18.6",
"prop-types": "^15.6.2",
"react": "^16.8.6",
"react-dom": "^16.8.6"
Expand Down
2 changes: 1 addition & 1 deletion extensions/dicom-tag-browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
},
"peerDependencies": {
"@ohif/core": "^2.6.0",
"dcmjs": "0.18.5",
"dcmjs": "0.18.6",
"react": "^16.8.6"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion extensions/vtk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"cornerstone-core": "^2.2.8",
"cornerstone-tools": "^4.20.1",
"cornerstone-wado-image-loader": "^3.1.0",
"dcmjs": "0.18.5",
"dcmjs": "0.18.6",
"dicom-parser": "^1.8.3",
"i18next": "^17.0.3",
"i18next-browser-languagedetector": "^3.0.1",
Expand Down
2 changes: 1 addition & 1 deletion platform/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"dependencies": {
"@babel/runtime": "^7.5.5",
"ajv": "^6.10.0",
"dcmjs": "0.18.5",
"dcmjs": "0.18.6",
"dicomweb-client": "^0.6.0",
"immer": "6.0.2",
"isomorphic-base64": "^1.0.2",
Expand Down
73 changes: 72 additions & 1 deletion platform/core/src/DICOMSR/parseDicomStructuredReport.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import dcmjs from 'dcmjs';

import findInstanceMetadataBySopInstanceUID from './utils/findInstanceMetadataBySopInstanceUid';

const toArray = x => (Array.isArray(x) ? x : [x]);

/**
* Function to parse the part10 array buffer that comes from a DICOM Structured report into measurementData
* measurementData format is a viewer specific format to be stored into the redux and consumed by other components
Expand All @@ -21,7 +23,76 @@ const parseDicomStructuredReport = (part10SRArrayBuffer, displaySets) => {

const { MeasurementReport } = dcmjs.adapters.Cornerstone;
const storedMeasurementByToolType = MeasurementReport.generateToolState(
dataset
dataset,
{
/**
* TODO: This custom mapping for CCC uni/bidirectional annotations to
* Cornerstone tool classes is based on very limited matching
* of specific code values e.g. length and long axis.
*
* We need to use smarter matching criteria for
* different types/complex annotations in the long term.
*
* Ongoing discussion/representation here: https://github.com/OHIF/Viewers/issues/1215
*/
getToolClass: (measurementGroup, dataset, toolClasses) => {
const measurementGroupContentSequence = toArray(
measurementGroup.ContentSequence
);

const CrowdsCureCancer = {
identifiers: ['99CCC', 'crowds-cure', 'Crowds Cure Cancer'],
LONG_AXIS: 'G-A185',
SHORT_AXIS: 'G-A186',
FINDING_SITE: 'G-C0E3',
LENGTH: 'G-D7FE',
};

const isCrowdsCureCancer = CrowdsCureCancer.identifiers.some(
identifier => JSON.stringify(dataset).includes(identifier)
);

if (isCrowdsCureCancer) {
const ShortAxisContentItem = measurementGroupContentSequence.find(
contentItem =>
contentItem.ConceptNameCodeSequence.CodeValue ===
CrowdsCureCancer.SHORT_AXIS
);

const LongAxisContentItem = measurementGroupContentSequence.find(
contentItem =>
contentItem.ConceptNameCodeSequence.CodeValue ===
CrowdsCureCancer.LONG_AXIS
);

const LengthContentItem = measurementGroupContentSequence.find(
contentItem =>
contentItem.ConceptNameCodeSequence.CodeValue ===
CrowdsCureCancer.LENGTH
);

if (ShortAxisContentItem && LongAxisContentItem) {
return toolClasses.find(t => t.toolType === 'Bidirectional');
}

if (LengthContentItem) {
return toolClasses.find(t => t.toolType === 'Length');
}
} else {
const TrackingIdentifierGroup = measurementGroupContentSequence.find(
contentItem =>
contentItem.ConceptNameCodeSequence.CodeMeaning ===
TRACKING_IDENTIFIER
);

const TrackingIdentifierValue = TrackingIdentifierGroup.TextValue;

toolClasses.find(tc =>
tc.isValidCornerstoneTrackingIdentifier(TrackingIdentifierValue)
);
}
},
}
);
const measurementData = {};
let measurementNumber = 0;
Expand Down
2 changes: 1 addition & 1 deletion platform/viewer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"cornerstone-math": "^0.1.8",
"cornerstone-tools": "^4.20.1",
"cornerstone-wado-image-loader": "^3.1.0",
"dcmjs": "0.18.5",
"dcmjs": "0.18.6",
"dicom-parser": "^1.8.3",
"dicomweb-client": "^0.4.4",
"hammerjs": "^2.0.8",
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6619,10 +6619,10 @@ dateformat@^3.0.0:
resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-3.0.3.tgz#a6e37499a4d9a9cf85ef5872044d62901c9889ae"
integrity sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q==

[email protected].5:
version "0.18.5"
resolved "https://registry.yarnpkg.com/dcmjs/-/dcmjs-0.18.5.tgz#06edd5562a91fa1e6be3a9fd2fc919e103f44e6f"
integrity sha512-AWGFMwCdQg4C/hJIhnnWS4ieClnWMkVmV9sX29jpLYYMEb7QGBe1t9UsWvgBh1QiXePUh4u+zGFQk27duHB6rw==
[email protected].6:
version "0.18.6"
resolved "https://registry.yarnpkg.com/dcmjs/-/dcmjs-0.18.6.tgz#df2128eebd35c8a0b514eaca3b77dce9ac67ecb5"
integrity sha512-Ecc3NEf5cNrIJq3NIxhP2FuN3Eod3pB6YjiPZQOrYIksPc5T3L8pdhz+6Bpv0puSbEz2IMQ2p8ZVrIuYhoCOBg==
dependencies:
"@babel/polyfill" "^7.8.3"
"@babel/runtime" "^7.8.4"
Expand Down