Skip to content

Commit e2aa843

Browse files
authored
Merge branch 'master' into feat/gamma-correction
2 parents a075f0f + 64a1098 commit e2aa843

File tree

2 files changed

+41
-2
lines changed

2 files changed

+41
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dicom-microscopy-viewer",
3-
"version": "0.48.11",
3+
"version": "0.48.12",
44
"license": "MIT",
55
"author": "ImagingDataCommons",
66
"homepage": "https://github.com/imagingdatacommons/dicom-microscopy-viewer#readme",

src/viewer.js

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -788,6 +788,7 @@ const _pointsSources = Symbol('pointsSources')
788788
const _clustersSources = Symbol('clustersSources')
789789
const _segmentationInterpolate = Symbol('segmentationInterpolate')
790790
const _segmentationTileGrid = Symbol('segmentationTileGrid')
791+
const _parametricMapInterpolate = Symbol('parametricMapInterpolate')
791792
const _mapViewResolutions = Symbol('mapViewResolutions')
792793

793794
/**
@@ -849,6 +850,7 @@ class VolumeImageViewer {
849850
this[_pointsSources] = {}
850851
this[_clustersSources] = {}
851852
this[_segmentationInterpolate] = false
853+
this[_parametricMapInterpolate] = true
852854

853855
this._onBulkAnnotationsFeaturesLoadStart = this._onBulkAnnotationsFeaturesLoadStart.bind(this)
854856
this._onBulkAnnotationsFeaturesLoadEnd = this._onBulkAnnotationsFeaturesLoadEnd.bind(this)
@@ -2371,6 +2373,43 @@ class VolumeImageViewer {
23712373
})
23722374
}
23732375

2376+
/**
2377+
* Toggle parametric map interpolation.
2378+
*
2379+
* @returns {void}
2380+
*/
2381+
toggleParametricMapInterpolation () {
2382+
console.debug('toggle parametric map interpolation:', this[_parametricMapInterpolate])
2383+
this[_parametricMapInterpolate] = !this[_parametricMapInterpolate]
2384+
2385+
const mappings = Object.values(this[_mappings])
2386+
2387+
mappings.forEach(mapping => {
2388+
const tileGrid = new TileGrid({
2389+
extent: mapping.loaderParams.pyramid.extent,
2390+
origins: mapping.loaderParams.pyramid.origins,
2391+
resolutions: mapping.loaderParams.pyramid.resolutions,
2392+
sizes: mapping.loaderParams.pyramid.gridSizes,
2393+
tileSizes: mapping.loaderParams.pyramid.tileSizes
2394+
})
2395+
2396+
mapping.layer.setSource(new DataTileSource({
2397+
tileGrid,
2398+
projection: this[_projection],
2399+
wrapX: false,
2400+
bandCount: 1,
2401+
interpolate: this[_parametricMapInterpolate]
2402+
}))
2403+
// Reset hasLoader flag since we created a new source
2404+
mapping.hasLoader = false
2405+
if (mapping.layer.getVisible() === true) {
2406+
this.showParameterMapping(mapping.mapping.uid)
2407+
} else {
2408+
this.hideParameterMapping(mapping.mapping.uid)
2409+
}
2410+
})
2411+
}
2412+
23742413
/**
23752414
* Show an optical path.
23762415
*
@@ -5453,7 +5492,7 @@ class VolumeImageViewer {
54535492
projection: this[_projection],
54545493
wrapX: false,
54555494
bandCount: 1,
5456-
interpolate: true
5495+
interpolate: this[_parametricMapInterpolate]
54575496
})
54585497
source.on('tileloaderror', (event) => {
54595498
console.error(`error loading tile of mapping "${mappingUID}"`, event.tile?.error_?.message || event)

0 commit comments

Comments
 (0)