F. Direction of Gradient back | top | MacLIspix Home

A not commonly used but very informative operation is the direction of the gradient. The gradient of a function is the vector giving the magnitude and direction of greatest change. If the pixel values are considered as a function of horizontal and vertical position, then the gradient gives the maximum change in brightness from a given pixel to one of its neighbors. The magnitude of the gradient is most often used as an edge enhancer, or high pass filter. The direction of the gradient can show detail not easily shown using contrast enhancement. Holding down the option key while selecting the following menus, and then clicking on the 'Source Code' button or the 'Help' button will give more details and literature references on these functions.

Clear the screen with MLx -> Pixel Array Ops -> Erase Everything.

Load and display the image of fibers 'amosite1.tiff' in the MAS Journal Article folder:

Type command-D, when THIS file is in the front window. Use the DBMac -> Defaults - Set Image Dir command. Hold down the command key and invoke the MLx - Image Files -> TIFF -> Read command. Select the amosite1.tiff image.

The magnitude of the gradient, calculated from two nearest neighbors, can be shown using the MLx -> Pixel Array Ops -> Special -> Grada command. (Holding down the option key while selecting this menu, and then clicking on the 'Source Code' button and on the 'Help' button will give references and information on how this is calculated.)

Enhance this image using the MLx -> Scaling -> % Outliers command, using the default of 1 for the percentage of outliers to clip.

(Optional) More detail can be seen in this image using the Thermal Slider. Access this using the MLx -> Threshold Slider as explained above.

The direction of the gradient, on the other hand, is not often displayed as an image.

Display the direction of the gradient using the MLx -> Pixel Array Ops - Special -> DOG255 command. This operation takes about half a minute on a IIFx. While it is running, pressing command-T, or using the MLx -> Loop Monitor will give information on its progress in the Listener window. (If you can't see the Listener window where this information is displayed, type command-L to bring that window to the front, or select it in the Windows menu.) Other operations that take more than a few seconds are monitored in this way. (You may edit text in LISP or run some other application while the calculation is proceeding).

MacLispix displays the angular values as shades of gray by showing a preferred direction as white, the opposite direction as black, and the angles in-between as shades of gray scaled linearly. There is a right-left ambiguity for a given shade of gray, but the appearance of the image is that of a shadowed bas-relief. Display the direction of gradient image.

To choose the preferred direction, make sure the AMOSITE1_DOG window is in the front, and use the MLx -> False Color -> Directional Palette command. Mouse the direction by clicking or dragging in the new windoid to the lower right. Note that there are regions of the image between the fibers that appear to be blank, but that upon inspection of the directional gradient image, are seen to have very small fibers. They are just as visible as the larger fibers in this image because the direction of the gradient reflects the direction in changes of image brightness regardless of how large or small they may be. This makes some images look strange, but has the advantage of showing very low contrast detail along with high contrast information all in one image. The direction of gradient operation is especially useful in examining images with high dynamic range that have very dim and very bright areas of interest.

Next (multiple images)