code: def white_tophat(image, radius=None, mask=None, footprint=None):
      '''White tophat filter an image using a circular structuring element
      
      image - image in question
      radius - radius of the circular structuring element. If no radius, use
               an 8-connected structuring element.
      mask  - mask of significant pixels in the image. Points outside of
              the mask will not participate in the morphological operations
      '''
      #
      # Subtract the opening to get the tophat
      #
      final_image = image - opening(image, radius, mask, footprint) 
      #
      # Paint the masked pixels into the final image
      #
      if not mask is None:
          not_mask = np.logical_not(mask)
          final_image[not_mask] = image[not_mask]
      return final_imagf white_tophat(image, radius=None, mask=None, footprint=None):
      '''White tophat filter an image using a circular structuring element
      
      image - image in question
      radius - radius of the circular structuring element. If no radius, use
               an 8-connected structuring element.
      mask  - mask of significant pixels in the image. Points outside of
              the mask will not participate in the morphological operations
      '''
      #
      # Subtract the opening to get the tophat
      #
      final_image = image - opening(image, radius, mask, footprint) 
      #
      # Paint the masked pixels into the final image
      #
      if not mask is None:
          not_mask = np.logical_not(mask)
          final_image[not_mask] = image[not_mask]
      return final_image
docs: White tophat filter an image using a circular structuring element
      
      image - image in question
      radius - radius of the circular structuring element. If no radius, use
               an 8-connected structuring element.
      mask  - mask of significant pixels in the image. Points outside of
              the mask will not participate in the morphological operations