HypVINN.utils.visualization_utils

HypVINN.utils.visualization_utils.get_lut(lookup_table_path=PosixPath('/home/runner/work/FastSurfer/FastSurfer/src/HypVINN/config/HypVINN_ColorLUT.txt'))[source]

Retrieve a color lookup table (LUT) from a file.

This function reads a file and constructs a lookup table (LUT) from it.

Parameters:
lookup_table_pathPath, default=”/home/runner/work/FastSurfer/FastSurfer/src/HypVINN/config/HypVINN_ColorLUT.txt”

The path to the file from which the LUT will be constructed.

Returns:
lutOrderedDict

The constructed LUT as an ordered dictionary.

HypVINN.utils.visualization_utils.map_hyposeg2label(hyposeg, lut_file=PosixPath('/home/runner/work/FastSurfer/FastSurfer/src/HypVINN/config/HypVINN_ColorLUT.txt'))[source]

Map a HypVINN segmentation to a continuous label space using a lookup table.

Parameters:
hyposegnp.ndarray

The original segmentation map.

lut_filePath, default=”/home/runner/work/FastSurfer/FastSurfer/src/HypVINN/config/HypVINN_ColorLUT.txt”

The path to the lookup table file.

Returns:
mapped_hyposegndarray

The mapped segmentation.

cmapListedColormap

The colormap for the mapped segmentation.

HypVINN.utils.visualization_utils.plot_coronal_predictions(cmap, images_batch=None, pred_batch=None, img_per_row=8)[source]

Plot the predicted segmentations on a grid layout.

Parameters:
cmapmatplotlib.colors.Colormap

The colormap to be used for the predicted segmentations.

images_batchnp.ndarray, optional

The batch of input images. If not provided, the function will not plot anything.

pred_batchnp.ndarray, optional

The batch of predicted segmentations. If not provided, the function will not plot anything.

img_per_rowint, default=8

The number of images to be plotted per row in the grid layout.

Returns:
fig: matplotlib.figure.Figure

The figure containing the plotted images and predictions.

HypVINN.utils.visualization_utils.plot_qc_images(subject_qc_dir, orig_path, prediction_path, padd=45, lut_file=PosixPath('/home/runner/work/FastSurfer/FastSurfer/src/HypVINN/config/HypVINN_ColorLUT.txt'), slice_step=2)[source]

Plot the quality control images for the subject.

Parameters:
subject_qc_dirPath

The directory for the subject.

orig_pathPath

The path to the original image.

prediction_pathPath

The path to the predicted image.

paddint, default=45

The padding value for cropping the images and segmentations.

lut_filePath, default=”/home/runner/work/FastSurfer/FastSurfer/src/HypVINN/config/HypVINN_ColorLUT.txt”

The path to the lookup table file.

slice_stepint, default=2

The step size for selecting indices from the predicted segmentation.

HypVINN.utils.visualization_utils.remove_values_from_list(the_list, val)[source]

Removes values from a list.

Parameters:
the_listlist

The original list from which values will be removed.

valany

The value to be removed from the list.

Returns:
list

A new list with the specified value removed.

HypVINN.utils.visualization_utils.select_index_to_plot(hyposeg, slice_step=2)[source]

Select indices to plot based on the given segmentation map.

Parameters:
hyposegnp.ndarray

The segmentation map from which indices will be selected.

slice_stepint, default=2

The step size for selecting indices from the remaining indices after removing certain indices.

Returns:
list

The selected indices, sorted in ascending order.