HypVINN.data_loader.data_utils

HypVINN.data_loader.data_utils.hypo_map_label2subseg(mapped_subseg)[source]

Perform look-up table mapping from label space to subseg space.

This function is used to perform a look-up table mapping from label space to subseg space.

Parameters:
mapped_subsegnp.ndarray of integers

The input array in label space to be mapped to subseg space.

Returns:
np.ndarray of integers

The mapped array in subseg space.

HypVINN.data_loader.data_utils.hypo_map_prediction_sagittal2full(prediction_sag)[source]

Remap the prediction on the sagittal network to full label space.

This function is used to remap the prediction on the sagittal network to the full label space used by the coronal and axial networks.

Parameters:
prediction_sagnp.ndarray of integers

The sagittal prediction in label space to be remapped to full label space.

Returns:
np.ndarray of integers

The remapped prediction in full label space.

HypVINN.data_loader.data_utils.hypo_map_subseg_2_fsseg(subseg, reverse=False)[source]

Remap HypVINN internal labels to FastSurfer Labels and vice versa.

This function is used to remap HypVINN internal labels to FastSurfer Labels and vice versa. If the reverse parameter is set to False, the function will map HypVINN labels to FastSurfer labels. If it is set to True, the function will map FastSurfer labels to HypVINN labels.

Parameters:
subsegnp.ndarray of integers

The input array with HypVINN or FastSurfer labels to be remapped.

reversebool, default=False

A flag to determine the direction of the remapping. If False, remap HypVINN labels to FastSurfer labels. If True, remap FastSurfer labels to HypVINN labels.

Returns:
np.ndarray of integers

The remapped array with FastSurfer or HypVINN labels.

HypVINN.data_loader.data_utils.rescale_image(img_data)[source]

Rescale the image data to the range [0, 255].

This function rescales the input image data to the range [0, 255].

Parameters:
img_datanp.ndarray

The image data to rescale.

Returns:
np.ndarray

The rescaled image data.

HypVINN.data_loader.data_utils.transform_axial2coronal(vol, axial2coronal=True)[source]

Transforms a volume into the coronal axis and back.

This function is used to transform a volume into the coronal axis and back. The transformation is done by moving the axes of the volume. If the axial2coronal parameter is set to True, the function will transform from axial to coronal. If it is set to False, the function will transform from coronal to axial.

Parameters:
volnp.ndarray

The image volume to transform.

axial2coronalbool, optional

A flag to determine the direction of the transformation. If True, transform from axial to coronal. If False, transform from coronal to axial. (Default: True).

Returns:
np.ndarray

The transformed volume.

HypVINN.data_loader.data_utils.transform_axial2sagittal(vol, axial2sagittal=True)[source]

Transforms a volume into the sagittal axis and back.

This function is used to transform a volume into the sagittal axis and back. The transformation is done by moving the axes of the volume. If the axial2sagittal parameter is set to True, the function will transform from axial to sagittal. If it is set to False, the function will transform from sagittal to axial.

Parameters:
volnp.ndarray

The image volume to transform.

axial2sagittalbool, default=True

A flag to determine the direction of the transformation. If True, transform from axial to sagittal. If False, transform from sagittal to axial. (Default: True).

Returns:
np.ndarray

The transformed volume.