Adapting studyPrefecther to the new Viewer Data structure

This commit is contained in:
Bruno Alves de Faria 2017-03-17 19:24:25 -03:00
parent 69c8aea993
commit 2ea2107e11

View File

@ -1,9 +1,10 @@
import { OHIF } from 'meteor/ohif:core'; import { Meteor } from 'meteor/meteor';
import { Session } from 'meteor/session'; import { Session } from 'meteor/session';
import { StackManager } from '../StackManager.js';
import { OHIFError } from './OHIFError';
import { $ } from 'meteor/jquery'; import { $ } from 'meteor/jquery';
import { _ } from 'meteor/underscore'; import { _ } from 'meteor/underscore';
import { OHIF } from 'meteor/ohif:core';
import { OHIFError } from './OHIFError';
import { StackManager } from '../StackManager.js';
export class StudyPrefetcher { export class StudyPrefetcher {
@ -11,7 +12,7 @@ export class StudyPrefetcher {
this.studies = []; this.studies = [];
this.prefetchDisplaySetsTimeout = 300; this.prefetchDisplaySetsTimeout = 300;
this.lastActiveViewportElement = null; this.lastActiveViewportElement = null;
$(cornerstone).on('CornerstoneImageCacheFull.StudyPrefetcher', _.bind(this.cacheFullHandler, this)); $(cornerstone).on('CornerstoneImageCacheFull.StudyPrefetcher', _.bind(this.cacheFullHandler, this));
} }
@ -84,8 +85,7 @@ export class StudyPrefetcher {
if (this.hasStack(element)) { if (this.hasStack(element)) {
// Check if this is a clip or not // Check if this is a clip or not
const activeViewportIndex = Session.get('activeViewport'); const activeViewportIndex = Session.get('activeViewport');
const contentId = Session.get('activeContentId'); const displaySetInstanceUid = OHIF.viewer.data.loadedSeriesData[activeViewportIndex].displaySetInstanceUid;
const displaySetInstanceUid = ViewerData[contentId].loadedSeriesData[activeViewportIndex].displaySetInstanceUid;
const stack = StackManager.findStack(displaySetInstanceUid); const stack = StackManager.findStack(displaySetInstanceUid);
@ -178,7 +178,7 @@ export class StudyPrefetcher {
getActiveDisplaySet(displaySets, instance) { getActiveDisplaySet(displaySets, instance) {
return _.find(displaySets, displaySet => { return _.find(displaySets, displaySet => {
return _.some(displaySet.images, displaySetImage => { return _.some(displaySet.images, displaySetImage => {
return displaySetImage.sopInstanceUid == instance.sopInstanceUid; return displaySetImage.sopInstanceUid === instance.sopInstanceUid;
}); });
}); });
} }
@ -308,5 +308,5 @@ export class StudyPrefetcher {
OHIF.log.warn('Cache full'); OHIF.log.warn('Cache full');
this.stopPrefetching(); this.stopPrefetching();
} }
}; }