monai.deploy.operators.DICOMSeriesToVolumeOperator

class monai.deploy.operators.DICOMSeriesToVolumeOperator(fragment, *args, **kwargs)[source]

Bases: holoscan.core.Operator

This operator converts an instance of DICOMSeries into an Image object.

The loaded Image Object can be used for further processing via other operators. The data array will be a 3D image NumPy array with index order of DHW. Channel is limited to 1 as of now, and C is absent in the NumPy array.

Named Input:

study_selected_series_list: List of StudySelectedSeries.

Named Output:

image: Image object.

Create an instance for a containing application object.

Parameters

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

Methods

__init__(fragment, *args, **kwargs)

Create an instance for a containing application object.

add_arg(*args, **kwargs)

Overloaded function.

compute(op_input, op_output, context)

Performs computation for this operator and handles I/O.

compute_affine_transform(s_1, s_n, n, series)

Computes the affine transform for this series.

convert_to_image(study_selected_series_list)

Extracts the pixel data from a DICOM Series and other attributes to create an Image object

create_metadata(series)

Collects all relevant metadata from the DICOM Series and creates a dictionary.

create_volumetric_image(vox_data, metadata)

Creates an instance of 3D image.

generate_voxel_data(series)

Applies rescale slope and rescale intercept to the pixels.

initialize()

Default implementation of initialize

prepare_series(series)

Computes the slice normal for each slice and then projects the first voxel of each slice on that slice normal.

resource(self, name)

Resources associated with the operator.

setup(spec)

Default implementation of setup method.

start()

Default implementation of start

stop()

Default implementation of stop

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 (holoscan.core.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

The operator spec (holoscan.core.OperatorSpec) associated with the operator.

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

Bases: pybind11_builtins.pybind11_object

Enum class for operator types used by the executor.

  • NATIVE: Native operator.

  • GXF: GXF operator.

  • VIRTUAL: Virtual operator. (for internal use, not intended for use by application authors)

Members:

NATIVE

GXF

VIRTUAL

property name
__init__(fragment, *args, **kwargs)[source]

Create an instance for a containing application object.

Parameters

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

add_arg(*args, **kwargs)

Overloaded function.

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

Add an argument to the component.

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

Add a list of arguments to the component.

  1. add_arg(self: holoscan.core._core.Operator, **kwargs) -> None

Add arguments to the component via Python kwargs.

  1. add_arg(self: holoscan.core._core.Operator, arg: holoscan.core._core.Condition) -> None

  2. add_arg(self: holoscan.core._core.Operator, arg: holoscan.core._core.Resource) -> None

Add a condition or resource to the Operator.

This can be used to add a condition or resource to an operator after it has already been constructed.

argholoscan.core.Condition or holoscan.core.Resource

The condition or resource to add.

property args

The list of arguments associated with the component.

arglist : holoscan.core.ArgList

compute(op_input, op_output, context)[source]

Performs computation for this operator and handles I/O.

compute_affine_transform(s_1, s_n, n, series)[source]

Computes the affine transform for this series. It does it in both DICOM Patient oriented coordinate system as well as the pne preferred by NIFTI standard. Accordingly, the two attributes dicom_affine_transform and nifti_affine_transform are stored in the series instance.

The Image Orientation Patient contains two triplets, [rx ry rz cx cy cz], which encode direction cosines of the row and column of an image slice. The Image Position Patient of the first slice in a volume, [x1 y1 z1], is the x, y, z coordinates of the upper-left corner voxel of the slice. These two parameters define the location of the slice in PCS. To determine the location of a volume, the Image Position Patient of another slice is normally needed. In practice, we tend to use the position of the last slice in a volume, [xn yn zn]. The voxel size within the slice plane, [vr vc], is stored in object Pixel Spacing.

Parameters
  • s_1 – A first slice in the series.

  • s_n – A last slice in the series.

  • n – A number of slices in the series.

  • series – An instance of DICOMSeries.

property conditions

Conditions associated with the operator.

convert_to_image(study_selected_series_list)[source]

Extracts the pixel data from a DICOM Series and other attributes to create an Image object

Return type

Optional[Image]

create_metadata(series)[source]

Collects all relevant metadata from the DICOM Series and creates a dictionary.

Parameters

series – An instance of DICOMSeries.

Return type

Dict

Returns

An instance of a dictionary containing metadata for the volumetric image.

create_volumetric_image(vox_data, metadata)[source]

Creates an instance of 3D image.

Parameters
  • vox_data – A numpy array representing the volumetric data.

  • metadata – DICOM attributes in a dictionary.

Returns

An instance of Image object.

property description

YAML formatted string describing the operator.

property fragment

The fragment (holoscan.core.Fragment) that the operator belongs to.

generate_voxel_data(series)[source]

Applies rescale slope and rescale intercept to the pixels.

Supports monochrome image only for now. Photometric Interpretation attribute, tag (0028,0004), is considered. Both MONOCHROME2 (IDENTITY) and MONOCHROME1 (INVERSE) result in an output image where The minimum sample value is intended to be displayed as black.

Parameters

series – DICOM Series for which the pixel data needs to be extracted.

Returns

A 3D numpy tensor representing the volumetric data.

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()

Default implementation of initialize

property name

The name of the operator.

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.

prepare_series(series)[source]

Computes the slice normal for each slice and then projects the first voxel of each slice on that slice normal.

It computes the distance of that point from the origin of the patient coordinate system along the slice normal. It orders the slices in the series according to that distance.

Parameters

series – An instance of DICOMSeries.

resource(self: holoscan.core._core.Operator, name: str) Optional[object]

Resources associated with the operator.

name : str The name of the resource to retrieve

holoscan.core.Resource or None

The resource with the given name. If no resource with the given name is found, None is returned.

property resources

Resources associated with the operator.

setup(spec)[source]

Default implementation of setup method.

property spec

The operator spec (holoscan.core.OperatorSpec) associated with the operator.

start()

Default implementation of start

stop()

Default implementation of stop