Style: Images

 

Style: Images

The Style panel in the Contents pane manages the display of an image by specifying how data channels are assigned to drive Red R, Green G, Blue B, and Alpha (transparency) A display outputs.   Style controls allow us to choose which of the values in those data channels should be used and how the possibly very wide range of values in the data should be converted and used for display within the 0 to 255 range utilized to drive R, G, B and A display outputs.  

 

Style properties are properties of an image, not of the data within the table.  Changing the style used for display only changes how data is displayed.  It does not change the data.  We can change settings in the Style panel as much as we like, and the data within the image's table will remain unchanged.  If we Copy an image and Paste it to create a second image that uses exactly the same data in the same table,  we can style the two images differently to create different displays from exactly the same data.  

Two Ways to Drive RGB Pixel Elements

Images come in many formats with varying use of channels.   What they all have in common on Windows computers is that they all end up driving red, green and blue pixel elements in our computer screens.  One way or another, the data channels in the image get assigned to driving RGB outputs in the monitor.  

 

There are two ways that numbers within the image are used to drive RGB outputs:

 

 

 

eg_click_right_hand_style_button.pngManifold allows using either way to specify how Manifold should make use of numbers within images.    In the Source box we can choose (use RGBA channels) or choose a specific Channel.    See the Style: Channels and Outputs Tutorial topic.

Click on the Right Side of the Style Property Button

When we click onto the Style panel for an image a single Style button appears.  To see the displays below, click onto the right side of the button.   That will open up the full set of controls for the panel.

Style using RGBA Channels

Unless an image specifies otherwise, the default for Manifold is (use RGBA channels), with channels assigned to driving R,G, B, outputs.    The A, or Alpha, output for transparency is also included, in case we will be working with RGBA images.   If the image has no fourth channel then a fixed Value of 0 is used for A, meaning no transparency.

 

il_style_dialog_images.png

 

Source

Choose how channels drive outputs:

 

  • (use RGBA channels) - Use individual channel choices to drive R, G, B, and A outputs.

  • Channel n -  Choosing a single channel from available data channels to drive R,G, and B via a palette.

 

Controls will be configured for the choice made in the Source box.  The above illustration and this table show controls for the (use RGBA channels)  choice.

  btn_arranger_style_images.png  Arranger

Launch a one click menu to assign how channels drive R,G,B, and A outputs.   Typical choices are:

 

  • BGR - The default.  Assign channels 0, 1 and 2 to B, G and R respectively.

  • RGB - Assign channels 0, 1 and 2 to R, G and B respectively.

  • Channel 0 - Assign channel 0 to all three R, G and B outputs.

  • Channel 1 - Assign channel 1 to all three R, G and B outputs.

  • Channel 2 - Assign channel 2 to all three R, G and B outputs.

 

If images use the A or Alpha channel or if they have more data channels there will be more options in the button's pull down menu.

 

See the Example: Using the Assign Channels Button topic.

RGBA Outputs

A list of Red, R, Green, G, Blue, B and Alpha, A (transparency) display outputs with the channel that is used to drive each output.

il_double_click_channel.png

Double-clicking on an output's channel or value cell opens a menu that allows choosing either a Channel n or Value.   Choosing Value allows specifying a fixed value for that output to be used for each pixel.

 

Setting one or more channels to an explicit, fixed value is equivalent to "turning a channel off" in Manifold 8 and other software packages, except that we have control over what value the system is going to use to fill the channel.   If we specify a value of 0, that turns the channel completely "off".

 

Ranges

For Channel rows, two numbers for the lower bound and the upper bound of the range of values to be mapped into the output range.  For Value rows, one number for the specific value to be used.  

 

il_double_click_range.png

Double-click into a cell to change the value.  We can change the range numbers to a range different than found in the data to alter how data in channels is utilized.   For example, if the data has all values between 0 and 250 with only one pixel having a value of 9999 we could set a range of 0 to 250.

 

Ctrl-click a channel row to select it or to de-select it.  Changing a value in a  selected channel row, such as changing a range cell or choosing a channel, will change that value in all selected channel rows.

il_right_click_selrange.png

Right-click onto a range cell in a selected channel row for a menu of Autocontrast or Full Range, to use the full range of values found in that channel.

 

  • Autocontrast - set both range numbers automatically using a list of standard deviation choices.  

  • Full Range - set both range numbers to the minimum to maximum found in the data for that channel.

 

