Class SpotiflowBuilder

java.lang.Object
qupath.ext.biop.spotiflow.SpotiflowBuilder

public class SpotiflowBuilder extends Object
Spot detection based on the following method:
   Albert Dominguez Mantes et al.
     "Spotiflow: accurate and efficient spot detection for fluorescence microscopy with deep stereographic flow regression"
   Cold Spring Harbor Laboratory - bioRxiv, 2024. doi: 10.1101/2024.02.01.578426
 
See the main repo at https://github.com/weigertlab/spotiflow

Very much inspired by qupath-extension-cellpose at https://github.com/BIOP/qupath-extension-cellpose

  • Constructor Details

    • SpotiflowBuilder

      protected SpotiflowBuilder()
      Build a spotiflow model
  • Method Details

    • tempDirectory

      public SpotiflowBuilder tempDirectory(File inputDir)
      Set input folder to predict spots
      Parameters:
      inputDir - path to prediction input dir
      Returns:
      this builder
    • savePredictionImages

      public SpotiflowBuilder savePredictionImages(boolean savePredictionImages)
      Set input folder to predict spots
      Parameters:
      savePredictionImages - overwrite variable
      Returns:
      this builder
    • setPretrainedModelName

      public SpotiflowBuilder setPretrainedModelName(String modelName)
      Set pre-trained model to use for prediction
      Parameters:
      modelName - name of the pre-trained model
      Returns:
      this builder
    • setProbabilityThreshold

      public SpotiflowBuilder setProbabilityThreshold(double probabilityThreshold)
      Set probability threshold for peak detection
      Parameters:
      probabilityThreshold -
      Returns:
      this builder
    • setMinDistance

      public SpotiflowBuilder setMinDistance(double minDistance)
      Set minimum distance between spots for NMS
      Parameters:
      minDistance -
      Returns:
      this builder
    • setModelDir

      public SpotiflowBuilder setModelDir(File modelDir)
      Set model directory to use for prediction
      Parameters:
      modelDir - path to the custom model
      Returns:
      this builder
    • channels

      public SpotiflowBuilder channels(int... channels)
      Specify channels. Useful for detecting nuclei for one channel within a multi-channel image, or potentially for trained models that support multi-channel input.
      Parameters:
      channels - 0-based indices of the channels to use
      Returns:
      this builder
    • channels

      public SpotiflowBuilder channels(String... channels)
      Specify channels by name. Useful for detecting nuclei for one channel within a multi-channel image, or potentially for trained models that support multi-channel input.
      Parameters:
      channels - channels names to use
      Returns:
      this builder
    • setTrainingInputDir

      public SpotiflowBuilder setTrainingInputDir(File inputDir)
      Set input folder to train a new model
      Parameters:
      inputDir - path to the training input dir
      Returns:
      this builder
    • setTrainingOutputDir

      public SpotiflowBuilder setTrainingOutputDir(File outputDir)
      Set output folder to save a new model
      Parameters:
      outputDir - path to the training input dir
      Returns:
      this builder
    • useGPU

      public SpotiflowBuilder useGPU(boolean useGPU)
      Enable CPU / GPU usage
      Parameters:
      useGPU - override useGPU
      Returns:
      this builder
    • process3d

      public SpotiflowBuilder process3d(boolean process3d)
      Allows to process all slices
      Parameters:
      process3d - override process3d
      Returns:
      this builder
    • doSubpixel

      public SpotiflowBuilder doSubpixel(boolean doSubpixel)
      Allows to go subpixel resolution
      Parameters:
      doSubpixel - override doSubpixel
      Returns:
      this builder
    • setClassChannelName

      public SpotiflowBuilder setClassChannelName()
      Allows to go subpixel resolution
      Returns:
      this builder
    • setClass

      public SpotiflowBuilder setClass(String pathClass)
      Allows to go subpixel resolution
      Returns:
      this builder
    • addParameter

      public SpotiflowBuilder addParameter(String flagName, String flagValue)
      Generic means of adding a spotiflow parameter
      Parameters:
      flagName - the name of the flag, eg. "save_every"
      flagValue - the value that is linked to the flag, eg. "20". Can be an empty string or null if it is not needed
      Returns:
      this builder
    • addParameter

      public SpotiflowBuilder addParameter(String flagName)
      Generic means of adding a spotiflow parameter
      Parameters:
      flagName - the name of the flag, eg. "save_every" * @param flagName the name of the flag, eg. "save_every"
      Returns:
      this builder
    • build

      public Spotiflow build()
      Create a Spotiflow, all ready for detection.
      Returns:
      a new Spotiflow instance