Class PyramidalOMEZarrWriter.Builder

java.lang.Object
qupath.lib.images.writers.ome.zarr.PyramidalOMEZarrWriter.Builder
Enclosing class:
PyramidalOMEZarrWriter

public static class PyramidalOMEZarrWriter.Builder extends Object
Builder to create an instance of a PyramidalOMEZarrWriter.
  • Constructor Details

  • Method Details

    • compression

      public PyramidalOMEZarrWriter.Builder compression(com.bc.zarr.Compressor compressor)
      Set the compressor to use when writing the image. By default, the blocs compression is used.
      Parameters:
      compressor - the compressor to use when writing the image
      Returns:
      this builder
      Throws:
      NullPointerException - if the provided compressor is null
    • parallelize

      public PyramidalOMEZarrWriter.Builder parallelize(int numberOfThreads)
      Tiles will be written from a pool of thread. This function specifies the number of threads to use. By default, ThreadTools.getParallelism() threads are used.
      Parameters:
      numberOfThreads - the number of threads to use when writing tiles
      Returns:
      this builder
      Throws:
      IllegalArgumentException - if the provided number of threads is less than 1
    • downsamples

      public PyramidalOMEZarrWriter.Builder downsamples(double... downsamples)
      Enable the creation of a pyramidal image with the provided downsamples. By default, only one downsample of value 1 is used.
      Parameters:
      downsamples - the downsamples the output image should have. There must be at least one downsample and each downsample should be greater than or equal to 1
      Returns:
      this builder
      Throws:
      IllegalArgumentException - if no downsample with value 1 is provided or if one provided downsample is less than 1
    • setMaxNumberOfChunksOnEachSpatialDimension

      public PyramidalOMEZarrWriter.Builder setMaxNumberOfChunksOnEachSpatialDimension(int maxNumberOfChunks)
      In Zarr images, data is stored in chunks. This parameter defines the maximum number of chunks on the x,y, and z dimensions. By default, this value is set to -1.

      Use a negative value to not define any maximum number of chunks.

      Parameters:
      maxNumberOfChunks - the maximum number of chunks on the x,y, and z dimensions
      Returns:
      this builder
    • tileSize

      public PyramidalOMEZarrWriter.Builder tileSize(int tileSize)
      In Zarr images, data is stored in chunks. This parameter defines the size of chunks on the x and y dimensions. By default, these values are set to 1024.

      Use a negative value to use the tile width/height of the provided image server.

      The provided tile width/height may not be used if this implies creating more chunks than the value given in setMaxNumberOfChunksOnEachSpatialDimension(int).

      Parameters:
      tileSize - the width/height each chunk should have
      Returns:
      this builder
    • tileSize

      public PyramidalOMEZarrWriter.Builder tileSize(int tileWidth, int tileHeight)
      In Zarr images, data is stored in chunks. This parameter defines the size of chunks on the x and y dimensions. By default, these values are set to 1024.

      Use a negative value to use the tile width/height of the provided image server.

      The provided tile width/height may not be used if this implies creating more chunks than the value given in setMaxNumberOfChunksOnEachSpatialDimension(int).

      Parameters:
      tileWidth - the width each chunk should have
      tileHeight - the height each chunk should have
      Returns:
      this builder
    • region

      public PyramidalOMEZarrWriter.Builder region(ImageRegion boundingBox)
      Define a region (on the x-axis and y-axis) of the input image to consider.
      Parameters:
      boundingBox - the region to consider. Only the x, y, width, and height of this region are taken into account. Can be null to use the entire image. Null by default
      Returns:
      this builder
    • zSlices

      public PyramidalOMEZarrWriter.Builder zSlices(int zStart, int zEnd)
      Define the z-slices of the input image to consider.
      Parameters:
      zStart - the 0-based inclusive index of the first z-slice to consider. 0 by default
      zEnd - the 0-based exclusive index of the last z-slice to consider. Equal to the number of z-slices of the image by default
      Returns:
      this builder
      Throws:
      IllegalArgumentException - if the min z-slice index is greater than the max z-slice index
    • timePoints

      public PyramidalOMEZarrWriter.Builder timePoints(int tStart, int tEnd)
      Define the timepoints of the input image to consider.
      Parameters:
      tStart - the 0-based inclusive index of the first timepoint to consider. 0 by default
      tEnd - the 0-based exclusive index of the last timepoint to consider. Equal to the number of timepoints of the image by default
      Returns:
      this builder
      Throws:
      IllegalArgumentException - if the min timepoint index is greater than the max timepoint index
    • onProgress

      public PyramidalOMEZarrWriter.Builder onProgress(DoubleConsumer onProgress)
      Set a function that will be called at different steps when the writing occurs. Its parameter will be a double between 0 and 1 indicating the progress of the operation (0: beginning, 1: finished). This function may be called from any thread.
      Parameters:
      onProgress - a function that will be called at different steps when the writing occurs
      Returns:
      this builder
      Throws:
      NullPointerException - if the provided parameter is null
    • build

      public PyramidalOMEZarrWriter build(String path) throws IOException
      Create a new instance of PyramidalOMEZarrWriter. This will also create an empty image on the provided path.
      Parameters:
      path - the path where to write the image. It must end with ".ome.zarr" and shouldn't already exist
      Returns:
      the new PyramidalOMEZarrWriter
      Throws:
      InvalidPathException - if a path object cannot be created from the provided path
      IOException - if the empty image cannot be created. This can happen if the provided path is incorrect or if the user doesn't have enough permissions
      IllegalArgumentException - if the provided path doesn't end with ".ome.zarr" or a file/directory already exists at this location