monai.deploy.operators.STLConversionOperator

class monai.deploy.operators.STLConversionOperator(fragment, *args, output_file, class_id=None, is_smooth=True, keep_largest_connected_component=True, **kwargs)[source]

Bases: holoscan.core.Operator

Converts volumetric image to surface mesh in STL format.

If a file path is provided, the STL binary will be saved in the said output folder. This operator also save the STL file as bytes in memory, idenfied by the named output. Being optional, this output does not require any downstream receiver.

Named inputs:

image: Image object for which to generate surface mesh. output_file: Optional, the path of the file to save the mesh in STL format.

If provided, this will overrider the output file path set on the object.

Named output:

stl_bytes: Bytes of the surface mesh STL file. Optional, not requiring a downstram receiver.

Creates an object to generate a surface mesh and saves it as an STL file if the path is provided.

Parameters
  • fragment (Fragment) – An instance of the Application class which is derived from Fragment.

  • output_file ([Path,str], optional) – output STL file path. None for no file output.

  • class_id (array, optional) – Class label ids. Defaults to None.

  • is_smooth (bool, optional) – smoothing or not. Defaults to True.

  • keep_largest_connected_component (bool, optional) – Defaults to True.

Methods

__init__(fragment, *args, output_file[, …])

Creates an object to generate a surface mesh and saves it as an STL file if the path is provided.

add_arg(*args, **kwargs)

Overloaded function.

compute(op_input, op_output, context)

Gets the input (image), processes it and sets results in the output.

initialize(self)

Operator initialization method.

setup(spec)

Default implementation of setup method.

start(self)

Operator start method.

stop(self)

Operator stop method.

Attributes

args

The list of arguments associated with the component.

conditions

Conditions associated with the operator.

description

YAML formatted string describing the operator.

fragment

The fragment that the operator belongs to.

id

The identifier of the component.

name

The name of the operator.

operator_type

The operator type.

resources

Resources associated with the operator.

spec

class OperatorType(self: holoscan.core._core.Operator.OperatorType, value: int) None

Bases: pybind11_builtins.pybind11_object

Members:

NATIVE

GXF

property name
__init__(fragment, *args, output_file, class_id=None, is_smooth=True, keep_largest_connected_component=True, **kwargs)[source]

Creates an object to generate a surface mesh and saves it as an STL file if the path is provided.

Parameters
  • fragment (Fragment) – An instance of the Application class which is derived from Fragment.

  • output_file ([Path,str], optional) – output STL file path. None for no file output.

  • class_id (array, optional) – Class label ids. Defaults to None.

  • is_smooth (bool, optional) – smoothing or not. Defaults to True.

  • keep_largest_connected_component (bool, optional) – Defaults to True.

add_arg(*args, **kwargs)

Overloaded function.

  1. add_arg(self: holoscan.core._core.Component, arg: holoscan.core._core.Arg) -> None

Add an argument to the component.

  1. add_arg(self: holoscan.core._core.Component, arg: holoscan.core._core.ArgList) -> None

Add a list of arguments to the component.

property args

The list of arguments associated with the component.

arglist : holoscan.core.ArgList

compute(op_input, op_output, context)[source]

Gets the input (image), processes it and sets results in the output.

This function sets the mesh in STL bytes in its named output, which require no receivers. If provided, the mesh will be saved to the file in STL format.

Parameters
  • op_input (InputContext) – An input context for the operator.

  • op_output (OutputContext) – An output context for the operator.

  • context (ExecutionContext) – An execution context for the operator.

property conditions

Conditions associated with the operator.

property description

YAML formatted string describing the operator.

property fragment

The fragment that the operator belongs to.

name : holoscan.core.Fragment

property id

The identifier of the component.

The identifier is initially set to -1, and will become a valid value when the component is initialized.

With the default executor (holoscan.gxf.GXFExecutor), the identifier is set to the GXF component ID.

id : int

initialize(self: holoscan.core._core.Operator) None

Operator initialization method.

property name

The name of the operator.

name : str

property operator_type

The operator type.

holoscan.core.Operator.OperatorType enum representing the type of the operator. The two types currently implemented are native and GXF.

property resources

Resources associated with the operator.

setup(spec)[source]

Default implementation of setup method.

start(self: holoscan.core._core.Operator) None

Operator start method.

stop(self: holoscan.core._core.Operator) None

Operator stop method.