File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -2733,7 +2733,20 @@ class VolumeImageViewer {
27332733 * @param {number[] } styleOptions.fill.color - RGBA color of the body
27342734 */
27352735 addROI ( roi , styleOptions = { } ) {
2736- console . info ( `add ROI ${ roi . uid } ` )
2736+ console . info ( `add ROI "${ roi . uid } "` )
2737+
2738+ // Avoid insertion of duplicates
2739+ let exists = false
2740+ for ( let i = 0 ; i < this [ _features ] . getLength ( ) ; i ++ ) {
2741+ const feature = this [ _features ] . item ( i )
2742+ if ( feature . getId ( ) === roi . uid ) {
2743+ exists = true
2744+ break
2745+ }
2746+ }
2747+ if ( exists ) {
2748+ console . warn ( `ROI "${ roi . uid } " not added because it already exists` )
2749+ }
27372750
27382751 const frameOfReferenceUID = this [ _pyramid ] . metadata . FrameOfReferenceUID
27392752 if ( roi . frameOfReferenceUID !== frameOfReferenceUID ) {
You can’t perform that action at this time.
0 commit comments