Interface ImageOp

All Superinterfaces:
qupath.lib.io.UriResource
All Known Implementing Classes:
ImageOps.PaddedOp

public interface ImageOp extends qupath.lib.io.UriResource
An operation that may be applied to a Mat.

This is intended to apply simple transforms to an image (e.g. color transforms, channel extraction, filtering, normalization), which may impact the number and type of image channels - but not other aspects of the image, with the exception of removing any padding.

Operations may be chained

  • Method Summary

    Modifier and Type
    Method
    Description
    apply(Mat input)
    Apply operation to the image.
    default List<qupath.lib.images.servers.ImageChannel>
    getChannels(List<qupath.lib.images.servers.ImageChannel> channels)
    Get appropriate channels to reflect the output of this transform.
    default qupath.lib.images.servers.PixelType
    getOutputType(qupath.lib.images.servers.PixelType inputType)
    Get the output pixel type.
    default qupath.lib.regions.Padding
    Get the padding requested for this operation.
    default Collection<URI>
    Default implementation returns an empty list; classes should override this if necessary.
    default boolean
    updateURIs(Map<URI,URI> replacements)
    Default implementation makes no changes; classes should override this if necessary.

    Methods inherited from interface qupath.lib.io.UriResource

    getUris, updateUris
  • Method Details

    • apply

      Mat apply(Mat input)
      Apply operation to the image. The input may be modified (and the operation applied in-place), therefore should be duplicated if a copy is required to be kept.

      Note that any non-empty padding will be removed, potentially giving an output image smaller than the input. If this is not desirable use ImageOps.padAndApply(ImageOp, Mat).

      Parameters:
      input - input image
      Returns:
      output image, which may be the same as the input image
      See Also:
    • getPadding

      default qupath.lib.regions.Padding getPadding()
      Get the padding requested for this operation. The default is to return Padding.empty().

      Subclasses that perform neighborhood operations should override this. If the padding is non-empty, it will be removed when apply(Mat) is called - and so the Mat that is output will be smaller than the Mat that was input.

      Returns:
      the padding requested by this operation
    • getChannels

      default List<qupath.lib.images.servers.ImageChannel> getChannels(List<qupath.lib.images.servers.ImageChannel> channels)
      Get appropriate channels to reflect the output of this transform. The default is to return the input list unchanged.

      Classes that change the meaning or number of channels should override this. In particular, the number of channels in the output list should match the number of channels output by this transformer, given the input channels.

      Parameters:
      channels -
      Returns:
    • getOutputType

      default qupath.lib.images.servers.PixelType getOutputType(qupath.lib.images.servers.PixelType inputType)
      Get the output pixel type. The default is to return the pixel type unchanged.
      Parameters:
      inputType - the input pixel type
      Returns:
      the output pixel type
    • getURIs

      default Collection<URI> getURIs() throws IOException
      Default implementation returns an empty list; classes should override this if necessary.
      Specified by:
      getURIs in interface qupath.lib.io.UriResource
      Throws:
      IOException
    • updateURIs

      default boolean updateURIs(Map<URI,URI> replacements) throws IOException
      Default implementation makes no changes; classes should override this if necessary.
      Specified by:
      updateURIs in interface qupath.lib.io.UriResource
      Throws:
      IOException