Autocontrast might use a range wider or narrower than the values found in the data in order to stretch the data further or to displace it lower or higher.   When Autocontrast puts negative values into the minimum range box, it is using a number outside the range found in the data to spread out data values downward.   See the Style: Autocontrast topic.

Update Style

Apply changes that have been made.

Supplemental Menus

 

Autocontrast

Right-click on a range cell of a selected channel row.  Autocontrast computes the range of values found in the data channel given the number of standard deviations chosen in the Autocontrast sub-menu, and loads the lower and upper bounds of that range into the range boxes.  

Full Range

Right-click on a range cell of a selected channel row.  Full Range fills the adjacent range boxes with the full range, from the smallest value to the largest value, of values actually found in that data channel.

Options Tab

 

(not enabled)

Shading controls in the Options tab are not enabled for the (use RGBA channels)  choice of Source.

 

Example: Show only the Red output of an RGB image

eg_red_channel01_01.png   eg_red_channel01_02.png

 

Open the image and in the Style panel click the right side of the big color well button.

 

eg_red_channel01_03.pngeg_red_channel01_04.png

 

Double-click into the G row's Channel 1 cell and in the menu choose Value.   The G row now uses the value 0.  Double-click into the B row's Channel 0 cell and in the menu choose Value.   The B row now uses the value 0.

 

eg_red_channel01_05.png

 

Press the Update Style button.

 

eg_red_channel01_06.png

 

With G, Green, and B, Blue, outputs assigned a fixed Value of 0, only the R, Red, output is powered by the numbers in Channel 2.  See also the Images and Channels topic for additional examples.

Style Using a Single Channel

Choosing a single channel, Channel n, in the Source box drives RGB pixel element outputs by using the numbers in that channel as a lookup, or index, into a table of palette colors, each of which is a triplet of numbers, that is, an RGB color.   The controls in the Style panel will switch to controls which, first, allow us to specify the number of palette intervals and how those intervals are determined, and second, how the numbers in the source channel should be used to choose a color from the palette.

il_style_dialog_images_common.png

Source

Choose how channels drive outputs:

 

  • (use RGBA channels) - Use individual channel choices to drive R, G, B, and A.

  • Channel n -  Choosing a single channel from available data channels to drive R,G, and B via a palette.

 

Controls will be configured for the choice made in the Source box.  The above illustration and this table show controls when a single channel, Channel n,  is the source.

Method

The method used to classify numbers found within the Source data channel into different intervals.

Tally

Press to compute bounds, and therefore intervals, based upon the specified Method and number of Breaks.

Breaks

The number of intervals into which numbers within the channel should be tallied.

(palette button)

Press to apply a palette to the color sample boxes in the intervals list.

(delete button)

Enabled when an interval row in the intervals list has been selected.  Press to delete the selected interval.

Intervals

Displays the intervals used to group numbers from the Source channel into intervals to which specific colors can be assigned.

(bounds for intervals)

Specifies the numeric bound for the beginning of each interval.  Double-click to edit.  

Samples

The color to be used for values within that interval.   Double-click a color sample to edit the color.  When more than one interval is selected, changing the color sample in any of the intervals will assign the specified color to all selected intervals.

*

Asterisk character in intervals list.  Double-click into the bounds region of that row to add another bound.  Adding a bound adds an interval.

Fill

Fill rules: How colors specified for intervals should be assigned, that is, filled into, specific channel values that occur within those intervals.  See the examples for Fill rules below.

Update Style

Apply any changes in the panel to the image.

Options Tab

 

Use shading

Check the box to apply shading:  Interpret the values of pixels as heights and adjust colors in the display to simulate the generation of shadows as if a light source were located at the specified Azimuth and Altitude.  

 

Also called hill shading since the normal use is to shade images representing views of terrain to provide a 3D effect, as if the Sun was illuminating the hills and valleys and shadows provided greater relief.  See the Example: Autocontrast and Hill Shading Images using Style  topic.

Azimuth

The compass bearing to the light source, 315 degrees by default.

Altitude

The angular elevation, in degrees, of the light source, 45 degrees by default.

Z scale

Scaling factor for heights used when shading..   Increase the Z scale to increase the relative heights and thus the apparent shading effect.

Update Options

Apply any changes in the Options tab to the image.

 

Grouping Methods for Intervals

 

equal intervals

Calculate bounds so each interval spans approximately the same part of the total range of values that occur in the field.   

 

