File tree Expand file tree Collapse file tree 1 file changed +19
-6
lines changed Expand file tree Collapse file tree 1 file changed +19
-6
lines changed Original file line number Diff line number Diff line change 11import { generateUID } from './utils.js' ;
22
3+ const _uid = Symbol ( 'uid' ) ;
4+ const _scoord3d = Symbol ( 'scoord3d' ) ;
35
46/* Region of interest.
57 */
@@ -11,18 +13,29 @@ class ROI {
1113 */
1214 constructor ( options ) {
1315 if ( ! ( 'scoord3d' in options ) ) {
14- console . error ( 'spatial coordinates are required for ROI' )
16+ throw new Error ( 'spatial coordinates are required for ROI' )
17+ }
18+ if ( ! ( typeof ( options . scoord3d ) === 'object' || options . scoord3d !== null ) ) {
19+ throw new Error ( 'scoord3d of ROI must be a Scoord3D object' )
1520 }
1621 if ( ! ( 'uid' in options ) ) {
17- this . uid = generateUID ( ) ;
22+ this [ _uid ] = generateUID ( ) ;
1823 } else {
19- if ( ! ( typeof options . uid === 'string' || options . uid instanceof String ) ) {
24+ if ( ! ( typeof ( options . uid ) === 'string' || options . uid instanceof String ) ) {
2025 throw new Error ( 'uid of ROI must be a string' )
2126 }
22- this . uid = options . uid ;
27+ this [ _uid ] = options . uid ;
2328 }
24- this . scoord3d = options . scoord3d ;
25- this . properties = options . properties ? options . properties : { } ;
29+ this [ _scoord3d ] = options . scoord3d ;
30+ // TODO: store SOPInstanceUID, SOPClassUID and FrameNumbers as reference
31+ }
32+
33+ get uid ( ) {
34+ return this [ _uid ] ;
35+ }
36+
37+ get scoord3d ( ) {
38+ return this [ _scoord3d ] ;
2639 }
2740
2841}
You can’t perform that action at this time.
0 commit comments