﻿ Transform Templates - Images

# Transform Templates - Images

This topic discusses application of the Transform Dialog with Images on a tile field for the image.  That is equivalent to applying the Transform dialog to a table for an image and using the tile field in the table.  See the Transform Dialog and Transform Templates topics for use and for links to lists of templates for other data types for tables and use of the Transform Dialog with other components, such as Tables and Drawings.

Important:  Many tile functions are the tile equivalents of mathematical functions operating on numbers.    The examples and table illustrations in this table show the operation of numeric transforms, since those are easily visible in a table.    The tile function equivalents for tile data type fields will do the same math, but operating upon the numeric pixel values within the tile.

Images such as RGB images that utilize multiple channels have only the Channels template, allowing creation of an image that extracts one of the channels used.   Images that utilize only a single channel have many more transforms as listed below.

### Images, Single Channels

 Absolute Value Take the absolute value of the number in the source field and put it into the target field.  Absolute value leaves positive numbers unchanged and converts negative numbers into their positive equivalents.     Example: Put in Temp the Absolute Value of Numbers. Add Add the two source fields and put the result in the target field.   Example: Add the Numbers and Fractions fields and put in Temp. Arc Cosine Take the arc cosine (inverse cosine) of the source field and put it into the target field.   Example: Put in Temp the Arc Cosine of Small. Arc Sine Take the arc sine (inverse sine) of the source field and put it into the target field.   Example: Put in Temp the Arc Sine of Small. Arc Tangent Take the arc tangent (inverse tangent) of the source field and put it into the target field.   Example: Put in Temp the Arc Tangent of Numbers. Arc Tangent of Ratio Take the arc tangent (inverse tangent) of the ratio between the DY field and the DX field and put into the target field.   Example: Put in Temp the Arc Tangent of the Ratio between Numbers as the DY field and Fractions as the DX field. Aspect Treating the pixel values as heights to imply a surface, compute the direction in which the slope of the terrain faces and save as a pixel value that direction in degrees, with 0 to 180 representing the Eastern semicircle and -1 to -179 the Western semicircle.  A larger Radius takes longer to calculate but averages out the changes in slope to a greater extent. Base 10 Logarithm Put the base 10 logarithm (also called the common logarithm) of the source field into the target field.   Example: Put in Temp the Base 10 Logarithm of Numbers. Base 2 Logarithm Put the base 2 logarithm (also called the binary logarithm) of the source field into the target field.   Example: Put in Temp the Base 2 Logarithm of Numbers. Bessel J0 A Bessel function of the first kind: Put the result of the Bessel function J0(x) using the source field as x into the target.   Example: Put in Temp the Bessel J0 function of Numbers. Bessel J1 A Bessel function of the first kind: Put the result of the Bessel function J1(x) using the source field as x into the target.   Example: Put in Temp the Bessel J1 function of Numbers. Bessel Jn The nth Bessel function of the first kind: Put the result of the Bessel function Jn(x) for Order n using the source field as x into the target.  Specifying 2 for Order uses a J2(x) Bessel function.  Using 0 or 1 for the Order is equivalent to using J0(x) or J1(x), respectively.   Example: Put in Temp the  Bessel Jn function for Order 2 of Numbers. Bessel Y0 A Bessel function of the second kind: Put the result of the Bessel Function Y0(x) using the source field as x into the target.   Example: Put in Temp the Bessel Y0 function of Numbers. Bessel Y1 A Bessel function of the second kind: Put the result of the Bessel Function Y1(x) using the source field as x into the target.   Example: Put in Temp the Bessel Y1 function of Numbers. Bessel Yn The nth Bessel function of the second kind: Put the result of the Bessel Function Yn(x) for Order n using the source field as x into the target.  Specifying 2 for Order uses a Y2(x) Bessel function.  Using 0 or 1 for the Order is equivalent to using Y0(x) or Y1(x), respectively.   Example: Put in Temp the  Bessel Yn function for Order 2 of Numbers. Blur Take the source field, Interpolate pixel values based on radius and power, averaging pixel values over a square array of pixels, and place the result in the target field.  The Radius value sets the number of pixels from the center pixel to the edge:  A Radius of 1 results in a 3x3 pixel array. The Power value is the weight to give the center pixel: a weight of 1 means not to emphasize it.  A weight of 5 means to give the center pixel's value five times the value in averaging compared to other pixels in the array. Ceiling Put the rounded up integer value of the source field into the target field.   Example: Put in Temp the Ceiling value of Fractions. Ceiling up to Decimals Put the value of the source field rounded up to the specified number of Decimal positions into the target field.   Example: Put in Temp the Ceiling up to Decimals value of Fractions with Decimals set to 2. Channel Put the value of the specified channel from the source field into the target field.     For a discussion of channels, see the Style: Presenting Images topic. Complementary Error Function Take the complementary error function (also called erfc(z) ) of the source field and put it into the target field.   Example: Put in Temp the Complementary Error Function of Numbers. Cosine Take the cosine of the source field and put it into the target field.   Example: Put in Temp the Cosine of Numbers. Cube Root Take the cube root of the source field and put it into the target field.   Example: Put in Temp the Cube Root of Numbers. Direction Blur Take the source field, Interpolate pixel values based on radius, power and angle (in radians)  and place the result in the target field.  Radius has a greater visual effect than power. Direction Edges Find edges (transitions between pixel values) in the direction of the angle (in radians) specified.  Begin by setting Radius and Power to 1. Divide Divide the source field by the divide field and put the result into the target field.   Example: Divide the Numbers field by Series and put the result in Temp. Divide and Truncate Divide the source field by the divide field and put the integer part of the result into the target field.   Example: Divide and Truncate the Numbers field by Series and put the result in Temp. Edges Find edges (transitions between pixel values) in any direction.  Begin by setting Radius and Power to 1. Error Function Take the error function (also called erf(z) ) of the source field and put it into the target field.   Example: Put in Temp the Error Function of Numbers. Exponent The exponential function: Take e to the power of the source field and place result into the target field. For anything but small numbers in the source field such exponentiation very rapidly results in numbers larger than can be represented in most types and thus stores a NULL in the target.     Example: Put in Temp the Exponent of Series. Floor Put the rounded down integer value of the source field into the target field.   Example: Put in Temp the Floor value of Fractions. Floor down to Decimals Put the value of the source field rounded up to the specified number of Decimal positions into the target field.   Example: Put in Temp the Floor down to Decimals value of Fractions with Decimals set to 2. Fractional Part Take only the decimal fraction portion of the source and put into the target field.   Example: Put in Temp the Fractional Part of Fractions. Fractional Part from Decimals Take only the decimal fraction portion of the source beyond the specified number of Decimal positions and put into the target field.   Example: Put in Temp the Fractional Part from Decimals of Fractions with Decimals set to 2. Gamma Function Put the gamma function for the source field into the target field.   Example: Put in Temp the Gamma Function of Series. Gaussian Blur Take the source field, Interpolate pixel values based on radius and power and place the result in the target field.  Radius has a greater visual effect than power.  Gaussian Blur corrects for circular radius while Blur computes blur on a square matrix. Hyperbolic Arc Cosine Put the hyperbolic arc cosine of the source field into the target field.   Example: Put in Temp the Hyperbolic Arc Cosine of Series. Hyperbolic Arc Sine Put the hyperbolic arc sine of the source field into the target field.   Example: Put in Temp the Hyperbolic Arc Sine of Series. Hyperbolic Arc Tangent Put the hyperbolic arc tangent of the source field into the target field.   Example: Put in Temp the Hyperbolic Arc Tangent of Small. Hyperbolic Cosine Put the hyperbolic cosine of the source field into the target field.   Example: Put in Temp the Hyperbolic Cosine of Series. Hyperbolic Sine Put the hyperbolic sine of the source field into the target field.   Example: Put in Temp the Hyperbolic Sine of Series. Hyperbolic Tangent Put the hyperbolic tangent of the source field into the target field.   Example: Put in Temp the Hyperbolic Tangent of Series. Hypotenuse The great and ancient Pythagorean theorem: The square root of the sum of the squares of the two sides of a right triangle.  Save into the target the value of the hypotenuse taking two given source fields as DX and DY.   Example: Put in Temp the Hypotenuse taking Numbers as DX and Fractions as DY. Example: Put in Temp the Hypotenuse taking the number 3 as DX and 4 as DY. Log-gamma Function The log-gamma function takes the natural logarithm of the gamma function for the source field and stores the result into the target field.   Example: Put in Temp the Log gamma Function of Small. Logarithm Put the base e logarithm (also called the natural logarithm) of the source field into the target field.   Example: Put in Temp the Logarithm of Numbers. Maximum Value Take the maximum, that is the greater value, of either the source field or the comparison field and save into the target field.   Example: Put in Temp the Maximum Value of Numbers or Fractions. Modulo The remainder (of a congruence) function: Take what is left over by the integral division of the source field by the given Divide by value and place into the target field.   Example: Put in Temp the Modulo of Numbers using 10 as the Divide by value. In the above we can see that 1474 can be integrally divided by 10, that is evenly divided, 147 times, leaving a remainder of 4. Multiply Multiply the two source fields and place the result into the target field.   Example: Multiply the Numbers field with Fractions and put the result in Temp. Negate Multiply the source field by -1 and place the result into the target field.   Example: Negate the Numbers field and put the result in Temp. Noise Place random noise values into pixels over the given range. Power Compute the source field to the power of the specified Power value and put the result into the target field. A Power of 2 is the source field squared while a Power of 3 is the source field cubed.   Example: Take the Power of Numbers using a Power of 3 and put the result in Temp. Power of 10 Compute 10 to the power of the source field and put the result into the target field.  If the source field has values 1, 2, 3,... the result of Power of 10 will be 10, 100, 1000,....   For anything but small numbers in the source field such exponentiation very rapidly results in numbers larger than can be represented in most types and thus stores a NULL in the target.     Example: Put in Temp the Power of 10 of Series. Power of 2 Compute 2 to the power of the source field and put the result into the target field.  If the source field has values 1, 2, 3,... the result of Power of 2 will be 2, 4, 8,....   For anything but small numbers in the source field such exponentiation very rapidly results in numbers larger than can be represented in most types and thus stores a NULL in the target.     Example: Put in Temp the Power of 2 of Series. Reciprocal Cube Root Also known as the inverse cube root: Take 1 divided by the cube root of the source field and put the result into the target field.   Example: Put in Temp the Reciprocal Cube Root of Numbers. Reciprocal Square Root Also known as the inverse square root: Take 1 divided by the square root of the source field and put the result into the target field.   Example: Put in Temp the Reciprocal Square Root of Numbers. Round Round a source field with a fractional part up or down to the nearest integer and put the result into the target field.   Example: Round the Fractions field and put the result into Temp. Round to Decimals Round a source field with a fractional part up or down to the number of decimals specified by  Decimals and put the result into the target field.   Example: Round to Decmials the Fractions field using a Decimals value of 2 and put the result into Temp. Sharpen Emphasize edges. Sign For a source field that is positive or negative put a 1 or -1 respectively into the target field.   Example: Determine Sign of the Numbers field and put the result into Temp. Sine Take the sine of the source field and put it into the target field.   Example: Put in Temp the Sine of Numbers. Slope Treating the pixel values as heights to imply a surface, the inclination in degrees of the surface at the pixel's position. and save as a pixel value from 0 to 90.  A larger Radius takes longer to calculate but averages out the changes in slope to a greater extent. Square Root Take the square root of the source field and put it into the target field.   Example: Put in Temp the Square Root of Numbers. Subtract Subtract one source field from the other and put the result into the target field.   Example: Subtract the Fractions field value from Numbers and put in Temp. Tangent Take the tangent of the source field and put it into the target field.   Example: Put in Temp the Tangent of Numbers. Truncate Take the integer part of the source field, discarding any decimal fraction part, and put the result into the target field.   Example: Truncate the Fractions field and put the result into Temp. Truncate to Decimals Take the integer part of the source field as well as any decimal fraction up to the specified number of Decimal places, discarding any decimal fraction part beyond, and put the result into the target field.   Example: Truncate to Decimals the Fractions field using a Decimals value of 2 and put the result into Temp. ## Notes

