Image analysis operations


Compute image co-occurence matrix


source cooccurence

?-neighbor x | y | z | t | ch (x)?.........Direction

?-dist value (1)?.........Distance (pixel)

?-power value (1)?.........Power

?-keep?.........Keep matrix


Returns: an option-value list containing statistical information characterizing the shape of the cooccurence matrix:

name <name of the matrix>
mean <mean of the image>
stdDev <standard deviation of image>
uniformity <uniformity of matrix>
entropy <entropy of matrix>
diffMoment2 <squared difference moment>
invDiffMoment2 <squared inverse difference moment>
power <order of variable power difference moments>
diffMomentPower <variable power difference moment>
invDiffMomentPower <variable power inverse difference moment>


If -keep is switched on the matrix is not deleted after the computation but retained in the form of an image. The name of the image is returned through the Tcl interface. The name will be the name of the source image with a suffix `:cmatrix'. If the matrix image already existed prior to running this tool it will be overwritten.

Locate the most in-focus plane


source findFocus


Returns: Focus positions in the form of an option-value list:

chanCnt 2 frameCnt 3 {chan_0} { 34.0 34.0 34.0} {chan_1} { 38.0 11.0 11.0}

In this case there are two channels and three frames. The focus positions are reported in units of Z-samples as a list between brackets, one list per channel.

Find object region


source findCropRegion

?-dataType raw | processed (raw)?.........Data type

?-crit value (1)?.........Relative criterium

?-incrLat value (0)?.........Lateral increase (%)

?-incrAx value (0)?.........Axial increase (%)


Find the region (bounding box) in which all objects are located. This region can be used for cropping empty borders around the image.

For restored widefield data -dataType processed should be set, otherwise the image will be prefiltered to detect object edges. The criterion is for non-widefield images relative to the max value in the image. For widefield data it is relative to the strongest gradients in the image. The criterion is usually in the range (0,10]. Typically '1' is a good choice.

Returns: An option-value list containing the offset and span vectors describing the data region:

offset { 0 0 0 0 0 } span { 0 0 0 0 0 }

Compute a ratio image of a two-channel image


source ratio  -> destination

?-ppu value (1)?.........Photons per unit

?-max value (0.3)?.........Max. error

?-mode sd | snr (sd)?.........Mode

?-ord A/B | B/A (A/B)?.........Order

?-create?.........Create Std. Dev. image


Returns: the new image name when the option -create is given; void otherwise.

Calculates the ratio between the two channels in a two-channel image.

-mode makes the calculation according to standard deviation (sd) or relative standard deviation (snr), actually the signal-to-noise ratio.

Derive labelled image from thresholded image


source label -> destination


Returns: void.

label applies a six-connected labelling operation to the source. Zero values in the source are taken as non-object; non-zero values as object. The destination image has data type signed 16 bit integer. All pixels in the first non-background object encountered are assigned value 1; subsequent objects are assigned subsequent numbers up to 32767.

Analyze objects in (original) image


source analyze <label image>

?-garb value (10)?.........Garbage level

?-maxVol value (1,000,000)?.........Maximum volume

?-iso value (0)?.........Iso-surface value

?-style full | compact | tcl | tclArray (full)?.........Output style


Returns: formatted feature list to task output or feature list as returned Tcl variable.

analyze analyzes the grey-value image imageName on the basis of a labelled image. The labelled image can be obtained by applying the label operation to a hresholded image. Thresholded images can be obtained by applying thres to the original grey-value image. In general, this image will be a restored image or a filtered image.

For each labelled region the following object statistics are computed:


  • Volume, i.e. the number of voxels in the region.
  • Minimum and maximum value of the voxels in the region.
  • The sum of all voxels in the region.
  • The location of the Center of Mass (CM) measured in samples. In the computation of the CM the voxel values are taken to be the 'mass' of each pixel. The CM is computed with sub-pixel accuracy.


The output is written to the Task reports Tab in compact format intended to be imported into spreadsheets, in a more readable long format or returned as Tcl return variable for use in scripts.

The compact format is self explanatory and looks like (including the first line identifying the features):

label vol min max sum CM-x CM-y CM-z
0 262022 5.00 127.00 8826457.0 30.43 33.36 30.24
3 3 140.00 147.00 430.00 25.33 45.00 30.33
4 ....


In this example labels 1 and 2 are not in the list since their volumes are below the garbage level.

The Tcl format is a single-line list of object features, each list element a set of option-value pairs describing the features. For example:

=>{label 0 vol 262088 min 5.00 max 127.00 sum 8826457.00
CM {30.43 33.36 30.24}}
{label 1 .....}


See also: label and threshold.

Analyze a labelled object


source analyzeObject <label image> label chan iso

?-maxVol value (1,000,000)?.........Maximum volume


Returns: formatted feature list to task output or feature list as returned Tcl variable.

Like analyze, but for one labelled object as specified by the label argument.

Find subpixel coordinates of local maxima


source findMaxima

?-chan value (0)?.........Channel to analyze

?-frame value (0)?.........Frame to analyze

?-max value (250)?.........Maximum number of maxima

?-border IndexVector (0 0 0 0 0)?.........Border dimensions where maxima are ignored

?-cyclic?.........Use cyclic padding


Returns: a list with (x y z value) tuples.

Find and report subpixel coordinates of local maxima in intensity.

Compute distance in image


source dist -begin <start vector> -end <end vector>

?-begin IndexVector (0 0 0 0 0)?.........Begin

?-end IndexVector (0 0 0 0 0)?.........End


Returns: distance in micrometers.

Example: a dist -begin {0 0 0} -end {3 2 0}

Estimate image background


source estbg

?-mode lowest | object | wf (lowest)?.........Search for background

?-r value (0.7)?.........Area radius (microns)

?-ch value (-1)?.........Channel number

?-tclReturn?.........Output to Tcl


For the background estimation, there are three methods, namely lowest, object and wf (widefield):
  • lowest: The easiest method, where a guassian filter is applied on the entire image. The lowest value then determines the background.
  • object: This method searches for the background value near an object. A gaussian filter is applied on the xy-plane with the highest intensity and searches for the optimal background in this slice.
  • wf: The focus plane of the image is determined after which a guassian filter is applied on this slice. The lowest value then determines the background.

The -radius determines the size of the Gaussian filter used in all three methods. The -ch makes it possible to only estimate the background for a selected channel. When set to -1, which is the default, it will be estimated for all channels.

When the -tclReturn option is given the values are reported in a list of option value pairs which allows for conversion into Tcl arrays, unless a channel is selected with the -ch option. Then the result will be a single list with the estimated background per time-frame.

Example: the return values from a two-channel image,

testTwoCh estbg -mode object -tclReturn
=>chanCnt 2 frameCnt 1 {chan_0} { 92.1353 } {chan_1} { 38.1662 }

Example: the return values from a 4-D image,

testWFTime estbg -mode wf -tclReturn
=>chanCnt 1 frameCnt 4 {chan_0} { 557.6548 543.4268 548.8170 556.3867 }

Example: the return value from the same 4-D image with the option -ch 0,

testWFTime estbg -mode wf -ch 0 -tclReturn
=>{ 557.6548 543.4268 548.8170 556.3867 }

Use the array set Tcl command to extract the pairs from the option-value lists. See the example as given with setp.

Compute colocalization coefficients


source coloc

?-threshMode absolute | relative (relative)?.........Threshold mode

?-threshR value (0.0)?.........First thresh (absolute or %)

?-threshG value (0.0)?.........Scnd. thresh (absolute or %)

?-sigmaR value (0.0)?.........First ch. soft thresh range (abs or %)

?-sigmaG value (0.0)?.........Scnd. ch. soft thresh range (abs or %)

?-chanR value (0)?.........First channel

?-chanG value (1)?.........Scnd. channel

?-map none | Pearson | ObjectPearson | Spearman | overlap | k12 | Manders | inters | i12 (Manders)?.........Colocalization map

?-noNorm?.........Skip map normalization

?-tclReturn?.........Output to Tcl

?-selection Pearson | ObjectPearson | Spearman | overlap | k12 | Manders | inters (all)?.........Colocalization Coefficient choice


Returns: colocalization parameters and optionally a colocalization map.

Compute co-localization coefficients of a multi-channel image. This function computes a number of established coefficients which characterize the degree of overlap between channels in an image. The minimum number of channels an image should have is two. In case the image is a multi-channel time series, the coefficients are computed for each time frame.

Colocalizing channels are named R and G, the first and second channels being analyzed. They can be any channel on the image as especified by -chanR and -chanG.

When -threshMode absolute, the thresholds are absolute intensity values. Otherwise they are understood as percentages of the estimated background. The percentage can be both negative and positive. A zero value means that the estimated background is used unchanged as threshold. In case of a time series, the background is estimated for each frame.

The backgrounds are subtracted from the channels intensities before calculating the coefficients.

For the intersection parameters, the backgrounds are used as intensity thresholds for a pixel to be accounted as interesting volume. In this case the -sigmaR and -sigmaG parameters are used to define smooth thresholds around the given values: pixels with intensities below threshold * (1 - sigma) are not considered, pixels with intensities above threshold * (1 + sigma) are counted as one volume unit, and pixels with intensities in between are considered only partially by using a weighting factor that linearly goes from zero to one as a function of the intensity. When sigma is zero, then the threshold acts as a regular threshold: pixels above it are accounted as one volume unit, pixels equal or below it are not. The intersection volume per pixel is the product of the two channels' pixel volume factor.

When -tclReturn is specified an option-value list is returned containing statistical parameters characterizing the degree of colocalization. In case of a time series the values are lists with one element per timeframe.

frameCnt <frameCount> The number of timeframes

channels <channel list> The channels over which the colocalization is computed

Pearson <value list> Pearson's coefficient

ObjectPearson <value list> Object Pearson's coefficient

Spearman <value list> Spearman's coefficient

Following this are coefficients known as the Manders coefficients. Each is followed by a list of values:

overlap <list>, k1 <list>, k2 <list>, m1 <list>, m2 <list>

Then some parameters quatifiying the intersection volume (globally and per channel) are given:

inters <list>, i1 <list>, i2 <list>

When a colocalization map is requested the map image is created and its name returned as Tcl return variable, also when -tclReturn is not specified. The format is a single option-value pair: name imageName:mapType. Depending on the map type the map image contains one or two channels.

When no map was to be returned name none is returned.

One can enter a list of colocalization coefficients using the -selection option, such that only those are calculated. The default is that all coefficients are calculated.

Example:

_4dtaALL coloc -tclReturn -map Pearson -selection {Pearson overlap k12 Manders}

=>name _4dtaALL:Pearson frameCnt 1 channels {0 1} Pearson {0.463 } overlap {0.529 } k1 {0.847 } k2 {0.331 } m1 {1.000 } m2 {0.994 }

Read about the colocalization coeficients and maps in the SVI-wiki12.

Compute a covariance matrix and mean vectors.


source lda classes


Returns: formatted list containing the covariance matrix and mean vectors.

Compute the covariance matrix and mean vectors for a multi-channel image (features) and a labelled image (classes). The result can be used in a linear discriminant function.

Calculate the Bayesian probability


source probability -> destination <covar. matrix> <mean vector>

?-prior value (0.5)?.........Prior probability


Returns: void.

Calculate the Bayesian probability for a multi-channel image (features). It requires a mean vector and covariance matrix as returned by the lda command.

Calculate the probability ratio image


source weigh -> destination <covar. matrix> <mean vector 1> <mean vector 2>


Returns: void.

Calculate the probability ratio P(a)/(P(a)+P(b)). It requires two mean vectors and the covariance matrix as returned by the lda command.

Watershed filter


parent watershed -> destination

?-max value (0)?.........Max. number of objects

?-frame value (0)?.........Frame

?-chan value (0)?.........Channel

?-thresh value (0.0)?.........Threshold

?-fwhm?.........Threshold on half maximum

?-bg value (0.0)?.........Background level

?-bins value (32768)?.........Number of bins for float images


Returns: void.

Phase correlation


source phasecor ref

?-hann IndexVector (1.0 1.0 1.0 0.0)?.........Relative width of the Hann window

?-pad IndexVector (0.5 0.5 0.5 0.0)?.........Pad the input images

?-dest image?.........Optional return image for the phase correlation

?-preprocessed image?.........Optional destination for the preprocessed input

?-sigma IndexVector (4.0 4.0 4.0 0.0)?.........Sigma of the Gaussian filter

?-returnCross?.........Optionally return the cross-correlation value

?-channels string?.........Channels

?-frame value (0)?.........The frame to process


Phase correlation


source phasecorPreprocess -> dest

?-hann IndexVector (1.0 1.0 1.0 0.0)?.........Relative width of the Hann window

?-pad IndexVector (0.5 0.5 0.5 0.0)?.........Pad the input images

?-channels string?.........Channels

?-frame value (0)?.........The frame to process


Retrieve information for optimizing phase correlations


source phasecorInfo

?-minDim IndexVector (128 128 128 0 0)?.........Minimal allowed dimensions

?-pad IndexVector (0.5 0.5 0.5 0.0)?.........Pad the input images

?-returnCross?.........Optionally return the cross-correlation value

?-channels string?.........Channels

?-frame value (0)?.........The frame to process


Helper function to reduce values in overlapping image regions


source reduceWindow -> dest

?-width IndexVector (64 64 64 0 0)?.........Window width

?-mode sum | sq | abs (sum)?.........Reduction mode


Local entropy filter


source localEntropy -> dest

?-width IndexVector (3 3 3 0 0)?.........Filter width





1. http://www.svi.nl/ColocalizationTheory
2. http://www.svi.nl/ColocalizationCoefficients