Spectral Fractal Explorer
Spectral Fractal Explorer measures spatial structural complexity in hyperspectral images using box-counting fractal dimension.
Overview
Spectral Fractal Explorer measures spatial structural complexity in hyperspectral images using box-counting fractal dimension.
Unlike conventional spectral analysis, which measures intensity as a function of wavelength, fractal analysis measures how spatial structure changes with scale.
- Binary / edge structure preview
- ROI fractal dimension at one wavelength
- ROI fractal spectrum D(lambda)
- Local spatial fractal-dimension map
Fractal dimension D is a numerical measure of how strongly a spatial structure fills space across different observation scales.
Higher D -> greater structural complexity or space-filling behavior Lower D -> simpler or less spatially complex structure The precise biological or physical interpretation depends on the imaging experiment and the structure being analyzed.
The tool uses a box-counting estimate of fractal dimension.
The binary structure is covered using boxes of different sizes.
For each scale, the number of boxes containing at least one structure pixel is counted.
A log-log relationship is then calculated between:
log(number of occupied boxes)
The slope of the fitted line is reported as the fractal dimension D.
The ROI D calculation also reports R² for the log-log linear fit.
R² describes how closely the box-counting measurements follow the expected linear scale relationship.
Values closer to 1 indicate a stronger linear fit.
IDCubePro displays a warning when R² is below 0.85.
A low R² does not necessarily mean that the image is unusable, but it indicates that the reported fractal dimension should be interpreted cautiously.
Before calculating fractal dimension, the image must be converted to a binary spatial structure.
Three structure-source options are available.
Creates a binary structure from pixels above an intensity threshold.
Available methods include Otsu, percentile thresholds, and adaptive thresholding.
Creates the binary structure from detected image edges.
Canny and Sobel edge detection are available.
This mode is useful when boundaries and structural contours are more important than filled objects.
Uses pixels above the 90th intensity percentile.
This can emphasize bright structures while suppressing lower-intensity background.
Automatically selects an intensity threshold by separating the grayscale histogram into two classes.
Retains pixels above the 75th intensity percentile.
Retains only the brightest 10 percent of normalized image intensities.
Uses spatially varying local thresholds.
Adaptive thresholding can be useful when illumination or background intensity varies across the image.
Detects edges using gradient information and non-maximum suppression.
Detects spatial intensity gradients using the Sobel operator.
Click Preview Structure before calculating fractal dimension.
The right panel displays the exact binary or edge structure that will be used for box counting.
Always inspect this preview.
Fractal analysis describes the structure created by the selected preprocessing method, so a poorly chosen threshold can produce a mathematically valid but scientifically misleading fractal dimension.
Use the wavelength slider to select the spectral band used for Preview Structure, ROI D, and Local Fractal Map.
Because hyperspectral contrast changes with wavelength, the apparent spatial structure and fractal dimension may also change strongly across the spectral range.
Draw an ellipse, rectangle, freehand region, or polygon on the RGB reference image.
The ROI defines the spatial region used for ROI D and Fractal Spectrum calculations.
Choose an ROI large enough to contain meaningful structure across several box sizes.
Very small ROIs can produce unstable fractal estimates.
ROI D calculates the box-counting fractal dimension for the selected ROI at the currently selected wavelength.
The right panel displays the binary ROI structure.
The lower plot displays the box-counting log-log relationship.
- R² of the box-counting fit
Fractal Spectrum calculates D independently at every wavelength.
The result is D(lambda): fractal dimension as a function of wavelength.
This allows spatial structural complexity to be treated as a spectral quantity.
Changes in D(lambda) may reveal wavelengths at which different structural features become emphasized.
A peak or change in fractal dimension at a particular wavelength means that the binary spatial structure becomes more or less complex at that spectral band.
It does not automatically identify the chemical or biological process responsible for that change.
Interpretation should consider the spectral properties of the sample, imaging modality, preprocessing method, and experimental controls.
Local Fractal Map calculates fractal dimension within moving image neighborhoods.
Three window sizes are available:
The calculation samples the image using approximately half-window steps.
Each analyzed neighborhood is assigned its estimated fractal dimension.
Window size controls the spatial scale of local fractal analysis.
Smaller windows provide greater spatial localization but contain fewer structure pixels and fewer useful box-counting scales.
Larger windows provide more stable estimates but reduce spatial resolution.
Medium is a good starting point for many datasets.
There is no universally correct threshold method.
The correct choice depends on what image structure represents the scientific quantity of interest.
If the relevant structure is a filled bright region, intensity thresholding may be appropriate.
If boundaries and contours are important, Edge Structure may be more meaningful.
Always compare the binary preview with the original image.
1. Load the hyperspectral dataset.
2. Open Spectral Fractal Explorer.
3. Select a representative wavelength.
5. Choose a threshold or edge method.
7. Confirm that the binary structure represents the image feature of interest.
11. Adjust the threshold or ROI if the fit is poor.
12. Click Fractal Spectrum to calculate D(lambda).
13. Use Local Fractal Map when spatial heterogeneity is important.
14. Save the results if needed.
Fractal analysis can be sensitive to image noise and thresholding.
Potential preprocessing includes:
- Removal of noisy wavelengths
Strong spatial smoothing should be used cautiously because smoothing can directly change the spatial complexity being measured.
Roi Contains Too Few Binary Pixels
Use a larger ROI, select another wavelength, or choose a less restrictive threshold.
The structure may not follow a consistent scale relationship over the available box sizes. Try a larger ROI or another structure-generation method.
Fractal Spectrum Contains Nan Values
Some wavelengths may not contain enough binary structure inside the ROI for a reliable box-counting estimate.
Local Map Contains Empty Regions
Some local windows may contain too few structure pixels to calculate a fractal dimension.
This reflects the finite local-analysis window and step size. A smaller window gives more spatial detail but may reduce estimate stability.
Results Change Greatly With Threshold
This indicates that the measured fractal dimension strongly depends on how the image structure is defined. Inspect the binary previews and use a scientifically justified thresholding approach.
Important Interpretation Note
Fractal dimension is a mathematical descriptor of spatial structure.
It does not directly identify a tissue type, molecular species, pathology, or material.
The scientific meaning of fractal differences should be supported by spatial context, spectral information, controls, and independent validation.