Removing seriesNavigation
This commit is contained in:
parent
64b76c2027
commit
6d57ef1197
@ -92,10 +92,6 @@ Viewerbase.imageViewerViewportData = imageViewerViewportData;
|
|||||||
import { panelNavigation } from './lib/panelNavigation';
|
import { panelNavigation } from './lib/panelNavigation';
|
||||||
Viewerbase.panelNavigation = panelNavigation;
|
Viewerbase.panelNavigation = panelNavigation;
|
||||||
|
|
||||||
// seriesNavigation.*
|
|
||||||
import { seriesNavigation } from './lib/seriesNavigation';
|
|
||||||
Viewerbase.seriesNavigation = seriesNavigation;
|
|
||||||
|
|
||||||
// WLPresets.*
|
// WLPresets.*
|
||||||
import { WLPresets } from './lib/WLPresets';
|
import { WLPresets } from './lib/WLPresets';
|
||||||
Viewerbase.wlPresets = WLPresets;
|
Viewerbase.wlPresets = WLPresets;
|
||||||
|
|||||||
@ -7,7 +7,6 @@ import { switchToImageRelative } from './switchToImageRelative';
|
|||||||
import { switchToImageByIndex } from './switchToImageByIndex';
|
import { switchToImageByIndex } from './switchToImageByIndex';
|
||||||
import { viewportUtils } from './viewportUtils';
|
import { viewportUtils } from './viewportUtils';
|
||||||
import { panelNavigation } from './panelNavigation';
|
import { panelNavigation } from './panelNavigation';
|
||||||
import { seriesNavigation } from './seriesNavigation';
|
|
||||||
import { WLPresets } from './WLPresets';
|
import { WLPresets } from './WLPresets';
|
||||||
|
|
||||||
// TODO: add this to namespace definitions
|
// TODO: add this to namespace definitions
|
||||||
@ -138,10 +137,10 @@ Meteor.startup(function() {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
previousDisplaySet() {
|
previousDisplaySet() {
|
||||||
OHIF.viewer.moveDisplaySets(false);
|
OHIF.viewerbase.layoutManager.moveDisplaySets(false);
|
||||||
},
|
},
|
||||||
nextDisplaySet() {
|
nextDisplaySet() {
|
||||||
OHIF.viewer.moveDisplaySets(true);
|
OHIF.viewerbase.layoutManager.moveDisplaySets(true);
|
||||||
},
|
},
|
||||||
nextPanel() {
|
nextPanel() {
|
||||||
panelNavigation.loadNextActivePanel();
|
panelNavigation.loadNextActivePanel();
|
||||||
@ -199,12 +198,6 @@ Meteor.startup(function() {
|
|||||||
flashButton(button);
|
flashButton(button);
|
||||||
clearImageAnnotations();
|
clearImageAnnotations();
|
||||||
},
|
},
|
||||||
nextSeries () {
|
|
||||||
seriesNavigation.loadNextSeries();
|
|
||||||
},
|
|
||||||
previousSeries () {
|
|
||||||
seriesNavigation.loadPreviousSeries();
|
|
||||||
},
|
|
||||||
cineDialog () {
|
cineDialog () {
|
||||||
/**
|
/**
|
||||||
* TODO: This won't work in OHIF's, since this element
|
* TODO: This won't work in OHIF's, since this element
|
||||||
|
|||||||
@ -1,91 +0,0 @@
|
|||||||
import { Session } from 'meteor/session';
|
|
||||||
import { OHIF } from 'meteor/ohif:core';
|
|
||||||
// @TODO: import symbols into local scope: ViewerData
|
|
||||||
|
|
||||||
const getStudyFromStudyInstanceUid = studyInstanceUid => {
|
|
||||||
// @TypeSafeStudies
|
|
||||||
return OHIF.viewer.Studies.findBy({ studyInstanceUid });
|
|
||||||
};
|
|
||||||
|
|
||||||
const getNumberOfStacks = studyInstanceUid => {
|
|
||||||
// May not work if the Study contains non-image series?
|
|
||||||
const study = getStudyFromStudyInstanceUid(studyInstanceUid);
|
|
||||||
|
|
||||||
if (!study || !study.displaySets || !study.displaySets.length) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
return study.displaySets.length;
|
|
||||||
};
|
|
||||||
|
|
||||||
const getActiveViewportIndex = () => {
|
|
||||||
return Session.get('activeViewport');
|
|
||||||
};
|
|
||||||
|
|
||||||
const loadSeries = indexCalculator => {
|
|
||||||
if(typeof indexCalculator !== 'function') {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const viewportIndex = getActiveViewportIndex();
|
|
||||||
const contentId = Session.get('activeContentId');
|
|
||||||
const viewerData = ViewerData[contentId].loadedSeriesData[viewportIndex];
|
|
||||||
|
|
||||||
if(!viewerData && !viewerData.studyInstanceUid) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const { studyInstanceUid, seriesInstanceUid, displaySetInstanceUid } = viewerData;
|
|
||||||
|
|
||||||
if(!studyInstanceUid) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const numberOfStacks = getNumberOfStacks(studyInstanceUid);
|
|
||||||
if (!numberOfStacks || numberOfStacks === 1) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const study = getStudyFromStudyInstanceUid(studyInstanceUid);
|
|
||||||
|
|
||||||
const displaySetInstanceUids = study.displaySets.map(displaySet => {
|
|
||||||
return displaySet.displaySetInstanceUid;
|
|
||||||
});
|
|
||||||
|
|
||||||
const currentLoadedStackIndex = displaySetInstanceUids.indexOf(displaySetInstanceUid);
|
|
||||||
|
|
||||||
const newStackIndex = indexCalculator(currentLoadedStackIndex, numberOfStacks);
|
|
||||||
if (currentLoadedStackIndex === newStackIndex) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const newDisplaySetInstanceUid = displaySetInstanceUids[newStackIndex];
|
|
||||||
|
|
||||||
const data = {
|
|
||||||
displaySetInstanceUid: newDisplaySetInstanceUid,
|
|
||||||
viewportIndex,
|
|
||||||
studyInstanceUid,
|
|
||||||
seriesInstanceUid
|
|
||||||
};
|
|
||||||
|
|
||||||
OHIF.viewerbase.layoutManager.rerenderViewportWithNewDisplaySet(viewportIndex, data);
|
|
||||||
};
|
|
||||||
|
|
||||||
const loadPreviousSeries = () => {
|
|
||||||
const indexCalculator = currentLoadedStackIndex => Math.max(currentLoadedStackIndex - 1, 0);
|
|
||||||
|
|
||||||
loadSeries(indexCalculator);
|
|
||||||
};
|
|
||||||
|
|
||||||
const loadNextSeries = () => {
|
|
||||||
const indexCalculator = (currentLoadedStackIndex, numberOfStacks) => Math.min(currentLoadedStackIndex + 1, numberOfStacks - 1);
|
|
||||||
|
|
||||||
loadSeries(indexCalculator);
|
|
||||||
};
|
|
||||||
|
|
||||||
const seriesNavigation = {
|
|
||||||
loadPreviousSeries,
|
|
||||||
loadNextSeries
|
|
||||||
};
|
|
||||||
|
|
||||||
export { seriesNavigation };
|
|
||||||
Loading…
Reference in New Issue
Block a user