def add_frame(
            self,
            left_boundary,
            right_boundary,
            upper_boundary,
            lower_boundary):
        """ Adds a frame to the image, e.g. turns the boundaries white

        Parameters
        ----------
        left_boundary : int
            the leftmost boundary of the frame
        right_boundary : int
            the rightmost boundary of the frame (must be greater than left_boundary)
        upper_boundary : int
            the upper boundary of the frame
        lower_boundary : int
            the lower boundary of the frame (must be greater than upper_boundary)

        Returns
        -------
        :obj:`BinaryImage`
            binary image with white (BINARY_IM_MAX_VAL) on the boundaries
        """
        # check valid boundary pixels
        left_boundary = max(0, left_boundary)
        right_boundary = min(self.width - 1, right_boundary)
        upper_boundary = max(0, upper_boundary)
        lower_boundary = min(self.height - 1, lower_boundary)

        if right_boundary < left_boundary:
            raise ValueError(
                'Left boundary must be smaller than the right boundary')
        if upper_boundary > lower_boundary:
            raise ValueError(
                'Upper boundary must be smaller than the lower boundary')

        # fill in border pixels
        bordered_data = self.data.copy()
        bordered_data[:upper_boundary, :] = BINARY_IM_MAX_VAL
        bordered_data[lower_boundary:, :] = BINARY_IM_MAX_VAL
        bordered_data[:, :left_boundary] = BINARY_IM_MAX_VAL
        bordered_data[:, right_boundary:] = BINARY_IM_MAX_VAL
        return BinaryImage(bordered_data, frame=self._frame)