LT-290 Baseline and followup is never opened in 1x2 layout

- Fix a bug by passing the matched protocols with their scores to be used in getBestMatch function
- Set timepointType property in studies array which is passed to the hanging protocol engine by matching their studyInstanceUid with timepoints
- Update lesionTrackerHangingProtocol rules to show baseline and followup properly
This commit is contained in:
Evren Ozkan 2016-11-03 17:46:48 -04:00 committed by Erik Ziegler
parent 5cbf08ea4f
commit c7089416bc
2 changed files with 22 additions and 64 deletions

View File

@ -65,6 +65,22 @@ Template.viewer.onCreated(() => {
instance.data.timepointApi = new OHIF.measurements.TimepointApi(instance.data.currentTimepointId);
const timepointsPromise = instance.data.timepointApi.retrieveTimepoints();
timepointsPromise.then(() => {
const timepoints = instance.data.timepointApi.all();
// Set timepointType in studies to be used in hanging protocol engine
timepoints.forEach(function(timepoint) {
timepoint.studyInstanceUids.forEach(function(studyInstanceUid) {
const study = _.find(instance.data.studies, function (element) {
return element.studyInstanceUid === studyInstanceUid;
});
if (!study) {
return;
}
study.timepointType = timepoint.timepointType;
});
});
Session.set('TimepointsReady', true);
});

View File

@ -1,18 +1,11 @@
//------------------------------------------------------------------------------
// Define Baseline protocol
var proto = new HP.Protocol('LT_Baseline');
proto.locked = true;
var studyDescription = new HP.ProtocolMatchingRule();
studyDescription.required = true;
studyDescription.attribute = 'studyDescription';
studyDescription.constraint = {
contains: {
value: 'CT'
}
};
var isBaseline = new HP.ProtocolMatchingRule();
isBaseline.required = true;
isBaseline.weight = 1;
isBaseline.attribute = 'timepointType';
isBaseline.constraint = {
equals: {
@ -20,7 +13,6 @@ isBaseline.constraint = {
}
};
proto.addProtocolMatchingRule(studyDescription);
proto.addProtocolMatchingRule(isBaseline);
var oneByOne = new HP.ViewportStructure('grid', {
@ -40,26 +32,7 @@ baseline.constraint = {
}
};
var body = new HP.SeriesMatchingRule();
body.attribute = 'seriesDescription';
body.weight = 5;
body.constraint = {
contains: {
value: 'Body'
}
};
var chest = new HP.SeriesMatchingRule();
chest.attribute = 'seriesDescription';
chest.constraint = {
contains: {
value: 'CHEST'
}
};
single.studyMatchingRules.push(baseline);
single.seriesMatchingRules.push(body);
single.seriesMatchingRules.push(chest);
var first = new HP.Stage(oneByOne, 'oneByOne');
first.viewports.push(single);
@ -69,22 +42,14 @@ proto.addStage(first);
HP.lesionTrackerBaselineProtocol = proto;
HP.lesionTrackerBaselineProtocol.id = 'lesionTrackerBaselineProtocol';
//------------------------------------------------------------------------------
// Define Followup Protocol
var proto = new HP.Protocol('LT_BaselineFollowup');
proto.locked = true;
var studyDescription = new HP.ProtocolMatchingRule();
studyDescription.required = true;
studyDescription.attribute = 'studyDescription';
studyDescription.constraint = {
contains: {
value: 'CT'
}
};
var isFollowup = new HP.ProtocolMatchingRule();
isFollowup.required = true;
isFollowup.weight = 2;
isFollowup.attribute = 'timepointType';
isFollowup.constraint = {
equals: {
@ -92,7 +57,6 @@ isFollowup.constraint = {
}
};
proto.addProtocolMatchingRule(studyDescription);
proto.addProtocolMatchingRule(isFollowup);
var oneByTwo = new HP.ViewportStructure('grid', {
@ -122,30 +86,8 @@ followup.constraint = {
}
};
var body = new HP.SeriesMatchingRule();
body.attribute = 'seriesDescription';
body.weight = 5;
body.constraint = {
contains: {
value: 'Body'
}
};
var chest = new HP.SeriesMatchingRule();
chest.attribute = 'seriesDescription';
chest.constraint = {
contains: {
value: 'CHEST'
}
};
left.studyMatchingRules.push(baseline);
//left.seriesMatchingRules.push(body);
//left.seriesMatchingRules.push(chest);
right.studyMatchingRules.push(followup);
//right.seriesMatchingRules.push(body);
//right.seriesMatchingRules.push(chest);
left.studyMatchingRules.push(followup);
right.studyMatchingRules.push(baseline);
var first = new HP.Stage(oneByTwo, 'oneByTwo');
first.viewports.push(left);