@@ -11,8 +11,11 @@ import vtkSVGWidgetManager from './vtkSVGWidgetManager';
1111import ViewportOverlay from '../ViewportOverlay/ViewportOverlay.js' ;
1212import { ViewTypes } from 'vtk.js/Sources/Widgets/Core/WidgetManager/Constants' ;
1313import { createSub } from '../lib/createSub.js' ;
14+ import realsApproximatelyEqual from '../lib/math/realsApproximatelyEqual' ;
1415import createLabelPipeline from './createLabelPipeline' ;
1516
17+ const minSlabThickness = 0.1 ; // TODO -> Should this be configurable or not?
18+
1619export default class View2D extends Component {
1720 static propTypes = {
1821 volumes : PropTypes . array . isRequired ,
@@ -27,10 +30,14 @@ export default class View2D extends Component {
2730 onCreated : PropTypes . func ,
2831 onDestroyed : PropTypes . func ,
2932 orientation : PropTypes . object ,
33+ labelmapRenderingOptions : PropTypes . object ,
3034 } ;
3135
3236 static defaultProps = {
3337 painting : false ,
38+ labelmapRenderingOptions : {
39+ visible : true ,
40+ } ,
3441 } ;
3542
3643 constructor ( props ) {
@@ -258,8 +265,6 @@ export default class View2D extends Component {
258265 if ( currentIStyle . getSlabThickness ) {
259266 return currentIStyle . getSlabThickness ( ) ;
260267 }
261-
262- //return this.currentSlabThickness;
263268 }
264269
265270 setSlabThickness ( slabThickness ) {
@@ -268,6 +273,23 @@ export default class View2D extends Component {
268273
269274 if ( istyle . setSlabThickness ) {
270275 istyle . setSlabThickness ( slabThickness ) ;
276+
277+ if ( this . props . paintFilterLabelMapImageData ) {
278+ const labelmapActor = this . labelmap . actor ;
279+
280+ if ( realsApproximatelyEqual ( slabThickness , minSlabThickness ) ) {
281+ if (
282+ labelmapActor . getVisibility ( ) !==
283+ this . props . labelmapRenderingOptions . visible
284+ ) {
285+ labelmapActor . setVisibility (
286+ this . props . labelmapRenderingOptions . visible
287+ ) ;
288+ }
289+ } else {
290+ labelmapActor . setVisibility ( false ) ;
291+ }
292+ }
271293 }
272294
273295 renderWindow . render ( ) ;
@@ -392,7 +414,8 @@ export default class View2D extends Component {
392414 const labelmapImageData = this . props . paintFilterLabelMapImageData ;
393415 const labelmap = createLabelPipeline (
394416 this . props . paintFilterBackgroundImageData ,
395- labelmapImageData
417+ labelmapImageData ,
418+ this . props . labelmapRenderingOptions
396419 ) ;
397420
398421 this . labelmap = labelmap ;
@@ -410,6 +433,16 @@ export default class View2D extends Component {
410433 ) ;
411434 }
412435
436+ if (
437+ prevProps . labelmapRenderingOptions &&
438+ prevProps . labelmapRenderingOptions . visible !==
439+ this . props . labelmapRenderingOptions . visible
440+ ) {
441+ this . labelmap . actor . setVisibility (
442+ prevProps . labelmapRenderingOptions . visible
443+ ) ;
444+ }
445+
413446 if ( prevProps . painting !== this . props . painting ) {
414447 if ( this . props . painting ) {
415448 this . viewWidget = this . widgetManager . addWidget (
0 commit comments