Class LabeledImageServer.Builder

java.lang.Object
qupath.lib.images.servers.LabeledImageServer.Builder
Enclosing class:
LabeledImageServer

public static class LabeledImageServer.Builder extends Object
Helper class for building a LabeledImageServer.
  • Constructor Details

  • Method Details

    • useDetections

      public LabeledImageServer.Builder useDetections()
      Use detections rather than annotations for labels. The default is to use annotations.
      Returns:
      See Also:
    • useCells

      public LabeledImageServer.Builder useCells()
      Use cells rather than annotations for labels. The default is to use annotations.
      Returns:
      See Also:
    • useCellNuclei

      public LabeledImageServer.Builder useCellNuclei()
      Use cells rather than annotations for labels, requesting the nucleus ROI where available. The default is to use annotations.
      Returns:
      See Also:
    • useAnnotations

      public LabeledImageServer.Builder useAnnotations()
      Use annotations for labels. This is the default.
      Returns:
      See Also:
    • useFilter

      public LabeledImageServer.Builder useFilter(Predicate<PathObject> filter)
      Use a custom method of selecting objects for inclusion. The default is to use annotations.
      Parameters:
      filter - the filter that determines whether an object will be included or not
      Returns:
      See Also:
    • grayscale

      public LabeledImageServer.Builder grayscale()
      Use grayscale LUT, rather than deriving colors from classifications. This can streamline import in software that automatically converts paletted images to RGB.
      Returns:
      Since:
      v0.4.0
      See Also:
    • grayscale

      public LabeledImageServer.Builder grayscale(boolean grayscaleLut)
      Optionally use grayscale LUT, rather than deriving colors from classifications. This can streamline import in software that automatically converts paletted images to RGB.
      Parameters:
      grayscaleLut -
      Returns:
      Since:
      v0.4.0
      See Also:
    • downsample

      public LabeledImageServer.Builder downsample(double downsample)
      Specify downsample factor. This is very important because it defines the resolution at which shapes will be drawn and the line thickness is determined.
      Parameters:
      downsample -
      Returns:
    • tileSize

      public LabeledImageServer.Builder tileSize(int tileSize)
      Set tile width and height (square tiles).
      Parameters:
      tileSize -
      Returns:
    • tileSize

      public LabeledImageServer.Builder tileSize(int tileWidth, int tileHeight)
      Set tile width and height.
      Parameters:
      tileWidth -
      tileHeight -
      Returns:
    • lineThickness

      public LabeledImageServer.Builder lineThickness(float thickness)
      Thickness of boundary lines and line annotations, defined in terms of pixels at the resolution specified by the downsample value of the server.
      Parameters:
      thickness -
      Returns:
    • useUniqueLabels

      @Deprecated public LabeledImageServer.Builder useUniqueLabels()
      Deprecated.
      Returns:
    • useInstanceLabels

      public LabeledImageServer.Builder useInstanceLabels()
      Request that unique labels are used for all objects, rather than classifications. If this flag is set, all other label requests are ignored.
      Returns:
      See Also:
    • useInstanceLabels

      public LabeledImageServer.Builder useInstanceLabels(boolean instanceLabels)
      Optionally request that unique labels are used for all objects, rather than classifications. If this flag is set, all other label requests are ignored.
      Parameters:
      instanceLabels -
      Returns:
      Since:
      v0.4.0
      See Also:
    • shuffleInstanceLabels

      public LabeledImageServer.Builder shuffleInstanceLabels(boolean doShuffle)
      Optionally request that instance labels are shuffled. Default is true. Only has an effect if useInstanceLabels(boolean) is called with true.
      Parameters:
      doShuffle -
      Returns:
      Since:
      v0.4.0
      See Also:
    • multichannelOutput

      public LabeledImageServer.Builder multichannelOutput(boolean doMultichannel)
      If true, the output image consists of multiple binary images concatenated as different channels, so that the channel number relates to a classification. If false, the output image is a single-channel indexed image so that each pixel value relates to a classification. Indexed images are much more efficient, but are unable to support more than one classification per pixel.
      Parameters:
      doMultichannel -
      Returns:
    • backgroundLabel

      public LabeledImageServer.Builder backgroundLabel(int label)
      Specify the background label (0 by default).
      Parameters:
      label -
      Returns:
    • backgroundLabel

      public LabeledImageServer.Builder backgroundLabel(int label, Integer color)
      Specify the background label (0 by default) and color.
      Parameters:
      label -
      color -
      Returns:
    • addLabelsByName

      public LabeledImageServer.Builder addLabelsByName(Map<String,Integer> labelMap)
      Add multiple labels by classname, where the key represents a classname and the value represents the integer label that should be used for annotations of the given class.
      Parameters:
      labelMap -
      Returns:
    • addLabels

      public LabeledImageServer.Builder addLabels(Map<PathClass,Integer> labelMap)
      Add multiple labels by PathClass, where the key represents a PathClass and the value represents the integer label that should be used for annotations of the given class.
      Parameters:
      labelMap -
      Returns:
    • addLabel

      public LabeledImageServer.Builder addLabel(String pathClassName, int label)
      Add a single label by classname, where the label represents the integer label used for annotations with the given classname.
      Parameters:
      pathClassName -
      label -
      Returns:
    • addLabel

      public LabeledImageServer.Builder addLabel(String pathClassName, int label, Integer color)
      Add a single label by classname, where the label represents the integer label used for annotations with the given classname.
      Parameters:
      pathClassName -
      label - the indexed image pixel value or channel number for the given classification
      color - the color of the lookup table used with any indexed image
      Returns:
    • addLabel

      public LabeledImageServer.Builder addLabel(PathClass pathClass, int label)
      Add a single label by PathClass, where the label represents the integer label used for annotations with the given classification.
      Parameters:
      pathClass -
      label - the indexed image pixel value or channel number for the given classification
      Returns:
    • addLabel

      public LabeledImageServer.Builder addLabel(PathClass pathClass, int label, Integer color)
      Add a single label by PathClass, where the label represents the integer label used for annotations with the given classification.
      Parameters:
      pathClass -
      label - the indexed image pixel value or channel number for the given classification
      color - the color of the lookup table used with any indexed image
      Returns:
    • addUnclassifiedLabel

      public LabeledImageServer.Builder addUnclassifiedLabel(int label, Integer color)
      Add a single label for objects that are unclassified, where the label represents the integer label used for annotations that have no classification set.
      Parameters:
      label - the indexed image pixel value or channel number without a classification
      color - the color of the lookup table used with any indexed image
      Returns:
    • addUnclassifiedLabel

      public LabeledImageServer.Builder addUnclassifiedLabel(int label)
      Add a single label for objects that are unclassified, where the label represents the integer label used for annotations that have no classification set.
      Parameters:
      label - the indexed image pixel value or channel number without a classification
      Returns:
    • setBoundaryLabel

      public LabeledImageServer.Builder setBoundaryLabel(PathClass pathClass, int label)
      Set the classification and label to use for boundaries for classified areas.
      Parameters:
      pathClass -
      label - the indexed image pixel value or channel number for the given classification
      Returns:
    • setBoundaryLabel

      public LabeledImageServer.Builder setBoundaryLabel(PathClass pathClass, int label, Integer color)
      Set the classification and label to use for boundaries for classified areas.
      Parameters:
      pathClass -
      label - the indexed image pixel value or channel number for the given classification
      color - the color of the lookup table used with any indexed image
      Returns:
    • setBoundaryLabel

      public LabeledImageServer.Builder setBoundaryLabel(String pathClassName, int label)
      Set the classification and label to use for boundaries for classified areas.
      Parameters:
      pathClassName -
      label - the indexed image pixel value or channel number for the given classification
      Returns:
    • setBoundaryLabel

      public LabeledImageServer.Builder setBoundaryLabel(String pathClassName, int label, Integer color)
      Set the classification and label to use for boundaries for classified areas.
      Parameters:
      pathClassName -
      label - the indexed image pixel value or channel number for the given classification
      color - the color of the lookup table used with any indexed image
      Returns:
    • maxOutputChannelLimit

      public LabeledImageServer.Builder maxOutputChannelLimit(int maxChannels)
      Specify the maximum number of output channels allowed before QuPath will throw an exception. This is used to guard against inadvertently requesting a labelled image that would have an infeasibly large number of output channels, most commonly with useInstanceLabels().
      Parameters:
      maxChannels - the maximum supported channels; set (cautiously!) ≤ 0 to ignore the limit entirely.
      Returns:
    • build

      public LabeledImageServer build()
      Build the ImageServer with the requested parameters.
      Returns: