Example: Assign Channels using Source

The Source control in the Style dialog for images assigns channels to display outputs such as R, G, B or A.  .  This topic shows examples of using Source and the visual results.

 

This example continues using the same example data as the Example: Use the BGR Button to Assign Channels  topic.   Although the example image is a painting, these same techniques are utilized to assign channels in spatial data applications, for example, when building a false color image from multispectral satellite sensing data.

il_style_image_source01_01.png

We open the sample ginevra image, a portrait of Ginevra de' Benci by Leonardo.   We then choose Edit - Style to launch the Style dialog for images.

 

il_style_image_source01_02.png

 

By default the Style dialog shows outputs and channels using default BGR assignment, that is, with Channel 0 going to the Blue or B output, Channel 1 going to the Green or G output and Channel 2 going to the Red or R output.   We will change that.    We begin by clicking the R row to highlight it.

 

il_style_image_source01_03.png

 

Next, in the pull down menu for the Source box we choose Channel: 1 to use Channel 1 as the source for the highlighted R row.

 

il_style_image_source01_04.png

 

Immediately the channels list updates to show that the R display output is now being driven by the values found in Channel 1.   We press Update to commit the changes to the intervals list and then Apply to commit those changes to the image.

 

il_style_image_source01_05.png

The drawing immediately updates.  It looks less red and more gray because the content for the red display output is being driven by values in the channel that was intended by the original image format to be driving the green display output.     Let us now use Channel 0 for the R display output.

 

il_style_image_source01_06.png

 

To do that in the Source pull down menu we choose Channel: 0.   Immediately, the dialog updates the channels list to show that the R display output will take its values from Channel 0.    We press Update and then we press Apply.

il_style_image_source01_07.png

The drawing updates so that regions where the channel originally intended to drive the Blue display output, Channel 0, were bright are now bright in a magenta color that is a blend of blue and red, since now the Red display output, also using Channel 0, is also bright in those regions as well.

 

il_style_image_source01_08.png

 

We click on the G row to highlight it.   The Source control will now apply to that row.   

 

il_style_image_source01_09.png

 

We choose Channel: 0 for the Source and then press Update and then press Apply.   Now all three display outputs, R, G and B, are all using the same channel.

 

il_style_image_source01_10.png

The result is a grayscale image that is a grayscale rendition of the values in channel 0.   When all pixels in an RGB image are the same value the result is a gray color.

Variations

We will now consider variations in how outputs are fed by channels or by values.

 

il_style_image_source01_11.png

 

In the above illustration we have assigned Channel 0 to R, Channel 2 to G and Channel 1 to B pressing the Update button after each assignment.   The original set of intensities, Channel 0, intended to drive the Blue output are now controlling Red, the values intended for Red, Channel 2, are now driving Green, and the original channel for Green, Channel 1, is now driving Blue.  Press Apply.

 

il_style_image_source01_12.png

The result is an otherworldly image, with color tones somewhat reminiscent of false color satellite imagery built from infrared spectra.

 

We can restore the original channel to display output assignments by pressing the BGR button, as discussed in the

Example: Use the BGR Button to Assign Channels topic.

 

il_style_image_source01_13.png

 

The illustration above shows the dialog just after we have pressed the BGR button.   Channels 0, 1 and 2 have been assigned to display outputs B, G and R respectively.   We press Apply.

 

il_style_image_source01_14.png

The image is now back to using the intended channels to drive each display output.

 

So far we have used the Source control to assign content from a data channel to the highlighted display output.   We can also use Source to apply a fixed value for all pixels for that specified display output.

 

il_style_image_source01_15.png

 

We click on the first, R, row to highlight it.   We then pull down the menu for the Source control.

 

il_style_image_source01_16.png

 

In the pull down menu we choose Value.

 

il_style_image_source01_17.png

 

We specify a value of 125 and choose Apply.  This applies the same value, that is display intensity, for the Red display output for all pixels.

