File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -439,6 +439,23 @@ export default class View2D extends Component {
439439 ) {
440440 this . subs . labelmap . unsubscribe ( ) ;
441441
442+ // Remove actors.
443+ if ( this . labelmap && this . labelmap . actor ) {
444+ this . renderer . removeVolume ( this . labelmap . actor ) ;
445+
446+ if ( this . api ) {
447+ const { actors } = this . api ;
448+
449+ const index = actors . findIndex (
450+ actor => actor === this . labelmap . actor
451+ ) ;
452+
453+ if ( index !== - 1 ) {
454+ actors . splice ( index , 1 ) ;
455+ }
456+ }
457+ }
458+
442459 const labelmapImageData = this . props . paintFilterLabelMapImageData ;
443460
444461 const labelmap = createLabelPipeline (
@@ -449,6 +466,15 @@ export default class View2D extends Component {
449466
450467 this . labelmap = labelmap ;
451468
469+ // Add actors.
470+ if ( this . labelmap && this . labelmap . actor ) {
471+ this . renderer . addVolume ( this . labelmap . actor ) ;
472+
473+ if ( this . api ) {
474+ this . api . actors = this . api . actors . concat ( this . labelmap . actor ) ;
475+ }
476+ }
477+
452478 labelmap . mapper . setInputConnection ( this . paintFilter . getOutputPort ( ) ) ;
453479
454480 // You can update the labelmap externally just by calling modified()
You can’t perform that action at this time.
0 commit comments