def validate_gt_label(label: int | np.ndarray | None) -> np.ndarray | None:
        """Validate the ground truth label.

        Validates and normalizes input labels to boolean numpy arrays.

        Args:
            label (``int`` | ``np.ndarray`` | ``None``): Input ground truth label.

        Returns:
            ``np.ndarray`` | ``None``: Validated label as boolean array, or None.

        Raises:
            TypeError: If ``label`` is not an integer or numpy array.
            ValueError: If ``label`` shape is not scalar.

        Example:
            Validate integer and array labels::

                >>> import numpy as np
                >>> from anomalib.data.validators import NumpyImageValidator
                >>> label_int = 1
                >>> validated_label = NumpyImageValidator.validate_gt_label(label_int)
                >>> validated_label
                array(True)
                >>> label_array = np.array(0)
                >>> validated_label = NumpyImageValidator.validate_gt_label(label_array)
                >>> validated_label
                array(False)

        Note:
            - Integer inputs are converted to numpy arrays
            - Output is always boolean type
            - None inputs return None
        """
        if label is None:
            return None
        if isinstance(label, int | np.bool_):
            label = np.array(label)
        if not isinstance(label, np.ndarray):
            msg = f"Ground truth label must be an integer or a numpy.ndarray, got {type(label)}."
            raise TypeError(msg)
        if label.ndim != 0:
            msg = f"Ground truth label must be a scalar, got shape {label.shape}."
            raise ValueError(msg)
        if not np.issubdtype(label.dtype, np.integer) and not np.issubdtype(label.dtype, bool):
            msg = f"Ground truth label must be boolean or integer, got {label.dtype}."
            raise TypeError(msg)
        return label.astype(bool)
Validate the ground truth label.

        Validates and normalizes input labels to boolean numpy arrays.

        Args:
            label (``int`` | ``np.ndarray`` | ``None``): Input ground truth label.

        Returns:
            ``np.ndarray`` | ``None``: Validated label as boolean array, or None.

        Raises:
            TypeError: If ``label`` is not an integer or numpy array.
            ValueError: If ``label`` shape is not scalar.

        Example:
            Validate integer and array labels::

                >>> import numpy as np
                >>> from anomalib.data.validators import NumpyImageValidator
                >>> label_int = 1
                >>> validated_label = NumpyImageValidator.validate_gt_label(label_int)
                >>> validated_label
                array(True)
                >>> label_array = np.array(0)
                >>> validated_label = NumpyImageValidator.validate_gt_label(label_array)
                >>> validated_label
                array(False)

        Note:
            - Integer inputs are converted to numpy arrays
            - Output is always boolean type
            - None inputs return None
        
src/anomalib/data/validators/numpy/image.py