Skip to content

Fractal dimension

Richard Domander edited this page Apr 12, 2017 · 13 revisions

This plugin estimates the fractal dimension of the outline of a binary image by applying a box-counting algorithm. The outline of the image is created by copying all the elements, which have at least one background neighbour (a neighbourhood in 2D is 8-connected and 3D 26-connected).

In the counting algorithm box grids of diminishing size are scanned over the image, and the number of boxes containing foreground is counted at each step. As the box size decreases and the grid becomes finer, the proportion of foreground boxes increases in a fractal structure. There's also an option to move the grid of boxes to find the best fitting one. The best fitting grid covers the objects in the image with least amount of boxes.

The box counting algorithm a set of (log(n), -log(m)) points, where n = number of boxes with foreground, and m = box size. The points are then passed into a curve-fitting algorithm, which returns the slope of the linear function which describes them (regression fit). The slope is the fractal dimension.

Fractal dimension

  • Menu path: Plugins>BoneJ>Fractal dimension
  • Input paremeters
    • ImgPlus inputImage
  • Output parameters
    • none
  • Calls
    • Outline in net.imagej.ops.morphology.outline
    • BoxCount in net.imagej.ops.morphology.net.imagej.ops.topology
Setup dialog
  • Input parameters
    • long startBoxSize
      • Label: Starting box size (px)
      • Tool tip: The size of the sampling box in pixels in the first iteration
      • Widget: Spin box, min: 1, step: 1
      • Callback to check that smallestBoxSize <= startBoxSize
    • long smallestBoxSize
      • Label: Smallest box size (px)
      • Tool tip: Sampling box size in pixels where algorithm stops
      • Widget: Spin box, min: 1, step: 1
      • Callback to check that smallestBoxSize <= startBoxSize
    • double scaleFactor
      • Label: Box scaling factor
      • Tool tip: The scale down factor of the box size after each step
      • Widget: Spin box, min: 1.001, step: 0.01
    • int translations
      • Label: Grid translations
      • Tool tip: How many times box grid is moved to find the best fit
      • Widget: Slider, min: 0, step: 1
    • boolean autoParameters
      • Label: Automatic parameters
      • Tool tip: Let the computer decide box sizes and scaling
      • Callback to set startBoxSize, smallestBoxSize and scaleFactor to automatic values
      • If true, box sizes and scale factor are set to predetermined values based on image size.
      • persist: false - there's no way the enforce automatic values on the saved parameters. This is because parameter initializers happen too early: the saved parameter values are loaded after them. Validaters happen too late: after the dialogue has been closed. Thus we make the user click the checkbox, which activates a callback that sets the parameters to the autovalues in the dialogue.
  • Output parameters
    • none
  • Other
    • Help
      • Tooltip: Open help web page
      • Widget: Button
Messages
  • If there's no image open
    • Show an error dialog
    • Abort the run
  • If the input image is not binary
    • Show an error dialog
    • Abort the run
Results
  • Prints the fractal dimension in the results table
    • Each channel / frame of a hyperstack is reported separately
Differences from BoneJ1
  • Option to set box sizes and scaling
  • Option to find the best fitting grid
  • Supports any n-dimensional image (hyperspace - e.g. channels and frames - processed as 3D sub-spaces)
  • If your image has an inverted LUT, flip it back to normal. Otherwise foreground is interpreted as background!

Outline Op

  • Location: net.imagej.ops.morphology.outline
  • "Hollows" all the objects in an image. Only those elements that have at least one background neighbour are copied to the output
  • The image can have any number of dimensions
  • A BinaryHybridCF op
  • Input
    • RandomAccessibleInterval<B> input
      • <B> is a generic type <B extends BooleanType<B>> (see BooleanType)
    • Boolean excludeEdges
      • Controls whether elements (with no background neighbours) on stack edges are considered kept or not
  • Outputs
    • RandomAccessibleInterval<BitType> output
      • The outlines of the objects in the input
      • See BitType

BoxCount Op

  • Location net.imagej.ops.morphology.net.imagej.ops.topology
  • Applies the box counting algorithm on the given image (see intro)
  • The image can have any number of dimensions
  • A UnaryFunctionOp
  • Inputs
  • Other optional input @Parameters
    • Long minSize
      • minimum size of the obxes in pixels before counting is stopped
    • Long maxSize
      • starting size of the boxes in pixels
    • Double scalingFactor
      • the constant used to scale the interval after each iteration
    • Long gridMoves
      • number of times box grids are moved to find the best fit
  • Output
    • List<ValuePair<DoubleType, DoubleType>> points
      • A list of (log(n), -log(m)) value pairs, where n = number of intervals with foreground, and m = intervals size
  • Returns a DoubleType ValuePair instead of Double since the former is mutable, and can thus be chained with other ops

Future

  • User documentation
  • Usage reporting
  • Plotting graphs from results
  • Show log(n) / log(m) as CSV text
Clone this wiki locally