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 authored and Eloízio Salgado committed 2017-03-02 10:18:11 -03:00
1 parent e1cc8adbad
commit 2a6cb42228
5 files changed
+51 -10

No files matched your search

@@ -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
@@ -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(() => {
@@ -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