Scroll

Scroll class.

Constructor

new Scroll(app)

Parameters:
NameTypeDescription
appApp

The associated application.

Examples
// create the dwv app
const app = new dwv.App();
// initialise
const viewConfig0 = new dwv.ViewConfig('layerGroup0');
const viewConfigs = {'*': [viewConfig0]};
const options = new dwv.AppOptions(viewConfigs);
options.tools = {Scroll: new dwv.ToolConfig()};
app.init(options);
// activate tool
app.addEventListener('load', function () {
  app.setTool('Scroll');
});
// load dicom data
app.loadURLs([
  'https://raw.githubusercontent.com/ivmartel/dwv/master/tests/data/bbmri-53323851.dcm',
  'https://raw.githubusercontent.com/ivmartel/dwv/master/tests/data/bbmri-53323707.dcm',
  'https://raw.githubusercontent.com/ivmartel/dwv/master/tests/data/bbmri-53323563.dcm'
]);

Example with slider

// create the dwv app
const app = new dwv.App();
// initialise
const viewConfig0 = new dwv.ViewConfig('layerGroup0');
const viewConfigs = {'*': [viewConfig0]};
const options = new dwv.AppOptions(viewConfigs);
options.tools = {Scroll: new dwv.ToolConfig()};
app.init(options);
// create range
const range = document.createElement('input');
range.type = 'range';
range.min = 0;
range.id = 'sliceRange';
document.body.appendChild(range);
// update app on slider change
range.oninput = function () {
  const lg = app.getLayerGroupByDivId('layerGroup0');
  const vc = lg.getActiveViewLayer().getViewController();
  const index = vc.getCurrentIndex();
  const values = index.getValues();
  values[2] = this.value;
  vc.setCurrentIndex(new dwv.Index(values));
}
// activate tool and update range max on load
app.addEventListener('load', function () {
  app.setTool('Scroll');
  const size = app.getImage(0).getGeometry().getSize();
  range.max = size.get(2) - 1;
});
// update slider on slice change (for ex via mouse wheel)
app.addEventListener('positionchange', function () {
  const lg = app.getLayerGroupByDivId('layerGroup0');
  const vc = lg.getActiveViewLayer().getViewController();
  range.value = vc.getCurrentIndex().get(2);
});
// load dicom data
app.loadURLs([
  'https://raw.githubusercontent.com/ivmartel/dwv/master/tests/data/bbmri-53323851.dcm',
  'https://raw.githubusercontent.com/ivmartel/dwv/master/tests/data/bbmri-53323707.dcm',
  'https://raw.githubusercontent.com/ivmartel/dwv/master/tests/data/bbmri-53323563.dcm'
]);

Classes

Scroll

Members

dblclick

Handle double click.

keydown

Handle key down event.

mousedown

Handle mouse down event.

mousemove

Handle mouse move event.

mouseout

Handle mouse out event.

mouseup

Handle mouse up event.

touchend

Handle touch end event.

touchmove

Handle touch move event.

touchstart

Handle touch start event.

wheel

Handle mouse wheel event.

Methods

activate(_bool)

Activate the tool.

Parameters:
NameTypeDescription
_boolboolean

The flag to activate or not.

init()

Initialise the tool.

setFeatures(features)

Set the tool live features: disaply tooltip.

Parameters:
NameTypeDescription
featuresobject

The list of features.