il_style_image_source01_18.png

A Value of 125 is approximately half-way from black, 0, to full intensity, 255, for the Red output.   The net effect is like replacing the red display output with a sheet of red plastic that is half-transparent.

 

il_style_image_source01_19.png

 

A more classic effect is to use a Value of 0 for the Red display output, in effect using only Blue and Green outputs to power the display.   Press Apply.

il_style_image_source01_20.png

The result is the classic blend of Blue and Green channels, or cyan.

 

We can also set Values of 0 for all display outputs we would like to turn off, so that only one display output is used at a time.

 

il_style_image_source01_21.png

 

In the above arrangement we have used Source to assign a Value of 0 to the R and G display rows and the original Channel 0 to the B row.   Press Apply.

il_style_image_source01_22.png

This produces an image using only Blue channel output.

 

il_style_image_source01_23.png

 

We use Source to assign a Value of 0 to R and B and to assign the original Channel 1 to G.  Press Apply.

 

il_style_image_source01_24.png

This produces an image using only Green channel output.

 

il_style_image_source01_25.png

 

We use Source to assign a Value of 0 to G and B and to assign the original Channel 2 to R.  Press Apply.

 

il_style_image_source01_26.png

This produces an image using only Red channel output.

 

To round out our presentation of how channels combine to create imagery, we will show how Green and Red produce yellow and then how Red and Blue produce magenta.

 

il_style_image_source01_27.png

 

We use Source to assign a Value of 0 to B and to assign the original Channel 2 to R and the original Channel 1 to G.  Press Apply.

 

il_style_image_source01_28.png

This produces an image using only Red and Green outputs, resulting in yellow.

 

il_style_image_source01_29.png

 

Finally, we use Source to assign a Value of 0 to G and to assign the original Channel 2 to R and the original Channel 0 to B.  Press Apply.

 

il_style_image_source01_30.png

This produces an image using only Red and Blue outputs, resulting in magenta.

il_style_image_source01_01.png

Considering the image that uses all channels to drive all three display outputs we can see how various combinations result in the classic presentation of Red, Green and Blue outputs with magenta, yellow and cyan combinations.

 

il_style_image_source01_31.png

 

See Also

Images

 

Images and Channels

 

Palette Images

 

Style

 

Style: Presenting Images

 

Style: Autocontrast

 

Style: Palettes

 

Example: How Images use Tiles from Tables - An example showing how an image is made up from data stored in a table in tiles.

 

Example: Create Two Images From One Table - More than one image can show data from the same table, including from the same tile field.

 

Example: An Image using Computed Fields in a Table - How an image can be created from tiles where the data for the tiles is taken from a field that is computed on the fly.

 

Example: Change the Contrast of an Image - In this example we use the Edit - Style dialog to change the contrast of an image.

 

Example: Use the BGR Button to Assign Channels - The BGR button in the Edit - Style dialog for images allows us to assign channels in the data to B, G and R outputs that create the displayed image, using BGR, RGB or Grayscale ordering.

 

Example: Set Image Transparency using Alpha - The A row in the Style dialog allows us to specify what transparency we want to apply to the image, either by applying the same value for A for all pixels or by using one of the other channels to also control the A value.

 

Example: Autocontrast and Hill Shading Images using Style - This example shows how the Edit - Style dialog can hill shade an image using the values of pixels as heights and generating shadows as if the Sun were located at the specified azimuth and altitude.   This capability is used most frequently with raster images to give an impression of three dimensionality in cases where the values of pixels represent terrain elevations.

 

Example: Style Applied to an Image Server Image - Because the Edit - Style dialog simply changes the way an image is displayed and not the data, it can operate on read-only data served by various web servers such as WMS REST servers.    In this example we look at every detail of creating a data source using an image server and then manipulating the appearance of the display with Style.  We will connect to a WMS server that provides LiDAR data in various forms, including as terrain elevation.