dicom-microscopy-viewer 0.36.1 → 0.36.4
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/README.md +45 -43
- package/{build → dist}/08929516bda4c4fd2597.module.wasm +0 -0
- package/{build/6b62efd6c7f30afd4c78.module.wasm → dist/4f2853de305c1b5afcac.module.wasm} +0 -0
- package/{build → dist}/6ae9c6e051fd2bd70fad.module.wasm +0 -0
- package/dist/6b62efd6c7f30afd4c78.module.wasm +0 -0
- package/{build → dist}/7e1d2da75b59525e1933.module.wasm +0 -0
- package/{build → dist}/d051f2d564fae150ce94.module.wasm +0 -0
- package/dist/dicom-microscopy-viewer.js +2 -0
- package/{build → dist}/dicom-microscopy-viewer.js.LICENSE.txt +0 -0
- package/dist/dicom-microscopy-viewer.js.map +1 -0
- package/{build → dist}/e6305f756142e57c92cd.module.wasm +0 -0
- package/{build → dist}/f3e0c999ad06a34a7f75.module.wasm +0 -0
- package/docs/annotation.AnnotationGroup.html +142 -43
- package/docs/annotation.html +2 -2
- package/docs/annotation.js.html +47 -34
- package/docs/annotations__AnnotationManager.js.html +2 -2
- package/docs/annotations_markups__MarkupManager.js.html +2 -2
- package/docs/api.html +2 -2
- package/docs/color.PaletteColorLookupTable.html +42 -14
- package/docs/color.html +6 -6
- package/docs/color.js.html +14 -14
- package/docs/dicom-microscopy-viewer.js.html +2 -2
- package/docs/events.html +316 -2
- package/docs/events.js.html +13 -4
- package/docs/index.html +45 -45
- package/docs/mapping.ParameterMapping.html +342 -27
- package/docs/mapping.Transformation.html +221 -14
- package/docs/mapping.html +2 -2
- package/docs/mapping.js.html +41 -32
- package/docs/metadata.Comprehensive3DSR.html +254 -5
- package/docs/metadata.MicroscopyBulkSimpleAnnotations.html +254 -5
- package/docs/metadata.ParametricMap.html +254 -5
- package/docs/metadata.SOPClass.html +399 -0
- package/docs/metadata.Segmentation.html +254 -5
- package/docs/metadata.VLWholeSlideMicroscopyImage.html +255 -7
- package/docs/metadata.html +14 -32
- package/docs/metadata.js.html +55 -21
- package/docs/opticalPath.OpticalPath.html +453 -26
- package/docs/opticalPath.html +2 -2
- package/docs/opticalPath.js.html +16 -17
- package/docs/pyramid.js.html +2 -2
- package/docs/roi.ROI.html +317 -25
- package/docs/roi.html +2 -2
- package/docs/roi.js.html +26 -19
- package/docs/scoord3d.Ellipse.html +14 -18
- package/docs/scoord3d.Ellipsoid.html +14 -18
- package/docs/scoord3d.Multipoint.html +14 -18
- package/docs/scoord3d.Point.html +13 -17
- package/docs/scoord3d.Polygon.html +14 -18
- package/docs/scoord3d.Polyline.html +14 -18
- package/docs/scoord3d.Scoord3D.html +608 -0
- package/docs/scoord3d.html +5 -2
- package/docs/scoord3d.js.html +101 -54
- package/docs/segment.Segment.html +160 -48
- package/docs/segment.html +2 -2
- package/docs/segment.js.html +37 -33
- package/docs/utils.html +148 -4
- package/docs/utils.js.html +6 -6
- package/docs/viewer.LabelImageViewer.html +14 -15
- package/docs/viewer.OverviewImageViewer.html +15 -15
- package/docs/viewer.VolumeImageViewer.html +215 -282
- package/docs/viewer.html +2 -2
- package/docs/viewer.js.html +150 -133
- package/package.json +9 -8
- package/src/annotation.js +45 -32
- package/src/color.js +12 -12
- package/src/events.js +11 -2
- package/src/mapping.js +39 -30
- package/src/metadata.js +53 -19
- package/src/opticalPath.js +14 -15
- package/src/roi.js +24 -17
- package/src/scoord3d.js +99 -52
- package/src/segment.js +35 -31
- package/src/utils.js +4 -4
- package/src/viewer.js +148 -131
- package/webpack.config.js +11 -1
- package/build/33ef438573e49fde75eb.module.wasm +0 -0
- package/build/510fe8aff40dafc5b19b.module.wasm +0 -0
- package/build/713dba1fa973be4d97f4.module.wasm +0 -0
- package/build/86e23957894a6f373e11.module.wasm +0 -0
- package/build/c337ef929a626d7e5353.module.wasm +0 -0
- package/build/ce3907ececff7b46856f.wasm +0 -0
- package/build/dicom-microscopy-viewer.js +0 -2
- package/build/dicom-microscopy-viewer.js.map +0 -1
package/src/opticalPath.js
CHANGED
|
@@ -31,14 +31,13 @@ const _attrs = Symbol('_attrs')
|
|
|
31
31
|
* @memberof opticalPath
|
|
32
32
|
*/
|
|
33
33
|
class OpticalPath {
|
|
34
|
-
|
|
35
|
-
*
|
|
34
|
+
/**
|
|
36
35
|
* @param {Object} options - Options
|
|
37
36
|
* @param {string} options.identifier - Optical Path Identifier
|
|
38
37
|
* @param {string} options.description - Optical Path Description
|
|
39
|
-
* @param {
|
|
38
|
+
* @param {Object} options.illuminationType - Illumination Type Code
|
|
40
39
|
* @param {boolean} options.isMonochromatic - Whether optical path is monochromatic
|
|
41
|
-
* @param {
|
|
40
|
+
* @param {Object|undefined} options.illuminationColor - Illumination Color Code
|
|
42
41
|
* @param {string|undefined} options.illuminationWaveLength - Illumination Wave Length
|
|
43
42
|
* @param {string} options.studyInstanceUID - Study Instance UID of VL Whole Slide Microscopy Image instances
|
|
44
43
|
* @param {string} options.seriesInstanceUID - Series Instance UID of VL Whole Slide Microscopy Image instances
|
|
@@ -101,7 +100,7 @@ class OpticalPath {
|
|
|
101
100
|
/**
|
|
102
101
|
* Optical Path Identifier
|
|
103
102
|
*
|
|
104
|
-
* @
|
|
103
|
+
* @type string
|
|
105
104
|
*/
|
|
106
105
|
get identifier () {
|
|
107
106
|
return this[_attrs].identifier
|
|
@@ -110,7 +109,7 @@ class OpticalPath {
|
|
|
110
109
|
/**
|
|
111
110
|
* Optical Path Description
|
|
112
111
|
*
|
|
113
|
-
* @
|
|
112
|
+
* @type string
|
|
114
113
|
*/
|
|
115
114
|
get description () {
|
|
116
115
|
return this[_attrs].description
|
|
@@ -119,7 +118,7 @@ class OpticalPath {
|
|
|
119
118
|
/**
|
|
120
119
|
* Illumination Type Code
|
|
121
120
|
*
|
|
122
|
-
* @
|
|
121
|
+
* @type object
|
|
123
122
|
*/
|
|
124
123
|
get illuminationType () {
|
|
125
124
|
return this[_attrs].illuminationType
|
|
@@ -128,7 +127,7 @@ class OpticalPath {
|
|
|
128
127
|
/**
|
|
129
128
|
* Illumination Color
|
|
130
129
|
*
|
|
131
|
-
* @
|
|
130
|
+
* @type object
|
|
132
131
|
*/
|
|
133
132
|
get illuminationColor () {
|
|
134
133
|
return this[_attrs].illuminationColor
|
|
@@ -137,7 +136,7 @@ class OpticalPath {
|
|
|
137
136
|
/**
|
|
138
137
|
* Illumination Wave Length
|
|
139
138
|
*
|
|
140
|
-
* @
|
|
139
|
+
* @type string | undefined
|
|
141
140
|
*/
|
|
142
141
|
get illuminationWaveLength () {
|
|
143
142
|
return this[_attrs].illuminationWaveLength
|
|
@@ -146,7 +145,7 @@ class OpticalPath {
|
|
|
146
145
|
/**
|
|
147
146
|
* Study Instance UID of images
|
|
148
147
|
*
|
|
149
|
-
* @
|
|
148
|
+
* @type string
|
|
150
149
|
*/
|
|
151
150
|
get studyInstanceUID () {
|
|
152
151
|
return this[_attrs].studyInstanceUID
|
|
@@ -155,7 +154,7 @@ class OpticalPath {
|
|
|
155
154
|
/**
|
|
156
155
|
* Series Instance UID of images
|
|
157
156
|
*
|
|
158
|
-
* @
|
|
157
|
+
* @type string
|
|
159
158
|
*/
|
|
160
159
|
get seriesInstanceUID () {
|
|
161
160
|
return this[_attrs].seriesInstanceUID
|
|
@@ -164,7 +163,7 @@ class OpticalPath {
|
|
|
164
163
|
/**
|
|
165
164
|
* SOP Instance UIDs of images
|
|
166
165
|
*
|
|
167
|
-
* @
|
|
166
|
+
* @type string[]
|
|
168
167
|
*/
|
|
169
168
|
get sopInstanceUIDs () {
|
|
170
169
|
return this[_attrs].sopInstanceUIDs
|
|
@@ -173,7 +172,7 @@ class OpticalPath {
|
|
|
173
172
|
/**
|
|
174
173
|
* Palette Color Lookup Table UID
|
|
175
174
|
*
|
|
176
|
-
* @
|
|
175
|
+
* @type string
|
|
177
176
|
*/
|
|
178
177
|
get paletteColorLookupTableUID () {
|
|
179
178
|
return this[_attrs].paletteColorLookupTableUID
|
|
@@ -182,7 +181,7 @@ class OpticalPath {
|
|
|
182
181
|
/**
|
|
183
182
|
* Whether optical path is monochromatic
|
|
184
183
|
*
|
|
185
|
-
* @
|
|
184
|
+
* @type boolean
|
|
186
185
|
*/
|
|
187
186
|
get isMonochromatic () {
|
|
188
187
|
return this[_attrs].isMonochromatic
|
|
@@ -191,7 +190,7 @@ class OpticalPath {
|
|
|
191
190
|
/**
|
|
192
191
|
* Whether images of optical path are colorable
|
|
193
192
|
*
|
|
194
|
-
* @
|
|
193
|
+
* @type boolean
|
|
195
194
|
*/
|
|
196
195
|
get isColorable () {
|
|
197
196
|
return this[_attrs].paletteColorLookupTableUID == null
|
package/src/roi.js
CHANGED
|
@@ -11,10 +11,9 @@ const _properties = Symbol('properties')
|
|
|
11
11
|
* @memberof roi
|
|
12
12
|
*/
|
|
13
13
|
class ROI {
|
|
14
|
-
|
|
15
|
-
*
|
|
14
|
+
/**
|
|
16
15
|
* @param {Object} options - Options for construction of ROI
|
|
17
|
-
* @param {Scoord3D} options.scoord3d - Spatial 3D coordinates
|
|
16
|
+
* @param {scoord3d.Scoord3D} options.scoord3d - Spatial 3D coordinates
|
|
18
17
|
* @param {string} options.uid - Unique idenfifier
|
|
19
18
|
* @param {Object} options.properties - Properties (name-value pairs)
|
|
20
19
|
*/
|
|
@@ -50,59 +49,67 @@ class ROI {
|
|
|
50
49
|
this[_properties][Enums.InternalProperties.Evaluations] = []
|
|
51
50
|
this[_properties][Enums.InternalProperties.Measurements] = []
|
|
52
51
|
}
|
|
52
|
+
Object.freeze(this)
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
/**
|
|
55
|
+
/**
|
|
56
|
+
* Unique identifier of region of interest.
|
|
56
57
|
*
|
|
57
|
-
* @
|
|
58
|
+
* @type string
|
|
58
59
|
*/
|
|
59
60
|
get uid () {
|
|
60
61
|
return this[_uid]
|
|
61
62
|
}
|
|
62
63
|
|
|
63
|
-
/**
|
|
64
|
+
/**
|
|
65
|
+
* Spatial coordinates of region of interest.
|
|
64
66
|
*
|
|
65
|
-
* @
|
|
67
|
+
* @type scoord3d.Scoord3D
|
|
66
68
|
*/
|
|
67
69
|
get scoord3d () {
|
|
68
70
|
return this[_scoord3d]
|
|
69
71
|
}
|
|
70
72
|
|
|
71
|
-
/**
|
|
73
|
+
/**
|
|
74
|
+
* Properties of region of interest.
|
|
72
75
|
*
|
|
73
|
-
* @
|
|
76
|
+
* @type Object
|
|
74
77
|
*/
|
|
75
78
|
get properties () {
|
|
76
79
|
return this[_properties]
|
|
77
80
|
}
|
|
78
81
|
|
|
79
|
-
/**
|
|
82
|
+
/**
|
|
83
|
+
* Measurements of region of interest.
|
|
80
84
|
*
|
|
81
|
-
* @
|
|
85
|
+
* @type Object[]
|
|
82
86
|
*/
|
|
83
87
|
get measurements () {
|
|
84
88
|
return this[_properties].measurements
|
|
85
89
|
}
|
|
86
90
|
|
|
87
|
-
/**
|
|
91
|
+
/**
|
|
92
|
+
* Qualitative evaluations of region of interest.
|
|
88
93
|
*
|
|
89
|
-
* @
|
|
94
|
+
* @type Object[]
|
|
90
95
|
*/
|
|
91
96
|
get evaluations () {
|
|
92
97
|
return this[_properties].evaluations
|
|
93
98
|
}
|
|
94
99
|
|
|
95
|
-
/**
|
|
100
|
+
/**
|
|
101
|
+
* Add a measurement.
|
|
96
102
|
*
|
|
97
|
-
* @
|
|
103
|
+
* @param {Object} item - NUM content item representing a measurement
|
|
98
104
|
*/
|
|
99
105
|
addMeasurement (item) {
|
|
100
106
|
this[_properties][Enums.InternalProperties.Measurements].push(item)
|
|
101
107
|
}
|
|
102
108
|
|
|
103
|
-
/**
|
|
109
|
+
/**
|
|
110
|
+
* Add a qualitative evaluation.
|
|
104
111
|
*
|
|
105
|
-
* @
|
|
112
|
+
* @param {Object} item - CODE content item representing a qualitative evaluation
|
|
106
113
|
*/
|
|
107
114
|
addEvaluation (item) {
|
|
108
115
|
this[_properties][Enums.InternalProperties.Evaluations].push(item)
|
package/src/scoord3d.js
CHANGED
|
@@ -4,26 +4,43 @@ const _coordinates = Symbol('coordinates')
|
|
|
4
4
|
const _frameOfReferenceUID = Symbol('frameOfReferenceUID')
|
|
5
5
|
const _fiducialUID = Symbol('fiducialUID')
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* 3D spatial coordinates.
|
|
9
|
+
*
|
|
10
|
+
* @class
|
|
11
|
+
* @abstract
|
|
12
|
+
* @memberof scoord3d
|
|
13
|
+
*/
|
|
7
14
|
class Scoord3D {
|
|
15
|
+
/**
|
|
16
|
+
* @param {Object} options - Options
|
|
17
|
+
* @param {string} options.frameOfReferenceUID - Frame of Reference UID
|
|
18
|
+
* @param {number[][]} options.coordinates - (x, y, z) coordinates for
|
|
19
|
+
* each point
|
|
20
|
+
* @param {string} options.fiducialUID - Fiducial UID
|
|
21
|
+
*/
|
|
8
22
|
constructor (options) {
|
|
9
23
|
if (!(typeof options.frameOfReferenceUID === 'string' ||
|
|
10
24
|
options.frameOfReferenceUID instanceof String)) {
|
|
11
|
-
throw new Error(
|
|
25
|
+
throw new Error(
|
|
26
|
+
'Argument "frameOfReferenceUID" of Scoord3D must be a string.'
|
|
27
|
+
)
|
|
12
28
|
}
|
|
13
29
|
this[_frameOfReferenceUID] = options.frameOfReferenceUID
|
|
14
30
|
options.fiducialUID = options.fiducialUID || _generateUID()
|
|
15
31
|
if (!(typeof options.fiducialUID === 'string' ||
|
|
16
32
|
options.fiducialUID instanceof String)) {
|
|
17
|
-
throw new Error('fiducialUID of Scoord3D must be a string')
|
|
33
|
+
throw new Error('Argument "fiducialUID" of Scoord3D must be a string.')
|
|
18
34
|
}
|
|
19
35
|
this[_fiducialUID] = options.fiducialUID
|
|
20
36
|
if (!Array.isArray(options.coordinates)) {
|
|
21
|
-
throw new Error('coordinates of Scoord3D must be an array')
|
|
37
|
+
throw new Error('Argument "coordinates" of Scoord3D must be an array.')
|
|
22
38
|
}
|
|
23
39
|
this[_coordinates] = options.coordinates
|
|
24
40
|
}
|
|
25
41
|
|
|
26
|
-
/**
|
|
42
|
+
/**
|
|
43
|
+
* Graphic Data
|
|
27
44
|
*
|
|
28
45
|
* @type {number[][]}
|
|
29
46
|
*/
|
|
@@ -31,7 +48,8 @@ class Scoord3D {
|
|
|
31
48
|
return this[_coordinates]
|
|
32
49
|
}
|
|
33
50
|
|
|
34
|
-
/**
|
|
51
|
+
/**
|
|
52
|
+
* Graphic Type
|
|
35
53
|
*
|
|
36
54
|
* @type {string}
|
|
37
55
|
*/
|
|
@@ -39,7 +57,8 @@ class Scoord3D {
|
|
|
39
57
|
throw new Error('Prototype property "graphicType" must be implemented')
|
|
40
58
|
}
|
|
41
59
|
|
|
42
|
-
/**
|
|
60
|
+
/**
|
|
61
|
+
* Frame of Reference UID
|
|
43
62
|
*
|
|
44
63
|
* @type {string}
|
|
45
64
|
*/
|
|
@@ -47,7 +66,8 @@ class Scoord3D {
|
|
|
47
66
|
return this[_frameOfReferenceUID]
|
|
48
67
|
}
|
|
49
68
|
|
|
50
|
-
/**
|
|
69
|
+
/**
|
|
70
|
+
* Fiducial UID
|
|
51
71
|
*
|
|
52
72
|
* @type {string}
|
|
53
73
|
*/
|
|
@@ -56,15 +76,15 @@ class Scoord3D {
|
|
|
56
76
|
}
|
|
57
77
|
}
|
|
58
78
|
|
|
59
|
-
/**
|
|
79
|
+
/**
|
|
80
|
+
* POINT graphic denoted by a single (x, y, z) triplet.
|
|
60
81
|
*
|
|
61
82
|
* @class
|
|
62
|
-
* @extends Scoord3D
|
|
83
|
+
* @extends scoord3d.Scoord3D
|
|
63
84
|
* @memberof scoord3d
|
|
64
85
|
*/
|
|
65
86
|
class Point extends Scoord3D {
|
|
66
|
-
/**
|
|
67
|
-
*
|
|
87
|
+
/**
|
|
68
88
|
* @param {Object} options
|
|
69
89
|
* @param {string} options.frameOfReferenceUID - Unique identifier of the Frame of Reference
|
|
70
90
|
* @param {number[]} options.coordinates - X, Y and Z coordinate.
|
|
@@ -72,10 +92,12 @@ class Point extends Scoord3D {
|
|
|
72
92
|
*/
|
|
73
93
|
constructor (options) {
|
|
74
94
|
if (!Array.isArray(options.coordinates)) {
|
|
75
|
-
throw new Error('coordinates of Point must be an array')
|
|
95
|
+
throw new Error('Argument "coordinates" of Point must be an array.')
|
|
76
96
|
}
|
|
77
97
|
if (options.coordinates.length !== 3) {
|
|
78
|
-
throw new Error(
|
|
98
|
+
throw new Error(
|
|
99
|
+
'Argument "coordinates" of Point must be an array of length 3.'
|
|
100
|
+
)
|
|
79
101
|
}
|
|
80
102
|
if (options.coordinates.some(c => c < 0)) {
|
|
81
103
|
console.warn('coordinates of Point are negative numbers')
|
|
@@ -85,6 +107,7 @@ class Point extends Scoord3D {
|
|
|
85
107
|
frameOfReferenceUID: options.frameOfReferenceUID,
|
|
86
108
|
fiducialUID: options.fiducialUID
|
|
87
109
|
})
|
|
110
|
+
Object.freeze(this)
|
|
88
111
|
}
|
|
89
112
|
|
|
90
113
|
/** Graphic Data
|
|
@@ -100,36 +123,40 @@ class Point extends Scoord3D {
|
|
|
100
123
|
}
|
|
101
124
|
}
|
|
102
125
|
|
|
103
|
-
/**
|
|
126
|
+
/**
|
|
127
|
+
* MULTIPOINT graphic denoted by multiple, coplanar (x, y, z) coordinates that
|
|
104
128
|
* represent individual points.
|
|
105
129
|
*
|
|
106
130
|
* @class
|
|
107
|
-
* @extends Scoord3D
|
|
131
|
+
* @extends scoord3d.Scoord3D
|
|
108
132
|
* @memberof scoord3d
|
|
109
133
|
*/
|
|
110
134
|
class Multipoint extends Scoord3D {
|
|
111
|
-
/**
|
|
112
|
-
*
|
|
135
|
+
/**
|
|
113
136
|
* @param {Object} options
|
|
114
137
|
* @param {string} options.frameOfReferenceUID - Unique identifier of the Frame of Reference
|
|
115
|
-
* @param {number[][]} options.coordinates -
|
|
138
|
+
* @param {number[][]} options.coordinates - (x, y, z) coordinates of each point.
|
|
116
139
|
* @param {string} [options.fiducialUID] - Unique identifier of an imaging fiducial
|
|
117
140
|
*/
|
|
118
141
|
constructor (options) {
|
|
119
142
|
if (!Array.isArray(options.coordinates)) {
|
|
120
|
-
throw new Error('coordinates of Multipoint must be an array')
|
|
143
|
+
throw new Error('Argument "coordinates" of Multipoint must be an array.')
|
|
121
144
|
}
|
|
122
145
|
if (options.coordinates.find(c => c.length !== 3) !== undefined) {
|
|
123
|
-
throw new Error(
|
|
146
|
+
throw new Error(
|
|
147
|
+
'Argument "coordinates" of Multipoint must be an array of ' +
|
|
148
|
+
'(x, y, z) triplets.'
|
|
149
|
+
)
|
|
124
150
|
}
|
|
125
151
|
if (options.coordinates.find(c => c.some(item => item < 0))) {
|
|
126
|
-
console.warn('coordinates of Multipoint contain
|
|
152
|
+
console.warn('coordinates of Multipoint contain negative numbers')
|
|
127
153
|
}
|
|
128
154
|
super({
|
|
129
155
|
coordinates: options.coordinates,
|
|
130
156
|
frameOfReferenceUID: options.frameOfReferenceUID,
|
|
131
157
|
fiducialUID: options.fiducialUID
|
|
132
158
|
})
|
|
159
|
+
Object.freeze(this)
|
|
133
160
|
}
|
|
134
161
|
|
|
135
162
|
get graphicType () {
|
|
@@ -137,27 +164,30 @@ class Multipoint extends Scoord3D {
|
|
|
137
164
|
}
|
|
138
165
|
}
|
|
139
166
|
|
|
140
|
-
/**
|
|
167
|
+
/**
|
|
168
|
+
* POLYLINE graphic denoted by multiple, ordered (x, y, z) coordinates that
|
|
141
169
|
* represent vertices of connected line segments.
|
|
142
170
|
*
|
|
143
171
|
* @class
|
|
144
|
-
* @extends Scoord3D
|
|
172
|
+
* @extends scoord3d.Scoord3D
|
|
145
173
|
* @memberof scoord3d
|
|
146
174
|
*/
|
|
147
175
|
class Polyline extends Scoord3D {
|
|
148
|
-
/**
|
|
149
|
-
*
|
|
176
|
+
/**
|
|
150
177
|
* @param {Object} options
|
|
151
178
|
* @param {string} options.frameOfReferenceUID - Unique identifier of the Frame of Reference
|
|
152
|
-
* @param {number[][]} options.coordinates - (
|
|
179
|
+
* @param {number[][]} options.coordinates - (x, y, z) coordinates of point on the line
|
|
153
180
|
* @param {string} [options.fiducialUID] - Unique identifier of an imaging fiducial
|
|
154
181
|
*/
|
|
155
182
|
constructor (options) {
|
|
156
183
|
if (!Array.isArray(options.coordinates)) {
|
|
157
|
-
throw new Error('coordinates of Polyline must be an array')
|
|
184
|
+
throw new Error('Argument "coordinates" of Polyline must be an array.')
|
|
158
185
|
}
|
|
159
186
|
if (options.coordinates.find(c => c.length !== 3) !== undefined) {
|
|
160
|
-
throw new Error(
|
|
187
|
+
throw new Error(
|
|
188
|
+
'Argument "coordinates" of Polyline must be an array of ' +
|
|
189
|
+
'(x, y, z) triplets.'
|
|
190
|
+
)
|
|
161
191
|
}
|
|
162
192
|
if (options.coordinates.find(c => c.some(item => item < 0))) {
|
|
163
193
|
console.warn('coordinates of Polyline contain negative numbers')
|
|
@@ -167,6 +197,7 @@ class Polyline extends Scoord3D {
|
|
|
167
197
|
frameOfReferenceUID: options.frameOfReferenceUID,
|
|
168
198
|
fiducialUID: options.fiducialUID
|
|
169
199
|
})
|
|
200
|
+
Object.freeze(this)
|
|
170
201
|
}
|
|
171
202
|
|
|
172
203
|
get graphicType () {
|
|
@@ -174,28 +205,31 @@ class Polyline extends Scoord3D {
|
|
|
174
205
|
}
|
|
175
206
|
}
|
|
176
207
|
|
|
177
|
-
/**
|
|
208
|
+
/**
|
|
209
|
+
* POLYGON graphic denoted by multiple, ordered, coplaner (x, y, z) coordinates
|
|
178
210
|
* that represent vertices of connected line segments.
|
|
179
211
|
* The first and last coordinate should be identical.
|
|
180
212
|
*
|
|
181
213
|
* @class
|
|
182
|
-
* @extends Scoord3D
|
|
214
|
+
* @extends scoord3d.Scoord3D
|
|
183
215
|
* @memberof scoord3d
|
|
184
216
|
*/
|
|
185
217
|
class Polygon extends Scoord3D {
|
|
186
|
-
/**
|
|
187
|
-
*
|
|
218
|
+
/**
|
|
188
219
|
* @param {Object} options
|
|
189
220
|
* @param {string} options.frameOfReferenceUID - Unique identifier of the Frame of Reference
|
|
190
|
-
* @param {number[][]} options.coordinates - (
|
|
221
|
+
* @param {number[][]} options.coordinates - (x, y, z) coordinates of points on the perimeter of the polygon (first and last coordinate must be the same).
|
|
191
222
|
* @param {string} [options.fiducialUID] - Unique identifier of an imaging fiducial
|
|
192
223
|
*/
|
|
193
224
|
constructor (options) {
|
|
194
225
|
if (!Array.isArray(options.coordinates)) {
|
|
195
|
-
throw new Error('coordinates of Polygon must be an array')
|
|
226
|
+
throw new Error('Argument "coordinates" of Polygon must be an array.')
|
|
196
227
|
}
|
|
197
228
|
if (options.coordinates.find(c => c.length !== 3) !== undefined) {
|
|
198
|
-
throw new Error(
|
|
229
|
+
throw new Error(
|
|
230
|
+
'Argument "coordinates" of Polygon must be an array of ' +
|
|
231
|
+
'(x, y, z) triplets.'
|
|
232
|
+
)
|
|
199
233
|
}
|
|
200
234
|
if (options.coordinates.find(c => c.some(item => item < 0))) {
|
|
201
235
|
console.warn('coordinates of Polygon contain negative numbers')
|
|
@@ -204,13 +238,14 @@ class Polygon extends Scoord3D {
|
|
|
204
238
|
if ((options.coordinates[0][0] !== options.coordinates[n - 1][0]) ||
|
|
205
239
|
(options.coordinates[0][1] !== options.coordinates[n - 1][1]) ||
|
|
206
240
|
(options.coordinates[0][2] !== options.coordinates[n - 1][2])) {
|
|
207
|
-
throw new Error('
|
|
241
|
+
throw new Error('First and last coordinate of Polygon must be the same.')
|
|
208
242
|
}
|
|
209
243
|
super({
|
|
210
244
|
coordinates: options.coordinates,
|
|
211
245
|
frameOfReferenceUID: options.frameOfReferenceUID,
|
|
212
246
|
fiducialUID: options.fiducialUID
|
|
213
247
|
})
|
|
248
|
+
Object.freeze(this)
|
|
214
249
|
}
|
|
215
250
|
|
|
216
251
|
get graphicType () {
|
|
@@ -218,33 +253,38 @@ class Polygon extends Scoord3D {
|
|
|
218
253
|
}
|
|
219
254
|
}
|
|
220
255
|
|
|
221
|
-
/**
|
|
256
|
+
/**
|
|
257
|
+
* ELLIPSOID graphic denoted by six (x, y, z) coordinates that represent
|
|
222
258
|
* endpoints of the three orthogonal geometric axes, where the first and second
|
|
223
259
|
* coordinates represent the endpoints of the first axis, the third and forth
|
|
224
260
|
* coordinates represent the endpoints of the second axis and the fifth and
|
|
225
261
|
* sixth coordinates represent the endpoints of the third axis.
|
|
226
262
|
*
|
|
227
263
|
* @class
|
|
228
|
-
* @extends Scoord3D
|
|
264
|
+
* @extends scoord3d.Scoord3D
|
|
229
265
|
* @memberof scoord3d
|
|
230
266
|
*/
|
|
231
267
|
class Ellipsoid extends Scoord3D {
|
|
232
|
-
/**
|
|
233
|
-
*
|
|
268
|
+
/**
|
|
234
269
|
* @param {Object} options
|
|
235
270
|
* @param {string} options.frameOfReferenceUID - Unique identifier of the Frame of Reference
|
|
236
|
-
* @param {number[][]} options.coordinates - (
|
|
271
|
+
* @param {number[][]} options.coordinates - (x, y, z) coordinates of the three axes endpoints
|
|
237
272
|
* @param {string} [options.fiducialUID] - Unique identifier of an imaging fiducial
|
|
238
273
|
*/
|
|
239
274
|
constructor (options) {
|
|
240
275
|
if (!Array.isArray(options.coordinates)) {
|
|
241
|
-
throw new Error('coordinates of Ellipsoid must be an array')
|
|
276
|
+
throw new Error('Argument "coordinates" of Ellipsoid must be an array.')
|
|
242
277
|
}
|
|
243
278
|
if (options.coordinates.length !== 6) {
|
|
244
|
-
throw new Error(
|
|
279
|
+
throw new Error(
|
|
280
|
+
'Argument "coordinates" of Ellipsoid must be an array of length 6.'
|
|
281
|
+
)
|
|
245
282
|
}
|
|
246
283
|
if (options.coordinates.find(c => c.length !== 3) !== undefined) {
|
|
247
|
-
throw new Error(
|
|
284
|
+
throw new Error(
|
|
285
|
+
'Argument "coordinates" of Ellipsoid must be an array of ' +
|
|
286
|
+
'(x, y, z) triplets.'
|
|
287
|
+
)
|
|
248
288
|
}
|
|
249
289
|
if (options.coordinates.find(c => c.some(item => item < 0))) {
|
|
250
290
|
console.warn('coordinates of Ellipsoid contain negative numbers')
|
|
@@ -254,6 +294,7 @@ class Ellipsoid extends Scoord3D {
|
|
|
254
294
|
frameOfReferenceUID: options.frameOfReferenceUID,
|
|
255
295
|
fiducialUID: options.fiducialUID
|
|
256
296
|
})
|
|
297
|
+
Object.freeze(this)
|
|
257
298
|
}
|
|
258
299
|
|
|
259
300
|
get graphicType () {
|
|
@@ -261,32 +302,37 @@ class Ellipsoid extends Scoord3D {
|
|
|
261
302
|
}
|
|
262
303
|
}
|
|
263
304
|
|
|
264
|
-
/**
|
|
305
|
+
/**
|
|
306
|
+
* ELLIPSE graphic denoted by four, coplaner (x, y, z) coordinates that represent
|
|
265
307
|
* the endpoints of the major and minor axes, where the first and second
|
|
266
308
|
* coordinates represent the endpoints of the major axis and the third and
|
|
267
309
|
* forth coordinates represent the endpoints of the minor axis.
|
|
268
310
|
*
|
|
269
311
|
* @class
|
|
270
|
-
* @extends Scoord3D
|
|
312
|
+
* @extends scoord3d.Scoord3D
|
|
271
313
|
* @memberof scoord3d
|
|
272
314
|
*/
|
|
273
315
|
class Ellipse extends Scoord3D {
|
|
274
|
-
/**
|
|
275
|
-
*
|
|
316
|
+
/**
|
|
276
317
|
* @param {Object} options
|
|
277
318
|
* @param {string} options.frameOfReferenceUID - Unique identifier of the Frame of Reference
|
|
278
|
-
* @param {number[][]} options.coordinates - (
|
|
319
|
+
* @param {number[][]} options.coordinates - (x, y, z) coordinates of the major and minor axes endpoints
|
|
279
320
|
* @param {string} [options.fiducialUID] - Unique identifier of an imaging fiducial
|
|
280
321
|
*/
|
|
281
322
|
constructor (options) {
|
|
282
323
|
if (!Array.isArray(options.coordinates)) {
|
|
283
|
-
throw new Error('coordinates of Ellipse must be an array')
|
|
324
|
+
throw new Error('Argument "coordinates" of Ellipse must be an array.')
|
|
284
325
|
}
|
|
285
326
|
if (options.coordinates.length !== 4) {
|
|
286
|
-
throw new Error(
|
|
327
|
+
throw new Error(
|
|
328
|
+
'Argument "coordinates" of Ellipse must be an array of length 4.'
|
|
329
|
+
)
|
|
287
330
|
}
|
|
288
331
|
if (options.coordinates.find(c => c.length !== 3) !== undefined) {
|
|
289
|
-
throw new Error(
|
|
332
|
+
throw new Error(
|
|
333
|
+
'Argument "coordinates" of Ellipse must be an array of ' +
|
|
334
|
+
'(x, y, z) triplets.'
|
|
335
|
+
)
|
|
290
336
|
}
|
|
291
337
|
if (options.coordinates.find(c => c.some(item => item < 0))) {
|
|
292
338
|
console.warn('coordinates of Ellipse contain negative numbers')
|
|
@@ -325,6 +371,7 @@ class Ellipse extends Scoord3D {
|
|
|
325
371
|
frameOfReferenceUID: options.frameOfReferenceUID,
|
|
326
372
|
fiducialUID: options.fiducialUID
|
|
327
373
|
})
|
|
374
|
+
Object.freeze(this)
|
|
328
375
|
}
|
|
329
376
|
|
|
330
377
|
get graphicType () {
|