@@ -133,6 +133,7 @@ const ViewerModel = widgets.DOMWidgetModel.extend(
133133 z_slice : null ,
134134 clicked_slice_point : null ,
135135 gradient_opacity : 0.2 ,
136+ sample_distance : 0.25 ,
136137 opacity_gaussians : null ,
137138 channels : null ,
138139 blend_mode : 'composite' ,
@@ -737,6 +738,7 @@ const ViewerView = widgets.DOMWidgetView.extend({
737738 if ( rendered_image ) {
738739 this . shadow_changed ( )
739740 this . gradient_opacity_changed ( )
741+ this . sample_distance_changed ( )
740742 this . channels_changed ( )
741743 this . blend_mode_changed ( )
742744 }
@@ -1035,6 +1037,16 @@ const ViewerView = widgets.DOMWidgetView.extend({
10351037 this . model . itkVtkViewer . on ( 'gradientOpacityChanged' ,
10361038 onGradientOpacityChange
10371039 )
1040+
1041+ const onVolumeSampleDistanceChange = ( distance ) => {
1042+ if ( distance !== this . model . get ( 'sample_distance' ) ) {
1043+ this . model . set ( 'sample_distance' , distance )
1044+ this . model . save_changes ( )
1045+ }
1046+ }
1047+ this . model . itkVtkViewer . on ( 'volumeSampleDistanceChanged' ,
1048+ onVolumeSampleDistanceChange
1049+ )
10381050 } // end use2D
10391051
10401052 const onCameraChanged = macro . throttle ( ( ) => {
@@ -1163,6 +1175,11 @@ const ViewerView = widgets.DOMWidgetView.extend({
11631175 this . gradient_opacity_changed ,
11641176 this
11651177 )
1178+ this . model . on (
1179+ 'change:sample_distance' ,
1180+ this . sample_distance_changed ,
1181+ this
1182+ )
11661183 this . model . on ( 'change:blend_mode' , this . blend_mode_changed , this )
11671184 this . model . on ( 'change:select_roi' , this . select_roi_changed , this )
11681185 this . model . on ( 'change:_scale_factors' , this . scale_factors_changed , this )
@@ -1716,6 +1733,13 @@ const ViewerView = widgets.DOMWidgetView.extend({
17161733 }
17171734 } ,
17181735
1736+ sample_distance_changed : function ( ) {
1737+ const sample_distance = this . model . get ( 'sample_distance' )
1738+ if ( this . model . hasOwnProperty ( 'itkVtkViewer' ) && ! this . model . use2D ) {
1739+ this . model . itkVtkViewer . setVolumeSampleDistance ( sample_distance )
1740+ }
1741+ } ,
1742+
17191743 opacity_gaussians_changed : function ( ) {
17201744 const opacity_gaussians = this . model . get ( 'opacity_gaussians' )
17211745 if ( this . model . hasOwnProperty ( 'itkVtkViewer' ) && ! this . model . use2D ) {
0 commit comments