Adding Metadata classes to Lesion Tracker and Hanging Protocols to both viewers
This commit is contained in:
parent
b5166088a3
commit
3def03e7d0
@ -4,6 +4,7 @@ import { _ } from 'meteor/underscore';
|
|||||||
// OHIF Modules
|
// OHIF Modules
|
||||||
import { OHIF } from 'meteor/ohif:core';
|
import { OHIF } from 'meteor/ohif:core';
|
||||||
import 'meteor/ohif:viewerbase';
|
import 'meteor/ohif:viewerbase';
|
||||||
|
import 'meteor/ohif:metadata';
|
||||||
|
|
||||||
// Define a global variable that will be used to refer to the Protocol Engine
|
// Define a global variable that will be used to refer to the Protocol Engine
|
||||||
// It must be populated by HP.setEngine when the Viewer is initialized and a ProtocolEngine
|
// It must be populated by HP.setEngine when the Viewer is initialized and a ProtocolEngine
|
||||||
@ -422,9 +423,8 @@ HP.ProtocolEngine = class ProtocolEngine {
|
|||||||
// TODO: Add relative Date / time
|
// TODO: Add relative Date / time
|
||||||
});
|
});
|
||||||
|
|
||||||
var lastStudyIndex = this.studies.length - 1;
|
this.studies.forEach(study => {
|
||||||
this.studies.forEach(function(study) {
|
const studyMatchDetails = HP.match(study, studyMatchingRules);
|
||||||
var studyMatchDetails = HP.match(study, studyMatchingRules);
|
|
||||||
if ((studyMatchingRules.length && !studyMatchDetails.score) ||
|
if ((studyMatchingRules.length && !studyMatchDetails.score) ||
|
||||||
studyMatchDetails.score < highestStudyMatchingScore) {
|
studyMatchDetails.score < highestStudyMatchingScore) {
|
||||||
return;
|
return;
|
||||||
@ -441,7 +441,7 @@ HP.ProtocolEngine = class ProtocolEngine {
|
|||||||
|
|
||||||
highestSeriesMatchingScore = seriesMatchDetails.score;
|
highestSeriesMatchingScore = seriesMatchDetails.score;
|
||||||
|
|
||||||
series.instances.forEach(function(instance, index) {
|
series.instances.forEach((instance, index) => {
|
||||||
// This tests to make sure there is actually image data in this instance
|
// This tests to make sure there is actually image data in this instance
|
||||||
// TODO: Change this when we add PDF and MPEG support
|
// TODO: Change this when we add PDF and MPEG support
|
||||||
// See https://ohiforg.atlassian.net/browse/LT-227
|
// See https://ohiforg.atlassian.net/browse/LT-227
|
||||||
@ -449,9 +449,9 @@ HP.ProtocolEngine = class ProtocolEngine {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var instanceMatchDetails = HP.match(instance, instanceMatchingRules);
|
const instanceMatchDetails = HP.match(instance, instanceMatchingRules);
|
||||||
|
|
||||||
var matchDetails = {
|
const matchDetails = {
|
||||||
passed: [],
|
passed: [],
|
||||||
failed: []
|
failed: []
|
||||||
};
|
};
|
||||||
@ -464,9 +464,9 @@ HP.ProtocolEngine = class ProtocolEngine {
|
|||||||
matchDetails.failed = matchDetails.failed.concat(seriesMatchDetails.details.failed);
|
matchDetails.failed = matchDetails.failed.concat(seriesMatchDetails.details.failed);
|
||||||
matchDetails.failed = matchDetails.failed.concat(studyMatchDetails.details.failed);
|
matchDetails.failed = matchDetails.failed.concat(studyMatchDetails.details.failed);
|
||||||
|
|
||||||
var totalMatchScore = instanceMatchDetails.score + seriesMatchDetails.score + studyMatchDetails.score;
|
const totalMatchScore = instanceMatchDetails.score + seriesMatchDetails.score + studyMatchDetails.score;
|
||||||
|
|
||||||
var imageDetails = {
|
const imageDetails = {
|
||||||
studyInstanceUid: study.studyInstanceUid,
|
studyInstanceUid: study.studyInstanceUid,
|
||||||
seriesInstanceUid: series.seriesInstanceUid,
|
seriesInstanceUid: series.seriesInstanceUid,
|
||||||
sopInstanceUid: instance.sopInstanceUid,
|
sopInstanceUid: instance.sopInstanceUid,
|
||||||
@ -481,16 +481,19 @@ HP.ProtocolEngine = class ProtocolEngine {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Find the displaySet
|
// Filter imageSet function: filter by InstanceUid
|
||||||
const filter = {
|
const filterImageSetFn = (imageSet, sopInstanceUid) => {
|
||||||
sopInstanceUid: instance.sopInstanceUid
|
return imageSet.getData().sopInstanceUid === instance.sopInstanceUid;
|
||||||
};
|
};
|
||||||
const displaySet = _.filter(study.displaySets, ds => _.findWhere(ds.images, filter))[0];
|
|
||||||
|
// Find the displaySet
|
||||||
|
const displaySet = study.displaySets.find(ds => ds.images.filter(imageSet => filterImageSetFn));
|
||||||
|
|
||||||
// If the instance was found, set the displaySet ID
|
// If the instance was found, set the displaySet ID
|
||||||
if (displaySet) {
|
if (displaySet) {
|
||||||
|
const instanceMetadata = new OHIF.metadata.InstanceMetadata(instance);
|
||||||
imageDetails.displaySetInstanceUid = displaySet.displaySetInstanceUid;
|
imageDetails.displaySetInstanceUid = displaySet.displaySetInstanceUid;
|
||||||
imageDetails.imageId = OHIF.viewerbase.getImageId(instance);
|
imageDetails.imageId = OHIF.viewerbase.getImageId(instanceMetadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((totalMatchScore > highestImageMatchingScore) || !bestMatch) {
|
if ((totalMatchScore > highestImageMatchingScore) || !bestMatch) {
|
||||||
|
|||||||
@ -19,6 +19,7 @@ Package.onUse(function(api) {
|
|||||||
api.use('validatejs');
|
api.use('validatejs');
|
||||||
|
|
||||||
// Our custom packages
|
// Our custom packages
|
||||||
|
api.use('ohif:metadata');
|
||||||
api.use('ohif:viewerbase');
|
api.use('ohif:viewerbase');
|
||||||
|
|
||||||
api.addAssets('assets/dots.svg', 'client');
|
api.addAssets('assets/dots.svg', 'client');
|
||||||
|
|||||||
@ -38,7 +38,7 @@ Template.viewerMain.onRendered(() => {
|
|||||||
|
|
||||||
OHIF.viewerbase.layoutManager = new LayoutManager(parentElement, studies);
|
OHIF.viewerbase.layoutManager = new LayoutManager(parentElement, studies);
|
||||||
|
|
||||||
OHIF.viewerbase.layoutManager.updateViewports();
|
// OHIF.viewerbase.layoutManager.updateViewports();
|
||||||
// Default actions for Associated Studies
|
// Default actions for Associated Studies
|
||||||
if(currentTimepointId) {
|
if(currentTimepointId) {
|
||||||
// Follow-up studies: same as the first measurement in the table
|
// Follow-up studies: same as the first measurement in the table
|
||||||
@ -98,8 +98,8 @@ Template.viewerMain.onRendered(() => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ProtocolEngine = new HP.ProtocolEngine(OHIF.viewerbase.layoutManager, studies);
|
ProtocolEngine = new HP.ProtocolEngine(OHIF.viewerbase.layoutManager, studies);
|
||||||
// HP.setEngine(ProtocolEngine);
|
HP.setEngine(ProtocolEngine);
|
||||||
|
|
||||||
// Enable hotkeys
|
// Enable hotkeys
|
||||||
hotkeyUtils.enableHotkeys();
|
hotkeyUtils.enableHotkeys();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user