Example: An Image using Computed Fields in a Table

This example is a continuation of the Example: How Images use Tiles from Tables topic.


Using the same bronze image from the previous example, we make a copy of the bronze Tiles table under the name bronze Tiles 2.   


We edit the Properties of the bronze image so it uses the bronze Tiles 2 table.  


We open the bronze Tiles 2 table.


Next, we click on the asterisk * column in the bronze Tiles 2 table to add a new field called cTile of type tile.  We use the name cTile as a mnemonic for "computed tile" since we are going to make this new field a computed field.



We check the Set field values box, which expands the New Field dialog to allow us to enter a computed field.




In the Expression tab we choose the TileAbs(<tile>) function to operate on the Tile field, writing the expression TileAbs([Tile]).   This is an absolute value function that when applied to RGB data has the effect of cutting out and using the first channel.




We add the computed field to the table where it appears as type tile.




Back in the Properties of the bronze image we change the FieldTile value to use the new computed field, cTile.  




When we press OK to update the image's properties we see it is now drawn in a sort of gray scale, the result of the TileAbs function operating on the pixel values within the tiles of the Tile fields for each record to grab the first channel of each pixel.


The example shows not only the use of a computed field, it also shows how images can take their content from whatever compatible table and field their properties specify.   In this example we created a bronze Tiles 2 table that has two fields of type tile, one the original data and the other a field computed from that original data.  We could use either column in an image.  Note that the new, computed tiles are made up of different data in each pixel but the image display nonetheless still was able to create an image.


Multiple images can use multiple fields from the same table at the same time.   We could copy the bronze  image and paste to create a new bronze4 image and then edit the properties of the bronze4 image so it would use the original Tiles field in the bronze Tiles 2 table for its tiles.  We could then have both the bronze4 image and the bronze image open at the same time, both drawing their tiles from the same table but from different fields in that table.


One of the benefits of Manifold's "everything is a table" philosophy is the ability to keep just one copy of data somewhere and then see different views of that data based upon computations.  Manifold is fast, especially when GPU parallel processing can be used, so it is a realistic strategy to do even complex computations on large images to transform data on the fly for display in different forms based on a single, stored data set.


See Also



Images and Channels


Palette Images




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: 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: 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.


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.