For example, given a Range of 0 to 100 with Breaks equal to 6 the five intervals thus created would be 0 to 20, to 40, to 60 to 80 and finally to 100. Each range would interval would be about the same size, a difference of 20 in range.

equal count

Calculate bounds so each interval contains about the same number of occurrences of values.  

 

For example, if many values of the channel were evenly scattered between 0 and 25 but only one record had a value of 100, creating five intervals with equal count could create intervals from 0 to 5, to 10, to 15 , to 20 and then a final interval to 100.    The final interval would be a range of 80 values but it would still contain a count of occurrences of values equal to the other four intervals which each covered a range of only five occurrences of values.

exponential intervals

Assign interval values so that each interval contains an exponentially increasing number of occurrences of values.

natural breaks

Find groupings of values and assign bounds so groups of values tend to fall into the specified number of breaks.

standard intervals

Assign values of bounds so that each interval represents one standard deviation.

unique values

Given the number of breaks up to a maximum of 100 breaks, find the most frequently occurring unique values within that number and assign an interval to each such value.  For example, if we have 5 breaks the five most frequently occurring values will appear as intervals.

Intervals and Fill Rules

Consider an image of terrain elevation using the following intervals, computed using the equal count method:

 

il_style_fill_intervals_image.png

 

Intervals in the list are defined by the lowest value found in the channel at the top of the list, the highest value found in the channel at the bottom of the list with intervals in between such that each interval's lowest bound is the value given for that interval.   Each interval starts with the lower bound given and then continues up through increasing values of the field in the channel until we hit the next defining value, which is the lowest bound for the next interval.   

 

In the illustration above the lowest value found in the channel is 20.   That interval, assigned a light blue color, continues upward from the lowest value until we hit 24, which is the lower value bound for the next interval, assigned a green color.  That interval continues until we hit 33, the lower bound for the interval colored yellow.   That interval continues until we reach 50, the lower bound for the last interval that has been assigned a salmon color.    The last interval starts at that lower bound of 50 and continues up to the largest value in the channel, 212.   By default only that largest value will be colored red.  By default, all values less than the very largest, even just one less at 211, if such a value existed in the channel, would be colored using the salmon color assigned to the last interval that starts at 50.

 

Colors for each interval can be whatever color we want, including invisible color as seen below.  See the Style: Invisible Pixels topic.

 

il_import_ddf_dem01_08a.pngil_import_ddf_dem01_09a.png

 

 

Fill Rules specify how values found in the channel between those values which specify the bounds of intervals such as the numbers 20, 24, 33, 50 and 212 seen above.   Fill rules specify how a value such as 28, which falls between 24 and 33 should be colored.    The default setting is to use closest lower value so it would be colored green.   If we changed that to use closest higher value it would be colored yellow.  For examples of using closest lower value see the Style: Invisible Pixels and Style: Contouring using Colors topics.

Fill Rules

closest lower value

The default.  Assign the format specified for the lower bound of the interval.  The previous fill rule used will persist, so it could be by default some other fill rule is loaded.

closest higher value

Assign the format specified for the upper bound of the interval.

lowest value

Assign the format specified for the very lowest value found in the channel.

highest value

Assign the format specified for the very highest value found in the channel.

interpolate

Assign a format that is interpolated between the formats used for the lower bound and the upper bound of the interval, proportionately interpolating based on the value in the channel.

 

The closest lower value and closest higher value rules are handy for creating raster-based contours:

 

il_import_ddf_dem01_15.pngil_import_ddf_dem01_17.png

 

See the Style: Contouring using Colors topic.

 

Sun Azimuth and Altitude

The default hill shading gives a 3D effect as if the terrain were elevated according to the values used for pixel grayscale, with the Sun shining from a direction of 315 degrees, that is, from the upper left, and at an altitude of 45 degrees, that is, about half-way up from the horizon to directly overhead.   

 

eg_style01_09a.png

 

The illustration below shows the imaginary placement of the Sun for the computation of shading effects, within a synthetic 3D view of the terrain (using greatly exaggerated differences in elevation, necessary since Florida is so flat...) as if we were flying over the region above one of the round ponds near the center of the image above and looking North.

 

i_azi_alt.png

 

For most people, applying hill shading with the Sun apparently shining from the upper left of the view provides the easiest to "read" view of shading where hills appear to pop up and depressions (such as craters) appear as low places. This avoids a false reading of shading effects as sometimes happens when looking at photos of the Moon in which craters appear to be round mounds instead of depressions.   Many hill shading packages therefore use defaults of an azimuth of 315 and an elevation of 45 even though in many parts of the Northern hemisphere the Sun is always South of the line from East to West.  

