< 

 Lazy LUTs 

 > 


 

SEM image of granitoid (BSE contrast) with histogram showing peaks for mineral phases

 

 

INTRODUCTION

The Lazy LUTs macros are intended to provide a quick introduction to the concept of look-up tables. At the same time, because they are very simple and easily edited, the serve as an introduction to Image SXM macro programming.


 

 

   

 

GETTING STARTED

Load Lazy LUTs macro.

The macros are grouped as follows:

  • import/export LUTs as text or line plot
  • reset LUT to grayscale
  • LUTs as algebraic functions
  • significant bit removing
  • color representation of color channels
  • segmentation by grey value

 

 


System LUT

 


Plot of System LUT

 


System LUT text file

 

 

IMPORTING EXPORTING PLOTTING

Look-up tables (LUT) can be loaded from the Options menu of Image SXM.

They can be saved as a plot [P] or text file [E] or they can be exported as a so-called Palette. Palettes are LUTs that can be loaded like any other Image SXM LUT.

LUTs can also be imported from a text file [I] - the text file has to be 256 lines long and contain 3 columns of integers (1-254); a fourth column (index) is optional.
 


 


Inverted LUT

 


[X] → image with inverted LUT

 

Presentation of LUT functions in Map window

 

LUT FUNCTIONS

An example of a very simple function is given here:

macro 'invert LUT [X]';

var

 i:integer;

begin

 for i:=0 to 255 do begin

  RedLUT[i]:=255-RedLut[i];

  GreenLUT[i]:=255-GreenLut[i];

  BlueLUT[i]:=255-BlueLut[i];

 end;

 UpdateLUT;

end;
 


 


[T] → 3 least significant bits removed → 8 steps


[S] → 4 most significant bits removed → 16 ramps

 

 

SIGNIFICANT BIT REMOVAL

Using 1 byte = 8 bit to encode grey values yields 256 different values. If 1 bit is removed, i.e., if only 7 are used, only 128 GV are possible, etc. Bits can be removed from either end of the byte: removing the least significant bit yields 2, 4, 8, 16 etc. steps; removing the most signifcant bit yields 2, 4, 8, 16 etc. ramps.
 


 


color image

 


[R] → R channel


L channel (= copy of slice of stack).

 


[G] → G channel


[1] → a channel

 


[B] → B channel


[2] → b channel

 

 

 

COLOR CHANNELS

This set of LUT macros serves to render color channels in the appropriate color.

NOTE:

Image SXM does open color images - they are converted to an R-G-B stack and an index image is displayed - with the System LUT loaded - to give a color impression. If the image is RGB, the slices of the stack contain the corresponding channels Red, Green and Blue. If the image is Lab, the slices contain L(brightness), a(red-gren), b(yellow-blue).

In the case of an Lab image, the rendition of the color channels in color is approximate.

Note also, that the index image (System LUT), which gives a color impression if the image is RGB, makes no sense for Lab images.
 


 

SEM image of granitoid (BSE contrast) with histogram showing peaks for mineral phases

[5] → Segmented image with histogram showing colors of mineral phases

 

 

SEGMENTATION

Look-up tables correspond to point operations. LUTs can therefore be used to segment images by combining ranges of gray value (grey level slicing) Once the LUT is applied, the image is effectively segmented.

NOTE:

Here, the histogram of grey values is used to determine the limits of the grey level slices.