Bug Fix: Default timpoint protocol for LT not being applied + Lesions not being correctly selected on jumpToRowItem function.

This commit is contained in:
Emanuel F. Oliveira 2017-02-23 13:23:17 -03:00 committed by Eloízio Salgado
parent e1cc8adbad
commit 2a6cb42228
5 changed files with 51 additions and 10 deletions

View File

@ -11,7 +11,6 @@ import 'meteor/ohif:viewerbase';
import 'meteor/ohif:metadata';
Meteor.startup(() => {
Session.set('ViewerMainReady', false);
Session.set('TimepointsReady', false);
Session.set('MeasurementsReady', false);
@ -24,10 +23,13 @@ Meteor.startup(() => {
// Metadata configuration
const metadataProvider = OHIF.viewer.metadataProvider;
cornerstoneTools.metaData.addProvider(metadataProvider.provider.bind(metadataProvider));
cornerstoneTools.metaData.addProvider(metadataProvider.getProvider());
});
Template.viewer.onCreated(() => {
Session.set('ViewerReady', false);
const toolManager = OHIF.viewerbase.toolManager;
ViewerData = window.ViewerData || ViewerData;
@ -162,7 +164,7 @@ Template.viewer.onCreated(() => {
instance.autorun(() => {
if (!Session.get('TimepointsReady') ||
!Session.get('MeasurementsReady') ||
!Session.get('ViewerMainReady') ||
!Session.get('ViewerReady') ||
firstMeasurementActivated) {
return;
}
@ -314,6 +316,8 @@ const initHangingProtocol = () => {
// Sets up Hanging Protocol engine
HP.setEngine(ProtocolEngine);
Session.set('ViewerReady', true);
});
};

View File

@ -37,6 +37,8 @@ const initHangingProtocol = () => {
// Sets up Hanging Protocol engine
HP.setEngine(ProtocolEngine);
Session.set('ViewerReady', true);
});
};
@ -77,6 +79,9 @@ Meteor.startup(() => {
Template.viewer.onCreated(() => {
Session.set('ViewerReady', false);
const instance = Template.instance();
instance.data.state = new ReactiveDict();

View File

@ -1,9 +1,27 @@
import { parsingUtils } from '../parsingUtils';
const FUNCTION = 'function';
export class MetadataProvider {
constructor() {
this.metadataLookup = new Map();
// Define the main "metadataLookup" private property as an immutable property.
Object.defineProperty(this, 'metadataLookup', {
configurable: false,
enumerable: false,
writable: false,
value: new Map()
});
// Local reference to provider function bound to current instance.
Object.defineProperty(this, '_provider', {
configurable: false,
enumerable: false,
writable: true,
value: null
});
}
/**
@ -244,6 +262,18 @@ export class MetadataProvider {
return imageInfo;
}
/**
* Get a bound reference to the privider function.
*/
getProvider() {
let provider = this._provider;
if (typeof this._provider !== FUNCTION) {
provider = this.provider.bind(this);
this._provider = provider;
}
return provider;
}
/**
* Looks up metadata for Cornerstone Tools given a specified type and imageId
* A type may be, e.g. 'study', or 'patient', or 'imagePlane'. These types

View File

@ -2,6 +2,8 @@ import { Meteor } from 'meteor/meteor';
import { Template } from 'meteor/templating';
import { Viewerbase } from 'meteor/ohif:viewerbase';
const { InstanceMetadata, StudySummary } = Viewerbase.metadata;
// TODO: [LT-refactor] move this to ohif:hanging-protocols package
/**
* Get a timepoint type for a given study metadata
@ -9,18 +11,18 @@ import { Viewerbase } from 'meteor/ohif:viewerbase';
* @return {String|undefined} Timepoint type if found or undefined if not found or any error/missing information
*/
const getTimepointType = study => {
const timepointApi = Template.instance().timepointApi;
const timepointApi = OHIF.viewer.timepointApi;
if (!timepointApi || !(study instanceof Viewerbase.metadata.StudyMetadata)) {
if (!timepointApi || !(study instanceof InstanceMetadata || study instanceof StudySummary) ) {
return;
}
const timepoint = timepointApi.study(study.getStudyInstanceUID())[0];
if (!timepoint) {
const timepoint = timepointApi.study(study.getStudyInstanceUID());
if (!timepoint || !(timepoint instanceof Array) || timepoint.length < 1) {
return;
}
return timepoint.timepointType;
return timepoint[0].timepointType;
};
Meteor.startup(() => {

View File

@ -90,7 +90,7 @@ OHIF.measurements.jumpToRowItem = (rowItem, timepoints) => {
// Retrieve the list of available viewports
const $viewports = $('.imageViewerViewport');
const numViewports = Math.max($viewports.length, 1);
const numViewports = Math.max($viewports.length, 0);
/*
Two Timepoints, Two measurements, load Followup (FU and BA), display FU in left and BA in right