Skip to content

Commit e852932

Browse files
committed
Move method from non-volume to volume viewer
1 parent 7b01f96 commit e852932

File tree

1 file changed

+24
-22
lines changed

1 file changed

+24
-22
lines changed

src/viewer.js

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1903,6 +1903,25 @@ class VolumeImageViewer {
19031903
scaleInnerElement.style.willChange = 'contents,width'
19041904
}
19051905

1906+
/**
1907+
* Navigate the view to a spatial position or resolution level.
1908+
*
1909+
* @param {Object} options - Options.
1910+
* @param {number} level - Zoom level.
1911+
*/
1912+
navigate ({ level }) {
1913+
const numLevels = this[_pyramid].resolutions.length
1914+
if (level > numLevels) {
1915+
throw new Error('Argument "level" exceeds number of resolution levels.')
1916+
}
1917+
// TODO: center position in slide/image coordinates
1918+
const view = this[_map].getView()
1919+
const currentZoomLevel = view.getZoom()
1920+
if (level !== currentZoomLevel) {
1921+
view.animate({ zoom: this[_pyramid] })
1922+
}
1923+
}
1924+
19061925
/**
19071926
* Activate the draw interaction for graphic annotation of regions of interest.
19081927
*
@@ -4102,7 +4121,8 @@ class _NonVolumeImageViewer {
41024121
})
41034122
}
41044123

4105-
if (this[_metadata].ImageType[2] === 'VOLUME') {
4124+
const imageFlavor = this[_metadata].ImageType[2]
4125+
if (imageFlavor === 'VOLUME') {
41064126
throw new Error('Viewer cannot render images of type VOLUME.')
41074127
}
41084128

@@ -4117,7 +4137,7 @@ class _NonVolumeImageViewer {
41174137
]
41184138

41194139
const imageLoadFunction = (image, src) => {
4120-
console.info('load image')
4140+
console.info(`load ${imageFlavor} image`)
41214141
const mediaType = 'image/png'
41224142
const queryParams = {}
41234143
if (resizeFactor !== 1) {
@@ -4148,7 +4168,8 @@ class _NonVolumeImageViewer {
41484168
units: 'metric',
41494169
extent: extent,
41504170
getPointResolution: (pixelRes, point) => {
4151-
/** DICOM Pixel Spacing has millimeter unit while the projection has
4171+
/*
4172+
* DICOM Pixel Spacing has millimeter unit while the projection has
41524173
* meter unit.
41534174
*/
41544175
const mmSpacing = getPixelSpacing(this[_metadata])[0]
@@ -4223,25 +4244,6 @@ class _NonVolumeImageViewer {
42234244
})
42244245
}
42254246

4226-
/**
4227-
* Move the view to a spatial position or resolution level.
4228-
*
4229-
* @param {Object} options - Options.
4230-
* @param {number} level - Zoom level.
4231-
*/
4232-
move ({ level }) {
4233-
const numLevels = this[_pyramid].resolutions.length
4234-
if (level > numLevels) {
4235-
throw new Error('Argument "level" exceeds number of resolution levels.')
4236-
}
4237-
// TODO: center position in slide/image coordinates
4238-
const view = this[_map].getView()
4239-
const currentZoomLevel = view.getZoom()
4240-
if (level !== currentZoomLevel) {
4241-
view.animate({ zoom: this[_pyramid] })
4242-
}
4243-
}
4244-
42454247
/**
42464248
* DICOM metadata for the displayed VL Whole Slide Microscopy Image instances.
42474249
*

0 commit comments

Comments
 (0)