Everything Math - For a handy reference to anything in mathematics, see the Wolfram MathWorld site.  Thank you, Wolfram!

A guy walks into a bar and asks for 1.014 root beers.  The bartender says, “I’ll have to charge you extra, that’s a root beer float”.  So the guy says, “In that case, better make it a double.”

Why do programmers confuse Halloween with Christmas?  Because OCT 31 = DEC 25.

Transform Dialog

Transform Options

Transform Templates

Transform Templates - Drawings

Transform Templates - Binary

Transform Templates - Boolean

Transform Templates - Datetime

Transform Templates - Geom

Transform Templates - Text

Transform Templates - Tile

Transform: Center and Centroids

Transform: Escape Templates

Example: Two Drawings from the Same Table - Take a table with a geom field that is visualized by a drawing.  Add a second geom field to the table and create an rtree index on that field so it can be visualized by a drawing.   Copy the first drawing, paste it and adjust the pasted copy so it uses the second geom field. Demonstrate how to use the Transform dialog to show "live" modifications in the second drawing compared to the first drawing.

Example: Copy one Column into Another Column with Transform - How to use the Transform dialog to copy the contents of one column in a table into another column, but only for selected records.  Uses the Products table from the Nwind example data set.

Example: Transform Field Values using an Expression in the Transform Dialog -  How the Expressions tab of the Transform Dialog may be used to change the values of fields.   We include an example of changing the price of selected products and using two different Transform dialogs open at the same time for two different table windows.

Example: Construct JSON String using Select and Transform - Use the Select and Transform dialogs to manually construct a JSON string using values from other fields in a table. Shows how we can manipulate text to build desired contents in a field.

Example: Edit a Drawing with Transform Dialog Templates -  In this example we open a drawing and edit objects in the drawing using the Transform dialog Template tab.   Includes examples of using the Add Component button and also the Edit Query button.

Example: Use a Transform Dialog Expression to Create Buffers in a Drawing - Use the Expression tab of the Transform Dialog to create three different sizes of buffers for different lines in a drawing and then automatically create a query which does the same thing.  Includes examples of using the Add Component button and also the Edit Query button.

Example: Clip Areas with a Transform Dialog Expression - Use the Expression tab of the Transform dialog to clip areas in a drawing to fit within horizontal bounds.   Includes examples of using the Add Component button and also the Edit Query button.

Example: Smooth Lines with a Transform Dialog Expression - Use the Expression tab of the Transform dialog to make lines smoother in a drawing so that longer lines are smoothed more.  Includes examples of using the Edit Query button to show how different queries are created automatically depending on if we want to update a field or to add a new component.

Example: Transfer Options and Merge Areas - Using the Merge Areas Transform dialog template, an exploration of the difference between using Copy and Sum for transfer options.