22 * Spatial coordinates of a geometric region of interest (ROI) in the DICOM
33 * image coordinate system.
44 */
5+ const _coordinates = Symbol ( 'coordinates' )
6+ const _majorAxisEndpointCoordinates = Symbol ( 'majorAxisEndpointCoordinates' )
7+ const _minorAxisEndpointCoordinates = Symbol ( 'minorAxisEndpointCoordinates' )
8+ const _centerCoordinates = Symbol ( 'centerCoordinates' )
9+ const _radius = Symbol ( 'radius' )
10+
511class Scoord3D {
612
713 constructor ( ) { }
814
915 get graphicData ( ) {
10- throw new Error ( 'Propotype property "graphicData" must be implemented.' ) ;
16+ throw new Error ( 'Propotype property "graphicData" must be implemented.' )
1117 }
1218
1319 get graphicType ( ) {
14- throw new Error ( 'Propotype property "graphicType" must be implemented.' ) ;
20+ throw new Error ( 'Propotype property "graphicType" must be implemented.' )
1521 }
1622
1723 get referencedFrameOfReferenceUID ( ) {
18- throw new Error ( 'Propotype property "referencedFrameOfReferenceUID" must be implemented.' ) ;
24+ throw new Error ( 'Propotype property "referencedFrameOfReferenceUID" must be implemented.' )
1925 }
2026
2127 get fiducialUID ( ) {
22- throw new Error ( 'Propotype property "fiducialUID" must be implemented.' ) ;
28+ throw new Error ( 'Propotype property "fiducialUID" must be implemented.' )
2329 }
2430
2531}
2632
2733class Point extends Scoord3D {
28-
34+
35+
2936 constructor ( coordinates ) {
3037 super ( )
3138 if ( ! Array . isArray ( coordinates ) ) {
@@ -34,15 +41,15 @@ class Point extends Scoord3D {
3441 if ( coordinates . length !== 3 ) {
3542 throw new Error ( 'coordinates of Point must be an array of length 3' )
3643 }
37- this . coordinates = coordinates ;
44+ this [ _coordinates ] = coordinates
3845 }
3946
4047 get graphicData ( ) {
41- return this . coordinates ;
48+ return this [ _coordinates ]
4249 }
4350
4451 get graphicType ( ) {
45- return 'POINT' ;
52+ return 'POINT'
4653 }
4754
4855}
@@ -57,15 +64,15 @@ class Multipoint extends Scoord3D {
5764 if ( coordinates . find ( c => c . length !== 3 ) !== undefined ) {
5865 throw new Error ( 'coordinates of Multipoint must be an array of length 3' )
5966 }
60- this . coordinates = coordinates
67+ this [ _coordinates ] = coordinates
6168 }
6269
6370 get graphicData ( ) {
64- return this . coordinates ;
71+ return this [ _coordinates ]
6572 }
6673
6774 get graphicType ( ) {
68- return 'MULTIPOINT' ;
75+ return 'MULTIPOINT'
6976 }
7077
7178}
@@ -80,7 +87,7 @@ class Polyline extends Scoord3D {
8087 if ( coordinates . find ( c => c . length !== 3 ) !== undefined ) {
8188 throw new Error ( 'coordinates of Polyline must be a list of points of length 3' )
8289 }
83- this . coordinates = coordinates
90+ this [ _coordinates ] = coordinates
8491 }
8592
8693 get graphicData ( ) {
@@ -89,11 +96,11 @@ class Polyline extends Scoord3D {
8996 * with ordered vertices denoted by (column,row) pairs.
9097 * If the first and last vertices are the same it is a closed polygon.
9198 */
92- return this . coordinates ;
99+ return this [ _coordinates ]
93100 }
94101
95102 get graphicType ( ) {
96- return 'POLYLINE' ;
103+ return 'POLYLINE'
97104 }
98105
99106}
@@ -108,20 +115,20 @@ class Polygon extends Scoord3D {
108115 if ( coordinates . find ( c => c . length !== 3 ) !== undefined ) {
109116 throw new Error ( 'coordinates of Polygon must be a list of points of length 3' )
110117 }
111- this . coordinates = coordinates
118+ this [ _coordinates ] = coordinates
112119 }
113120
114121 get graphicData ( ) {
115122 /*
116123 * A polygon is defined a series of connected line segments with ordered vertices
117124 * denoted by (x,y,z) triplets, where the first and last vertices shall be the same
118- * forming a polygon; the points shall be coplanar
125+ * forming a polygon the points shall be coplanar
119126 */
120- return this . coordinates ;
127+ return this [ _coordinates ]
121128 }
122129
123130 get graphicType ( ) {
124- return 'POLYGON' ;
131+ return 'POLYGON'
125132 }
126133
127134}
@@ -139,8 +146,8 @@ class Circle extends Scoord3D {
139146 if ( radius === undefined ) {
140147 throw new Error ( 'radius has to be defined' )
141148 }
142- this . centerCoordinates = centerCoordinates
143- this . radius = radius
149+ this [ _centerCoordinates ] = centerCoordinates
150+ this [ _radius ] = radius
144151 }
145152
146153 get graphicData ( ) {
@@ -150,12 +157,12 @@ class Circle extends Scoord3D {
150157 * The second point is a pixel on the perimeter of the circle.
151158 */
152159 return [
153- this . centerCoordinates ,
154- [ this . centerCoordinates [ 0 ] , this . centerCoordinates [ 1 ] + this . radius , 1 ] ] ;
160+ this [ _centerCoordinates ] ,
161+ [ this [ _centerCoordinates [ 0 ] ] , this [ _centerCoordinates [ 1 ] ] + this [ _radius ] , 1 ] ]
155162 }
156163
157164 get graphicType ( ) {
158- return 'CIRCLE' ;
165+ return 'CIRCLE'
159166 }
160167
161168}
@@ -176,8 +183,8 @@ class Ellipse extends Scoord3D {
176183 if ( minorAxisEndpointCoordinates . length !== 2 ) {
177184 throw new Error ( 'minorAxisEndpointCoordinates coordinates of Ellipse must be an array of length 2' )
178185 }
179- this . majorAxisEndpointCoordinates = majorAxisEndpointCoordinates
180- this . minorAxisEndpointCoordinates = minorAxisEndpointCoordinates
186+ this [ _majorAxisEndpointCoordinates ] = majorAxisEndpointCoordinates
187+ this [ _minorAxisEndpointCoordinates ] = minorAxisEndpointCoordinates
181188 }
182189
183190 get graphicData ( ) {
@@ -187,16 +194,16 @@ class Ellipse extends Scoord3D {
187194 * The second two points specify the endpoints of the minor axis.
188195 */
189196 return [
190- ...this . majorAxisEndpointCoordinates ,
191- ...this . minorAxisEndpointCoordinates
192- ] ;
197+ ...this [ _majorAxisEndpointCoordinates ] ,
198+ ...this [ _minorAxisEndpointCoordinates ]
199+ ]
193200 }
194201
195202 get graphicType ( ) {
196- return 'ELLIPSE' ;
203+ return 'ELLIPSE'
197204 }
198205
199206}
200207
201- export { Point , Multipoint , Polyline , Polygon , Circle , Ellipse } ;
208+ export { Point , Multipoint , Polyline , Polygon , Circle , Ellipse }
202209
0 commit comments