Fixing metadata issues
This commit is contained in:
parent
a742c8036d
commit
19c31ffbb8
@ -86,8 +86,6 @@ Template.viewer.onCreated(() => {
|
||||
|
||||
instance.data.studies.forEach(study => {
|
||||
study.selected = true;
|
||||
const studyMetadata = new OHIF.metadata.StudyMetadata(study);
|
||||
study.displaySets = OHIF.viewerbase.sortingManager.getDisplaySets(studyMetadata);
|
||||
OHIF.viewer.Studies.insert(study);
|
||||
});
|
||||
|
||||
|
||||
@ -32,7 +32,7 @@ Meteor.startup(() => {
|
||||
};
|
||||
|
||||
OHIF.viewer.stackImagePositionOffsetSynchronizer = new OHIF.viewerbase.StackImagePositionOffsetSynchronizer();
|
||||
|
||||
|
||||
// Create the synchronizer used to update reference lines
|
||||
OHIF.viewer.updateImageSynchronizer = new cornerstoneTools.Synchronizer('CornerstoneNewImage', cornerstoneTools.updateImageSynchronizer);
|
||||
|
||||
@ -77,8 +77,6 @@ Template.viewer.onCreated(() => {
|
||||
ViewerData[contentId].studyInstanceUids = [];
|
||||
instance.data.studies.forEach(study => {
|
||||
study.selected = true;
|
||||
const studyMetadata = new OHIF.metadata.StudyMetadata(study);
|
||||
study.displaySets = OHIF.viewerbase.sortingManager.getDisplaySets(studyMetadata);
|
||||
OHIF.viewer.Studies.insert(study);
|
||||
ViewerData[contentId].studyInstanceUids.push(study.studyInstanceUid);
|
||||
});
|
||||
|
||||
@ -3,7 +3,7 @@ import { parsingUtils } from '../parsingUtils';
|
||||
export class MetadataProvider {
|
||||
|
||||
constructor() {
|
||||
this.metadataLookup = {};
|
||||
this.metadataLookup = new Map();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -58,7 +58,7 @@ export class MetadataProvider {
|
||||
metadata.imagePlane = this.getImagePlane(instanceMetadata);
|
||||
|
||||
// Add the metadata to the imageId lookup object
|
||||
this.metadataLookup[imageId] = metadata;
|
||||
this.metadataLookup.set(imageId, metadata);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -67,7 +67,7 @@ export class MetadataProvider {
|
||||
* @returns image metadata
|
||||
*/
|
||||
getMetadata(imageId) {
|
||||
return this.metadataLookup[imageId];
|
||||
return this.metadataLookup.get(imageId);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -82,7 +82,8 @@ export class MetadataProvider {
|
||||
const metadata = {};
|
||||
metadata[type] = data;
|
||||
|
||||
this.metadataLookup[imageId] = $.extend(this.metadataLookup[imageId], metadata);
|
||||
const oldMetadata = this.metadataLookup.get(imageId);
|
||||
this.metadataLookup.set(imageId, Object.assign(oldMetadata, metadata));
|
||||
}
|
||||
|
||||
getFromDataSet(dataSet, type, tag) {
|
||||
@ -104,7 +105,7 @@ export class MetadataProvider {
|
||||
* @param image
|
||||
*/
|
||||
updateMetadata(image) {
|
||||
const imageMetadata = this.metadataLookup[image.imageId];
|
||||
const imageMetadata = this.metadataLookup.get(image.imageId);
|
||||
if (!imageMetadata) {
|
||||
return;
|
||||
}
|
||||
@ -252,7 +253,7 @@ export class MetadataProvider {
|
||||
* @returns {Object} Relevant metadata of the specified type
|
||||
*/
|
||||
provider(type, imageId) {
|
||||
const imageMetadata = this.metadataLookup[imageId];
|
||||
const imageMetadata = this.metadataLookup.get(imageId);
|
||||
if (!imageMetadata) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -407,9 +407,8 @@ HP.ProtocolEngine = class ProtocolEngine {
|
||||
});
|
||||
|
||||
if (!alreadyLoaded) {
|
||||
getStudyMetadata(priorStudy.studyInstanceUid, study => {
|
||||
OHIF.studylist.retrieveStudyMetadata(priorStudy.studyInstanceUid).then(study => {
|
||||
study.abstractPriorValue = abstractPriorValue;
|
||||
study.displaySets = OHIF.viewerbase.sortingManager.getDisplaySets(study);
|
||||
OHIF.viewer.Studies.insert(study);
|
||||
this.studies.push(study);
|
||||
this.matchImages(viewport);
|
||||
|
||||
@ -29,31 +29,36 @@ class ConformanceCriteria {
|
||||
}
|
||||
|
||||
validate(trialCriteriaType) {
|
||||
const baselineData = this.getData('baseline');
|
||||
const followupData = this.getData('followup');
|
||||
const mergedData = {
|
||||
targets: [],
|
||||
nonTargets: []
|
||||
};
|
||||
return new Promise((resolve, reject) => {
|
||||
const baselinePromise = this.getData('baseline');
|
||||
const followupPromise = this.getData('followup');
|
||||
Promise.all([baselinePromise, followupPromise]).then(values => {
|
||||
const [baselineData, followupData] = values;
|
||||
const mergedData = {
|
||||
targets: [],
|
||||
nonTargets: []
|
||||
};
|
||||
|
||||
mergedData.targets = mergedData.targets.concat(baselineData.targets);
|
||||
mergedData.targets = mergedData.targets.concat(followupData.targets);
|
||||
mergedData.nonTargets = mergedData.nonTargets.concat(baselineData.nonTargets);
|
||||
mergedData.nonTargets = mergedData.nonTargets.concat(followupData.nonTargets);
|
||||
mergedData.targets = mergedData.targets.concat(baselineData.targets);
|
||||
mergedData.targets = mergedData.targets.concat(followupData.targets);
|
||||
mergedData.nonTargets = mergedData.nonTargets.concat(baselineData.nonTargets);
|
||||
mergedData.nonTargets = mergedData.nonTargets.concat(followupData.nonTargets);
|
||||
|
||||
this.maxTargets.set(null);
|
||||
const resultBoth = this.validateTimepoint('both', trialCriteriaType, mergedData);
|
||||
const resultBaseline = this.validateTimepoint('baseline', trialCriteriaType, baselineData);
|
||||
const resultFollowup = this.validateTimepoint('followup', trialCriteriaType, followupData);
|
||||
const nonconformities = resultBaseline.concat(resultFollowup).concat(resultBoth);
|
||||
const groupedNonConformities = this.groupNonConformities(nonconformities);
|
||||
this.maxTargets.set(null);
|
||||
const resultBoth = this.validateTimepoint('both', trialCriteriaType, mergedData);
|
||||
const resultBaseline = this.validateTimepoint('baseline', trialCriteriaType, baselineData);
|
||||
const resultFollowup = this.validateTimepoint('followup', trialCriteriaType, followupData);
|
||||
const nonconformities = resultBaseline.concat(resultFollowup).concat(resultBoth);
|
||||
const groupedNonConformities = this.groupNonConformities(nonconformities);
|
||||
|
||||
// Keep both? Group the data only on viewer/measurementTable views?
|
||||
// Work with not grouped data (worse lookup performance on measurementTableRow)?
|
||||
this.nonconformities.set(nonconformities);
|
||||
this.groupedNonConformities.set(groupedNonConformities);
|
||||
// Keep both? Group the data only on viewer/measurementTable views?
|
||||
// Work with not grouped data (worse lookup performance on measurementTableRow)?
|
||||
this.nonconformities.set(nonconformities);
|
||||
this.groupedNonConformities.set(groupedNonConformities);
|
||||
|
||||
return nonconformities;
|
||||
resolve(nonconformities);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
groupNonConformities(nonconformities) {
|
||||
@ -128,48 +133,47 @@ class ConformanceCriteria {
|
||||
* Build the data that will be used to do the conformance criteria checks
|
||||
*/
|
||||
getData(timepointType) {
|
||||
const data = {
|
||||
targets: [],
|
||||
nonTargets: []
|
||||
};
|
||||
return new Promise((resolve, reject) => {
|
||||
const data = {
|
||||
targets: [],
|
||||
nonTargets: []
|
||||
};
|
||||
|
||||
const fillData = measurementType => {
|
||||
const measurements = this.measurementApi.fetch(measurementType);
|
||||
const studyPromises = [];
|
||||
|
||||
measurements.forEach(measurement => {
|
||||
const { studyInstanceUid, imageId } = measurement;
|
||||
const metadata = this.getImageInstanceMetadata(studyInstanceUid, imageId);
|
||||
const timepointId = measurement.timepointId;
|
||||
const timepoint = timepointId && this.timepointApi.timepoints.findOne({ timepointId });
|
||||
const fillData = measurementType => {
|
||||
const measurements = this.measurementApi.fetch(measurementType);
|
||||
|
||||
if (!timepoint || ((timepointType !== 'both') && (timepoint.timepointType !== timepointType))) {
|
||||
return;
|
||||
}
|
||||
measurements.forEach(measurement => {
|
||||
const { studyInstanceUid, imageId } = measurement;
|
||||
|
||||
data[measurementType].push({
|
||||
measurement,
|
||||
metadata,
|
||||
timepoint
|
||||
const timepointId = measurement.timepointId;
|
||||
const timepoint = timepointId && this.timepointApi.timepoints.findOne({ timepointId });
|
||||
|
||||
if (!timepoint || ((timepointType !== 'both') && (timepoint.timepointType !== timepointType))) {
|
||||
return;
|
||||
}
|
||||
|
||||
const promise = OHIF.studylist.retrieveStudyMetadata(studyInstanceUid);
|
||||
promise.then(study => {
|
||||
const metadata = OHIF.viewer.metadataProvider.getMetadata(imageId);
|
||||
data[measurementType].push({
|
||||
measurement,
|
||||
metadata: metadata.instance,
|
||||
timepoint
|
||||
});
|
||||
});
|
||||
studyPromises.push(promise);
|
||||
});
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
fillData('targets');
|
||||
fillData('nonTargets');
|
||||
fillData('targets');
|
||||
fillData('nonTargets');
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
getImageInstanceMetadata(studyInstanceUid, imageId) {
|
||||
const study = OHIF.viewer.Studies.findBy({ studyInstanceUid });
|
||||
|
||||
// Stop here if the study was not found
|
||||
if (!study) {
|
||||
return;
|
||||
}
|
||||
|
||||
const metadata = OHIF.cornerstone.metadataProvider.getMetadata(imageId);
|
||||
return metadata ? metadata.instance : undefined;
|
||||
Promise.all(studyPromises).then(() => {
|
||||
resolve(data);
|
||||
}).catch(reject);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -21,7 +21,7 @@ function findAndRenderDisplaySet(displaySets, viewportIndex, studyInstanceUid, s
|
||||
currentImageIdIndex: specificImageIndex
|
||||
};
|
||||
|
||||
// Add a renderedCallback to activate the measurements once it's
|
||||
// Add a renderedCallback to activate the measurements once it's
|
||||
if (renderedCallback) {
|
||||
displaySetData.renderedCallback = renderedCallback;
|
||||
}
|
||||
@ -45,20 +45,19 @@ function renderIntoViewport(viewportIndex, studyInstanceUid, seriesInstanceUid,
|
||||
const element = $viewports.get(viewportIndex);
|
||||
const startLoadingHandler = cornerstoneTools.loadHandlerManager.getStartLoadHandler();
|
||||
startLoadingHandler(element);
|
||||
getStudyMetadata(studyInstanceUid, loadedStudy => {
|
||||
loadedStudy.displaySets = createStacks(loadedStudy);
|
||||
OHIF.studylist.retrieveStudyMetadata(studyInstanceUid).then(study => {
|
||||
OHIF.log.warn('renderIntoViewport');
|
||||
|
||||
// Double check to make sure this study wasn't already inserted
|
||||
// into OHIF.viewer.Studies, so we don't cause duplicate entry errors
|
||||
const loaded = OHIF.viewer.Studies.findBy({
|
||||
studyInstanceUid: loadedStudy.studyInstanceUid
|
||||
studyInstanceUid: study.studyInstanceUid
|
||||
});
|
||||
if (!loaded) {
|
||||
OHIF.viewer.Studies.insert(loadedStudy);
|
||||
OHIF.viewer.Studies.insert(study);
|
||||
}
|
||||
|
||||
findAndRenderDisplaySet(loadedStudy.displaySets, viewportIndex, studyInstanceUid, seriesInstanceUid, sopInstanceUid, renderedCallback)
|
||||
findAndRenderDisplaySet(study.displaySets, viewportIndex, studyInstanceUid, seriesInstanceUid, sopInstanceUid, renderedCallback);
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -93,16 +92,16 @@ OHIF.measurements.jumpToRowItem = (rowItem, timepoints) => {
|
||||
const $viewports = $('.imageViewerViewport');
|
||||
const numViewports = Math.max($viewports.length, 1);
|
||||
|
||||
/*
|
||||
/*
|
||||
Two Timepoints, Two measurements, load Followup (FU and BA), display FU in left and BA in right
|
||||
Two Timepoints, One measurement (BA), on 2x1 view: Display BA in right
|
||||
Two Timepoints, One measurement (FU), on 2x1 view: Display FU in left
|
||||
|
||||
Two Timepoints, Two measurements, load Baseline (FU and BA) on 1x1 view: Display whichever is clicked on?
|
||||
Two Timepoints, Two measurements, load Baseline (FU and BA) on 1x1 view: Display whichever is clicked on?
|
||||
One Timepoint, One measurement: Display clicked on in 1x1
|
||||
*/
|
||||
const numViewportsToUpdate = Math.min(numTimepoints, numViewports);
|
||||
|
||||
|
||||
for (var i=0; i < numViewportsToUpdate; i++) {
|
||||
const timepoint = timepoints[i];
|
||||
const timepointId = timepoint.timepointId;
|
||||
@ -123,7 +122,7 @@ OHIF.measurements.jumpToRowItem = (rowItem, timepoints) => {
|
||||
// or maybe just remove the 'error' this throws?
|
||||
let enabledElement;
|
||||
try {
|
||||
enabledElement = cornerstone.getEnabledElement(element)
|
||||
enabledElement = cornerstone.getEnabledElement(element)
|
||||
} catch(error) {
|
||||
OHIF.log.warn(error);
|
||||
}
|
||||
@ -135,7 +134,7 @@ OHIF.measurements.jumpToRowItem = (rowItem, timepoints) => {
|
||||
|
||||
if (series.seriesInstanceUid === measurementData.seriesInstanceUid &&
|
||||
study.studyInstanceUid === measurementData.studyInstanceUid) {
|
||||
|
||||
|
||||
// If it is, activate the measurements in this viewport and stop here
|
||||
activateMeasurements(element, measurementData);
|
||||
continue;
|
||||
|
||||
@ -1,3 +1,8 @@
|
||||
import { Template } from 'meteor/templating';
|
||||
import { ReactiveDict } from 'meteor/reactive-dict';
|
||||
import { _ } from 'meteor/underscore';
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
|
||||
Template.seriesDetailsTable.onCreated(() => {
|
||||
const instance = Template.instance();
|
||||
|
||||
@ -31,8 +36,7 @@ Template.seriesDetailsTable.onRendered(() => {
|
||||
// Get series list for the study
|
||||
_.map(studies, (selectedStudy, index) => {
|
||||
studies[index].seriesList = [];
|
||||
getStudyMetadata(selectedStudy.studyInstanceUid, study => {
|
||||
|
||||
OHIF.studylist.retrieveStudyMetadata(study => {
|
||||
// Set series list
|
||||
studies[index].seriesList = study.seriesList;
|
||||
studies[index].displaySeriesLoadingText = false;
|
||||
@ -48,4 +52,4 @@ Template.seriesDetailsTable.helpers({
|
||||
const instance = Template.instance();
|
||||
return instance.selectedStudies.get('studies');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@ -1,10 +1,9 @@
|
||||
import { $ } from 'meteor/jquery';
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
|
||||
/**
|
||||
* Retrieves metaData for multiple studies at once.
|
||||
*
|
||||
* This function calls getStudyMetadata several times, asynchronously,
|
||||
* This function calls retrieveStudyMetadata several times, asynchronously,
|
||||
* and waits for all of the results to be returned.
|
||||
*
|
||||
* @param studyInstanceUids The UIDs of the Studies to be retrieved
|
||||
@ -27,32 +26,21 @@ OHIF.studylist.getStudiesMetadata = (studyInstanceUids, doneCallback, failCallba
|
||||
|
||||
// Loop through the array of studyInstanceUids
|
||||
studyInstanceUids.forEach(function(studyInstanceUid) {
|
||||
// Create a new Deferred to monitor the progress of the asynchronous
|
||||
// metaData retrieval
|
||||
const deferred = new $.Deferred();
|
||||
|
||||
// Send the call, and attach doneCallbacks and failCallbacks
|
||||
// which can resolve or reject the related promise based on its outcome
|
||||
getStudyMetadata(studyInstanceUid, function(study) {
|
||||
deferred.resolve(study);
|
||||
}, function(error) {
|
||||
deferred.reject(error);
|
||||
});
|
||||
const promise = OHIF.studylist.retrieveStudyMetadata(studyInstanceUid);
|
||||
|
||||
// Add the current promise to the array of promises
|
||||
promises.push(deferred.promise());
|
||||
promises.push(promise);
|
||||
});
|
||||
|
||||
// When all of the promises are complete, this callback runs
|
||||
$.when.apply($, promises).done(function() {
|
||||
// Convert the Arguments Array-like Object to an actual array
|
||||
const studies = $.makeArray(arguments);
|
||||
|
||||
Promise.all(promises).then(studies => {
|
||||
// Pass the studies array to the doneCallback, if one exists
|
||||
if (doneCallback && typeof doneCallback === 'function') {
|
||||
doneCallback(studies);
|
||||
}
|
||||
}).fail(function(error) {
|
||||
}).catch(error => {
|
||||
OHIF.log.warn(error);
|
||||
if (failCallback && typeof failCallback === 'function') {
|
||||
failCallback(error);
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
import 'meteor/ohif:viewerbase';
|
||||
|
||||
// DEPRECATED - use OHIF.studylist.retrieveStudyMetadata instead
|
||||
// Define the StudyMetaData object. This is used as a cache
|
||||
// to store study meta data information to prevent unnecessary
|
||||
// calls to the server
|
||||
|
||||
@ -7,5 +7,6 @@ import './getStudiesMetadata.js';
|
||||
import './importStudies.js';
|
||||
import './openNewTab.js';
|
||||
import './queryStudies.js';
|
||||
import './retrieveStudyMetadata.js';
|
||||
import './studylist.js';
|
||||
import './switchToTab.js';
|
||||
|
||||
@ -5,31 +5,26 @@ import { OHIF } from 'meteor/ohif:core';
|
||||
* @param studiesToQuery Studies to query
|
||||
*/
|
||||
queryStudies = function(studiesToQuery, options) {
|
||||
const studiesQueried = [],
|
||||
numberOfStudiesToQuery = studiesToQuery.length,
|
||||
notify = (options || {}).notify || function() { /* noop */ }
|
||||
let studiesQueried = 0;
|
||||
const numberOfStudiesToQuery = studiesToQuery.length;
|
||||
const notify = (options || {}).notify || function() { /* noop */ };
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
if (studiesToQuery.length < 1) {
|
||||
return reject();
|
||||
}
|
||||
const promises = [];
|
||||
|
||||
studiesToQuery.forEach(function(studyToQuery) {
|
||||
getStudyMetadata(studyToQuery.studyInstanceUid, function(study) {
|
||||
studiesQueried.push(study);
|
||||
|
||||
notify({
|
||||
total: numberOfStudiesToQuery,
|
||||
processed: studiesQueried.length
|
||||
});
|
||||
|
||||
if (studiesQueried.length === numberOfStudiesToQuery) {
|
||||
resolve(studiesQueried);
|
||||
}
|
||||
studiesToQuery.forEach(studyToQuery => {
|
||||
const promise = OHIF.studylist.retrieveStudyMetadata(studyToQuery.studyInstanceUid);
|
||||
promise.then(study => {
|
||||
studiesQueried++;
|
||||
notify({
|
||||
total: numberOfStudiesToQuery,
|
||||
processed: studiesQueried
|
||||
});
|
||||
});
|
||||
promises.push(promise);
|
||||
});
|
||||
}
|
||||
|
||||
return Promise.all(promises);
|
||||
};
|
||||
|
||||
queryStudiesWithProgress = function(studiesToQuery) {
|
||||
return OHIF.ui.showDialog('dialogProgress', {
|
||||
@ -60,7 +55,7 @@ queryStudiesWithProgress = function(studiesToQuery) {
|
||||
* @returns {number}
|
||||
*/
|
||||
getNumberOfFilesInStudy = function(study) {
|
||||
var numberOFFilesToExport = 0;
|
||||
let numberOFFilesToExport = 0;
|
||||
|
||||
study.seriesList.forEach(function(series) {
|
||||
series.instances.forEach(function(instance) {
|
||||
|
||||
85
Packages/ohif-study-list/client/lib/retrieveStudyMetadata.js
Normal file
85
Packages/ohif-study-list/client/lib/retrieveStudyMetadata.js
Normal file
@ -0,0 +1,85 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
import 'meteor/ohif:viewerbase';
|
||||
|
||||
// Define the StudyMetaDataPromises object. This is used as a cache to store study meta data
|
||||
// promises and prevent unnecessary subsequent calls to the server
|
||||
const StudyMetaDataPromises = new Map();
|
||||
|
||||
/**
|
||||
* Retrieves study metadata using a server call
|
||||
*
|
||||
* @param {String} studyInstanceUid The UID of the Study to be retrieved
|
||||
* @returns {Promise} that will be resolved with the metadata or rejected with the error
|
||||
*/
|
||||
OHIF.studylist.retrieveStudyMetadata = studyInstanceUid => {
|
||||
// If the StudyMetaDataPromises cache already has a pending or resolved promise related to the
|
||||
// given studyInstanceUid, then that promise is returned
|
||||
if (StudyMetaDataPromises.has(studyInstanceUid)) {
|
||||
return StudyMetaDataPromises.get(studyInstanceUid);
|
||||
}
|
||||
|
||||
console.time('retrieveStudyMetadata');
|
||||
|
||||
// Create a promise to handle the data retrieval
|
||||
const promise = new Promise((resolve, reject) => {
|
||||
// If no study metadata is in the cache variable, we need to retrieve it from
|
||||
// the server with a call.
|
||||
Meteor.call('GetStudyMetadata', studyInstanceUid, function(error, study) {
|
||||
console.timeEnd('retrieveStudyMetadata');
|
||||
|
||||
if (Meteor.user && Meteor.user()) {
|
||||
HipaaLogger.logEvent({
|
||||
eventType: 'viewed',
|
||||
userId: Meteor.userId(),
|
||||
userName: Meteor.user().profile.fullName,
|
||||
collectionName: 'Study',
|
||||
recordId: studyInstanceUid,
|
||||
patientId: study.patientId,
|
||||
patientName: study.patientName
|
||||
});
|
||||
}
|
||||
|
||||
if (error) {
|
||||
OHIF.log.warn(error);
|
||||
reject(error);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!study) {
|
||||
throw new Meteor.Error('GetStudyMetadata', 'No study data returned from server');
|
||||
}
|
||||
|
||||
// Once the data was retrieved, the series are sorted by series and instance number
|
||||
OHIF.viewerbase.sortStudy(study);
|
||||
|
||||
// Add additional metadata to our study from the studylist
|
||||
const studylistStudy = StudyListStudies.findOne({
|
||||
studyInstanceUid: study.studyInstanceUid
|
||||
});
|
||||
|
||||
if (!studylistStudy) {
|
||||
// return;
|
||||
} else {
|
||||
Object.assign(study, studylistStudy);
|
||||
}
|
||||
|
||||
// Transform the study in a StudyMetadata object
|
||||
const studyMetadata = new OHIF.metadata.StudyMetadata(study);
|
||||
|
||||
// Add the display sets to the study
|
||||
study.displaySets = OHIF.viewerbase.sortingManager.getDisplaySets(studyMetadata);
|
||||
study.displaySets.forEach(displaySet => {
|
||||
OHIF.viewerbase.stackManager.makeAndAddStack(study, displaySet);
|
||||
});
|
||||
|
||||
// Resolve the promise with the final study metadata object
|
||||
resolve(study);
|
||||
});
|
||||
});
|
||||
|
||||
// Store the promise in cache
|
||||
StudyMetaDataPromises.set(studyInstanceUid, promise);
|
||||
|
||||
return promise;
|
||||
};
|
||||
@ -110,13 +110,11 @@ Template.studyTimepointStudy.events({
|
||||
if (!alreadyLoaded) {
|
||||
const $studies = instance.getStudyElement(true);
|
||||
$studies.trigger('loadStarted');
|
||||
getStudyMetadata(studyInstanceUid, study => {
|
||||
const studyMetadata = new OHIF.metadata.StudyMetadata(study);
|
||||
study.displaySets = sortingManager.getDisplaySets(studyMetadata);
|
||||
OHIF.studylist.retrieveStudyMetadata(studyInstanceUid).then(study => {
|
||||
instance.data.study = study;
|
||||
OHIF.viewer.Studies.insert(study);
|
||||
|
||||
Meteor.setTimeout(() => {
|
||||
Meteor.setTimeout(() => {
|
||||
$studies.trigger('loadEnded');
|
||||
instance.select(isQuickSwitch);
|
||||
}, 1);
|
||||
|
||||
@ -52,8 +52,6 @@ Template.viewer.onCreated(() => {
|
||||
ViewerData[contentId].studyInstanceUids = [];
|
||||
instance.data.studies.forEach(study => {
|
||||
study.selected = true;
|
||||
const studyMetadata = new OHIF.metadata.StudyMetadata(study);
|
||||
study.displaySets = OHIF.viewerbase.sortingManager.getDisplaySets(studyMetadata);
|
||||
OHIF.viewer.Studies.insert(study);
|
||||
ViewerData[contentId].studyInstanceUids.push(study.studyInstanceUid);
|
||||
});
|
||||
@ -67,4 +65,4 @@ Template.viewer.events({
|
||||
const current = instance.data.state.get('leftSidebar');
|
||||
instance.data.state.set('leftSidebar', !current);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user