Class BioFormatsServerOptions
java.lang.Object
qupath.lib.images.servers.bioformats.BioFormatsServerOptions
Container for various options that can customize the behavior of the
BioFormatsImageServer
.- Author:
- Pete Bankhead
-
Field Summary
Modifier and TypeFieldDescriptionstatic String
System property controlling whether memoization is allowed or not. -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
Check whether memoization should be allowed or not.boolean
Returns true if Bio-Formats is enabled and may be used to read images.void
Clear all reader options, returning these to their defaults.boolean
Returns true if Bio-Formats is restricted to support only local files, not other URLs.static BioFormatsServerOptions
Get the static instance of BioFormatsServerOptions, available to servers being constructed.int
Returns the number of milliseconds that must elapse when opening an image before a memoization file is generated.Get the path to the directory where memoization files should be written, or null if no path is set.Get a map representing additional arguments that should be passed to readers.Query the set of file extensions for which Bio-Formats should not be used.Query the set of file extensions for which Bio-Formats should always be used.boolean
Returns true if multiple readers may be created for different threads, to enable parallel image reading.void
setBioformatsEnabled
(boolean bioformatsEnabled) Set whether Bio-Formats should be enabled or disabled (in favor of other readers).void
setFilesOnly
(boolean filesOnly) Set whether Bio-Formats should support only local files (rather than any URL).void
setMemoizationTimeMillis
(int memoizationTimeMillis) Set the number of milliseconds that must elapse when opening an image before a memoization file is generated.void
setPathMemoization
(String pathMemoization) Set the directory where memoization files should be written.void
setReaderOptions
(Map<String, String> options) Set additional arguments that should be passed to readers.void
setRequestParallelization
(boolean requestParallelization) Optionally enable or disable parallelization when reading images.
-
Field Details
-
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
Get the path to the directory where memoization files should be written, or null if no path is set.- Returns:
-
setPathMemoization
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
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 tosetReaderOptions(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
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 callclearReaderOptions()
after options are no longer required.- Parameters:
options
- the arguments to pass when opening new readers- See Also:
-
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
Query the set of file extensions for which Bio-Formats should not be used.- Returns:
-
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 propertyALLOW_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
-