utils
- class trame_slicer.utils.SlicerWrapper(slicer_obj: T | None = None)
Bases:
Generic[T]This class provides automatic conversion of snake_case attributes to CamelCase if the original attribute is not found in any slicer object. If neither form exists, raises AttributeError is raised.
Delegates calls to the wrapped object.
- modified
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.
- trame_slicer.utils.as_rgba_hex(hex_channels: str) str
Pads input hex string to RGBA (8 characters) by adding FF values.
- trame_slicer.utils.create_scripted_module_dataclass_proxy(dataclass_type: type[T], node: vtkMRMLScriptedModuleNode, scene: vtkMRMLScene, encoders: list[IStateEncoderDecoder] | None = None) T
- trame_slicer.utils.ensure_node_in_scene(node: T | None, scene: vtkMRMLScene) T | None
Ensure that the input node is properly registered in the scene.
- trame_slicer.utils.float_channels_to_hex(float_channels: list[float]) str
Converts a list of input color channels to hex format. Supports arbitrary length of color components (e.g., RGB, RG, RGBA).
- trame_slicer.utils.hex_to_float_channels(hex_channels: str) list[float]
Converts a list of input hex colors channels prefixed by # to the equivalent float color channels. Supports arbitrary length of color hex channels (e.g., RGB, RG, RGBA).
- trame_slicer.utils.is_scripted_module_dataclass(instance: T)
- trame_slicer.utils.scripted_proxy_from_dataclass(instance: T, dataclass_obj: T) T
- trame_slicer.utils.scripted_proxy_to_dataclass(instance: T) T
- trame_slicer.utils.to_camel_case(attr: str) str
Copied from https://github.com/jpvanhal/inflection/blob/master/inflection/__init__.py Also capitalizes letters that follow digits.
- trame_slicer.utils.to_snake_case(attr: str) str
Copied from https://github.com/jpvanhal/inflection/blob/master/inflection/__init__.py Preserves digit-letter sequences like ‘3D’ as single tokens.
- trame_slicer.utils.wrap(obj)
- trame_slicer.utils.write_client_files_to_dir(client_file_dicts: list[dict], dest_dir: str | Path) list[str]
Helper method to copy files from client to a local server dir
trame_slicer.utils.closest_to_camera_picker module
trame_slicer.utils.convert_colors module
- trame_slicer.utils.convert_colors.as_rgba_hex(hex_channels: str) str
Pads input hex string to RGBA (8 characters) by adding FF values.
- trame_slicer.utils.convert_colors.float_channels_to_hex(float_channels: list[float]) str
Converts a list of input color channels to hex format. Supports arbitrary length of color components (e.g., RGB, RG, RGBA).
trame_slicer.utils.ensure_node_in_scene module
trame_slicer.utils.file_access module
trame_slicer.utils.scripted_module_node_dataclass_proxy module
- class trame_slicer.utils.scripted_module_node_dataclass_proxy.DefaultScriptedModuleEncoderDecoder(scene: vtkMRMLScene)
Bases:
IStateEncoderDecoderDefault primitive type encoding/decoding for scripted field.
- trame_slicer.utils.scripted_module_node_dataclass_proxy.create_scripted_module_dataclass_proxy(dataclass_type: type[T], node: vtkMRMLScriptedModuleNode, scene: vtkMRMLScene, encoders: list[IStateEncoderDecoder] | None = None) T
- trame_slicer.utils.scripted_module_node_dataclass_proxy.create_scripted_module_dataclass_proxy_name(dataclass_type: type[T]) T
- trame_slicer.utils.scripted_module_node_dataclass_proxy.is_scripted_module_dataclass(instance: T)
- trame_slicer.utils.scripted_module_node_dataclass_proxy.raise_if_not_scripted_proxy(instance: T)
- trame_slicer.utils.scripted_module_node_dataclass_proxy.scripted_proxy_from_dataclass(instance: T, dataclass_obj: T) T
- trame_slicer.utils.scripted_module_node_dataclass_proxy.scripted_proxy_to_dataclass(instance: T) T
trame_slicer.utils.slicer_wrapper module
- trame_slicer.utils.slicer_wrapper.to_camel_case(attr: str) str
Copied from https://github.com/jpvanhal/inflection/blob/master/inflection/__init__.py Also capitalizes letters that follow digits.
- trame_slicer.utils.slicer_wrapper.to_snake_case(attr: str) str
Copied from https://github.com/jpvanhal/inflection/blob/master/inflection/__init__.py Preserves digit-letter sequences like ‘3D’ as single tokens.
- exception trame_slicer.utils.slicer_wrapper.SlicerWrappingAttributeError
Bases:
AttributeError
- class trame_slicer.utils.slicer_wrapper.SlicerWrapper(slicer_obj: T | None = None)
Bases:
Generic[T]This class provides automatic conversion of snake_case attributes to CamelCase if the original attribute is not found in any slicer object. If neither form exists, raises AttributeError is raised.
Delegates calls to the wrapped object.
- modified
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.
- trame_slicer.utils.slicer_wrapper.wrap(obj)