Class ImageChannel

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

public class ImageChannel extends Object
The name and display color for a single image channel.
Author:
Pete Bankhead
  • Field Details

    • TRANSPARENT

      public static final Integer TRANSPARENT
      Special color indicating pixel values for a channel indicate levels of transparency.
    • RED

      public static final ImageChannel RED
      Default red channel for RGB images.
    • GREEN

      public static final ImageChannel GREEN
      Default green channel for RGB images.
    • BLUE

      public static final ImageChannel BLUE
      Default blue channel for RGB images.
  • Method Details

    • getInstance

      public static ImageChannel getInstance(String name, Integer color)
      Get a channel instance with the specified name and color.
      Parameters:
      name - Name for the channel - this must not be null.
      color - Color as a packed (A)RGB value.
      Returns:
    • getChannelList

      public static List<ImageChannel> getChannelList(String... names)
      Convert an array of channel names into a list of ImageChannel using default colors.
      Parameters:
      names - the names of the channels
      Returns:
      a list of ImageChannel, where channel names are taken from the input array
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getDefaultChannelColor

      public static Integer getDefaultChannelColor(int channel)
      Get the default color for a specified channel, for use when no channel colors are already known.

      Note that the exact colors returned may differ in future releases, and it is not guaranteed that all colors will be unique. If the colors must be exactly reproducible then it is better to specify them rather than to depend on this method.

      Parameters:
      channel -
      Returns:
    • getDefaultRGBChannels

      public static List<ImageChannel> getDefaultRGBChannels()
      Get default channel list for RGB images.
      Returns:
    • getDefaultChannelList

      public static List<ImageChannel> getDefaultChannelList(int nChannels)
      Get default channel list for an image with a specified number of channels. This is useful whenever no further channel name or color information is available.
      Parameters:
      nChannels -
      Returns:
    • isTransparent

      public boolean isTransparent()
      Check if the color is 'transparent'; this is used for background/ignored channels.
      Returns:
    • getName

      public String getName()
      Name of the output channel.
      Returns:
    • getColor

      public Integer getColor()
      Color used to display the output channel
      Returns:
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object