Interface ColorTransforms.ColorTransform

Enclosing class:
ColorTransforms

public static interface ColorTransforms.ColorTransform
Interface defining a color transform that can extract a float value from a BufferedImage.

The simplest example of this is to extract a single channel (band) from an image.

Note that only implementations of this interface present in this file will be correctly serialized/deserialized into JSON, and not custom implementations. As such, some features of QuPath (such as saving a ColorTransform in a project) won't work for custom implementations.

  • Method Details

    • extractChannel

      float[] extractChannel(ImageServer<BufferedImage> server, BufferedImage img, float[] pixels)
      Extract a (row-wise) array containing the pixels extracted from a BufferedImage.
      Parameters:
      server - the server from which the image was read; can be necessary for some transforms (e.g. to request color deconvolution stains)
      img - the image
      pixels - optional preallocated array; will be used if it is long enough to hold the transformed pixels
      Returns:
      a (row-wise) array containing the transformed pixels of the provided image
    • supportsImage

      boolean supportsImage(ImageServer<BufferedImage> server)
      Query whether this transform can be applied to the specified image. Reasons why it may not be supported include the type or channel number being incompatible.
      Parameters:
      server - the server from which the image will be read
      Returns:
      whether this transform can be applied to the provided image
    • getName

      String getName()
      Get a displayable name for the transform. Can be null