2017-01-16 18:30:54 +01:00
|
|
|
import { viewportUtils } from './viewportUtils';
|
2018-10-29 15:58:53 +01:00
|
|
|
import { cornerstoneTools } from 'meteor/ohif:cornerstone';
|
|
|
|
|
|
|
|
|
|
const scrollToIndex = cornerstoneTools.import('util/scrollToIndex');
|
2017-01-16 18:30:54 +01:00
|
|
|
|
2015-12-09 15:48:24 +01:00
|
|
|
/**
|
|
|
|
|
* This function switches to an image given an element and the index of the image in the current stack
|
|
|
|
|
* Note: Negative indexing is supported:
|
|
|
|
|
*
|
|
|
|
|
* e.g. switchToImageByIndex(element, -1) to switch to the last image of the stack
|
|
|
|
|
*
|
|
|
|
|
* @param element
|
|
|
|
|
* @param {number} [newImageIdIndex] The image index in the stack to switch to.
|
|
|
|
|
*/
|
2017-01-16 18:30:54 +01:00
|
|
|
export function switchToImageByIndex(newImageIdIndex) {
|
|
|
|
|
var element = viewportUtils.getActiveViewportElement();
|
2018-10-29 15:58:53 +01:00
|
|
|
scrollToIndex(element, newImageIdIndex);
|
2017-01-16 18:30:54 +01:00
|
|
|
}
|