Overview

The get_shape3d_features function computes comprehensive geometric descriptors of three-dimensional objects in medical images. This analysis extracts quantitative shape characteristics from 3D binary masks, providing essential information for radiomics analysis and image-based biomarker discovery.

Input Requirements

The function accepts a 3D binary mask and voxel spacing parameters. It can optionally isolate the largest connected component and automatically pads the mask to ensure accurate surface extraction using the Marching Cubes algorithm.

[Image of Marching Cubes algorithm]

Extracted Features

Surface Area

Total area of the 3D object's surface mesh, calculated using triangular mesh elements from the Marching Cubes reconstruction.

A = Σ A_triangle

Mesh Volume

Volume of the object computed from the surface mesh representation, providing a precise measurement of the 3D region.

V_mesh = |Σ (p₁ · (p₂ × p₃))/6|

Surface-to-Volume Ratio

Normalized ratio quantifying the relationship between surface area and enclosed volume, useful for characterizing shape compactness.

SVR = A / V_mesh

Sphericity

Measure of how closely the shape resembles a perfect sphere, with values approaching 1 indicating higher spherical similarity.

Ψ = (π^(1/3) × (6V)^(2/3)) / A

Maximum 3D Diameter

Largest distance between any two points on the object's surface (Feret diameter), representing the maximum spatial extent.

D_max = max(||p_i - p_j||)

Principal Axes Lengths

Major, minor, and least axis lengths derived from eigenvalue decomposition of the voxel coordinate covariance matrix.

λ₁, λ₂, λ₃ (eigenvalues of Σ)

Elongation

Ratio between the middle and largest principal axes, describing the degree of shape elongation along primary directions.

E = √(λ₂ / λ₁)

Flatness

Ratio between the smallest and largest principal axes, quantifying how flat or thin the object appears in 3D space.

F = √(λ₃ / λ₁)

Voxel-based Volume

Volume calculated by counting foreground voxels and scaling by the voxel spacing, providing a discrete approximation.

V_voxel = N × Δx × Δy × Δz

Notation Legend

The following symbols are used in the formulas above:

  • A = total surface area
  • A_triangle = area of individual triangular mesh element
  • V_mesh = volume from mesh representation
  • V_voxel = volume from voxel counting
  • N = number of foreground voxels
  • Δx, Δy, Δz = voxel spacing in x, y, z directions
  • p₁, p₂, p₃ = vertices of a triangular face
  • p_i, p_j = points on the object surface
  • λ₁, λ₂, λ₃ = eigenvalues (largest to smallest)
  • Σ = covariance matrix of voxel coordinates
  • ||·|| = Euclidean distance
  • × = cross product, · = dot product

Computational Methodology

The extraction of 3D shape features relies on advanced computational geometry techniques:

  • Marching Cubes Algorithm: Generates high-quality surface meshes from the binary mask, enabling accurate surface area and volume calculations
  • Eigenvalue Analysis: Performs linear algebra operations on voxel coordinate covariance matrices to extract principal axes and shape orientation
  • Feret Diameter Computation: Calculates maximum inter-point distances on the surface mesh, with optional sampling for computational efficiency on large volumes
  • Connected Component Analysis: Isolates the largest connected region when multiple disconnected objects are present

Performance Optimization

For large volumetric datasets, the function supports optional point sampling to approximate the maximum 3D diameter efficiently while maintaining acceptable accuracy. This optimization significantly reduces computation time for high-resolution medical images.