2424 vtkRenderWindowInteractor ,
2525)
2626
27+ from pan3d .ui .layouts import StandardExplorerLayout
2728from pan3d .ui .slicer import SliceRenderingSettings
28- from pan3d .ui .vtk_view import Pan3DView
2929from pan3d .utils .common import Explorer
30+ from pan3d .widgets .pan3d_view import Pan3DView
3031from pan3d .xarray .algorithm import vtkXArrayRectilinearSource
3132from trame .decorators import change
3233from trame .widgets import html
@@ -265,25 +266,24 @@ def _build_ui(self, *args, **kwargs):
265266 }
266267 )
267268
268- # Add SliceSummary as an additional component
269- def add_slice_summary ():
270- SliceSummary (
271- v_show = "!control_expended" ,
272- style = "position: absolute; right: 1rem; top: 50%; transform: translateY(-50%); z-index: 2;" ,
273- )
274-
275269 # Use the standard UI creation method
276- return self ._create_standard_ui (
277- panel_label = "Slice Explorer" ,
278- view_class = Pan3DSlicerView ,
279- rendering_settings_class = SliceRenderingSettings ,
280- view_kwargs = {
281- "render_window" : self .render_window ,
282- "local_rendering" : self .local_rendering ,
283- "widgets" : [self .widget ],
284- },
285- additional_components = add_slice_summary ,
286- )
270+ with StandardExplorerLayout (explorer = self , title = "Slice Explorer" ) as self .ui :
271+ with self .ui .canvas :
272+ Pan3DSlicerView (
273+ render_window = self .render_window ,
274+ local_rendering = self .local_rendering ,
275+ widget = [self .widget ],
276+ )
277+ SliceSummary (
278+ v_show = "!control_expended" ,
279+ style = "position: absolute; right: 1rem; top: 50%; transform: translateY(-50%); z-index: 2;" ,
280+ )
281+ with self .ui .control_panel :
282+ SliceRenderingSettings (
283+ ctx_name = "rendering" ,
284+ source = self .source ,
285+ update_rendering = self .update_rendering ,
286+ )
287287
288288 def update_rendering (self , reset_camera = False ):
289289 self .state .dirty_data = False
@@ -320,27 +320,6 @@ def slice_axis(self, axis: str) -> None:
320320 with self .state :
321321 self .state .slice_axis = axis
322322
323- @property
324- def slice_value (self ):
325- """
326- Returns the value(origin) for the dimension along which the slice
327- is performed
328- """
329- s = self .state
330- axis = "xyz" [s .slice_axes .index (s .slice_axis )]
331- return s [f"cut_{ axis } " ]
332-
333- @slice_value .setter
334- def slice_value (self , value : float ) -> None :
335- """
336- Sets the value(origin) for the dimension along which the slice
337- is performed
338- """
339- with self .state :
340- s = self .state
341- axis = "xyz" [s .slice_axes .index (s .slice_axis )]
342- s [f"cut_{ axis } " ] = value
343-
344323 @property
345324 def view_mode (self ):
346325 """
@@ -357,22 +336,6 @@ def view_mode(self, mode):
357336 with self .state :
358337 self .state .view_mode = mode
359338
360- @property
361- def scale_axis (self ):
362- s = self .state
363- return [s .x_scale , s .y_scale , s .z_scale ]
364-
365- @scale_axis .setter
366- def scale_axis (self , sfac ):
367- s = self .state
368- s .x_scale = float (sfac [0 ])
369- s .y_scale = float (sfac [1 ])
370- s .z_scale = float (sfac [2 ])
371- self .slice_actor .SetScale (* sfac )
372- self .data_actor .SetScale (* sfac )
373- self .outline_actor .SetScale (* sfac )
374- self .on_view_mode_change (s .view_mode )
375-
376339 # -------------------------------------------------------------------------
377340 # UI triggers
378341 # -------------------------------------------------------------------------
0 commit comments