Class BioFormatsServerOptions

java.lang.Object
qupath.lib.images.servers.bioformats.BioFormatsServerOptions

public class BioFormatsServerOptions extends Object
Container for various options that can customize the behavior of the BioFormatsImageServer.
Author:
Pete Bankhead
  • Field Details

    • ALLOW_MEMOIZATION_PROPERTY

      public static String ALLOW_MEMOIZATION_PROPERTY
      System property controlling whether memoization is allowed or not. If set to false, this is a hint that memoization should not be supported - but it is up to consumers to enforce that.

      Default is to set status based upon Java version, with 17+ turning memoization off.

      See https://github.com/qupath/qupath/issues/957

  • Method Details

    • getPathMemoization

      public String getPathMemoization()
      Get the path to the directory where memoization files should be written, or null if no path is set.
      Returns:
    • setPathMemoization

      public void setPathMemoization(String pathMemoization)
      Set the directory where memoization files should be written. This can be null, in which case memoization files may be written in the same directory as the original image.
      Parameters:
      pathMemoization -
    • getReaderOptions

      public Map<String,String> getReaderOptions()
      Get a map representing additional arguments that should be passed to readers. This method returns a copy of the map, and therefore changes will not automatically be reflected in the options until these are passed to setReaderOptions(Map).
      Returns:
      the additional arguments currently requested when opening images
      See Also:
    • clearReaderOptions

      public void clearReaderOptions()
      Clear all reader options, returning these to their defaults.
      See Also:
    • setReaderOptions

      public void setReaderOptions(Map<String,String> options)
      Set additional arguments that should be passed to readers. Example:
              BioFormatsServerOptions.setReaderOptions(Map.of("zeissczi.autostitch", "false"));
       
      Note: options are passed to every server, even when irrelevant for the particular server type. Therefore they can end up being stored unnecessarily in projects and server paths. For that reason it best practice to call clearReaderOptions() after options are no longer required.
      Parameters:
      options - the arguments to pass when opening new readers
      See Also:
    • getInstance

      public static BioFormatsServerOptions getInstance()
      Get the static instance of BioFormatsServerOptions, available to servers being constructed.
      Returns:
    • bioformatsEnabled

      public boolean bioformatsEnabled()
      Returns true if Bio-Formats is enabled and may be used to read images.
      Returns:
    • setBioformatsEnabled

      public void setBioformatsEnabled(boolean bioformatsEnabled)
      Set whether Bio-Formats should be enabled or disabled (in favor of other readers).
      Parameters:
      bioformatsEnabled -
    • setFilesOnly

      public void setFilesOnly(boolean filesOnly)
      Set whether Bio-Formats should support only local files (rather than any URL).
      Parameters:
      filesOnly -
    • getFilesOnly

      public boolean getFilesOnly()
      Returns true if Bio-Formats is restricted to support only local files, not other URLs.
      Returns:
    • getMemoizationTimeMillis

      public int getMemoizationTimeMillis()
      Returns the number of milliseconds that must elapse when opening an image before a memoization file is generated.
      Returns:
    • setMemoizationTimeMillis

      public void setMemoizationTimeMillis(int memoizationTimeMillis)
      Set the number of milliseconds that must elapse when opening an image before a memoization file is generated.
      Parameters:
      memoizationTimeMillis -
    • requestParallelization

      public boolean requestParallelization()
      Returns true if multiple readers may be created for different threads, to enable parallel image reading.
      Returns:
    • setRequestParallelization

      public void setRequestParallelization(boolean requestParallelization)
      Optionally enable or disable parallelization when reading images. Parallelization required creating multiple readers, which may in some cases be too memory-hungry and cause problems.
      Parameters:
      requestParallelization -
    • getSkipAlwaysExtensions

      public Set<String> getSkipAlwaysExtensions()
      Query the set of file extensions for which Bio-Formats should not be used.
      Returns:
    • getUseAlwaysExtensions

      public Set<String> getUseAlwaysExtensions()
      Query the set of file extensions for which Bio-Formats should always be used.
      Returns:
    • allowMemoization

      public static boolean allowMemoization()
      Check whether memoization should be allowed or not. This returns true, unless the system property ALLOW_MEMOIZATION_PROPERTY specifies that it should be false. The reason it exists is that memoization can fail
      Returns:
      true if memoization should be allowed, false otherwise
      Since:
      v0.4.0