diff --git a/src/ui/nehubaContainer/nehubaContainer.component.ts b/src/ui/nehubaContainer/nehubaContainer.component.ts index 1ee340abf89b2ba8295496df670f52e0bb0c9c33..275b2ffa11670602c525558b0ca01fec7547cb84 100644 --- a/src/ui/nehubaContainer/nehubaContainer.component.ts +++ b/src/ui/nehubaContainer/nehubaContainer.component.ts @@ -516,6 +516,8 @@ export class NehubaContainer implements OnInit, OnChanges, OnDestroy { this.selectedParcellation$.subscribe((this.handleParcellation).bind(this)), ) + let prevParcellation = null + this.subscriptions.push( combineLatest( @@ -538,13 +540,16 @@ export class NehubaContainer implements OnInit, OnChanges, OnDestroy { const { ngId: defaultNgId } = selectedParcellation /* selectedregionindexset needs to be updated regardless of forceshowsegment */ - this.selectedRegionIndexSet = new Set(regions.map(({ngId = defaultNgId, labelIndex}) => generateLabelIndexId({ ngId, labelIndex }))) + this.selectedRegionIndexSet = !prevParcellation || prevParcellation === selectedParcellation? + new Set(regions.map(({ngId = defaultNgId, labelIndex}) => generateLabelIndexId({ ngId, labelIndex }))) : new Set() if ( forceShowSegment === false || (forceShowSegment === null && hideSegmentFlag) ) { this.nehubaViewer.hideAllSeg() return } + prevParcellation = selectedParcellation + this.selectedRegionIndexSet.size > 0 ? this.nehubaViewer.showSegs([...this.selectedRegionIndexSet]) : this.nehubaViewer.showAllSeg()