Class TransformedServerBuilder

java.lang.Object
qupath.lib.images.servers.TransformedServerBuilder

public class TransformedServerBuilder extends Object
Helper class for creating an ImageServer that applies one or more transforms to another (wrapped) ImageServer.

Note: This is an early-stage experimental class, which may well change!

Author:
Pete Bankhead
  • Constructor Details

    • TransformedServerBuilder

      public TransformedServerBuilder(ImageServer<BufferedImage> baseServer)
      Create a transformed ImageServer.
      Parameters:
      baseServer - the initial server that will be transformed.
  • Method Details

    • crop

      public TransformedServerBuilder crop(ImageRegion region)
      Crop an specified region based on a bounding box.
      Parameters:
      region -
      Returns:
    • transform

      public TransformedServerBuilder transform(AffineTransform transform)
      Apply an AffineTransform to the server. Note that the transform must be invertible, otherwise and IllegalArgumentException will be thrown.
      Parameters:
      transform -
      Returns:
    • deconvolveStains

      public TransformedServerBuilder deconvolveStains(ColorDeconvolutionStains stains, int... stainNumbers)
      Apply color deconvolution to the brightfield image, so that deconvolved stains behave as separate channels/
      Parameters:
      stains - the stains to apply for color deconvolution
      stainNumbers - the indices of the stains that should be use (an array compressing values that are 1, 2 or 3); if not specified, all 3 stains will be used.
      Returns:
    • reorderRGB

      public TransformedServerBuilder reorderRGB(String order)
      Rearrange the channel order of an RGB image. This is intended for cases where an image has wrongly been interpreted as RGB or BGR.
      Parameters:
      order -
      Returns:
    • rotate

      Rotate the image, using an increment of 90 degrees.
      Parameters:
      rotation -
      Returns:
    • extractChannels

      public TransformedServerBuilder extractChannels(int... channels)
      Extract specified channels for an image.
      Parameters:
      channels - indices (0-based) of channels to extract.
      Returns:
    • extractChannels

      public TransformedServerBuilder extractChannels(String... names)
      Extract specified channels for an image.
      Parameters:
      names - names of channels to extract.
      Returns:
    • maxChannelProject

      public TransformedServerBuilder maxChannelProject()
      Perform a maximum projection of the channels.
      Returns:
    • averageChannelProject

      public TransformedServerBuilder averageChannelProject()
      Perform an average (mean) projection of the channels.
      Returns:
    • minChannelProject

      public TransformedServerBuilder minChannelProject()
      Perform a minimum projection of the channels.
      Returns:
    • concatChannels

      public TransformedServerBuilder concatChannels(Collection<ImageServer<BufferedImage>> additionalChannels)
      Concatenate a collection of additional servers along the 'channels' dimension (iteration order is used).
      Parameters:
      additionalChannels - additional servers that will be applied as channels; note that these should be of an appropriate type and dimension for concatenation.
      Returns:
    • concatChannels

      public TransformedServerBuilder concatChannels(ImageServer<BufferedImage>... additionalChannels)
      Concatenate additional servers along the 'channels' dimension.
      Parameters:
      additionalChannels - additional servers from which channels will be added; note that the servers should be of an appropriate type and dimension for concatenation.
      Returns:
    • build

      public ImageServer<BufferedImage> build()
      Get the ImageServer that applies all the requested transforms.
      Returns: