Image Math performs simple mathematical operations on image intensities.
This module can perform addition, subtraction, multiplication, division, or averaging of two or more image intensities, as well as inversion, log transform, or scaling by a constant for individual image intensities.
Keep in mind that after the requested operations are carried out, the final image may have a substantially different range of pixel intensities than the original. CellProfiler assumes that the image is scaled from 0 – 1 for object identification and display purposes, so additional rescaling may be needed. Please see the RescaleIntensity module for more scaling options.
See also ApplyThreshold, RescaleIntensity, CorrectIlluminationCalculate.
Settings:
Operation
Select the operation to perform. Note that if more than two images are chosen,
then operations will be performed sequentially from first to last, e.g.,
for "Divide", (Image1 / Image2) / Image3
- Add: Adds the first image to the second, and so on.
- Subtract: Subtracts the second image from the first.
- Absolute Difference: The absolute value of the difference between the first and second images.
- Multiply: Multiplies the first image by the second.
- Divide: Divides the first image by the second.
- Average Calculates the mean intensity of the images loaded in the module.
This is equivalent to the Add option divided by the number of images loaded
by this module. If you would like to average all of the images in
an entire pipeline, i.e., across cycles, you should instead use the CorrectIlluminationCalculate module
and choose the All (vs. Each) option.
- Maximum: Returns the element-wise maximum value at each pixel location.
- Invert: Subtracts the image intensities from 1. This makes the darkest
color the brightest and vice-versa.
- Log transform (base 2) Log transforms each pixel's intensity.
The actual function is log2(image + 1), transforming values from 0 to 1 into values from 0 to 1.
- Log transform (legacy) Log2 transform for backwards compatibility.
- None This option is useful if you simply want to select some of the later
options in the module, such as adding, multiplying, or exponentiating your image by a constant.
Note that Invert, Log transform (base 2), and None operate on only a single image.
Name the output image
Enter a name for the resulting image.
Image or measurement?
You can perform math operations using two images or you
can use a measurement for one of the operands. For instance,
to divide the intensity of one image by another, choose Image
for both and pick the respective images. To divide the intensity
of an image by its median intensity, use MeasureImageIntensity
prior to this module to calculate the median intensity, then
select Measurement and use the median intensity measurement as
the denominator
Selec the image that you want to use for this operation.
Measurement
This is a measurement made on the image. The value of the
measurement is used for the operand for all of the pixels of the
other operand's image.
Enter the number that you would like to multiply the above image by. This multiplication
is applied before other operations.
Raise the power of the result by
Enter an exponent to raise the result to *after* the chosen operation
Multiply the result by
Enter a factor to multiply the result by *after* the chosen operation
Add to result
Enter a number to add to the result *after* the chosen operation
Set values less than 0 equal to 0?
Values outside the range 0 to 1 might not be handled well by other modules.
Select Yes to set negative values to 0.
Set values greater than 1 equal to 1?
Values outside the range 0 to 1 might not be handled well by other modules.
Select Yes to set values greater than 1 to a maximum value of 1.
Ignore the image masks?
Usually, the smallest mask of all image operands is applied after
image math has been completed. Select Yes to set
equal to zero all previously masked pixels and operate on the masked
images as if no mask had been applied.