Example: Shuffle Channels with a Raster Self Join

We use the Join dialog to rearrange channels within an image.   Because we will join data from the same image into itself, this is a self-join.


Starting with a four channel image that has RGB plus infrared channels, we rearrange the order of channels so that infrared values are in the first channel powering the red output, red values are in the second channel powering the green output, and green values are in the third channel the blue output.   This is the classic Color Infrared (CIR) channel arrangement.  


Unlike a virtual rearrangement using Style shown in the  Example: Display an NAIP Four Band Image as Color Infrared (CIR) topic, rearranging channels in this way changes the structure of the data so that any exported image will retain the new arrangement.

Four Channel NAIP Images

The National Agriculture Imagery Program (NAIP) run by the US Department of Agriculture (USDA) acquires aerial imagery with a resolution of approximately one meter during the agricultural growing seasons in the continental United States.  Beginning in 2007, various states began acquiring NAIP imagery as four band imagery, with Red, Green Blue and near-Infrared bands.  


Nomenclature:  Band and Channel are used as synonyms.  The USDA tends to uses band, while modern technical applications tend to use channel, but both are perfectly good words that in this context mean the same thing.  Manifold uses channel.   USDA numbers channels counting 1, 2, 3, 4.  Manifold uses the more technical approach (so the numbers stay the same when using SQL, writing scripts, using functions, etc.) of counting channels as 0, 1, 2, 3.   This documentation uses 0, 1, 2, 3.


Four band NAIP imagery uses the following channel order:



NAIP imagery is thus the classic RGB channel ordering plus an extra channel that gives infrared values.


A popular use of four band NAIP imagery is to create false color images called Color Infrared (CIR ) images.   CIR images use Infrared wavelengths to drive the Red output, Red wavelengths to drive the Green output, and Green wavelengths to drive the Blue output.  The channel that records Blue wavelengths is not used.   


We can copy data from one channel into a different channel to rearrange the order of data channels within the image.   Suppose we make the following changes:



The result will be an "RGB" image that has channels rearranged into the Color Infrared arrangement.   


We start with a four channel NAIP image that shows a region near Redding, California.   The illustration below shows a zoomed-in view of part of the image.   The image is shown using RGB channel arrangement in the Style pane.



With the focus on the open Redding image, in the main menu we choose Edit - Join.



The Join dialog launches with the Redding image as both the target, original image in the upper left corner box, and also as the source, joined image in the upper right corner box.  


We double-click into the right most cell in the first row, to choose what field we want to use to transfer data into Channel 0.



From the pull down menu we choose Channel 3.  



We leave copy as the transfer method.  We have now specified that the values in Channel 3 should be copied into Channel 0.  



We repeat the procedure twice more for the next two rows, choosing Channel 0 to be copied into Channel 1, and choosing Channel 1 to be copied into Channel 2.    We will not make any changes to Channel 3, since that is not used in an RGB display.


Press Join.



The channels are immediately rearranged by the Join dialog, and the image automatically updates to show the above view, a classic color infrared display.


Why the traditional CIR arrangement?   It results in an image that matches the reddish, false color look of photographic images obtained using Kodak color Infrared film. Kodak's CIR film was developed during WWII to record near Infrared, red, and green channels instead of the usual red, green and blue channels.  During the war, Kodak's film was used to distinguish camouflage from real plant cover, since in near Infrared camouflage has a different appearance than real foliage.


In modern times, digital sensors acquire red, green, blue, and near-Infrared bands to record a four band image.  When the bands are combined in a GIS package to use red, green and blue bands the result is a natural color RGB aerial photo.  When bands are combined to use near-Infrared, red and green, the result is a CIR image.   CIR imagery is used to monitor the health of crops or forests and to distinguish plant species. Near-Infrared also penetrates atmospheric haze better than visible light bands, so CIR images can be sharper than natural color RGB images.


Changing channel assignments vs changing channel order - Different image formats utilize different arrangements of channels within the actual image data.  Some have the red channel first, while other arrangements have the blue channel first.  To change the appearance of the image, we can rearrange channels, as shown in this topic, or we can use the Style pane to specify how those channels should be assigned to red, green and blue display outputs, no matter what channel ordering is used within the data.


Using the Style pane to say how data channels should be used, as shown in the Example: Display an NAIP Four Band Image as Color Infrared (CIR) topic, does not  change the order of data channels within the actual image.   It simply reassigns how the data should be interpreted for display purposes.   


If we want to change the actual order of data in the image, we use the technique illustrated in  this topic or in the Example: Rearrange Channels using an Expression topic.


See Also



Images and Channels


Palette Images




Style: Images


Style: Channels and Outputs Tutorial


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 Style pane to change the contrast of an image.


Example: Using the Assign Channels Button - The Assign Channels button in the Style pane for images allows us to assign channels to the standard three Red, Green, and Blue display outputs using frequently-desired arrangements.   The button provides a short cut way to assign all channels at once instead of doing each channel individually.


Example: Assign Channels - How to use the Style pane for images to assign channels to display outputs such as R, G, B or A.  This topic shows examples of channel combinations and the visual results.


Example: Display an NAIP Four Band Image as Color Infrared (CIR) - How to use the Style pane for images to re-assign channels in a four band NAIP image to produce a Color Infrared (CIR) image display.


Example: Set Image Transparency using Alpha - The A row in the Style pane 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 Style pane 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 Style pane 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.


SQL Example: Create NDVI Displays - How to create a query that creates an NDVI display from a four-band NAIP image, with tips and tricks on how to copy and paste existing information to get the result we want.


Example: Rearrange Channels using an Expression - We use a simple expression in the Transform pane to rearrange the order of channels within the data.