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_path
Path, default=”/home/runner/work/FastSurfer/FastSurfer/src/HypVINN/config/HypVINN_ColorLUT.txt” The path to the file from which the LUT will be constructed.
- lookup_table_path
- Returns:
- lut
OrderedDict The constructed LUT as an ordered dictionary.
- lut
- 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:
- hyposeg
np.ndarray The original segmentation map.
- lut_file
Path, default=”/home/runner/work/FastSurfer/FastSurfer/src/HypVINN/config/HypVINN_ColorLUT.txt” The path to the lookup table file.
- hyposeg
- Returns:
- mapped_hyposeg
ndarray The mapped segmentation.
- cmap
ListedColormap The colormap for the mapped segmentation.
- mapped_hyposeg
- 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:
- cmap
matplotlib.colors.Colormap The colormap to be used for the predicted segmentations.
- images_batch
np.ndarray,optional The batch of input images. If not provided, the function will not plot anything.
- pred_batch
np.ndarray,optional The batch of predicted segmentations. If not provided, the function will not plot anything.
- img_per_row
int, default=8 The number of images to be plotted per row in the grid layout.
- cmap
- Returns:
- fig:
matplotlib.figure.Figure The figure containing the plotted images and predictions.
- fig:
- 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_dir
Path The directory for the subject.
- orig_path
Path The path to the original image.
- prediction_path
Path The path to the predicted image.
- padd
int, default=45 The padding value for cropping the images and segmentations.
- lut_file
Path, default=”/home/runner/work/FastSurfer/FastSurfer/src/HypVINN/config/HypVINN_ColorLUT.txt” The path to the lookup table file.
- slice_step
int, default=2 The step size for selecting indices from the predicted segmentation.
- subject_qc_dir
- HypVINN.utils.visualization_utils.remove_values_from_list(the_list, val)[source]¶
Removes values from a list.
- HypVINN.utils.visualization_utils.select_index_to_plot(hyposeg, slice_step=2)[source]¶
Select indices to plot based on the given segmentation map.
- Parameters:
- hyposeg
np.ndarray The segmentation map from which indices will be selected.
- slice_step
int, default=2 The step size for selecting indices from the remaining indices after removing certain indices.
- hyposeg
- Returns:
listThe selected indices, sorted in ascending order.