calc_vesselness_mask_from_quantiled_vesselness#
- petpal.preproc.segmentation_tools.calc_vesselness_mask_from_quantiled_vesselness(input_image: ants.core.ANTsImage, min_quantile: float = 0.99, morph_dil_radius: int = 0, z_crop: int = 3) ants.core.ANTsImage#
Generates a binary vesselness mask from a given vesselness image using quantile-based thresholding.
This function creates a binary mask by thresholding a vesselness image at a specified quantile of non-zero voxel values. Additionally, it allows for optional z-axis cropping and morphological dilation to refine the mask.
- Parameters:
input_image (ants.core.ANTsImage) – Input vesselness image.
min_quantile (float, optional) – Minimum quantile value for voxel thresholding (default: 0.99). Must be in the range [0, 1).
morph_dil_radius (int, optional) – Radius for morphological dilation to refine the mask (default: 0). No dilation is applied if set to 0.
z_crop (int, optional) – Number of slices to crop from the z-axis from the bottom (default: 3).
- Returns:
ants.core.ANTsImage – Binary vesselness mask.
Notes
The input image must be an ANTs image containing vesselness measures.
The quantile value (min_quartile) determines the threshold value based on non-zero voxel intensities.
If z_crop is greater than 0, the z-axis is cropped from the top and bottom.
Morphological dilation is applied to the binary mask with the specified radius, if provided.
- Raises:
- AssertionError – If the input image is not 3D.
- AssertionError – If the provided quantile is not in the range [0, 1].
- AssertionError – If the provided z-crop is larger than the number of z-slices in the input image.