IMAGE TYPE


Options for How to Assess Pixels


IMAGE TYPE OPTIONS

The IMAGE TYPE Panel

This panel is for setting the Image Type, which means deciding what rules FracLac should use when assessing pixels. To use it:

  1. From the top drop-down menu on the IMAGE TYPE panel, select whether images should be analyzed as either binary or grayscale. Note that the selection made here does not necessarily have to be the same as the actual image type. See General Discussion.

    - Click to read about how to Select Either Binary or Grayscale.

  2. Then, if one of the 2 binary options was selected, another drop-down menu (that says Set Scan Background) will be present underneath the first. Select a choice from that second menu to set which should be the pixels of interest. If the top option was a grayscale option, the bottom menu is not activated and disappears.

    - Click to read about how to Select the Background for Binary Images Only
  3. Select "Stack as Montage" to analyze time series (waves) stored as stacks.

Notes on the Image Type Options

Both binary and grayscale Image Types can be scanned on screen, in batch jobs, and with ImageJ's ROI Manager.

Image Type affects how a pattern is measured and which options appear on the panel.

For images being scanned on screen, Image Type can be changed for each image or ROI, but the same type will be applied to all slices if the image is a stack. For Batch Jobs, the same set of options is applied to all images and all of their slices in the job.

For binary images, inverting LUTs should be converted to non-inverting LUTs prior to processing.

Note that options higher up in the dialog often affect those lower down. The IMAGE TYPE panel, at the top of the setup dialog, is the starting point for setting up all scan types.




Select Either Binary or Grayscale Scans

Binary or Grayscale - top dropdown for Image Type

Select an option from this dropdown on the IMAGE TYPE panel to analyze images as binary or grayscale.

To learn how to use the top dropdown, click on the links below explaining its choices, or click on the options in the dropdown itself:

For binary images, inverting LUTs should be converted to non-inverting LUTs prior to processing. See info on extracting patterns from digital images.




Choice 1 in Binary or Grayscale Drop-down Menu

Use Binary - black and white images only

Select this choice from the Binary or Grayscale dropdown on the IMAGE TYPE panel to tell the program to analyze only black and white images. Then, FracLac assesses one colour as meaningful foreground pattern and the other as empty background, noise, etc. Which colour it considers foreground and which background depends on the option for background colour.

Select Use Binary for finding fractal dimensions with all scan types and for finding the convex hull and bounding circle.

Scanning is aborted if this option is selected and images that are not binary are loaded. This ensures and requires that the results of a scan correspond to the actual input. (See autoconvert for an alternative option.)


Typically, binary images suitable for fractal analysis include branching patterns, silhouettes, contours, outlines, skeletons, etc.


Choice 2 in Binary or Grayscale Drop-down Menu

Autoconvert to Binary - automatically threshold to black and white

If this option is selected from the Binary or Grayscale dropdown on the IMAGE TYPE panel, then while scanning, the program converts colour or grayscale images to binary using ImageJ's built-in thresholding.

Scanning is not interrupted if this option is selected when images that are not binary are loaded.

Auto-converting produces a consistent result, but there is a drawback. The thresholded image may not necessarily be the pattern expected. Thus, this method is typically used in two situations. One is when the images being analyzed are already at a stage where auto-thresholding extracts the desired pattern. The second is during preliminary stages of analysis, in which case it is usually eventually replaced by more specific preprocessing to extract patterns from original images. To see if the pattern extracted by auto-converting is as expected, select an option to show a graphics file.


After converting an image to binary, this setting works the same as Use Binary.


Choices 3-5 in Binary or Grayscale Drop-down Menu

GRAYSCALE OPTIONS - select one of 3

Select one of the 3 grayscale options from the Binary or Grayscale dropdown on the IMAGE TYPE panel, to scan all images without converting to binary, using a different scan algorithm than is used for binary.

Scanning is not aborted if a grayscale option is selected when images that are not grayscale are loaded. Instead, all images are converted to gray then RGB. This means all images including binary images will be assessed as grayscale if loaded in a grayscale analysis.

Images are converted to RGB so FracLac may add a filler colour to distinguish areas excluded by ROIs. The filler colour is a non-gray value ignored by the scanner. Click here to learn about this important feature of scanning grayscale images.

Selecting one of the grayscale options disables the convex hull and bounding circle options.

This option is not available for some scans such as Particle Analyzer and Local Connected Fractal Dimension.




Differential Methods for Scanning Grayscale Images

All 3 grayscale scanning options are based on the Differential Method.


Overview of how different fractal dimensions relate to Image Type


Select the Background for Binary Images Only

Set Scan Background - Dropdown

