Class BioimageIoTools

java.lang.Object
qupath.opencv.ml.BioimageIoTools

public class BioimageIoTools extends Object
Helper class for working with Bioimage Model Zoo model specs, and attempting to replicating the processing within QuPath.
Since:
v0.4.0
Author:
Pete Bankhead
  • Constructor Details

    • BioimageIoTools

      public BioimageIoTools()
  • Method Details

    • buildDnnModel

      public static DnnModel buildDnnModel(qupath.bioimageio.spec.BioimageIoSpec.BioimageIoModel spec)
      Attempt to build a DnnModel that follows this spec as closely as possible.

      In some instances, the processing steps requires by the spec might not currently be supported by QuPath - see transformToOp(Processing) for more information.

      Parameters:
      spec -
      Returns:
    • buildPatchClassifierParams

      public static PatchClassifierParams buildPatchClassifierParams(qupath.bioimageio.spec.BioimageIoSpec.BioimageIoModel model, ImageOp... inputOps)
      Create an instance of PatchClassifierParams from a model spec. This encapsulates some key information QuPath needs for building a model in a way that can be modified and updated according to user requirements.
      Parameters:
      model - the model spec to initialize the parameters
      inputOps - optional additional preprocessing ops to apply, before any in the model spec are added
      Returns:
    • buildPatchClassifierParams

      public static PatchClassifierParams buildPatchClassifierParams(qupath.bioimageio.spec.BioimageIoSpec.BioimageIoModel modelSpec, int preferredTileWidth, int preferredTileHeight, ImageOp... inputOps)
      Create an instance of PatchClassifierParams from a model spec. This encapsulates some key information QuPath needs for building a model in a way that can be modified and updated according to user requirements.
      Parameters:
      modelSpec - the model spec to initialize the parameters
      preferredTileWidth - preferred tile width, or -1 to automatically determine this; the width will be updated based on the spec
      preferredTileHeight - preferred tile height, or -1 to automatically determine this; the height will be updated based on the spec
      inputOps - optional additional preprocessing ops to apply, before any in the model spec are added
      Returns:
    • transformsToOp

      public static ImageOp transformsToOp(Collection<? extends qupath.bioimageio.spec.BioimageIoSpec.Processing> transforms)
      Create an ImageOp that applies the specified transforms sequentially.

      Important! This method is experimental and subject to change in future versions.

      Not all Bioimage Model Zoo transforms are supported by QuPath ops, and ops are generally per tile whereas model zoo transforms sometimes require global statistics (e.g. for normalization).

      This method will make an attempt to return a suitable op, but it may not be able to incorporate all steps.

      Parameters:
      transforms -
      Returns:
    • transformToOp

      public static ImageOp transformToOp(qupath.bioimageio.spec.BioimageIoSpec.Processing transform)
      Create an ImageOp that applies the specified transforms, if possible.

      Important! This method is experimental and subject to change in future versions.

      Not all Bioimage Model Zoo transforms are supported by QuPath ops, and ops are generally per tile whereas model zoo transforms sometimes require global statistics (e.g. for normalization).

      This method will make an attempt to return a suitable op, but may return null if no such op is available.

      Parameters:
      transform -
      Returns: