Package gov.nih.mipav.view.dialogs
Class AlgorithmParameters
java.lang.Object
gov.nih.mipav.view.dialogs.AlgorithmParameters
- Direct Known Subclasses:
DataProvenanceParameters
This class standardizes the parameter names given to many common parameters used in algorithms. It also provides helper methods to store/retrieve those common parameters.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intCounter used to track the number of input images stored (aka used) by an algorithm.static final StringLabel used for the parameter indicating whether an algorithm should output a new image.static final StringLabel used for the parameter indicating whether an algorithm should process a 3D image as a set of 2D slices instead of a 3D volume.static final StringLabel used for the parameter indicating whether to process the each channel of an RGB image (ignored for grayscale images).static final StringLabel used for the parameter indicating whether separable convolution kernels should be used in an algorithm.static final StringLabel used for the parameter indicating whether the whole image should be processed (true), or just areas within VOIs (false).static final StringThe base of parameter labels used for an algorithm's input image(s).static final StringLabel used for the parameter indicating the number of iterations to perform in a script action.protected ParameterTableThe list of parameters selected by the user in an algorithm's dialog, or the list of parameters to use to setup the dialog GUI.static final StringLabel used in ActionDiscovery system for main result image of an algorithm.static final StringLabel used for the parameter indicating whether to correct the gaussian's standard deviation Z dimension using the ratio of the X and Z resolutions.static final StringLabel used for the parameter indicating the unnormalized/uncorrected gaussian standard deviation to be used.static final StringLabel used for boolean param indicating whether the algorithm should try to use OpenCL. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new AlgorithmParameters object to be used to record the current parameters entered into the algorithm's GUI by the user.AlgorithmParameters(ParameterTable parsedParams) Creates a new AlgorithmParameters object to be used to set up the algorithm's GUI from stored parameters. -
Method Summary
Modifier and TypeMethodDescriptionbooleanDOCUMENT ME!booleanDOCUMENT ME!boolean[]DOCUMENT ME!booleanDOCUMENT ME!booleanDOCUMENT ME!booleanDOCUMENT ME!static StringgetInputImageLabel(int inputImageNumber) Returns the label which should be used for an input image parameter.intDOCUMENT ME!Retrieves the list of parameters to either be used to run the script or store settings for future executions of the algorithm in a script.float[]DOCUMENT ME!protected static booleanReturns whether an image has been registered in the script recorder.retrieveImage(String imageParamLabel) Returns an image with a particular parameter name.Returns the first input image for the algorithm.retrieveInputImage(int inputImageNumber) Returns one of the algorithm's input images.voidsetColorOptionsGUI(JPanelColorChannels colorChannelPanel) Sets the color channel GUI panel, based on the script action's parameters.voidsetOutputOptionsGUI(JPanelAlgorithmOutputOptions outputOptionsPanel) Sets up the algorithm output options panel components (whole image vs.voidsetSigmasGUI(JPanelSigmas sigmaPanel) Sets up the GUI containing the sigmas used in an algorithm (usually Gaussian sigmas), based on the script action's parameters.voidstoreColorOptions(boolean processRed, boolean processGreen, boolean processBlue) Stores the values of color channel processing options in the parameter table.voidstoreColorOptions(JPanelColorChannels colorChannelPanel) Stores the values from the color channel panel in the parameter table.storeImage(ModelImage image, String paramLabel) Stores an input image in the list of parameters for the algorithm.storeImageInRecorder(ModelImage image) Store an image in the script recorder image variable table.static StringstoreImageInRunner(ModelImage image) Store an image in the script runner image variable table.storeInputImage(ModelImage inputImage) Stores an input image in the list of parameters for the algorithm.voidstoreNumIterations(int numIters) DOCUMENT ME!storeOutputImageParams(ModelImage outputImage, boolean isNewImage) Stores information about the output of images for this algorithm in the parameter table.voidstoreProcess3DAs25D(boolean doProcess3DAs25D) voidstoreProcessingOptions(boolean doWholeImage, boolean do25D) Stores options for how an algorithm should process images in the parameter table.voidstoreProcessSeparable(boolean doProcessSep) Stores options for an algorithm using a kernel that can process dimensions separately.voidstoreProcessWholeImage(boolean doWholeImage) Stores whether the whole image or just VOI regions should be processed in the parameter table.voidstoreSigmas(float[] sigmas, boolean isZCorrectionEnabled) Stores an algorithm's sigmas in the parameter table.voidstoreSigmas(JPanelSigmas sigmaPanel) Stores an algorithm's sigmas in the parameter table.voidstoreWaterShed(float[] sigmas, boolean isZCorrectionEnabled) Stores an algorithm's sigmas in the parameter table.voidtryToStoreResultImageInRunner(ModelImage resultImage) DOCUMENT ME!
-
Field Details
-
INPUT_IMAGE_LABEL_BASE
The base of parameter labels used for an algorithm's input image(s). Append a '_1' to get the first image, for example.- See Also:
-
DO_OUTPUT_NEW_IMAGE
Label used for the parameter indicating whether an algorithm should output a new image.- See Also:
-
DO_PROCESS_WHOLE_IMAGE
Label used for the parameter indicating whether the whole image should be processed (true), or just areas within VOIs (false).- See Also:
-
DO_PROCESS_SEPARABLE
Label used for the parameter indicating whether separable convolution kernels should be used in an algorithm.- See Also:
-
DO_PROCESS_3D_AS_25D
Label used for the parameter indicating whether an algorithm should process a 3D image as a set of 2D slices instead of a 3D volume.- See Also:
-
SIGMAS
Label used for the parameter indicating the unnormalized/uncorrected gaussian standard deviation to be used.- See Also:
-
SIGMA_DO_Z_RES_CORRECTION
Label used for the parameter indicating whether to correct the gaussian's standard deviation Z dimension using the ratio of the X and Z resolutions.- See Also:
-
DO_PROCESS_RGB
Label used for the parameter indicating whether to process the each channel of an RGB image (ignored for grayscale images).- See Also:
-
NUM_ITERATIONS
Label used for the parameter indicating the number of iterations to perform in a script action.- See Also:
-
RESULT_IMAGE
Label used in ActionDiscovery system for main result image of an algorithm.- See Also:
-
USE_OPENCL
Label used for boolean param indicating whether the algorithm should try to use OpenCL.- See Also:
-
currentInputImageLabelNumber
protected int currentInputImageLabelNumberCounter used to track the number of input images stored (aka used) by an algorithm. This is only used while recording parameters from an algorithm's GUI. -
params
The list of parameters selected by the user in an algorithm's dialog, or the list of parameters to use to setup the dialog GUI. This depends on whether this object is being used to store parameters or to make use of previously stored parameters.
-
-
Constructor Details
-
AlgorithmParameters
public AlgorithmParameters()Creates a new AlgorithmParameters object to be used to record the current parameters entered into the algorithm's GUI by the user. -
AlgorithmParameters
Creates a new AlgorithmParameters object to be used to set up the algorithm's GUI from stored parameters.- Parameters:
parsedParams- stored parameters which should be used to set up the algorithm's variables/GUI.
-
-
Method Details
-
getInputImageLabel
Returns the label which should be used for an input image parameter.- Parameters:
inputImageNumber- Number indicating which input image this is.- Returns:
- The label/name which should be used for this input image in the parameter table.
-
storeImageInRecorder
Store an image in the script recorder image variable table. Used to store input/output images while recording a script. Should not be used while running a script.- Parameters:
image- The image to store in the variable table.- Returns:
- The image placeholder variable assigned to the image by the variable table.
-
storeImageInRunner
Store an image in the script runner image variable table. Used to store input/output images while running a script. Should not be used while recording a script.- Parameters:
image- The image to store in the variable table.- Returns:
- The image placeholder variable assigned to the image by the variable table.
-
doOutputNewImage
public boolean doOutputNewImage()DOCUMENT ME!- Returns:
- DOCUMENT ME!
-
doProcess3DAs25D
public boolean doProcess3DAs25D()DOCUMENT ME!- Returns:
- DOCUMENT ME!
-
doProcessRGB
public boolean[] doProcessRGB()DOCUMENT ME!- Returns:
- DOCUMENT ME!
-
doProcessSeparable
public boolean doProcessSeparable()DOCUMENT ME!- Returns:
- DOCUMENT ME!
-
doProcessWholeImage
public boolean doProcessWholeImage()DOCUMENT ME!- Returns:
- DOCUMENT ME!
-
doSigmaResolutionCorrection
public boolean doSigmaResolutionCorrection()DOCUMENT ME!- Returns:
- DOCUMENT ME!
-
getNumIterations
public int getNumIterations()DOCUMENT ME!- Returns:
- DOCUMENT ME!
-
getParams
Retrieves the list of parameters to either be used to run the script or store settings for future executions of the algorithm in a script.- Returns:
- The table of parameters for this algorithm.
-
getUnnormalizedSigmas
public float[] getUnnormalizedSigmas()DOCUMENT ME!- Returns:
- DOCUMENT ME!
-
retrieveImage
Returns an image with a particular parameter name.- Parameters:
imageParamLabel- The parameter label of the image to retrieve.- Returns:
- The requested image.
-
retrieveInputImage
Returns the first input image for the algorithm.- Returns:
- The first input image.
- See Also:
-
retrieveInputImage
Returns one of the algorithm's input images.- Parameters:
inputImageNumber- A number indicating which input image should be retrieved.- Returns:
- The
inputImageNumber-th input image.
-
setColorOptionsGUI
Sets the color channel GUI panel, based on the script action's parameters. This is a helper function used to handle parameters common to many algorithms.- Parameters:
colorChannelPanel- The color channel panel to set the values of.
-
setOutputOptionsGUI
Sets up the algorithm output options panel components (whole image vs. VOI and new image vs. replace), based on the script action's parameters. This is a helper function used to handle parameters common to many algorithms.- Parameters:
outputOptionsPanel- The algorithm output options panel to set the values of.
-
setSigmasGUI
Sets up the GUI containing the sigmas used in an algorithm (usually Gaussian sigmas), based on the script action's parameters. This is a helper function used to handle parameters common to many algorithms.- Parameters:
sigmaPanel- The sigmas panel to set up based on the parameters.
-
storeColorOptions
Stores the values from the color channel panel in the parameter table. This function is used when recording a script. This is a helper function used to handle parameters common to many algorithms.- Parameters:
colorChannelPanel- The color channel panel to extract the options from.- Throws:
ParserException- If there is a problem creating one of the new parameters.
-
storeColorOptions
public void storeColorOptions(boolean processRed, boolean processGreen, boolean processBlue) throws ParserException Stores the values of color channel processing options in the parameter table. This function is used when recording a script. This is a helper function used to handle parameters common to many algorithms.- Parameters:
processRed- Whether the red channel of a color image should be processed.processGreen- Whether the green channel of a color image should be processed.processBlue- Whether the blue channel of a color image should be processed.- Throws:
ParserException- If there is a problem creating one of the new parameters.
-
storeImage
Stores an input image in the list of parameters for the algorithm.- Parameters:
image- The image to store.paramLabel- The label to give to the new image parameter.- Returns:
- The image placeholder variable assigned to the image by the variable table.
- Throws:
ParserException- If there is a problem creating one of the new parameters.
-
storeInputImage
Stores an input image in the list of parameters for the algorithm. This image is stored with a new parameter label incremented with each new call to this method.- Parameters:
inputImage- The input image to store.- Returns:
- The image placeholder variable assigned to the image by the variable table.
- Throws:
ParserException- If there is a problem creating one of the new parameters.
-
storeNumIterations
DOCUMENT ME!- Parameters:
numIters- DOCUMENT ME!- Throws:
ParserException- DOCUMENT ME!
-
storeOutputImageParams
public String storeOutputImageParams(ModelImage outputImage, boolean isNewImage) throws ParserException Stores information about the output of images for this algorithm in the parameter table. It first stores whether a new output image should be generated by the algorithm, and then (if a new image should be generated) stores the new output image in the variable table.- Parameters:
outputImage- The result image generated by the algorithm (may benullifisNewImageisfalse.isNewImage- Whether the algorithm should output a new image when it is executed.- Returns:
- The new image placeholder variable assigned to the result image (or
nullif no output image should be generated). - Throws:
ParserException- If there is a problem creating one of the new parameters.
-
storeProcess3DAs25D
- Parameters:
doProcess3DAs25D- Whether to process 3D images in 2.5D mode (slice by slice).- Throws:
ParserException- If there is a problem creating one of the new parameters.- See Also:
-
storeProcessingOptions
Stores options for how an algorithm should process images in the parameter table. This function is used when recording a script. This is a helper function used to handle parameters common to many algorithms.- Parameters:
doWholeImage- Whether to process the whole image or just VOI regions.do25D- Whether to process 3D images in 2.5D mode (slice by slice).- Throws:
ParserException- If there is a problem creating one of the new parameters.
-
storeProcessSeparable
Stores options for an algorithm using a kernel that can process dimensions separately.- Parameters:
doProcessSep- Whether to use a separable filter kernel.- Throws:
ParserException- If there is a problem creating one of the new parameters.
-
storeProcessWholeImage
Stores whether the whole image or just VOI regions should be processed in the parameter table. This function is used when recording a script. This is a helper function used to handle parameters common to many algorithms.- Parameters:
doWholeImage- Whether to process the whole image or just VOI regions.- Throws:
ParserException- If there is a problem creating one of the new parameter.- See Also:
-
storeSigmas
Stores an algorithm's sigmas in the parameter table. This function is used when recording a script. This is a helper function used to handle parameters common to many algorithms.- Parameters:
sigmaPanel- The sigma GUI panel to extract the parameters from.- Throws:
ParserException- If there is a problem creating one of the new parameters.
-
storeSigmas
Stores an algorithm's sigmas in the parameter table. This function is used when recording a script. This is a helper function used to handle parameters common to many algorithms.- Parameters:
sigmas- The unnormalized sigmas (must be a 3D array).isZCorrectionEnabled- Whether adjustment of the Z sigma should be performed based on the ratio of x resolution to z resolution.- Throws:
ParserException- If there is a problem creating one of the new parameters.
-
storeWaterShed
Stores an algorithm's sigmas in the parameter table. This function is used when recording a script. This is a for the WaterShed algorithm.- Parameters:
sigmas- The unnormalized sigmas (must be a 3D array).isZCorrectionEnabled- Whether adjustment of the Z sigma should be performed based on the ratio of x resolution to z resolution.- Throws:
ParserException- If there is a problem creating one of the new parameters.
-
tryToStoreResultImageInRunner
DOCUMENT ME!- Parameters:
resultImage- DOCUMENT ME!- Throws:
ParserException- DOCUMENT ME!
-
isImageStoredInRecorder
Returns whether an image has been registered in the script recorder. If it has not been used, it must be specified externally when this script is run later.- Parameters:
image- The image to look for in the recorder's image table.- Returns:
Trueif the image has been stored in the recorder's image table,falseotherwise.
-