Skip to content

hoa_tools.voi

Tools for working with volumes of interest (VOIs).

A volume of interest is a sub-volume contained within a full dataset. It is represented by the VOI class.

All coordinates are given in 'array coordinates', where 0 is the centre of the first voxel, 1 is the centre of the second voxel etc.

VOI pydantic-model

Bases: BaseModel

A volume of interest attached to a given dataset.

Fields:

corners property

All 8 corners of the VOI.

dataset pydantic-field

dataset: Dataset

Dataset that this VOI is in.

downsample_level pydantic-field

downsample_level: int

Downsampling level of the dataset that this VOI is defined in.

lower_corner pydantic-field

lower_corner: ArrayCoordinate

Index of lower corner in array coordinates.

size pydantic-field

Size of VOI in array coordinates.

upper_corner property

upper_corner: ArrayCoordinate

Upper corner of the VOI.

voxel_size_um property

voxel_size_um: float

Voxel size in micrometers.

change_downsample_level

change_downsample_level(*, new_downsample_level: int) -> VOI

Return a new VOI at a different downsample level.

get_data_array

get_data_array() -> DataArray

Get data array for this VOI.

get_data_array_on_voi

get_data_array_on_voi(target_voi: VOI, *, interpolator: Any = sitkLinear, transform: Transform | None = None) -> DataArray

Get data array for this VOI resampled to the grid of another VOI.

If the transform isn't given, uses the transform between two datasets in the registration inventory.

Parameters:

Name Type Description Default
target_voi VOI

VOI to resample data in this VOI on to.

required
interpolator Any

Interpolation method to use. See https://simpleitk.org/doxygen/v2_4/html/namespaceitk_1_1simple.html#a7cb1ef8bd02c669c02ea2f9f5aa374e5

sitkLinear
transform Transform | None

If given, transform used to map this VOI on to the target VOI. If not given, transform is taken from the registration inventory.

None

get_sitk_image

get_sitk_image() -> Image

Get a SimpleITK image of this VOI.

transform_to

transform_to(dataset: Dataset, *, transform: Transform | None = None) -> VOI

Transform this VOI to another dataset.

The new VOI will completely contain the transformed original VOI.

Parameters:

Name Type Description Default
dataset Dataset

Dataset to transform to.

required
transform Transform | None

If given, transform used to map this VOI on to the target VOI. If not given, transform is taken from the registration inventory.

None