Instance metadata/metadata providers overhaul (#1481)
* Instance metadata plus metadata provider overhaul. Fix consumption of wado-uri urls fallbacks + datatype agnosticism. WIP DICOMify things. fix various issues with naturalized variable naming migration. Remove metadata provider. Fix consumption of multiframe images and addition of CWIL metadata. Fix strange build issues. Fix CWIL style windowWidth to array from naturalized DICOM. Fix PT, CT, CR and DX issues for cornerstone + DX issues for vtkjs. Move color palette fetching down to the natuaralized JSON level. Remove unused StudyMetadataSummary Remove redundant dicom metadata dictionary. Working local + json routes. Fix SR read. Finished first round of testing + cleaned up debugging etc. * data => metadata for instance naturalizedJSON * Update dcmjs version * Correct github isssues. * Fix erroneously replaced files. * Danny's recommended changes. * Instance metadata plus metadata provider overhaul. Fix consumption of wado-uri urls fallbacks + datatype agnosticism. WIP DICOMify things. fix various issues with naturalized variable naming migration. Remove metadata provider. Fix consumption of multiframe images and addition of CWIL metadata. Fix strange build issues. Fix CWIL style windowWidth to array from naturalized DICOM. Fix PT, CT, CR and DX issues for cornerstone + DX issues for vtkjs. Move color palette fetching down to the natuaralized JSON level. Remove unused StudyMetadataSummary Remove redundant dicom metadata dictionary. Working local + json routes. Fix SR read. Finished first round of testing + cleaned up debugging etc. * data => metadata for instance naturalizedJSON * Update dcmjs version * Correct github isssues. * Fix erroneously replaced files. * Danny's recommended changes. * Update JSON CI * Update casing of import. * Fix jump for SR. * Fix unit tests for measurements service * Fix json CI test. * fix: update yarn lock * Fix local non-encapsulated pdf view * CI updated to new sucess message. Co-authored-by: Danny <danny.ri.brown@gmail.com>
This commit is contained in:
1 parent
8833731ad3
commit
1d85f7a74e
142 files changed
+5322
-8570
No files matched your search
@@ -6,24 +6,19 @@ import { CustomAttributeRetrievalCallbacks } from './customAttributes';
|
||||
/**
|
||||
* Import Constants
|
||||
*/
|
||||
const { StudySummary, InstanceMetadata } = metadata;
|
||||
const { InstanceMetadata } = metadata;
|
||||
|
||||
/**
|
||||
* Match a Metadata instance against rules using Validate.js for validation.
|
||||
* @param {StudySummary|InstanceMetadata} metadataInstance Metadata instance object
|
||||
* @param {InstanceMetadata} metadataInstance Metadata instance object
|
||||
* @param {Array} rules Array of MatchingRules instances (StudyMatchingRule|SeriesMatchingRule|ImageMatchingRule) for the match
|
||||
* @return {Object} Matching Object with score and details (which rule passed or failed)
|
||||
*/
|
||||
const match = (metadataInstance, rules) => {
|
||||
// Make sure the supplied data is valid.
|
||||
if (
|
||||
!(
|
||||
metadataInstance instanceof StudySummary ||
|
||||
metadataInstance instanceof InstanceMetadata
|
||||
)
|
||||
) {
|
||||
if (!(metadataInstance instanceof InstanceMetadata)) {
|
||||
throw new OHIFError(
|
||||
'HPMatcher::match metadataInstance must be an instance of StudySummary or InstanceMetadata'
|
||||
'HPMatcher::match metadataInstance must be an instance of InstanceMetadata'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import { ProtocolStore } from './protocolStore/classes';
|
||||
/**
|
||||
* Import Constants
|
||||
*/
|
||||
const { StudyMetadata, InstanceMetadata, StudySummary } = metadata;
|
||||
const { StudyMetadata, InstanceMetadata } = metadata;
|
||||
|
||||
// Useful constants
|
||||
const ABSTRACT_PRIOR_VALUE = 'abstractPriorValue';
|
||||
@@ -298,10 +298,7 @@ export default class ProtocolEngine {
|
||||
}
|
||||
|
||||
// Invalid data
|
||||
if (
|
||||
!(priorStudy instanceof StudyMetadata) &&
|
||||
!(priorStudy instanceof StudySummary)
|
||||
) {
|
||||
if (!priorStudy instanceof StudyMetadata) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -385,11 +382,9 @@ export default class ProtocolEngine {
|
||||
// This tests to make sure there is actually image data in this instance
|
||||
// TODO: Change this when we add PDF and MPEG support
|
||||
// See https://ohiforg.atlassian.net/browse/LT-227
|
||||
// sopClassUid = x00080016
|
||||
// rows = x00280010
|
||||
if (
|
||||
!isImage(instance.getTagValue('x00080016')) &&
|
||||
!instance.getTagValue('x00280010')
|
||||
!isImage(instance.getTagValue('SOPClassUID')) &&
|
||||
!instance.getTagValue('Rows')
|
||||
) {
|
||||
return;
|
||||
}
|
||||
@@ -436,19 +431,19 @@ export default class ProtocolEngine {
|
||||
const currentSOPInstanceUID = instance.getSOPInstanceUID();
|
||||
|
||||
const imageDetails = {
|
||||
studyInstanceUid: study.getStudyInstanceUID(),
|
||||
seriesInstanceUid: series.getSeriesInstanceUID(),
|
||||
sopInstanceUid: currentSOPInstanceUID,
|
||||
StudyInstanceUID: study.getStudyInstanceUID(),
|
||||
SeriesInstanceUID: series.getSeriesInstanceUID(),
|
||||
SOPInstanceUID: currentSOPInstanceUID,
|
||||
currentImageIdIndex: index,
|
||||
matchingScore: totalMatchScore,
|
||||
matchDetails: matchDetails,
|
||||
sortingInfo: {
|
||||
score: totalMatchScore,
|
||||
study:
|
||||
instance.getTagValue('x00080020') +
|
||||
instance.getTagValue('x00080030'), // StudyDate = x00080020 StudyTime = x00080030
|
||||
series: parseInt(instance.getTagValue('x00200011')), // TODO: change for seriesDateTime SeriesNumber = x00200011
|
||||
instance: parseInt(instance.getTagValue('x00200013')), // TODO: change for acquisitionTime InstanceNumber = x00200013
|
||||
instance.getTagValue('StudyDate') +
|
||||
instance.getTagValue('StudyTime'),
|
||||
series: parseInt(instance.getTagValue('SeriesNumber')), // TODO: change for seriesDateTime
|
||||
instance: parseInt(instance.getTagValue('InstanceNumber')), // TODO: change for acquisitionTime
|
||||
},
|
||||
};
|
||||
|
||||
@@ -461,7 +456,7 @@ export default class ProtocolEngine {
|
||||
|
||||
// If the instance was found, set the displaySet ID
|
||||
if (displaySet) {
|
||||
imageDetails.displaySetInstanceUid = displaySet.getUID();
|
||||
imageDetails.displaySetInstanceUID = displaySet.getUID();
|
||||
imageDetails.imageId = instance.getImageId();
|
||||
}
|
||||
|
||||
@@ -654,25 +649,25 @@ export default class ProtocolEngine {
|
||||
}
|
||||
|
||||
if (currentMatch && currentMatch.imageId) {
|
||||
currentViewportData.studyInstanceUid = currentMatch.studyInstanceUid;
|
||||
currentViewportData.seriesInstanceUid = currentMatch.seriesInstanceUid;
|
||||
currentViewportData.sopInstanceUid = currentMatch.sopInstanceUid;
|
||||
currentViewportData.StudyInstanceUID = currentMatch.StudyInstanceUID;
|
||||
currentViewportData.SeriesInstanceUID = currentMatch.SeriesInstanceUID;
|
||||
currentViewportData.SOPInstanceUID = currentMatch.SOPInstanceUID;
|
||||
currentViewportData.currentImageIdIndex =
|
||||
currentMatch.currentImageIdIndex;
|
||||
currentViewportData.displaySetInstanceUid =
|
||||
currentMatch.displaySetInstanceUid;
|
||||
currentViewportData.displaySetInstanceUID =
|
||||
currentMatch.displaySetInstanceUID;
|
||||
currentViewportData.imageId = currentMatch.imageId;
|
||||
}
|
||||
|
||||
// @TODO Why should we throw an exception when a best match is not found? This was aborting the whole process.
|
||||
// if (!currentViewportData.displaySetInstanceUid) {
|
||||
// if (!currentViewportData.displaySetInstanceUID) {
|
||||
// throw new OHIFError('ProtocolEngine::updateViewports No matching display set found?');
|
||||
// }
|
||||
|
||||
viewportData.push(currentViewportData);
|
||||
});
|
||||
|
||||
this.setLayout(layoutProps.rows, layoutProps.columns);
|
||||
this.setLayout(layoutProps.Rows, layoutProps.Columns);
|
||||
|
||||
if (typeof this.options.setViewportSpecificData !== 'function') {
|
||||
log.error(
|
||||
|
||||
@@ -6,7 +6,7 @@ const EQUALS_REGEXP = /^equals$/;
|
||||
/**
|
||||
* This Class represents a Rule to be evaluated given a set of attributes
|
||||
* Rules have:
|
||||
* - An attribute (e.g. 'seriesDescription')
|
||||
* - An attribute (e.g. 'SeriesDescription')
|
||||
* - A constraint Object, in the form required by Validate.js:
|
||||
*
|
||||
* rule.constraint = {
|
||||
|
||||
@@ -45,9 +45,9 @@ export default class ViewportStructure {
|
||||
// Viewport structure can be updated later when we build more complex display layouts
|
||||
switch (this.type) {
|
||||
case 'grid':
|
||||
// For the typical grid layout, we only need to multiply rows by columns to
|
||||
// For the typical grid layout, we only need to multiply Rows by Columns to
|
||||
// obtain the number of viewports
|
||||
return this.properties.rows * this.properties.columns;
|
||||
return this.properties.Rows * this.properties.Columns;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,8 +9,8 @@ function getDefaultProtocol() {
|
||||
protocol.locked = true;
|
||||
|
||||
const oneByOne = new ViewportStructure('grid', {
|
||||
rows: 1,
|
||||
columns: 1,
|
||||
Rows: 1,
|
||||
Columns: 1,
|
||||
});
|
||||
|
||||
const viewport = new Viewport();
|
||||
|
||||
@@ -14,8 +14,8 @@ function getMRTwoByTwoTest() {
|
||||
proto.locked = true;
|
||||
// Use http://localhost:3000/viewer/1.2.840.113619.2.5.1762583153.215519.978957063.78
|
||||
|
||||
var studyInstanceUid = new ProtocolMatchingRule(
|
||||
'studyInstanceUid',
|
||||
var StudyInstanceUID = new ProtocolMatchingRule(
|
||||
'StudyInstanceUID',
|
||||
{
|
||||
equals: {
|
||||
value: '1.2.840.113619.2.5.1762583153.215519.978957063.78',
|
||||
@@ -24,30 +24,30 @@ function getMRTwoByTwoTest() {
|
||||
true
|
||||
);
|
||||
|
||||
proto.addProtocolMatchingRule(studyInstanceUid);
|
||||
proto.addProtocolMatchingRule(StudyInstanceUID);
|
||||
|
||||
var oneByTwo = new ViewportStructure('grid', {
|
||||
rows: 1,
|
||||
columns: 2,
|
||||
Rows: 1,
|
||||
Columns: 2,
|
||||
});
|
||||
|
||||
// Stage 1
|
||||
var left = new Viewport();
|
||||
var right = new Viewport();
|
||||
|
||||
var firstSeries = new SeriesMatchingRule('seriesNumber', {
|
||||
var firstSeries = new SeriesMatchingRule('SeriesNumber', {
|
||||
equals: {
|
||||
value: 1,
|
||||
},
|
||||
});
|
||||
|
||||
var secondSeries = new SeriesMatchingRule('seriesNumber', {
|
||||
var secondSeries = new SeriesMatchingRule('SeriesNumber', {
|
||||
equals: {
|
||||
value: 2,
|
||||
},
|
||||
});
|
||||
|
||||
var thirdImage = new ImageMatchingRule('instanceNumber', {
|
||||
var thirdImage = new ImageMatchingRule('InstanceNumber', {
|
||||
equals: {
|
||||
value: 3,
|
||||
},
|
||||
@@ -67,19 +67,19 @@ function getMRTwoByTwoTest() {
|
||||
|
||||
// Stage 2
|
||||
var twoByOne = new ViewportStructure('grid', {
|
||||
rows: 2,
|
||||
columns: 1,
|
||||
Rows: 2,
|
||||
Columns: 1,
|
||||
});
|
||||
var left2 = new Viewport();
|
||||
var right2 = new Viewport();
|
||||
|
||||
var fourthSeries = new SeriesMatchingRule('seriesNumber', {
|
||||
var fourthSeries = new SeriesMatchingRule('SeriesNumber', {
|
||||
equals: {
|
||||
value: 4,
|
||||
},
|
||||
});
|
||||
|
||||
var fifthSeries = new SeriesMatchingRule('seriesNumber', {
|
||||
var fifthSeries = new SeriesMatchingRule('SeriesNumber', {
|
||||
equals: {
|
||||
value: 5,
|
||||
},
|
||||
@@ -133,8 +133,8 @@ function getDemoProtocols() {
|
||||
viewportStructure: {
|
||||
type: 'grid',
|
||||
properties: {
|
||||
rows: 1,
|
||||
columns: 2,
|
||||
Rows: 1,
|
||||
Columns: 2,
|
||||
},
|
||||
layoutTemplateName: 'gridLayout',
|
||||
},
|
||||
@@ -195,8 +195,8 @@ function getDemoProtocols() {
|
||||
viewportStructure: {
|
||||
type: 'grid',
|
||||
properties: {
|
||||
rows: 1,
|
||||
columns: 2,
|
||||
Rows: 1,
|
||||
Columns: 2,
|
||||
},
|
||||
layoutTemplateName: 'gridLayout',
|
||||
},
|
||||
@@ -257,8 +257,8 @@ function getDemoProtocols() {
|
||||
viewportStructure: {
|
||||
type: 'grid',
|
||||
properties: {
|
||||
rows: 2,
|
||||
columns: 2,
|
||||
Rows: 2,
|
||||
Columns: 2,
|
||||
},
|
||||
layoutTemplateName: 'gridLayout',
|
||||
},
|
||||
@@ -402,8 +402,8 @@ function getDemoProtocols() {
|
||||
viewportStructure: {
|
||||
type: 'grid',
|
||||
properties: {
|
||||
rows: 1,
|
||||
columns: 2,
|
||||
Rows: 1,
|
||||
Columns: 2,
|
||||
},
|
||||
layoutTemplateName: 'gridLayout',
|
||||
},
|
||||
@@ -464,8 +464,8 @@ function getDemoProtocols() {
|
||||
viewportStructure: {
|
||||
type: 'grid',
|
||||
properties: {
|
||||
rows: 1,
|
||||
columns: 2,
|
||||
Rows: 1,
|
||||
Columns: 2,
|
||||
},
|
||||
layoutTemplateName: 'gridLayout',
|
||||
},
|
||||
@@ -548,8 +548,8 @@ function getDemoProtocols() {
|
||||
viewportStructure: {
|
||||
type: 'grid',
|
||||
properties: {
|
||||
rows: 2,
|
||||
columns: 2,
|
||||
Rows: 2,
|
||||
Columns: 2,
|
||||
},
|
||||
layoutTemplateName: 'gridLayout',
|
||||
},
|
||||
@@ -737,8 +737,8 @@ function getDemoProtocols() {
|
||||
viewportStructure: {
|
||||
type: 'grid',
|
||||
properties: {
|
||||
rows: 1,
|
||||
columns: 1,
|
||||
Rows: 1,
|
||||
Columns: 1,
|
||||
},
|
||||
layoutTemplateName: 'gridLayout',
|
||||
},
|
||||
@@ -770,8 +770,8 @@ function getDemoProtocols() {
|
||||
viewportStructure: {
|
||||
type: 'grid',
|
||||
properties: {
|
||||
rows: 2,
|
||||
columns: 2,
|
||||
Rows: 2,
|
||||
Columns: 2,
|
||||
},
|
||||
layoutTemplateName: 'gridLayout',
|
||||
},
|
||||
@@ -931,8 +931,8 @@ function getDemoProtocols() {
|
||||
viewportStructure: {
|
||||
type: 'grid',
|
||||
properties: {
|
||||
rows: 1,
|
||||
columns: 2,
|
||||
Rows: 1,
|
||||
Columns: 2,
|
||||
},
|
||||
layoutTemplateName: 'gridLayout',
|
||||
},
|
||||
@@ -993,8 +993,8 @@ function getDemoProtocols() {
|
||||
viewportStructure: {
|
||||
type: 'grid',
|
||||
properties: {
|
||||
rows: 1,
|
||||
columns: 2,
|
||||
Rows: 1,
|
||||
Columns: 2,
|
||||
},
|
||||
layoutTemplateName: 'gridLayout',
|
||||
},
|
||||
@@ -1044,8 +1044,8 @@ function getDemoProtocols() {
|
||||
viewportStructure: {
|
||||
type: 'grid',
|
||||
properties: {
|
||||
rows: 1,
|
||||
columns: 2,
|
||||
Rows: 1,
|
||||
Columns: 2,
|
||||
},
|
||||
layoutTemplateName: 'gridLayout',
|
||||
},
|
||||
@@ -1127,8 +1127,8 @@ function getDemoProtocols() {
|
||||
viewportStructure: {
|
||||
type: 'grid',
|
||||
properties: {
|
||||
rows: 1,
|
||||
columns: 2,
|
||||
Rows: 1,
|
||||
Columns: 2,
|
||||
},
|
||||
layoutTemplateName: 'gridLayout',
|
||||
},
|
||||
@@ -1190,8 +1190,8 @@ function getDemoProtocols() {
|
||||
viewportStructure: {
|
||||
type: 'grid',
|
||||
properties: {
|
||||
rows: 1,
|
||||
columns: 2,
|
||||
Rows: 1,
|
||||
Columns: 2,
|
||||
},
|
||||
layoutTemplateName: 'gridLayout',
|
||||
},
|
||||
@@ -1275,8 +1275,8 @@ function getDemoProtocols() {
|
||||
viewportStructure: {
|
||||
type: 'grid',
|
||||
properties: {
|
||||
rows: 2,
|
||||
columns: 2,
|
||||
Rows: 2,
|
||||
Columns: 2,
|
||||
},
|
||||
layoutTemplateName: 'gridLayout',
|
||||
},
|
||||
@@ -1386,8 +1386,8 @@ function getDemoProtocols() {
|
||||
viewportStructure: {
|
||||
type: 'grid',
|
||||
properties: {
|
||||
rows: 2,
|
||||
columns: 2,
|
||||
Rows: 2,
|
||||
Columns: 2,
|
||||
},
|
||||
layoutTemplateName: 'gridLayout',
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user