PixInsight 1.5

The Officially Unofficial Reference Guide

Rev.0.1 – 3/29/2010

Section 17: PixelMath

PixelMath

PixInsight's PixelMath is an extremely versatile and powerful tool to perform pixel-level arithmetic and logical operations between images. This reference manual does not aim to document PixelMath's syntax or every available function or operator. Instead, it focuses on explaining the user interface and available options. For a detailed documentation on PixInsight's PixelMath, please visit http://pixinsight.com/tutorials/PixelMath/en.html

Expressions

RGB/K: For grayscale images, enter here the expressions for the gray channel. For RGB images, enter here the expressions for the red channel (when the Use a single RGB/K expression is unselected) or for all RGB channels (when the Use a single RGB/K expression is selected).

G: If the Use a single RGB/K expression is unselected, enter here the expressions that will affect the green channel.

B: Same as above but for the blue channel.

A: Enter here the expressions that will affect the alpha channel.

Symbols: You can use symbols in your expressions. Here is where you define the symbols, their values, etc.

Each of the parameters defined above has a corresponding Edit button on the far right. Clicking on it will bring you to the Expression Editor, explained below.

Use a single RGB/K expression: If the operations you want to execute should affect all RGB channels of a color image, enable this function and enter the expressions in the RGB/K text box. If you want to perform different operations on different channels, uncheck this option.

Use 64-bit working space: If this option is selected, PixelMath will create and use 64-bit floating point working images to accumulate and store any intermediate results.

Rescale result: When this check box is checked, resulting pixels are rescaled to the specified range of values. When the Rescale check box is unchecked, resulting pixels are truncated to the normalized [0,1] range and the two edit controls for range boundaries are disabled. In simple terms, rescaling avoids out-of-range pixels.

Lower/Upper bound: The rescaling range is defined as two boundaries such as the normalized [1,0] range cannot be exceeded. Usually you want to keep these boundaries withing the default [0,1] range.

Destination

Replace target image: When you apply the PixelMath expression to an image, PixelMath will output its results in the same image.

Create new image: The results from PixelMath will be applied to a newly created image.

The next options are only available if Create new image is selected.

Image Id: The Image ID of the new image.

Image width/height: Width and height of the new image. <As target> means that the new image will have the same height and width as the target image (the image to which you applied PixelMath).

Color Space: Define the color space of the new image. Valid options are Same as target, RGB Color and Grayscale. Optionally, you can select the Alpha channel check-box if you want the new image to also have an alpha channel.

Sample format: You can select Same as source so the new image will have the same format (bit depth) as the source image, or specify a different format.

Pixel Math Expression Editor

The purpose of the PixelMath Expression editor is to make easier writing PixelMath expressions, by putting at your disposal all image Ids, symbols, functions, operators and even punctuators, as well as a parsing function to evaluate the defined expression. The PixelMath Expression editor is a modal dialog, that is, you must OK or Cancel this dialog box before you can do anything else with the instance of PixInsight from where this dialog was invoked.

The PixelMath Expression editor is divided in four different areas:


Expression editing area: Here is where you write your expression for the current channel. You can either type the expression – which you can also do from the PixelMath dialog – or with the aid of the operands in the operand area as well as the Images and Symbols pull-down lists that you can find at the bottom of this area.

The Images pull-down list contains a list of all available image identifiers. Likewise, the Symbols pull-down list contains a list of all defined symbols.

When you use any of the two pull-down lists (Images or Symbols) and select one of the items in the list, the name of the image/symbol is automatically added to the expression editing area at the cursor's current position. This is useful in case you don't remember the exact spelling of the images you want to work with, or if you simply don't feel like typing.

Operands area: The operands area offers all available functions, operators and punctuators you can use in PixelMath expressions. You can write any operand in the editing area by double-clicking on it.

Help area: When you single-click any operand in the operands area, a brief help about that particular operand is displayed in this area.

Parsing area: If you want to evaluate the expression in the editing area, click the Parse button and PixInsight will execute the expression but without applying it to the image. This is very helpful to verify if the syntax is correct, or to see whether the expression is doing what you're expecting, etc.

Back to the Index | Copyright Note