docs: def outline_segments(self, mask_background=False):
          """
          Outline the labeled segments.
  
          The "outlines" represent the pixels *just inside* the segments,
          leaving the background pixels unmodified.
  
          Parameters
          ----------
          mask_background : bool, optional
              Set to `True` to mask the background pixels (labels = 0) in
              the returned image.  This is useful for overplotting the
              segment outlines on an image.  The default is `False`.
  
          Returns
          -------
          boundaries : 2D `~numpy.ndarray` or `~numpy.ma.MaskedArray`
              An image with the same shape of the segmentation image
              containing only the outlines of the labeled segments.  The
              pixel values in the outlines correspond to the labels in the
              segmentation image.  If ``mask_background`` is `True`, then
              a `~numpy.ma.MaskedArray` is returned.
  
          Examples
          --------
          >>> from photutils import SegmentationImage
          >>> segm = SegmentationImage([[0, 0, 0, 0, 0, 0],
          ...                           [0, 2, 2, 2, 2, 0],
          ...                           [0, 2, 2, 2, 2, 0],
          ...                           [0, 2, 2, 2, 2, 0],
          ...                           [0, 2, 2, 2, 2, 0],
          ...                           [0, 0, 0, 0, 0, 0]])
          >>> segm.outline_segments()
          array([[0, 0, 0, 0, 0, 0],
                 [0, 2, 2, 2, 2, 0],
                 [0, 2, 0, 0, 2, 0],
                 [0, 2, 0, 0, 2, 0],
                 [0, 2, 2, 2, 2, 0],
                 [0, 0, 0, 0, 0, 0]])
          """
  
          from scipy.ndimage import grey_erosion, grey_dilation
  
          # mode='constant' ensures outline is included on the image borders
          selem = np.array([[0, 1, 0], [1, 1, 1], [0, 1, 0]])
          eroded = grey_erosion(self.data, footprint=selem, mode='constant',
                                cval=0.)
          dilated = grey_dilation(self.data, footprint=selem, mode='constant',
                                  cval=0.)
  
          outlines = ((dilated != eroded) & (self.data != 0)).astype(int)
          outlines *= self.data
  
          if mask_background:
              outlines = np.ma.masked_where(outlines == 0, outlines)
  
          return outlines