Package qupath.imagej.gui.scripts
Class ImageJScriptRunner.Builder
java.lang.Object
qupath.imagej.gui.scripts.ImageJScriptRunner.Builder
- Enclosing class:
ImageJScriptRunner
-
Method Summary
Modifier and TypeMethodDescriptionRequest that the script is stored in the workflow history when it is run for anImageData
.addToWorkflow
(boolean doAdd) Optionally request that the script is stored in the workflow history when it is run for anImageData
.applyToObjects
(ImageJScriptRunner.ApplyToObjects objectType) Specify the objects that the script should be applied to.build()
Build a newImageJScriptRunner
with the parameters specified in this builder.channelIndices
(int... inds) Optionally specify a subset of image channels to pass to ImageJ.channelNames
(String... names) Optionally specify a subset of image channels to pass to ImageJ, based on channel names.channels
(Collection<? extends ColorTransforms.ColorTransform> channels) Optionally specify channels to pass to ImageJ.channels
(ColorTransforms.ColorTransform channel, ColorTransforms.ColorTransform... channels) Optionally specify channels to pass to ImageJ.Request that the child objects are removed from any objects that are passed to the script runner.clearChildObjects
(boolean doClear) Optionally request that the child objects are removed from any objects that are passed to the script runner.closeOpenImages
(boolean doClose) Request that any images left open after the macro are closed.downsample
(DownsampleCalculator downsample) Specify how images should be downsampled when passing them to ImageJ.Specify the path to a file containing the script or macro.fixedDownsample
(double downsample) Use a fixed downsample value when passing images to ImageJ.groovyText
(String groovy) Specify the exact text for an ImageJ macro.Specify the exact text for an ImageJ macro.maxDimension
(int maxDim) Resize images to have a width and height ≤ a specified value when passing images to ImageJ.nThreads
(int nThreads) Specify the number of parallel threads to use.Convert Rois on the overlay of the current image at the end of the script to QuPath annotation objects.Convert Rois on the overlay of the current image at the end of the script to QuPath detection objects.Convert Rois on the overlay of the current image at the end of the script to the specified QuPath object type.Convert Rois on the overlay of the current image at the end of the script to QuPath tile objects.padding
(int padding) Specify how much padding to add around the ROI.pixelSize
(PixelCalibration targetCalibration) Resize images to have a target pixel value when passing images to ImageJ.pixelSizeMicrons
(double pixelSizeMicrons) Resize images to have a target pixel value in µm when passing images to ImageJ.Convert any active Roi at the end of the script to a QuPath annotation object.Convert any active Roi at the end of the script to a QuPath detection object.Convert any active Roi at the end of the script to the specified QuPath object type.Convert any active Roi at the end of the script to a QuPath tile object.scriptEngine
(String scriptEngine) Specify the name of any script engine to use.scriptFile
(File file) Specify a file containing the script or macro.scriptFile
(Path path) Specify a path to the script or macro.Add any QuPath objects within the field of view to an ImageJ overlay.setImageJOverlay
(boolean doSet) Optionally add any QuPath objects within the field of view to an ImageJ overlay.Set the ROI for the QuPath object being set as a Roi on the ImagePlus.setImageJRoi
(boolean doSet) Optionally set the ROI for the QuPath object being set as a Roi on the ImagePlus.taskRunner
(TaskRunner taskRunner) Provide an optional task runner.Specify the exact text for the script or macro.
-
Method Details
-
macroText
Specify the exact text for an ImageJ macro. This is equivalent totext(String)
and also setting the scripting language to specify that we have an ImageJ macro.- Parameters:
macroText
-- Returns:
- this builder
- See Also:
-
groovyText
Specify the exact text for an ImageJ macro. This is equivalent totext(String)
and also setting the scripting language to specify that we have a Groovy script.- Parameters:
groovy
-- Returns:
- this builder
- See Also:
-
text
Specify the exact text for the script or macro.- Parameters:
script
-- Returns:
- this builder
- See Also:
-
file
Specify the path to a file containing the script or macro. The file extension will be used to determine the scripting language (the default is to assume an ImageJ macro).- Parameters:
path
-- Returns:
- this builder
- Throws:
IOException
- if the script cannot be read- See Also:
-
scriptFile
Specify a file containing the script or macro. The file extension will be used to determine the scripting language (the default is to assume an ImageJ macro).- Parameters:
file
-- Returns:
- this builder
- Throws:
IOException
- if the script cannot be read- See Also:
-
scriptFile
Specify a path to the script or macro. The file extension will be used to determine the scripting language (the default is to assume an ImageJ macro).- Parameters:
path
-- Returns:
- this builder
- Throws:
IOException
- if the script cannot be read- See Also:
-
scriptEngine
Specify the name of any script engine to use. By default, the script is assumed to be an ImageJ macro. This parameter can be used to run a script written with another JSR 223-supported scripting language.- Parameters:
scriptEngine
-- Returns:
- this builder
-
setImageJRoi
Set the ROI for the QuPath object being set as a Roi on the ImagePlus.- Returns:
- this builder
-
setImageJRoi
Optionally set the ROI for the QuPath object being set as a Roi on the ImagePlus.- Parameters:
doSet
-- Returns:
- this builder
-
setImageJOverlay
Add any QuPath objects within the field of view to an ImageJ overlay.- Returns:
- this builder
-
setImageJOverlay
Optionally add any QuPath objects within the field of view to an ImageJ overlay.- Parameters:
doSet
-- Returns:
- this builder
-
closeOpenImages
Request that any images left open after the macro are closed.- Parameters:
doClose
-- Returns:
- this builder
-
roiToDetection
Convert any active Roi at the end of the script to a QuPath detection object.- Returns:
- this builder
-
roiToAnnotation
Convert any active Roi at the end of the script to a QuPath annotation object.- Returns:
- this builder
-
roiToTile
Convert any active Roi at the end of the script to a QuPath tile object.- Returns:
- this builder
-
roiToObject
Convert any active Roi at the end of the script to the specified QuPath object type.- Returns:
- this builder
-
overlayToAnnotations
Convert Rois on the overlay of the current image at the end of the script to QuPath annotation objects.- Returns:
- this builder
-
overlayToDetections
Convert Rois on the overlay of the current image at the end of the script to QuPath detection objects.- Returns:
- this builder
-
overlayToTiles
Convert Rois on the overlay of the current image at the end of the script to QuPath tile objects.- Returns:
- this builder
-
overlayToObjects
Convert Rois on the overlay of the current image at the end of the script to the specified QuPath object type.- Returns:
- this builder
-
clearChildObjects
Request that the child objects are removed from any objects that are passed to the script runner. This is usually desirable when adding new objects, to avoid duplicate objects being created by accident if the script is run multiple times.- Returns:
- this builder
-
clearChildObjects
Optionally request that the child objects are removed from any objects that are passed to the script runner. This is usually desirable when adding new objects, to avoid duplicate objects being created by accident if the script is run multiple times.- Parameters:
doClear
-- Returns:
- this builder
-
addToWorkflow
Request that the script is stored in the workflow history when it is run for anImageData
. This is useful to enable the script to be run in the future from a 'regular' Groovy script in QuPath.- Returns:
- this builder
-
addToWorkflow
Optionally request that the script is stored in the workflow history when it is run for anImageData
. This is useful to enable the script to be run in the future from a 'regular' Groovy script in QuPath.- Parameters:
doAdd
-- Returns:
- this builder
-
applyToObjects
Specify the objects that the script should be applied to.- Parameters:
objectType
-- Returns:
- this builder
-
fixedDownsample
Use a fixed downsample value when passing images to ImageJ.- Parameters:
downsample
-- Returns:
- this builder
-
maxDimension
Resize images to have a width and height ≤ a specified value when passing images to ImageJ.- Parameters:
maxDim
-- Returns:
- this builder
-
pixelSizeMicrons
Resize images to have a target pixel value in µm when passing images to ImageJ.- Parameters:
pixelSizeMicrons
-- Returns:
- this builder
-
pixelSize
Resize images to have a target pixel value when passing images to ImageJ.- Parameters:
targetCalibration
-- Returns:
- this builder
-
downsample
Specify how images should be downsampled when passing them to ImageJ.- Parameters:
downsample
-- Returns:
- this builder
-
padding
Specify how much padding to add around the ROI.- Parameters:
padding
- number of pixels of padding to add (should be ≥ 0)- Returns:
- this builder
-
nThreads
Specify the number of parallel threads to use. This value is only used if aTaskRunner
has not be provided.- Parameters:
nThreads
-- Returns:
- this builder
- See Also:
-
taskRunner
Provide an optional task runner. This can be used to show a progress dialog or log output.- Parameters:
taskRunner
-- Returns:
- this builder
- See Also:
-
channelIndices
Optionally specify a subset of image channels to pass to ImageJ.- Parameters:
inds
- channel indices (zero-based)- Returns:
- this builder
-
channelNames
Optionally specify a subset of image channels to pass to ImageJ, based on channel names.- Parameters:
names
- channel names- Returns:
- this builder
-
channels
public ImageJScriptRunner.Builder channels(ColorTransforms.ColorTransform channel, ColorTransforms.ColorTransform... channels) Optionally specify channels to pass to ImageJ.- Parameters:
channel
- the first channel to usechannels
- any additional channels- Returns:
- this builder
-
channels
public ImageJScriptRunner.Builder channels(Collection<? extends ColorTransforms.ColorTransform> channels) Optionally specify channels to pass to ImageJ.- Parameters:
channels
- the channels to use- Returns:
- this builder
-
build
Build a newImageJScriptRunner
with the parameters specified in this builder.- Returns:
-