Select an option from the second dropdown on the IMAGE TYPE panel for the 2 binary scan options above.

This sets the background (along with the foreground). Typically, the colour to choose for background or empty is whichever is more prevalent of White or Black in an image. It follows that the colour to be considered foreground will be the other, less prevalent, of the two colours, although the only setting to select is for background. In addition to prevalence, there are other considerations to make, however, when setting this option. Scroll down or, if they are showing, click on the options on the panel to read more.

NB: This option is disabled if a grayscale method is selected from the dropdown for Binary or Grayscale. This is because grayscale analysis assesses the intensity of all pixels instead of only the presence of foreground pixels. To bring the dropdown back up, select a binary option from the top dropdown.




Let the Program Choose - set background automatically for binary images

Choose this option from the second dropdown on the IMAGE TYPE panel to have the program decide which pixels are meaningful and which are not, based on the ratio of white to black pixels. The more prevalent will be used as the background, and the less prevalent will be read as the pattern.

This method is often appropriate, but it may not be appropriate in some cases. One such case arises when the ratio of meaningful to empty pixels is reversed, so the pixels of interest are the more prevalent.

This may be doubly relevant when the ratio of white to black changes from one image or ROI to the next over a series of ROIs or images being compared despite that the actual background does not change. In this case, for every image in the series where this happens to be true, the program would change the background choice if Let the Program Choose is selected.

To avoid this and ensure consistency, lock the background by selecting one of the alternative choices from the dropdown. See the image below for an illustration of ambiguous background.




Comparison of Definite and Ambiguous Foreground

<html>Images having definite foreground/background 
                 <br/>and images with ambiguous foreground/background.

The figure shows the difference between images having very well defined foreground and background and images with ambiguous foreground and background. For images with ambiguous features, it is generally recommended to lock the background to ensure similar images are processed using the same rules.




Lock Black Background

Select this option from the second dropdown on the IMAGE TYPE panel to lock the background when you do not want the program to automatically choose based on which colour is more prevalent or to ensure consistency over several files as in a batch job.

Select this option to lock in the settings for using a black background so FracLac assesses all images or ROIs in a scan or batch by reading white pixels only. See picture of background issues for more on this option.




Lock White Background

Select this option from the second dropdown on the IMAGE TYPE panel to lock the background when you do not want the program to automatically choose based on which colour is more prevalent or to ensure consistency over several files as in a batch job.

Select this option to lock in the settings for using a white background so FracLac assesses all images or ROIs in a scan or batch reading black pixels only. See picture of background issues for more on this option.




Stack as Montage

Checkbox for Stack as Montage

Select this option on the IMAGE TYPE panel to analyze a stack as a continuous image.

This option is for binary stack images, typically wave data or time series that are too long to be processed as a continuous image. Examples include heart rate data, metabolite concentration, audio files, etc. To convert data to a wave image, use the Wave button on the main FracLac panel.

The entire stack is processed using ONE set of sampling sizes based on the first slice. In some cases, you may want to either use a custom set or indicate the number of sizes and specify the minimum and maximum sizes in pixels rather than percentages.





Image Type and Fractal Dimension



Background and Foreground


Binary images typically analyzed include outlines, contours, silhouettes, skeletonizations, and other patterns extracted to black and white images. The diffusion limited aggregate shown here illustrates such a pattern with a box counting grid drawn over it. To be "binary", an image's pixels must have only 2 possible values, "on" and "off", but to do a binary image scan here means to analyze only black and white pixels (i.e., digital images having no other pixel values than 0 and 255).

Black and White Binary vs Purple and Blue Binary

