OHIF #98 Support to show specific series in study by URL: <base_url>/study/<studyInstanceUid>/series/<seriesInstanceUid>
This commit is contained in:
parent
826b8bc667
commit
c678022bd9
@ -53,3 +53,10 @@ Router.route('/viewer/studies/:studyInstanceUids', function() {
|
||||
const studyInstanceUids = this.params.studyInstanceUids.split(';');
|
||||
OHIF.viewerbase.renderViewer(this, { studyInstanceUids });
|
||||
}, { name: 'viewerStudies' });
|
||||
|
||||
// OHIF #98 Show specific series of study
|
||||
Router.route('/study/:studyInstanceUid/series/:seriesInstanceUids', function () {
|
||||
const studyInstanceUid = this.params.studyInstanceUid;
|
||||
const seriesInstanceUids = this.params.seriesInstanceUids.split(';');
|
||||
OHIF.viewerbase.renderViewer(this, { studyInstanceUids: [studyInstanceUid], seriesInstanceUids });
|
||||
}, { name: 'viewerSeries' });
|
||||
@ -20,3 +20,10 @@ Router.route('/viewer/:studyInstanceUids', function() {
|
||||
const studyInstanceUids = this.params.studyInstanceUids.split(';');
|
||||
OHIF.viewerbase.renderViewer(this, { studyInstanceUids }, 'ohifViewer');
|
||||
}, { name: 'viewerStudies' });
|
||||
|
||||
// OHIF #98 Show specific series of study
|
||||
Router.route('/study/:studyInstanceUid/series/:seriesInstanceUids', function () {
|
||||
const studyInstanceUid = this.params.studyInstanceUid;
|
||||
const seriesInstanceUids = this.params.seriesInstanceUids.split(';');
|
||||
OHIF.viewerbase.renderViewer(this, { studyInstanceUids: [studyInstanceUid], seriesInstanceUids }, 'ohifViewer');
|
||||
}, { name: 'viewerSeries' });
|
||||
@ -9,7 +9,7 @@ import { OHIF } from 'meteor/ohif:core';
|
||||
* @param studyInstanceUids The UIDs of the Studies to be retrieved
|
||||
* @return Promise
|
||||
*/
|
||||
OHIF.studylist.retrieveStudiesMetadata = (studyInstanceUids, doneCallback, failCallback) => {
|
||||
OHIF.studylist.retrieveStudiesMetadata = (studyInstanceUids, seriesInstanceUids, doneCallback, failCallback) => {
|
||||
// Check to make sure studyInstanceUids were actually input
|
||||
if (!studyInstanceUids || !studyInstanceUids.length) {
|
||||
if (failCallback && typeof failCallback === 'function') {
|
||||
@ -26,7 +26,7 @@ OHIF.studylist.retrieveStudiesMetadata = (studyInstanceUids, doneCallback, failC
|
||||
studyInstanceUids.forEach(function(studyInstanceUid) {
|
||||
// Send the call, and attach doneCallbacks and failCallbacks
|
||||
// which can resolve or reject the related promise based on its outcome
|
||||
const promise = OHIF.studylist.retrieveStudyMetadata(studyInstanceUid);
|
||||
const promise = OHIF.studylist.retrieveStudyMetadata(studyInstanceUid, seriesInstanceUids);
|
||||
|
||||
// Add the current promise to the array of promises
|
||||
promises.push(promise);
|
||||
|
||||
@ -12,7 +12,7 @@ const StudyMetaDataPromises = new Map();
|
||||
* @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 => {
|
||||
OHIF.studylist.retrieveStudyMetadata = (studyInstanceUid, seriesInstanceUids) => {
|
||||
|
||||
// @TODO: Whenever a study metadata request has failed, its related promise will be rejected once and for all
|
||||
// and further requests for that metadata will always fail. On failure, we probably need to remove the
|
||||
@ -39,6 +39,11 @@ OHIF.studylist.retrieveStudyMetadata = studyInstanceUid => {
|
||||
return;
|
||||
}
|
||||
|
||||
// Filter series if seriesInstanceUid exists
|
||||
if (seriesInstanceUids && seriesInstanceUids.length) {
|
||||
study.seriesList = study.seriesList.filter(series => seriesInstanceUids.indexOf(series.seriesInstanceUid) > -1);
|
||||
}
|
||||
|
||||
if (!study) {
|
||||
reject(`GetStudyMetadata: No study data returned from server: ${studyInstanceUid}`);
|
||||
return;
|
||||
@ -64,7 +69,8 @@ OHIF.studylist.retrieveStudyMetadata = studyInstanceUid => {
|
||||
|
||||
// Add additional metadata to our study from the studylist
|
||||
const studylistStudy = OHIF.studylist.collections.Studies.findOne({
|
||||
studyInstanceUid: study.studyInstanceUid
|
||||
studyInstanceUid: study.studyInstanceUid,
|
||||
'seriesList.seriesInstanceUid': '123456',
|
||||
});
|
||||
|
||||
if (studylistStudy) {
|
||||
|
||||
@ -4,18 +4,19 @@ import { OHIF } from 'meteor/ohif:core';
|
||||
* Prepare the studies data to render the viewer template
|
||||
*
|
||||
* @param {Array} studyInstanceUids List of studies that will be loaded into viewer
|
||||
* @param {Array} seriesInstanceUids List of series that will be loaded into viewer. If it is not defined, all series will be loaded
|
||||
* @param {String} timepointId ID of the current timepoint to get the studies from
|
||||
* @param {Object} timepointsFilter An object containing the filter to retrieve the timepoints
|
||||
* @return {Promise} Promise that will be resolved with the studies when the metadata is loaded
|
||||
*/
|
||||
export const prepareViewerData = ({ studyInstanceUids, timepointId, timepointsFilter={} }) => {
|
||||
export const prepareViewerData = ({ studyInstanceUids, seriesInstanceUids, timepointId, timepointsFilter={}}) => {
|
||||
// Clear the cornerstone tool data to sync the measurements with the measurements API
|
||||
cornerstoneTools.globalImageIdSpecificToolStateManager.restoreToolState({});
|
||||
|
||||
// Retrieve the studies metadata
|
||||
const promise = new Promise((resolve, reject) => {
|
||||
const processData = viewerData => {
|
||||
OHIF.studylist.retrieveStudiesMetadata(viewerData.studyInstanceUids).then(studies => {
|
||||
OHIF.studylist.retrieveStudiesMetadata(viewerData.studyInstanceUids, viewerData.seriesInstanceUids).then(studies => {
|
||||
// Add additional metadata to our study from the studylist
|
||||
studies.forEach(study => {
|
||||
const studylistStudy = OHIF.studylist.collections.Studies.findOne({
|
||||
@ -38,7 +39,10 @@ export const prepareViewerData = ({ studyInstanceUids, timepointId, timepointsFi
|
||||
|
||||
// Check if the studies are already given and ignore the timepoint ID if so
|
||||
if (studyInstanceUids && studyInstanceUids.length) {
|
||||
const viewerData = { studyInstanceUids };
|
||||
const viewerData = {
|
||||
studyInstanceUids,
|
||||
seriesInstanceUids,
|
||||
};
|
||||
processData(viewerData);
|
||||
} else {
|
||||
// Find the timepoint by ID and load the studies from it
|
||||
|
||||
Loading…
Reference in New Issue
Block a user