Lower Sun Altitude = Less Light

A Sun altitude of 89 means the Sun is almost overhead, lighting the scene to the brightest extent.    As the sun lowers in the sky the scene will become increasingly darker, with low Sun angles creating highlights, as are indeed seen in reality.

 

eg_sun_altitude01_01.png

 

Consider a terrain elevation image above, seen without shading.

 

eg_sun_altitude01_02.pngeg_sun_altitude01_03.png

 

Shading using Sun Altitude of 89 degrees and 65 degrees will darken the image slightly.

 

eg_sun_altitude01_04.pngeg_sun_altitude01_05.png

 

As the Sun sets in the sky to lower Altitude values, the image becomes darker.   The model currently used by Manifold tends to darken the scene as occurs in reality.  However, GIS presentations are often not about reality but a more appealing presentation.   It could be that in response to community discussions Manifold will alter the model to provide brighter colors even with the Sun lower in the sky.

Style Applies to a Specific Image

If we like we can have more than one image showing the same data using different styles.   To do so, we Copy the image in the Project pane and then Paste it to create another image that is a copy of the image.   We can then open that copy and choose Edit - Style to change the style.   

 

When we copy and paste the image we are only making a copy of the image component that specifies how the data in the tiles in the source table should be displayed.   We are not making a copy of the table in which the data (in the form of tiles) is stored.   We can make dozens of copies of an image to use different display styles and that will not increase the size of the project. tech_tina_sm.png

 

Tech Tip:  Style properties apply to a specific, individual image or drawing and will apply in all windows where that image or drawing appears, including map windows where the image or drawing appears as a layer.   Style is about visualization, so it applies only to the image or drawing and does not extend into the tiles or geoms within the table from which an image or drawing is created.  If we create two different images or drawings from the same column in a table we can style those two different components differently.

Channels and Outputs

See the Images and Channels topic to learn about channels.   Each pixel in a computer monitor is made up of three tiny dots: a red dot, a blue dot and a green dot.  To display an image the brightness of each dot is varied in 256 steps from a brightness level of 0, meaning the dot is not turned on at all, to a brightness level of 255, meaning the dot is emitting its red, blue or green light as brightly as it can.  In Manifold we call each set of red, green or blue dots the display output. The intensity value used to drive each R, G or B dot is the output value.   Henceforth we will interchangeably refer to Red, Green and Blue as R, G and B.  

 

Images display data stored in tiles in a table, where each tile consists of pixels that in the case of color, RGB images, have three numbers per pixel.  Each of the three numbers in that triplet is a data channel, with the first number in the triplet being the value for Channel 0, the second number in the triplet being the value for Channel 1 and the third number in the triplet being the value for Channel 2.  The usual convention in computing is to use "zero based" numbering for channel names, that is, programming-style numbering beginning at 0 so if we have three channels they are called Channel 0, Channel 1 and Channel 2.  

 

Manifold constructs an image by taking the triplet of numbers for each pixel and then feeding the number for each channel to its assigned R, G or B output.   By convention most computer images use the first number in the triplet, Channel 0, to drive the B output, the second number in the triplet, Channel 1 to drive the G output and the third number in the triplet, Channel 2, to drive the R output.  Even though the near-universal casual name for such images is "RGB" images, the numbers which drive each pixel are actually in BGR order.   Programmers will sometimes refer to such images as "BGR" images.

 

When (use RGBA channels) is the choice for the channel source, the Style panel controls which channels in the data are assigned to drive the R, G and B outputs.  When an image is opened the channel assignments usually make sense, since Manifold will automatically assign channels to R, G and B outputs based on storage conventions for well-known image formats.    RGB images stored in well-known formats such as JPG will typically have three channels with Channel 0 assigned to B, Channel 1 assigned to G, and Channel 2 assigned to R.   Images in formats such as PNG might also have a fourth, Channel 3, that gives an Alpha or A value used for per-pixel transparency.   

 

Manifold will also automatically arrange channels as required when importing images from well-known formats that are not RGB or RGBA images.  For example, monochrome images may have just one channel, Channel 0, which will be used for R, G and B.   Palette images will also usually have just one channel, Channel 0, which is used to look up fixed colors from intervals which make up the palette.

Ranges and Method

