Class ScriptParameters
- Since:
- v0.4.0
- Author:
- Pete Bankhead
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic ScriptParameters.Builder
builder()
Create a new builder forScriptParameters
.boolean
Request whether to fire an update event for the object hierarchy, if an image data object is available.String[]
getArgs()
Get an optional array of string arguments passed to the script.int
Get the index of the current image for batch processing, where 0 is the first andgetBatchSize() - 1
is the last.Get whether changes to the image data should be saved.int
Get the number of images being batch processed, or 1 if just a single image is being processed.Get default imports that should be included with the script, where possible.Get default static imports that should be included with the script, where possible.Get the error writer for script output.getFile()
Get the file where the script is located.ImageData
<?> Get the currentImageData
that should be used with the script.Project
<?> Get the current project that should be used with the script.Get the text of the script.Get the main writer for script output.boolean
Request that any script should be compiled before being evaluated, and previously compiled versions reused when possible.
-
Method Details
-
getFile
Get the file where the script is located. This can return null if the script is purely in-memory.Note that if it is not null, the contents of the file do not have to match the result of
getScript()
, e.g. if the script has unsaved changes. It can nevertheless be helpful to know the location of the file to handle relative paths, if required.- Returns:
- See Also:
-
getScript
Get the text of the script. If this has not been set explicitly, the script is read fromgetFile()
. If there is no script and no valid file, aRuntimeException
will be thrown.- Returns:
-
getProject
Get the current project that should be used with the script. This may be null.- Returns:
-
getImageData
Get the currentImageData
that should be used with the script. This may be null.- Returns:
-
getBatchSize
public int getBatchSize()Get the number of images being batch processed, or 1 if just a single image is being processed.This is useful in combination with
getBatchIndex()
to write scripts that (for example) can adapt to whether they are the first or last to run in a batch.- Returns:
- See Also:
-
getBatchIndex
public int getBatchIndex()Get the index of the current image for batch processing, where 0 is the first andgetBatchSize() - 1
is the last.This is useful in combination with
getBatchSize()
to write scripts that (for example) can adapt to whether they are the first or last to run in a batch.- Returns:
- See Also:
-
getBatchSaveResult
Get whether changes to the image data should be saved.- Returns:
- true if changes should be saved after running the script, false if they should not or if it is unknown
-
getArgs
Get an optional array of string arguments passed to the script.- Returns:
-
getWriter
Get the main writer for script output.- Returns:
-
getErrorWriter
Get the error writer for script output.- Returns:
-
getDefaultImports
Get default imports that should be included with the script, where possible. Not all languages may support adding default imports.The purpose of this is to make scripting easier and more intuitive, resembling a macro language and without a need for the user to know much about QuPath's classes.
- Returns:
- See Also:
-
useCompiled
public boolean useCompiled()Request that any script should be compiled before being evaluated, and previously compiled versions reused when possible.This is not always supported, but where it is it may improve performance if the same script is evaluated many times. It may also mean that any errors are caught earlier.
- Returns:
-
doUpdateHierarchy
public boolean doUpdateHierarchy()Request whether to fire an update event for the object hierarchy, if an image data object is available.The purpose of this is to avoid requiring the caller to fire a hierarchy update as boilerplate at the end of a script.
- Returns:
-
getDefaultStaticImports
Get default static imports that should be included with the script, where possible. Not all languages may support adding default imports.The purpose of this is to make scripting easier and more intuitive, resembling a macro language and without a need for the user to know much about QuPath's classes.
- Returns:
- See Also:
-
builder
Create a new builder forScriptParameters
.- Returns:
-