@@ -132,6 +132,7 @@ const ViewerModel = widgets.DOMWidgetModel.extend(
132
132
z_slice : null ,
133
133
clicked_slice_point : null ,
134
134
gradient_opacity : 0.2 ,
135
+ sample_distance : 0.25 ,
135
136
opacity_gaussians : null ,
136
137
channels : null ,
137
138
blend_mode : 'composite' ,
@@ -733,6 +734,7 @@ const ViewerView = widgets.DOMWidgetView.extend({
733
734
if ( rendered_image ) {
734
735
this . shadow_changed ( )
735
736
this . gradient_opacity_changed ( )
737
+ this . sample_distance_changed ( )
736
738
this . channels_changed ( )
737
739
this . blend_mode_changed ( )
738
740
}
@@ -1010,6 +1012,16 @@ const ViewerView = widgets.DOMWidgetView.extend({
1010
1012
this . model . itkVtkViewer . on ( 'gradientOpacityChanged' ,
1011
1013
onGradientOpacityChange
1012
1014
)
1015
+
1016
+ const onVolumeSampleDistanceChange = ( distance ) => {
1017
+ if ( distance !== this . model . get ( 'sample_distance' ) ) {
1018
+ this . model . set ( 'sample_distance' , distance )
1019
+ this . model . save_changes ( )
1020
+ }
1021
+ }
1022
+ this . model . itkVtkViewer . on ( 'volumeSampleDistanceChanged' ,
1023
+ onVolumeSampleDistanceChange
1024
+ )
1013
1025
} // end use2D
1014
1026
1015
1027
const onCameraChanged = macro . throttle ( ( ) => {
@@ -1080,6 +1092,11 @@ const ViewerView = widgets.DOMWidgetView.extend({
1080
1092
this . gradient_opacity_changed ,
1081
1093
this
1082
1094
)
1095
+ this . model . on (
1096
+ 'change:sample_distance' ,
1097
+ this . sample_distance_changed ,
1098
+ this
1099
+ )
1083
1100
this . model . on ( 'change:blend_mode' , this . blend_mode_changed , this )
1084
1101
this . model . on ( 'change:select_roi' , this . select_roi_changed , this )
1085
1102
this . model . on ( 'change:_scale_factors' , this . scale_factors_changed , this )
@@ -1583,6 +1600,13 @@ const ViewerView = widgets.DOMWidgetView.extend({
1583
1600
}
1584
1601
} ,
1585
1602
1603
+ sample_distance_changed : function ( ) {
1604
+ const sample_distance = this . model . get ( 'sample_distance' )
1605
+ if ( this . model . hasOwnProperty ( 'itkVtkViewer' ) && ! this . model . use2D ) {
1606
+ this . model . itkVtkViewer . setVolumeSampleDistance ( sample_distance )
1607
+ }
1608
+ } ,
1609
+
1586
1610
opacity_gaussians_changed : function ( ) {
1587
1611
const opacity_gaussians = this . model . get ( 'opacity_gaussians' )
1588
1612
if ( this . model . hasOwnProperty ( 'itkVtkViewer' ) && ! this . model . use2D ) {
0 commit comments