Image Analyst MKIIWorkflow
HomeWorkflowImage Processing PrinciplesFunctions GlossaryPipelines GlossaryProtocolsQuick How ToSearch

Evaluation of expressions in function parameters

Image Analyst uses a string parser to generate file names or Image Window captions, a math parser to evaluate parametric input in pipelines and a matrix parser to enter kernels or crossbleed correction matrices. See a list of available variables and their values at Tools main menu, "Variables and Expression Evaluation". This dialog can be also used for building and testing string or math expressions, ones that can be used in function parameters in the parameter bar or as function parameters within pipelines, including manipulation of pipeline parameters before passing them to function parameters using the %param% variable.

Evaluation of string expressions e.g. automatic file name generation

Use any string after = and include any of the variables below between % marks; :n pads to n digits. variables and commands are case sensitive.
%BACK% or %BACK:n% is (n times) backspace

Variables referring to last opened image set:

%LoadFileName%, filename of the opened image, with extension.  (alias: %LoadName% )
%LoadFileExt%, extension of the opened image file.
%LoadBaseName%, the part of the filename that is common, if multiple files are opened as a merged time lapse, or filename without extensions.
%LoadFolderName% refers to the name of the top folder where the currently loaded image is, not the path. See %LoadFolder% for the path.

%LoadPositionNumber%, the numerical position in a multi stage position or multiwell plate recording  (alias: %LoadStageMaxNumber% ).
%LoadPositionCount%, the number of positions or wells in the recording  (alias: %LoadStageMaxNumber% ).
%LoadPositionName%, position or well name  (alias: %LoadStageName%).

%LoadPlateRow%, row position in a multiwell plate.
%LoadPlateCol%, column position in a multiwell plate.

%LoadChannelNumber%, channel number of the last opened image.
%LoadChannelCount%, total number of channels in the active Multi-Dimensional Open dialog.
%LoadChannelName%, channel name of the last opened image.
,
%ActiveWindowName%, caption of the top Image Window.
%ActiveWindowChannelNumber%, channel number of the top Image Window.

Folders refer to full path to the given folder.
%LoadFolder%, where the last image was opened.
%DocumentsFolder%, default documents folder in Windows.
%PipelinesFolder%, default pipeline folder in Documents\Image Analyst\Pipelines.
%MyPipelinesFolder%, default pipeline folder in Documents\Image Analyst\My Pipelines.
 
Pipeline parameter:
%param% in string parameters of functions within pipelines will be filled in from the corresponding pipeline parameter.

If a simple filename follows the '=' then the default folder is used, depending what is saved or loaded, e.g. image, ROI or export. Use the File/Set folder locations... main menu point to set the default folders. If a relative path is given, it will be appended to the default path. If no filename is given for saving, the Image Window name and default extension are used. Characters incompatible with the Windows files system are automatically removed from the save name.

Example
The following example concatenates a file name from multiple variables:
=%LoadFolderName%_%LoadBaseName%%BACK%%LoadStageNumber:2%w1.txt

Evaluation of mathematical expressions

Any numeric (integer of floating point) function parameter can be substituted with an '=' followed by a formula. Integer parameters use rounding, the input does not have to be integer. Besides standard arithmetic, the following functions are available (case sensitive):

log2(a) = two-based logarithm of a
log10(a) =  ten-based logarithm of a
ln(a) =   natural logarithm of a
log(a,b) = a-based logarithm of b
power(a,b) = a on the bth power
min(a,b) = the minimum of a and b
max(a,b) = the maximum of a and b
sqrt(a) = square root of a
sqr(a) = square of a
exp(a) = e on the ath power
int(a) = integer part of a
frac(a) = fractional part of a
round(a) = rounded integer value of a

Constants:
pi

Context-specific variables for pipelines:
param = the value of linked pipeline parameter to a function parameter

Context-specific variables for the actually processed image:
imagesizex = width of the image in pixels
imagesizey = height of the image in pixels
imagesizez or imagesizet = number of frames
pixelsizex = calibrated width of a pixel in microns
pixelsizey = calibrated height of a pixel in microns
pixelsizez = calibrated z-height of a pixel in microns
scalemin = minimum value of the image intensity histogram
scalemax = maximum value of the image intensity histogram


Entering a matrix

Functions using matrices as convolution kernels or spectral crossbleed matrices can be used by defining the matrix in the Preferences Dialog / Convolution kernels, Matrices tab, and referred by a name, or directly entered as a function parameter. Entering matrices into pipelines as names makes the pipeline dependent on the actual Kernel file (see in the Preferences Dialog), decreasing portability of the pipeline. Therefore kernel or matrix names can be automatically converted to matrices in the Pipeline Window Options panel.

Crossbleed matrices are defined as:
={{a,b,...},{c,d,...},...}

Kernels are defined as:
={{seedx,seedy},{{a,b,...},{c,d,...},...}}
the seed points to the pixel within the kernel (starting at 0), where the calculated value is placed back into the image during kernel convolution. Typically the center of the kernel.