dicom-microscopy-viewer 0.34.0 → 0.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/dicom-microscopy-viewer.js +257 -104
- package/docs/annotations__AnnotationManager.js.html +13 -2
- package/docs/annotations_markers_arrow.js.html +1 -1
- package/docs/annotations_markups__MarkupManager.js.html +31 -2
- package/docs/annotations_markups_measurement.js.html +1 -1
- package/docs/annotations_markups_textEvaluation.js.html +1 -1
- package/docs/annotations_markups_utils_getShortestLineBetweenOverlayAndFeature.js.html +1 -1
- package/docs/api.html +1 -1
- package/docs/channel.BlendingInformation.html +1 -1
- package/docs/channel._Channel.html +1 -1
- package/docs/channel.js.html +3 -3
- package/docs/dicom-microscopy-viewer.js.html +1 -1
- package/docs/events.html +1 -1
- package/docs/events.js.html +1 -1
- package/docs/global.html +1 -1
- package/docs/index.html +1 -1
- package/docs/metadata.Comprehensive3DSR.html +1 -1
- package/docs/metadata.VLWholeSlideMicroscopyImage.html +1 -1
- package/docs/metadata.html +1 -1
- package/docs/metadata.js.html +1 -1
- package/docs/renderingEngine.RenderingEngine.html +1 -1
- package/docs/renderingEngine.js.html +1 -1
- package/docs/roi.ROI.html +1 -1
- package/docs/roi.html +1 -1
- package/docs/roi.js.html +1 -1
- package/docs/scoord3d.Ellipse.html +1 -1
- package/docs/scoord3d.Ellipsoid.html +1 -1
- package/docs/scoord3d.Multipoint.html +1 -1
- package/docs/scoord3d.Point.html +1 -1
- package/docs/scoord3d.Polygon.html +1 -1
- package/docs/scoord3d.Polyline.html +1 -1
- package/docs/scoord3d.html +1 -1
- package/docs/scoord3d.js.html +7 -7
- package/docs/utils.html +1 -1
- package/docs/utils.js.html +1 -1
- package/docs/viewer.LabelImageViewer.html +2 -2
- package/docs/viewer.OverviewImageViewer.html +2 -2
- package/docs/viewer.VolumeImageViewer.html +54 -54
- package/docs/viewer.html +1 -1
- package/docs/viewer.js.html +42 -9
- package/package.json +2 -2
- package/src/annotations/_AnnotationManager.js +12 -1
- package/src/annotations/markups/_MarkupManager.js +30 -1
- package/src/channel.js +2 -2
- package/src/scoord3d.js +6 -6
- package/src/viewer.js +41 -8
|
@@ -22,10 +22,11 @@ import { areCodedConceptsEqual, getContentItemNameCodedConcept } from '../utils'
|
|
|
22
22
|
const { Marker, Markup } = Enums
|
|
23
23
|
|
|
24
24
|
class _AnnotationManager {
|
|
25
|
-
constructor ({ map, pyramid } = {}) {
|
|
25
|
+
constructor ({ map, pyramid, drawingSource } = {}) {
|
|
26
26
|
const markupManager = new _MarkupManager({
|
|
27
27
|
map,
|
|
28
28
|
pyramid,
|
|
29
|
+
drawingSource,
|
|
29
30
|
formatters: {
|
|
30
31
|
[Marker.Arrow]: arrowFormat,
|
|
31
32
|
[Markup.Measurement]: measurementFormat,
|
|
@@ -121,6 +122,16 @@ class _AnnotationManager {
|
|
|
121
122
|
this.props.markupManager.setVisible(isVisible)
|
|
122
123
|
}
|
|
123
124
|
|
|
125
|
+
/**
|
|
126
|
+
* Set markup visibility.
|
|
127
|
+
*
|
|
128
|
+
* @param {string} id The markup id
|
|
129
|
+
* @param {boolean} isVisible The markup visibility
|
|
130
|
+
*/
|
|
131
|
+
setMarkupVisibility (id, isVisible) {
|
|
132
|
+
this.props.markupManager.setVisibility(id, isVisible)
|
|
133
|
+
}
|
|
134
|
+
|
|
124
135
|
onAdd (feature) {
|
|
125
136
|
/**
|
|
126
137
|
* Add properties to ROI feature before triggering
|
|
@@ -15,10 +15,11 @@ import { coordinateWithOffset } from '../../scoord3dUtils'
|
|
|
15
15
|
import defaultStyles from '../styles'
|
|
16
16
|
|
|
17
17
|
class _MarkupManager {
|
|
18
|
-
constructor ({ map, pyramid, formatters, onClick, onStyle } = {}) {
|
|
18
|
+
constructor ({ map, pyramid, drawingSource, formatters, onClick, onStyle } = {}) {
|
|
19
19
|
this._map = map
|
|
20
20
|
this._pyramid = pyramid
|
|
21
21
|
this._formatters = formatters
|
|
22
|
+
this._drawingSource = drawingSource;
|
|
22
23
|
|
|
23
24
|
this.onClick = onClick
|
|
24
25
|
this.onStyle = onStyle
|
|
@@ -110,6 +111,34 @@ class _MarkupManager {
|
|
|
110
111
|
return id
|
|
111
112
|
}
|
|
112
113
|
|
|
114
|
+
/**
|
|
115
|
+
* Set markup visibility.
|
|
116
|
+
*
|
|
117
|
+
* @param {string} id The markup id
|
|
118
|
+
* @param {boolean} isVisible The markup visibility
|
|
119
|
+
*/
|
|
120
|
+
setVisibility (id, isVisible) {
|
|
121
|
+
const markup = this.get(id)
|
|
122
|
+
if (!markup) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const links = this._links.getArray()
|
|
127
|
+
const link = links.find((feature) => feature.getId() === id)
|
|
128
|
+
|
|
129
|
+
const feature = this._drawingSource.getFeatureById(id);
|
|
130
|
+
|
|
131
|
+
if (!isVisible) {
|
|
132
|
+
this._map.removeOverlay(markup.overlay)
|
|
133
|
+
this._links.remove(link)
|
|
134
|
+
} else {
|
|
135
|
+
this._map.addOverlay(markup.overlay)
|
|
136
|
+
this._drawLink(feature)
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
return isVisible
|
|
140
|
+
}
|
|
141
|
+
|
|
113
142
|
/**
|
|
114
143
|
* Creates a new markup
|
|
115
144
|
*
|
package/src/channel.js
CHANGED
|
@@ -603,8 +603,8 @@ class _Channel {
|
|
|
603
603
|
imagePixelSpacings.push(pixelSpacing)
|
|
604
604
|
|
|
605
605
|
physicalSizes.push([
|
|
606
|
-
(totalPixelMatrixColumns * pixelSpacing[
|
|
607
|
-
(totalPixelMatrixRows * pixelSpacing[
|
|
606
|
+
(totalPixelMatrixColumns * pixelSpacing[1]).toFixed(4),
|
|
607
|
+
(totalPixelMatrixRows * pixelSpacing[0]).toFixed(4)
|
|
608
608
|
])
|
|
609
609
|
/*
|
|
610
610
|
* Compute the resolution at each pyramid level, since the zoom
|
package/src/scoord3d.js
CHANGED
|
@@ -78,7 +78,7 @@ class Point extends Scoord3D {
|
|
|
78
78
|
throw new Error('coordinates of Point must be an array of length 3')
|
|
79
79
|
}
|
|
80
80
|
if (options.coordinates.some(c => c < 0)) {
|
|
81
|
-
|
|
81
|
+
console.warn('coordinates of Point are negative numbers')
|
|
82
82
|
}
|
|
83
83
|
super({
|
|
84
84
|
coordinates: options.coordinates,
|
|
@@ -123,7 +123,7 @@ class Multipoint extends Scoord3D {
|
|
|
123
123
|
throw new Error('coordinates of Multipoint must be an array of (X,Y,Z) triplets')
|
|
124
124
|
}
|
|
125
125
|
if (options.coordinates.find(c => c.some(item => item < 0))) {
|
|
126
|
-
|
|
126
|
+
console.warn('coordinates of Multipoint contain positive numbers')
|
|
127
127
|
}
|
|
128
128
|
super({
|
|
129
129
|
coordinates: options.coordinates,
|
|
@@ -160,7 +160,7 @@ class Polyline extends Scoord3D {
|
|
|
160
160
|
throw new Error('coordinates of Polyline must be an array of (X,Y,Z) triplets')
|
|
161
161
|
}
|
|
162
162
|
if (options.coordinates.find(c => c.some(item => item < 0))) {
|
|
163
|
-
|
|
163
|
+
console.warn('coordinates of Polyline contain negative numbers')
|
|
164
164
|
}
|
|
165
165
|
super({
|
|
166
166
|
coordinates: options.coordinates,
|
|
@@ -198,7 +198,7 @@ class Polygon extends Scoord3D {
|
|
|
198
198
|
throw new Error('coordinates of Polygon must be an array of (X,Y,Z) triplets')
|
|
199
199
|
}
|
|
200
200
|
if (options.coordinates.find(c => c.some(item => item < 0))) {
|
|
201
|
-
|
|
201
|
+
console.warn('coordinates of Polygon contain negative numbers')
|
|
202
202
|
}
|
|
203
203
|
const n = options.coordinates.length
|
|
204
204
|
if ((options.coordinates[0][0] !== options.coordinates[n - 1][0]) ||
|
|
@@ -247,7 +247,7 @@ class Ellipsoid extends Scoord3D {
|
|
|
247
247
|
throw new Error('coordinates of Ellipsoid must be an array of (X,Y,Z) triplets')
|
|
248
248
|
}
|
|
249
249
|
if (options.coordinates.find(c => c.some(item => item < 0))) {
|
|
250
|
-
|
|
250
|
+
console.warn('coordinates of Ellipsoid contain negative numbers')
|
|
251
251
|
}
|
|
252
252
|
super({
|
|
253
253
|
coordinates: options.coordinates,
|
|
@@ -289,7 +289,7 @@ class Ellipse extends Scoord3D {
|
|
|
289
289
|
throw new Error('coordinates of Ellipse must be an array of (X,Y,Z) triplets')
|
|
290
290
|
}
|
|
291
291
|
if (options.coordinates.find(c => c.some(item => item < 0))) {
|
|
292
|
-
|
|
292
|
+
console.warn('coordinates of Ellipse contain negative numbers')
|
|
293
293
|
}
|
|
294
294
|
const firstAxis = [
|
|
295
295
|
options.coordinates[0][0] - options.coordinates[1][0],
|
package/src/viewer.js
CHANGED
|
@@ -737,7 +737,8 @@ class VolumeImageViewer {
|
|
|
737
737
|
resolutions: this[_tileGrid].getResolutions(),
|
|
738
738
|
rotation: this[_rotation],
|
|
739
739
|
smoothResolutionConstraint: true,
|
|
740
|
-
showFullExtent: true
|
|
740
|
+
showFullExtent: true,
|
|
741
|
+
extent: this[_referenceExtents]
|
|
741
742
|
})
|
|
742
743
|
|
|
743
744
|
// Create a rendering engine object for offscreen rendering
|
|
@@ -826,7 +827,9 @@ class VolumeImageViewer {
|
|
|
826
827
|
rotation: this[_rotation],
|
|
827
828
|
zoom: 0,
|
|
828
829
|
minZoom: 0,
|
|
829
|
-
maxZoom: 0
|
|
830
|
+
maxZoom: 0,
|
|
831
|
+
constrainOnlyCenter: true,
|
|
832
|
+
center: getCenter(this[_referenceExtents])
|
|
830
833
|
})
|
|
831
834
|
|
|
832
835
|
this[_overviewMap] = new OverviewMap({
|
|
@@ -844,7 +847,7 @@ class VolumeImageViewer {
|
|
|
844
847
|
keyboardEventTarget: document
|
|
845
848
|
})
|
|
846
849
|
|
|
847
|
-
view.fit(this[_projection].getExtent(), this[_map].getSize())
|
|
850
|
+
view.fit(this[_projection].getExtent(), { size: this[_map].getSize() })
|
|
848
851
|
|
|
849
852
|
/**
|
|
850
853
|
* OpenLayer's map has default active interactions
|
|
@@ -894,7 +897,8 @@ class VolumeImageViewer {
|
|
|
894
897
|
|
|
895
898
|
this[_annotationManager] = new _AnnotationManager({
|
|
896
899
|
map: this[_map],
|
|
897
|
-
pyramid: this[_pyramidMetadata]
|
|
900
|
+
pyramid: this[_pyramidMetadata],
|
|
901
|
+
drawingSource: this[_drawingSource]
|
|
898
902
|
})
|
|
899
903
|
|
|
900
904
|
// This updates the tiles offscreen rendering when zoom is applied to the view.
|
|
@@ -1388,7 +1392,7 @@ class VolumeImageViewer {
|
|
|
1388
1392
|
this[_map].setTarget(options.container)
|
|
1389
1393
|
const view = this[_map].getView()
|
|
1390
1394
|
const projection = view.getProjection()
|
|
1391
|
-
view.fit(projection.getExtent(), this[_map].getSize())
|
|
1395
|
+
view.fit(projection.getExtent(), { size: this[_map].getSize() })
|
|
1392
1396
|
|
|
1393
1397
|
// Style scale element (overriding default Openlayers CSS "ol-scale-line")
|
|
1394
1398
|
const scaleElement = this[_controls].scale.element
|
|
@@ -1415,6 +1419,26 @@ class VolumeImageViewer {
|
|
|
1415
1419
|
scaleInnerElement.style.margin = '1px'
|
|
1416
1420
|
scaleInnerElement.style.willChange = 'contents,width'
|
|
1417
1421
|
|
|
1422
|
+
const overviewElement = this[_overviewMap].element
|
|
1423
|
+
const overviewmapElement = Object.values(overviewElement.children).find(
|
|
1424
|
+
c => c.className === 'ol-overviewmap-map'
|
|
1425
|
+
)
|
|
1426
|
+
overviewmapElement.style.border = '1px solid black'
|
|
1427
|
+
// Try to fit the overview map into the target control overlay container
|
|
1428
|
+
const resizeFactor = 300
|
|
1429
|
+
let width = Math.abs(this[_referenceExtents][1]) / resizeFactor
|
|
1430
|
+
let height = Math.abs(this[_referenceExtents][2]) / resizeFactor
|
|
1431
|
+
if (width > 400 || height > 400) {
|
|
1432
|
+
width /= 2
|
|
1433
|
+
height /= 2
|
|
1434
|
+
}
|
|
1435
|
+
if (width < 150 || height < 150) {
|
|
1436
|
+
width *= 1.5
|
|
1437
|
+
height *= 1.5
|
|
1438
|
+
}
|
|
1439
|
+
overviewmapElement.style.width = `${width}px`
|
|
1440
|
+
overviewmapElement.style.height = `${height}px`
|
|
1441
|
+
|
|
1418
1442
|
const container = this[_map].getTargetElement()
|
|
1419
1443
|
|
|
1420
1444
|
this[_drawingSource].on(VectorEventType.ADDFEATURE, (e) => {
|
|
@@ -1721,6 +1745,10 @@ class VolumeImageViewer {
|
|
|
1721
1745
|
return
|
|
1722
1746
|
}
|
|
1723
1747
|
this[_map].addControl(this[_overviewMap])
|
|
1748
|
+
const map = this[_overviewMap].getOverviewMap()
|
|
1749
|
+
const view = map.getView()
|
|
1750
|
+
const projection = view.getProjection()
|
|
1751
|
+
view.fit(projection.getExtent(), { size: map.getSize() })
|
|
1724
1752
|
}
|
|
1725
1753
|
|
|
1726
1754
|
/**
|
|
@@ -2082,6 +2110,8 @@ class VolumeImageViewer {
|
|
|
2082
2110
|
this[_features].push(feature)
|
|
2083
2111
|
|
|
2084
2112
|
_setFeatureStyle(feature, styleOptions)
|
|
2113
|
+
const isVisible = Object.keys(styleOptions).length !== 0
|
|
2114
|
+
this[_annotationManager].setMarkupVisibility(roi.uid, isVisible)
|
|
2085
2115
|
}
|
|
2086
2116
|
|
|
2087
2117
|
/**
|
|
@@ -2124,6 +2154,8 @@ class VolumeImageViewer {
|
|
|
2124
2154
|
const id = feature.getId()
|
|
2125
2155
|
if (id === uid) {
|
|
2126
2156
|
_setFeatureStyle(feature, styleOptions)
|
|
2157
|
+
const isVisible = Object.keys(styleOptions).length !== 0
|
|
2158
|
+
this[_annotationManager].setMarkupVisibility(id, isVisible)
|
|
2127
2159
|
}
|
|
2128
2160
|
})
|
|
2129
2161
|
}
|
|
@@ -2307,7 +2339,8 @@ class _NonVolumeImageViewer {
|
|
|
2307
2339
|
const view = new View({
|
|
2308
2340
|
center: getCenter(extent),
|
|
2309
2341
|
rotation: rotation,
|
|
2310
|
-
projection: projection
|
|
2342
|
+
projection: projection,
|
|
2343
|
+
extent: extent
|
|
2311
2344
|
})
|
|
2312
2345
|
|
|
2313
2346
|
// Creates the map with the defined layers and view and renders it.
|
|
@@ -2318,7 +2351,7 @@ class _NonVolumeImageViewer {
|
|
|
2318
2351
|
keyboardEventTarget: document
|
|
2319
2352
|
})
|
|
2320
2353
|
|
|
2321
|
-
view.fit(projection.getExtent(), this[_map].getSize())
|
|
2354
|
+
view.fit(projection.getExtent(), { size: this[_map].getSize() })
|
|
2322
2355
|
}
|
|
2323
2356
|
|
|
2324
2357
|
/** Renders the image in the specified viewport container.
|
|
@@ -2332,7 +2365,7 @@ class _NonVolumeImageViewer {
|
|
|
2332
2365
|
this[_map].setTarget(options.container)
|
|
2333
2366
|
const view = this[_map].getView()
|
|
2334
2367
|
const projection = view.getProjection()
|
|
2335
|
-
view.fit(projection.getExtent(), this[_map].getSize())
|
|
2368
|
+
view.fit(projection.getExtent(), { size: this[_map].getSize() })
|
|
2336
2369
|
|
|
2337
2370
|
this[_map].getInteractions().forEach((interaction) => {
|
|
2338
2371
|
this[_map].removeInteraction(interaction)
|