To analyze the blue binary image here one would have to use the AUTOCONVERT option or else process the image prior to scanning (e.g., using ImageJ's threshold function).


http://imagej.nih.gov/ij/docs/concepts.html


Foreground


As was noted with respect to setting the background, the choice of which pixel value to consider foreground and which background for binary scans is arbitrary. One colour is always deemed foreground, meaningful, or of interest, and all other are considered background or non-meaningful or noise. Choose the value that reflects the part of the pattern you are interested in and that was extracted from the original image.


See more on setting the foreground.


There are some caveats to understanding what is meant by the "meaning" of a pixel. For instance, succolarity is of interest in fractal analysis, and you can find data for analyzing the empties in the FracLac results file. Furthermore, in binary local connected fractal dimension scans, the pixels of interest are determined using the foreground choice plus criteria for the connected set.


Pixels and Binary Fractal Dimensions


What Image Type Means for Fractal Analysis

The Image Type (binary or grayscale) selected from the IMAGE TYPE panel affects how fractal dimensions are calculated. To summarize more extensive discussion, a box counting fractal dimension () is a scaling rule inferred from the relationship between the number of parts (N) counted in some pattern and the relative size (f) of the measuring thing used to count them.

For instance, if we measured a line using a ruler the same length as the line then measured it again using a ruler 1/3 that length, f would be 1/3 since we multiplied the original pattern's size by 1/3 to get the measuring device's size.

The general equation of a dimensional scaling rule is

N = f (-D)

We solve for D using logs:

-D = log N / log f.


Box Counting for Binary Images


In box counting on binary images, the measuring tool referred to above is a set of grids of decreasing calibre, where ε, the calibre, is based on f. The software lays the grids over a pattern to cut it into parts or boxes of size ε, then counts to find N, the number of boxes in any one grid that had any foreground pixels in them. This is done for every ε, to get a set of N(ε). For the binary image of a diffusion limited aggregate shown here, a set of three counts is illustrated.

3 Box Counts for a Binary Image of a Diffusion Limited Aggregate
ε (size) Nε (count)
22 24
14 48
image 11 84



After gathering the data, as per the equations above, the program infers the as the slope of the log-log relationship for N and ε. Since the data are approximate, the slope is approximated using regression analysis.

Calculating the Dʙ from the Log-Log Regression Line

The Dʙ is approximated from the count as the slope of the regression line from the plot of log N vs log ε. For the data shown above, the Dʙ is approximately 1.7.


Mass and Lacunarity


Box counting also yields data for finding a mass-related box-counting dimension, Dʍ. In this case, the data recorded are the numbers of pixels in each box. The Dʍ depends on this pixel mass or pixels per box similarly to how the DB depends on the count of boxes that had any pixels. It relates N to the contents of each box at a particular box size, using measures such as the sum or average foreground pixels for a particular ε instead of the count of boxes containing any pixels at a size. The mass is also used for calculating lacunarity (a measure of gappiness or heterogeneity or rotational invariance in a pattern), and in multifractal analysis.




Box Counting and Background for Grayscale Images


In contrast to binary scans, in grayscale scans, every pixel is meaningful, and there is no "background" pixel value. This important difference defines the sorts of analysis grayscale images are generally better suited for (e.g., texture analysis).

If we think in terms other than binary, then "background" is relevant to grayscale scans. One can remove irrelevant portions or enhance contrast to investigate patterns in grayscale images. Prior to scanning, one can smooth the background, for instance, using ImageJ's background subtraction function. This is part of image preparation.


Using ROIs in Grayscale Scans

Although there is no single "background" pixel colour in a grayscale image, FracLac can be told to ignore parts of a grayscale image. FracLac uses a green colour to fill areas that are not meant to be scanned. One might expect white and black to be more logical background choices but because they are valid grayscale pixel values, white and black pixels are counted in grayscale scans. The filler colour is not; FracLac ignores pixels of that colour colour during analysis, making it possible to select regions of interest (ROIs) for grayscale scans.

Separating ROIs in Grayscale Images

<html>A complex ROI illustrating 
                       green filler for grayscale scans.

This image shows a graphic returned from a scan in FracLac. The scan was done by setting an ROI on the original image open in ImageJ, and scanning in FracLac with the option selected to generate a colour graphic using the draw mode.


Grayscale Fractal Dimensions


The grayscale and binary box counting data gathering methods are the same, but the measuring mechanisms are not. Grayscale images are presumed to exist in a pseudo-3d space, where a pixel is not always either on or off but somewhere along a scale from 0 (black) to 255 (white). This provides a way to measure texture if we think in 3d and let the gray value (intensity) be a proxy for volume.

Visualize this by picturing the screen as a 2d grid with i rows and j columns, and each pixel at i,j rising up in 3d as a little prism, or mountain, or spheroid, or mushroom cloud, or whatever you would like to use for your landscape, to the relative height defined by the intensity.




Intensity Differences - (ɪ)


The methods by which FracLac turns these volumescapes into fractal dimensions are called Differential Box Counting Methods. They depend on something we will call ɪ, for not the actual intensity at a single pixel but the difference in pixel intensity over an area.

In particular, ɪ = (max − min) for all pixel intensities within some space sampled on an image. By "some space" we mean the area covered by a box or oval in box counting.

There is some history in the fractal analysis literature behind using this range, ɪ, but it is, nonetheless, arbitrary. In any sample of grayscale pixels, we could look, for instance, at the average, maximum, or distribution of intensity, but FracLac looks at ɪ, the difference or range in intensity over all pixels in a box at a box size.

To picture ɪ, revisualize the grayscale volumescape we explored earlier, examining the image using, instead of individual pixels, boxes. Using boxes, you see one pillar or mushroom cloud rising not from each pixel, but from each box; change your scale of enquiry, your grid calibre, and you get, for each identically sized box in your new grid, a new shape rising up from the base of each box.

Keep changing the grid calibre, and you keep getting one shape rising from every box, but the volume is changing. If you look at it with boxes the size of the image, you see but one large pillar or whatever shape you chose.




Types of Fractal Dimension Reported for Grayscale Images


Similar to the results for binary scans, FracLac reports 3 basic types of fractal dimension for grayscale scans, based on the sum of ɪ and the mean of ɪ, and one based on a single average cover from multiple grids:

These are based on ɪ instead of N. The equation below shows how FracLac counts and measures the shape rising from a box, for some ɪ at a box size ε and location (i,j):

(Eq. 0)    δɪ(i,j,ε) =
Maximum Intensity(i,j,ε) − Minimum Intensity(i,j,ε)
(Eq. 1)    ɪ(i,j,ε) = δɪ(i,j,ε)
(Eq. 2)    ɪ(i,j,ε) = 1 + δɪ(i,j,ε)

You may have noticed the transformation in Eq. 2, where we add 1 to the actual range. To get ahead of ourselves for a moment, this prevents there from being values of 0 in later calculations, which would crash our computers when we try to take logs. You can understand why this is ok if you realize that in the first place we are inferring something about geometry from pixel intensity rather than directly measuring it.




Gray Fractal Dimension Types


As is the case with binary images, FracLac infers a scaling rule for a pattern, i.e., a Dgray, by taking many measurements over many box sizes and approximating the log-log relationship from the slope of the regression line for the data. FracLac gathers for ɪ(ε) the sum and the mean over all samples at each ε, and determines 3 different types of fractal dimension.

The summary files that appear after every scan list beside each fractal dimension reported the type and the method used to calculate it. Note that the equation for finding ɪ(i,j,ε) depends on the user's option.


User Options for Grayscale Scans


There are 3 options for a grayscale analysis in the dropdown at the top of the IMAGE TYPE panel.


Option 1: Differential

If the grayscale option in the dropdown at the top of the IMAGE TYPE panel is set to "Differential", then FracLac uses a method that is very similar to mass box counting. It approximates the slope of the log-log relationship between box size and ɪ based on Eq. 2, and infers DBgray and DMgray from the regression line, as shown below:

ɪ(ε) = ∑ [1 + δɪi,j,ε]
DBgray = limε→0 ln (ɪ(ε)) / ln (1/ε)
= slope of the regression line.

ɪε = ɪ(ε) /N(ε)
DMgray = limε→0 ln (ɪ (ε)) / ln (1/ε)
= slope of the regression line.
N(ε) = number of samples (e.g., boxes) at a size




Option 2: Differential Volume Variation

If the grayscale option in the dropdown at the top of the IMAGE TYPE panel is set to "Diff Volume Variation", a 2d variation of Option 1 is used. This explicitly defines 3d volumes, V(i,j,ε), over a grayscale image. Basically, we imagine there is a 3d space for each pixel or box, for which V(i,j,ε) will depend on the size and shape of the box and the range in intensity. FracLac approximates a volume from the area of the box × ɪ:

V(i,j,ε) ∝ ɪ(i,j,ε) ε²

If the user has elected to use an oval sampling unit, FracLac calculates the base of this cylinder as a circle (e.g., area = πr×r, where r = ε / 2).

From this estimate of volume, FracLac calculates the log-log slope of V(ε)against ε, then uses a method based on the semi-variogram method ( Mark and Aronson; Mandelbrot; Sarkur and Charduri), to calculate the fractal dimension. Basically, the method assumes that the slope is equivalent to twice something called the Hausdorff-Besicovitch dimension, and that D can be calculated as below:

V(ε) = ∑ɪ(i,j,ε) ε²
S = limε→0 (ln V(ε) / ln 1/ε)
= slope of the regression line
DBgray = 3 - (S/2)




Option 3: Differential Volume Variation Plus 1

If the grayscale option in the dropdown at the top of the IMAGE TYPE panel is set to "Diff Volume Plus 1", then the method is nearly identical to Option 2. The only difference is that it uses Eq. 2 instead of Eq. 1 to calculate ɪ, as shown below:

V(i,j,ε) ∝ (1 + δɪ(i,j,ε)) ε²
V(ε) = ∑ (1 + δɪ(i,j,ε)) ε²
S = limε→0 (ln V(ε) / ln 1/ε)
= slope of the regression line
DBgray = 3 - (S/2)




HOME