HypVINN.data_loader.data_utils¶
- HypVINN.data_loader.data_utils.calculate_flip_orientation(iornt, base_ornt)[source]¶
Compute the flip orientation transform.
ornt[N, 1] is flip of axis N, where 1 means no flip and -1 means flip.
- Parameters:
- iornt
np.ndarray
Initial orientation.
- base_ornt
np.ndarray
Base orientation.
- iornt
- Returns:
- new_iornt
np.ndarray
New orientation.
- new_iornt
- 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.
- 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.
- 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:
- Returns:
npt.NDArray
[int
]The remapped array with FastSurfer or HypVINN labels.
- HypVINN.data_loader.data_utils.reorient_img(img, ref_img)[source]¶
Reorient a Nibabel image based on the orientation of a reference nibabel image.
- Parameters:
- img
nibabel.Nifti1Image
Nibabel Image to reorient.
- ref_img
nibabel.Nifti1Image
Reference orientation nibabel image.
- img
- Returns:
- img
nibabel.Nifti1Image
Reoriented image.
- img
- 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_data
np.ndarray
The image data to rescale.
- img_data
- 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:
- vol
np.ndarray
The image volume to transform.
- axial2coronal
bool
,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).
- vol
- 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:
- vol
np.ndarray
The image volume to transform.
- axial2sagittal
bool
, 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).
- vol
- Returns:
np.ndarray
The transformed volume.