The R, G and B dots on most displays can have only 256 steps of brightness from 0 to 255.  Three-channel images using 8 bit integers within data channels for R, G and B outputs will also have integer values in the channels that range from 0 to 255, so by default when displaying such images Manifold will take whatever value is in the channel and use that value for the brightness value of the corresponding R, G or B dot.  

 

When images have channels with numbers that are greater than 8 bits per pixel and thus might contain values beyond the range from 0 to 255, by default the values in the data channel are interpolated into a range of 0 to 255 using a linear ramp.

Notes

One time pause to compute statistics -   When working with an image for the very first time, when we open up the style controls the system will pause to computed statistics on pixel values found in the image.  That often happens so fast we won't notice the pause, but very large images may require sufficient time to compute statistics that we will be able to see the computation progress dialog in action.  For extremely large images we can cancel the process and the system will use whatever statistics have been computed. Statistics need to be computed only once for an image in a Manifold session and then they are saved within the images data structures.    If images are very large or located on a remote server that is accessed through a slow network link the computation process could require a few minutes.    

 

Use Style to See Channel Values - We can use the Style panel to look at the ranges of data in a channel:

 

il_style_images_notes01_05.png  il_style_images_notes01_06.png

 

Right-clicking a range cell in a selected channel and then choosing Full Range will fill the range with values found in the data channel, from lowest to highest.

 

Why does Style not autoselect a Channel n source for  Grayscale images? - Manifold presents all display channels for manipulation even when they are all driven, by default, by the same data channel.  That is done to allow us in advanced uses to alter how each individual display channel interprets the displayed data.

il_style_images_notes01_01.png

Consider the view of Florida used in the Example: Autocontrast and Hill Shading Images using Style  topic.    The image uses a single channel, the terrain elevation for Florida in that region, to drive all three R, G and B outputs.

 

In the Style panel for the image we can manipulate each output individually.

 

il_style_images_notes01_02.png

 

For example, as seen above we have clicked on the G output row.  That row uses Channel 0 the same as the R and the B outputs, using the values from 0 to 255 as a range.

 

il_style_images_notes01_03.png

 

In the range boxes we can change the 255 value to 100, and then press Update Style.   

 

The range we have chosen of 0 to 100 will be interpolated, using a linear ramp, into the output range of 0 to 255.   The net effect will be to make the Green intensities brighter since a smaller range of values will be stretched into bigger values such that a data channel value of 100 will now drive the Green output at the full intensity of 255, more than twice as bright.   A mid-range value in Channel 0 which will still drive the R and B outputs to mid-range intensity, will now drive the G output to full brightness.   

 

il_style_images_notes01_04.png

 

We can see the effect when we press Update Style.     The display now appears in a brighter, green color.   Each pixel is no longer gray but now uses shades of green as the proportionately greater value in the Green output compared to the Red and Blue values shifts the displayed color for each pixel from a shade of gray to a shade of green.

 

If Manifold forced the use of a single channel into all three outputs, manipulation like the above would not be possible.  Any change we applied to how the single data channel was used would apply to all three outputs.  The result would always be a grayscale image with the same numbers driving all three outputs.

 

Notes

Statistics and big images - The Style panel automatically computes statistics for images to correctly handle channels.  When working with a big image, the Style panel computes statistics from intermediate levels.  This provides good usability for the Style pane with big images while retaining good accuracy for computations, such as arranging intervals.

 

See Also

Images

 

Images and Channels

 

Palette Images

 

Style

 

Style: Drawings

 

Style: Labels

 

Style: Channels and Outputs Tutorial

 

Style: Autocontrast

 

Style: Invisible Pixels

 

Style: Contouring using Colors

 

Style: Palettes

 

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: Change the Contrast of an Image - In this example we use the Style panel to change the contrast of an image.

 

Example: Using the Assign Channels Button - The Assign Channels button in the Style panel 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 panel 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: Set Image Transparency using Alpha - The A row in the Style panel 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 panel 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 panel 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.

 

Example: Import CTG Grid Cell File and Style - A companion topic to the Example: Import GIRAS vector LULC File and Style topic.  We import a CTG LULC Grid Cell file containing raster data showing land use and land cover and then we use Style to provide a more understandable display.

 

Example: Import DDF SDTS DEM Raster File -  We import a raster data terrain elevation surface from USGS SDTS format using DDF files.

 

Example: Import GIRAS vector LULC File and Style - A companion topic to the Example: Import CTG Grid Cell File and Style topic.   We import a USGS land use file in GIRAS vector format and then we use Style to provide a more understandable display.