BlendColors allows you to assign a different color to each wave while also giving you the capability to tailor the color to fit your own preferences. Normally, you would use BlendColors to generate images for inclusion in publications or presentations.
BlendColors generates colors by combining 3 primary colors, red, green, and blue: any color BlendColors uses is represented by three values between zero and one where each value indicates the strength of the contribution from one of the primaries. As an example, the color with a red component of 0.55, a green component of 0.13 and blue component of 1 is a shade of purple. When you use BlendColors you will assign a color (some combination of red, green, and blue) to each wavelength in your input data. When BlendColors calculates the color for a point in the output it will use a weighted combination of the colors of the input wavelengths; the weights are the scaled intensity at the point in each wavelength. With the way Priism stores image files, BlendColors' output will have either three or four "wavelengths". The first three "wavelengths" hold the red, green, and blue components, respectively, for the result of the weighted combination of the input colors. The optional fourth "wavelength" holds the opacity, how opaque a pixel is; the opacity is useful when constructing volume renderings of your data.
Tuning how the input is scaled is an important part of getting good looking results from BlendColors. It is generally easiest to do some of that tuning prior to running BlendColors: load your data into an image window, turn on RGB display for that image window, and then use the Image->Scale menu entry in the image window to adjust the scaling for the different wavelengths so that the relative brightness of the different wavelengths is close to what you want in the final output. For instance, if you wanted to limit the contribution from one wavelength, you would stretch the maximum scaling value well past the upper limit for that wavelength's data values. After you have done the initial tuning of the scaling, use the image window where you did the tuning as the input to BlendColors: BlendColors will automatically pick up your modified scaling values. Another aid for tuning the scaling is BlendColors' scaling menu. It works after you have done an initial run with BlendColors: if you saved the output from that run to an image window, the you can use the scaling menu to adjust the scaling and see the effect on the currently displayed section of the blended result. After you have refining the scaling with the scaling menu, you would then press "DoIt" again in BlendColors to ensure that the updated scaling has been applied to all sections of the output.
A basic recipe for using BlendColors is
Overview | Region processing | Scaling parameters | Color parameters | Blending method | Opacity | Lowest priority wavelength | Scaling menu | Command line
Priism | Scale values | Volume Viewer
Before blending the different wavelengths, BlendColors scales the data. The parameters controlling the scaling (a minimum, maximum, exponent, and flag value) for each wavelength are shown in the "scale 0" through "scale 4" fields in BlendColors' main dialog. For more details about the scaling calculation and the handling of the four scale parameters, see the "Scaling Values" topic in the documentation for the image window's Scale application (note that the special case where the minimum and maximum are both zero does not apply to the behavior of BlendColors). When you select a new input data set for BlendColors, BlendColors will adjust the scaling values to match the new input: if the input is a file, the scaling will be linear between the minimum and maximum values recorded in the file's header; if the input is an image window, the scaling will match that used for the image window.
BlendColors has two dialogs to help you assign colors to the input wavelengths. The first, which you can open by pressing "color wheel..." in BlendColors' main dialog, allows you to select the color for a wavelength from a palette. The color wheel at the top of the dialog is the palette. Position the mouse over the desired color in the wheel and press the mouse button to select a color. Your selected color, in a range of intensities, will then appear in the bar just below the color wheel. If you are satisfied with the color, use the toggle buttons below the bar to select the wavelength you want to assign to that color and then press the "accept color" button.
The other dialog, which you can open by pressing "color parameters..." in BlendColors' main dialog, displays your currently selected colors for each wavelength. Just below that display the dialog has the RGB components for each color; you can edit the component values directly if you want. The dialog has three buttons to assist with saving the color parameters for use in the future or for restoring previously saved parameters:
BlendColors uses one of three methods to combine the scaled intensities for the input wavelengths and the assigned colors for those wavelengths to generate the blended result. Let I(j) be the scaled intensity (a value between zero and 255) for wavelength j at a pixel, C(i,j) be the ith component (i.e. the red component for i equal to one) of the color assigned to wavelength j, and B(i) be the ith component of the blended result for the pixel. With the additive method, the blended color at the pixel is the weighted sum of the wavelength colors with the scaled intensities at the pixel as the weights:
B(i) = C(i,1) * I(1) + C(i,2) * I(2) + ...
With the maximum intensity method, BlendColors finds the wavelength, k, which has the brightest scaled intensity at the pixel (if there is tie, BlendColors uses the wavelength with a lower value of k). The blended color for that pixel is then the color for wavelength k times the scaled intensity for wavelength k, i.e.
B(i) = C(i,k) * I(k)
The priority method treats one of the input wavelengths, the lowest priority wavelength, differently than the others. If the lowest priority wavelength is k, the blended color at a pixel is
B(i) = C(i,1) * I(1) + ... + C(i,k-1) * I(k-1) +
C(i,k) * maximum(0, I(k) - I(1) - ... I(k-1) - I(k+1) - ...) +
C(i,k+1) * I(k + 1) + ...
In other words, the blended color calculation is similar to the additive method but the lowest priority wavelength only contributes to the result at a pixel if the scaled intensity for the lowest priority wavelength at that pixel is greater than the sum of the scaled intensities for the other wavelengths.
When BlendColors computes the opacity (B(4) to use the same notation as above) for a a pixel, the unweighted opacity for each wavelength, i, (C(4,i)) is one.
When the "opacity" toggle button is on, BlendColors generates output with four "wavelengths" rather than three. The fourth "wavelength" records how transparent each point is: information that is useful with the progressive rendering option of Volume Viewer.
BlendColors uses the scaled intensity at a pixel as a measure of its opacity: a pixel with a scaled intensity of zero is completely transparent and a pixel with a scaled intensity of 255 is completely opaque. BlendColors then blends opacities in each wavelength just as it blends the red, green, and blue components.
The assignment of the lowest priority wavelength only has significance when you select the priority method as the method for blending colors. For that method, the contribution of the lowest priority wavelength to the blended result at a pixel is reduced by the sum of the scaled intensities in the other wavelengths, and if the scaled intensity in the lowest priority wavelength at a pixel is less than the sum of the scaled intensities for the other wavelengths, the lowest priority wavelength does not contribute to the blended color at that pixel. When you use the priority method of blending, select the wavelength to use as the lowest priority wavelength with the toggle buttons to the right of the "lowest" label.
If you have BlendColors save the blended images in an image window, BlendColors will enable the "scaling..." button after you generate the blended data. Pressing the "scaling..." button opens a dialog with which you can adjust the scaling parameters for the input. The scaling controls in the dialog mimic those in the Image->Scale dialog for image windows. As you adjust the scaling, BlendColors will update the currently displayed blended section to match the new scaling. Once you are satisfied with the scaling, press "DoIt" in BlendColors' main dialog to ensure that all the sections of the blended result are computed with the new scaling parameters.
BlendColors accepts the command-line arguments described in Region.html. In addition, it has the following options (parts in brackets are optional):
-color1=r:g:b
-color2,
-color3, -color4, and -color5 to
set the colors for the other wavelengths). If you do not set the color
for a wavelength with a -color1 (-color2, ...) or -colors option,
BlendColors will use black if you do not have a default color file or will
use the color in your default color file.
-colors=color_file
-lowest_priority=i
-method=name
-opacity
-scl1=bound1[:bound2[:exp[:flag]]]
-scl2,
-scl3, -scl4, and -scl5 to set the
scaling for the other input wavelengths).
The following example generates the blended result, blend.dat, from fish.dat and the color parameter file, scotts.blend, in the Priism COLORS directory. The example uses the priority blending algorithm with the second wavelength in the input as the lowest priority wavelength.
BlendColors fish.dat blend.dat -colors=${IVE_BASE}/COLORS/scotts.blend \
-method=priority -lowest_priority=1