Class DensityMaps.DensityMapBuilder

java.lang.Object
qupath.lib.analysis.heatmaps.DensityMaps.DensityMapBuilder
Enclosing class:
DensityMaps

public static class DensityMaps.DensityMapBuilder extends Object
Builder for an ImageServer representing a density map or for DensityMaps.DensityMapParameters.
  • Method Details

    • pixelSize

      public DensityMaps.DensityMapBuilder pixelSize(qupath.lib.images.servers.PixelCalibration requestedPixelSize)
      Requested pixel size to determine the resolution of the density map, in calibrated units.

      If this is not specified, an ImageData should be provided to buildClassifier(ImageData) and used to determine a suitable pixel size based upon the radius value and the image dimensions.

      This is recommended, since specifying a pixel size could potentially result in creating maps that are too large or too small, causing performance or memory problems.

      Parameters:
      requestedPixelSize -
      Returns:
      this builder
      See Also:
    • type

      The type of the density map, which determines any associated normalization.
      Parameters:
      type -
      Returns:
      this builder
    • addDensities

      public DensityMaps.DensityMapBuilder addDensities(String name, qupath.lib.objects.PathObjectPredicates.PathObjectPredicate filter)
      Add a filter for computing densities. This is added on top of the filter specified in DensityMaps.builder(PathObjectPredicate) to extract a subset of objects for which densities are determined.
      Parameters:
      name - name of the filter; usually this is the name of a classification that the objects should have
      filter - the filter itself (predicate that must be JSON-serializable)
      Returns:
      this builder
    • colorModel

      public DensityMaps.DensityMapBuilder colorModel(ColorModels.ColorModelBuilder colorModelBuilder)
      Set a ColorModels.ColorModelBuilder that can be used in conjunction with buildServer(ImageData). If this is not set, the default ColorModel used with buildServer(ImageData) may not convert well to RGB.
      Parameters:
      colorModelBuilder -
      Returns:
    • radius

      public DensityMaps.DensityMapBuilder radius(double radius)
      The radius of the filter used to calculate densities.
      Parameters:
      radius -
      Returns:
      this builder
    • buildParameters

      public DensityMaps.DensityMapParameters buildParameters()
      Build a DensityMaps.DensityMapParameters object containing the main density map parameters.
      Returns:
    • buildClassifier

      public qupath.lib.classifiers.pixel.PixelClassifier buildClassifier(qupath.lib.images.ImageData<BufferedImage> imageData)
      Build a PixelClassifier for a density map using the current parameters and the specified ImageData.
      Parameters:
      imageData -
      Returns:
      the density map
      See Also:
    • buildServer

      public qupath.lib.images.servers.ImageServer<BufferedImage> buildServer(qupath.lib.images.ImageData<BufferedImage> imageData)
      Build an ImageServer representing this density map.

      Note that this involved generating a unique ID and caching all tiles. The reason is that density maps can change over time as the object hierarchy changes, and therefore one should be generated that represents a snapshot in time. However, this imposes a limit on the size of density map that can be generated to avoid memory errors.

      If greater control is needed over when and how the density map is created, using buildClassifier(ImageData) instead.

      Parameters:
      imageData -
      Returns:
      See Also: