logic

class trame_slicer.app.logic.AbstractDynamicSelectLogic(state: TypedState[DynamicSelectState])

Bases: ABC, Generic[T]

Abstract logic handling VSelect with dynamic complex VSelect content and value. Not to be used for simple VSelect to static Enum list.

Deriving classes need to implement:
  • _set_slicer_state: Set Slicer state to input IDynamicSelectItem instance

  • _get_slicer_state: Get current Slicer state as IDynamicSelectItem instance

  • _get_current_items: List of all available items

Select trame state can be refreshed manually by calling the update_ui_from_slicer method.

current_index_changed

Signal implementation. Can be connected to one or more callables. When called, will call associated callables with the provided args and kwargs.

Provides utility methods and contextmanager to control signal execution. Can be used both as class property and instance.

Parameters:

type_info – Types of arguments expected by the signal.

get_selected() T | None
select_item(item: T)
update_available_items()
update_ui_from_slicer()
class trame_slicer.app.logic.BaseEffectLogic(server: Server, slicer_app: SlicerApp, state_type: type[T], effect_type: type[U])

Bases: BaseSegmentationLogic[T], Generic[T, U], ABC

property effect: U
is_active() bool
set_active()
class trame_slicer.app.logic.BaseLogic(server: Server, slicer_app: SlicerApp, state_type: type[T] | None)

Bases: Generic[T]

bind_changes(change_dict: dict[Any | list[Any] | tuple[Any], Callable])
property data: T
property name: T
property scene: vtkMRMLScene
property server: Server
set_ui(ui: Any)
property state: State
sub_state(sub_name) TypedState
class trame_slicer.app.logic.BaseSegmentationLogic(server: Server, slicer_app: SlicerApp, state_type: type[T] | None)

Bases: BaseLogic[T], Generic[T], ABC

property active_effect
property segmentation_editor
abstractmethod set_ui(ui: SegmentEditorUI)
class trame_slicer.app.logic.BrushEffectLogic(server: Server, slicer_app: SlicerApp, state_type: type[T], effect_type: type[U])

Bases: BaseEffectLogic[TBrush, U], Generic[TBrush, U]

set_ui(ui: SegmentEditorUI)
class trame_slicer.app.logic.DownloadSceneLogic(server: Server, slicer_app: SlicerApp)

Bases: BaseLogic[None]

set_ui(ui: DownloadSceneButton)
class trame_slicer.app.logic.DrawEffectLogic(server: Server, slicer_app: SlicerApp)

Bases: BaseEffectLogic[DrawEffectState, U], Generic[U]

property effect: SegmentationEffectDraw
set_ui(ui: SegmentEditorUI)
class trame_slicer.app.logic.EraseEffectLogic(server: Server, slicer_app: SlicerApp)

Bases: PaintEraseEffectLogic[SegmentationEffectErase]

class trame_slicer.app.logic.IDynamicSelectItem

Bases: ABC

abstractmethod matches(other: IDynamicSelectItem) bool
abstract property title: str
class trame_slicer.app.logic.IslandsEffectLogic(server: Server, slicer_app: SlicerApp)

Bases: BaseEffectLogic[IslandsState, SegmentationEffectIslands]

set_effect_ui(islands_ui: IslandsEffectUI) None
set_ui(ui: SegmentEditorUI) None
class trame_slicer.app.logic.LayoutButtonLogic(server: Server, slicer_app: SlicerApp)

Bases: BaseLogic[LayoutButtonState]

property layout_manager: LayoutManager
class trame_slicer.app.logic.LoadVolumeLogic(server: Server, slicer_app: SlicerApp)

Bases: BaseLogic[LoadVolumeState]

set_ui(ui: LoadVolumeUI)
volume_loaded

Signal implementation. Can be connected to one or more callables. When called, will call associated callables with the provided args and kwargs.

Provides utility methods and contextmanager to control signal execution. Can be used both as class property and instance.

Parameters:

type_info – Types of arguments expected by the signal.

class trame_slicer.app.logic.LogicalOperatorsEffectLogic(server: Server, slicer_app: SlicerApp)

Bases: BaseEffectLogic[LogicalOperatorsState, SegmentationEffectLogicalOperators]

set_effect_ui(logical_operators_ui: LogicalOperatorsEffectUI)
set_ui(ui: SegmentEditorUI)
class trame_slicer.app.logic.MarkupsButtonLogic(server: Server, slicer_app: SlicerApp)

Bases: BaseLogic

on_clear_clicked() None
on_place_node_type(node_type: str, is_persistent: bool) None
set_ui(ui: MarkupsButton)
class trame_slicer.app.logic.MedicalViewerLogic(server: Server, slicer_app: SlicerApp)

Bases: BaseLogic[ViewerLayoutState]

property layout_manager: LayoutManager
set_ui(ui: MedicalViewerUI)
class trame_slicer.app.logic.MprInteractionButtonLogic(server=<class 'trame_server.core.Server'>, slicer_app=<class 'trame_slicer.core.slicer_app.SlicerApp'>)

Bases: BaseLogic[MprInteractionButtonState]

set_ui(ui: MprInteractionButton)
class trame_slicer.app.logic.PaintEffectLogic(server: Server, slicer_app: SlicerApp)

Bases: PaintEraseEffectLogic[SegmentationEffectPaint]

class trame_slicer.app.logic.PaintEraseEffectLogic(server: Server, slicer_app: SlicerApp, effect_type: type[U])

Bases: BrushEffectLogic[PaintEffectState, U]

class trame_slicer.app.logic.ScissorsEffectLogic(server: Server, slicer_app: SlicerApp)

Bases: BaseEffectLogic[ScissorsEffectState, U], Generic[U]

property effect: SegmentationEffectScissors
set_ui(ui: SegmentEditorUI)
class trame_slicer.app.logic.SegmentEditLogic(server: Server, slicer_app: SlicerApp)

Bases: BaseSegmentationLogic[SegmentEditState]

set_active_segment_id(segment_id: str)
set_ui(ui: SegmentEditUI)
show_color_dialog()
class trame_slicer.app.logic.SegmentEditorLogic(server: Server, slicer_app: SlicerApp)

Bases: BaseSegmentationLogic[SegmentEditorState]

on_volume_changed(volume_node: vtkMRMLVolumeNode) None
set_ui(ui: SegmentEditorUI)
class trame_slicer.app.logic.SegmentMaskSelectLogic(state: TypedState[DynamicSelectState], segmentation_editor: SegmentationEditor)

Bases: AbstractDynamicSelectLogic[SegmentMaskModeSelectItem]

class trame_slicer.app.logic.SegmentationAppLogic(server: Server, slicer_app: SlicerApp)

Bases: BaseLogic[ViewerLayoutState]

property layout_manager: LayoutManager
set_ui(ui: SegmentationAppUI)
class trame_slicer.app.logic.SlabLogic(server: Server, slicer_app: SlicerApp)

Bases: BaseLogic[SlabState]

on_current_slab_type_change(current_slab_type: SlabType)
on_slab_slider_change(slab_thickness: float)
class trame_slicer.app.logic.SmoothingEffectLogic(server: Server, slicer_app: SlicerApp)

Bases: BrushEffectLogic[SmoothingState, SegmentationEffectSmoothing]

set_effect_ui(smoothing_ui: SmoothingEffectUI)
set_joint_smoothing_factor(smoothing_factor: float)
set_kernel_size(kernel_size: float)
set_smoothing_mode(mode: SmoothingEffectMode)
set_standard_deviation(standard_deviation: float)
set_ui(ui: SegmentEditorUI)
class trame_slicer.app.logic.ThresholdEffectLogic(server: Server, slicer_app: SlicerApp)

Bases: BaseEffectLogic[ThresholdState, SegmentationEffectThreshold]

set_effect_ui(threshold_ui: ThresholdEffectUI)
set_ui(ui: SegmentEditorUI)
class trame_slicer.app.logic.VolumeIntensityRangeMaskEffectLogic(server: Server, slicer_app: SlicerApp)

Bases: BaseEffectLogic[VolumeIntensityRangeMaskState, SegmentationEffectVolumeIntensityMask]

set_ui(ui: SegmentEditorUI)
class trame_slicer.app.logic.VolumePropertyLogic(server: Server, slicer_app: SlicerApp)

Bases: BaseLogic[VolumePropertyState]

on_volume_changed(volume_node: vtkMRMLVolumeNode)
set_ui(ui: VolumePropertyUI)
trame_slicer.app.logic.connect_slice_view_slider_to_state(server: Server, view: SliceView, *_) TypedState[SliderState]
trame_slicer.app.logic.get_view_slider_typed_state(server: Server, view: SliceView) TypedState[SliderState]
Returns:

Typed Slider state associated with input view

trame_slicer.app.logic.get_view_trame_id(server: Server, view: AbstractViewChild)
Returns:

Trame server translated singleton id for the input view.

trame_slicer.app.logic.base_logic module

class trame_slicer.app.logic.base_logic.BaseLogic(server: Server, slicer_app: SlicerApp, state_type: type[T] | None)

Bases: Generic[T]

property scene: vtkMRMLScene
property server: Server
property state: State
property name: T
property data: T
bind_changes(change_dict: dict[Any | list[Any] | tuple[Any], Callable])
set_ui(ui: Any)
sub_state(sub_name) TypedState

trame_slicer.app.logic.download_scene_logic module

class trame_slicer.app.logic.download_scene_logic.DownloadSceneLogic(server: Server, slicer_app: SlicerApp)

Bases: BaseLogic[None]

set_ui(ui: DownloadSceneButton)

trame_slicer.app.logic.dynamic_select_logic module

class trame_slicer.app.logic.dynamic_select_logic.IDynamicSelectItem

Bases: ABC

abstract property title: str
abstractmethod matches(other: IDynamicSelectItem) bool
class trame_slicer.app.logic.dynamic_select_logic.AbstractDynamicSelectLogic(state: TypedState[DynamicSelectState])

Bases: ABC, Generic[T]

Abstract logic handling VSelect with dynamic complex VSelect content and value. Not to be used for simple VSelect to static Enum list.

Deriving classes need to implement:
  • _set_slicer_state: Set Slicer state to input IDynamicSelectItem instance

  • _get_slicer_state: Get current Slicer state as IDynamicSelectItem instance

  • _get_current_items: List of all available items

Select trame state can be refreshed manually by calling the update_ui_from_slicer method.

current_index_changed

Signal implementation. Can be connected to one or more callables. When called, will call associated callables with the provided args and kwargs.

Provides utility methods and contextmanager to control signal execution. Can be used both as class property and instance.

Parameters:

type_info – Types of arguments expected by the signal.

update_available_items()
update_ui_from_slicer()
select_item(item: T)
get_selected() T | None

trame_slicer.app.logic.layout_button_logic module

class trame_slicer.app.logic.layout_button_logic.LayoutButtonLogic(server: Server, slicer_app: SlicerApp)

Bases: BaseLogic[LayoutButtonState]

property layout_manager: LayoutManager

trame_slicer.app.logic.load_volume_logic module

class trame_slicer.app.logic.load_volume_logic.LoadVolumeLogic(server: Server, slicer_app: SlicerApp)

Bases: BaseLogic[LoadVolumeState]

volume_loaded

Signal implementation. Can be connected to one or more callables. When called, will call associated callables with the provided args and kwargs.

Provides utility methods and contextmanager to control signal execution. Can be used both as class property and instance.

Parameters:

type_info – Types of arguments expected by the signal.

set_ui(ui: LoadVolumeUI)

trame_slicer.app.logic.markups_button_logic module

class trame_slicer.app.logic.markups_button_logic.MarkupsButtonLogic(server: Server, slicer_app: SlicerApp)

Bases: BaseLogic

set_ui(ui: MarkupsButton)
on_clear_clicked() None
on_place_node_type(node_type: str, is_persistent: bool) None

trame_slicer.app.logic.medical_viewer_logic module

class trame_slicer.app.logic.medical_viewer_logic.MedicalViewerLogic(server: Server, slicer_app: SlicerApp)

Bases: BaseLogic[ViewerLayoutState]

property layout_manager: LayoutManager
set_ui(ui: MedicalViewerUI)

trame_slicer.app.logic.mpr_interaction_button_logic module

class trame_slicer.app.logic.mpr_interaction_button_logic.MprInteractionButtonLogic(server=<class 'trame_server.core.Server'>, slicer_app=<class 'trame_slicer.core.slicer_app.SlicerApp'>)

Bases: BaseLogic[MprInteractionButtonState]

set_ui(ui: MprInteractionButton)

trame_slicer.app.logic.segmentation_app_logic module

class trame_slicer.app.logic.segmentation_app_logic.SegmentationAppLogic(server: Server, slicer_app: SlicerApp)

Bases: BaseLogic[ViewerLayoutState]

property layout_manager: LayoutManager
set_ui(ui: SegmentationAppUI)

trame_slicer.app.logic.slab_logic module

class trame_slicer.app.logic.slab_logic.SlabLogic(server: Server, slicer_app: SlicerApp)

Bases: BaseLogic[SlabState]

on_slab_slider_change(slab_thickness: float)
on_current_slab_type_change(current_slab_type: SlabType)

trame_slicer.app.logic.slice_view_logic module

trame_slicer.app.logic.slice_view_logic.get_view_trame_id(server: Server, view: AbstractViewChild)
Returns:

Trame server translated singleton id for the input view.

trame_slicer.app.logic.slice_view_logic.get_view_slider_typed_state(server: Server, view: SliceView) TypedState[SliderState]
Returns:

Typed Slider state associated with input view

trame_slicer.app.logic.slice_view_logic.connect_slice_view_slider_to_state(server: Server, view: SliceView, *_) TypedState[SliderState]

trame_slicer.app.logic.volume_property_logic module

class trame_slicer.app.logic.volume_property_logic.VolumePropertyLogic(server: Server, slicer_app: SlicerApp)

Bases: BaseLogic[VolumePropertyState]

set_ui(ui: VolumePropertyUI)
on_volume_changed(volume_node: vtkMRMLVolumeNode)