Constructor
new Scroll(app)
Parameters:
Name | Type | Description |
---|---|---|
app | App | The associated application. |
- Source
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'
]);
// 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.getData(0).image.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
Members
dblclick
Handle double click.
- Source
keydown
Handle key down event.
- Source
mousedown
Handle mouse down event.
- Source
mousemove
Handle mouse move event.
- Source
mouseout
Handle mouse out event.
- Source
mouseup
Handle mouse up event.
- Source
touchend
Handle touch end event.
- Source
touchmove
Handle touch move event.
- Source
touchstart
Handle touch start event.
- Source
wheel
Handle mouse wheel event.
- Source
Methods
activate(_bool)
Activate the tool.
Parameters:
Name | Type | Description |
---|---|---|
_bool | boolean | The flag to activate or not. |
- Source
init()
Initialise the tool.
- Source
setFeatures(features)
Set the tool live features: disaply tooltip.
Parameters:
Name | Type | Description |
---|---|---|
features | object | The list of features. |
- Source