Application Scenarios
- Texture Analysis: Quantify multi-scale properties of image textures
- Medical Imaging: Analyze tissue structure heterogeneity
- Materials Science: Study multifractal features of material surfaces
- Financial Analysis: Analyze multifractal properties of price fluctuations
- Earth Sciences: Study multi-scale features of terrain and landforms
Usage Examples
Basic Usage
GPU Accelerated Version
Local Alpha Map (per-pixel Hölder exponent)
Batch Processing
Class Description
CFAImageMFS
Box-counting multifractal analysis on a 2D grayscale image. Uses fixed square ROI (Scheme A) for consistent ε normalization across scales.
Initialization Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
image | numpy.ndarray | Required | Input 2D grayscale image |
corp_type | int | -1 | Crop type (-1:crop, 0:strict, 1:pad) |
q_list | array-like | linspace(-5,5,51) | q moment values |
with_progress | bool | True | Show progress bar |
bg_threshold | float | 0.01 | Background threshold (post-normalization) |
bg_reverse | bool | False | Zero pixels above threshold instead |
bg_otsu | bool | False | Apply Otsu thresholding before normalization |
mu_floor | float | 1e-12 | API compatibility only; not used |
get_mass_table(max_size, max_scales=80, min_box=2, roi_mode="center")
Compute per-scale partition function table. Returns DataFrame with columns scale, eps, q, value, kind.
kind='logMq': log∑μᵢ^q for q≠0,1kind='N': non-zero box count for q=0kind='S': Shannon entropy −∑μᵢ log μᵢ for q=1
fit_tau_and_D1(df_mass, min_points=6, ...)
Fit τ(q) and D(q) via linear regression. Key options: use_middle_scales, fit_scale_frac, if_auto_line_fit, cap_d0_at_2. Returns DataFrame with q, tau, Dq, D1, intercept, r_value, p_value, std_err, n_points.
alpha_falpha_from_tau(df_fit, spline_k=3, exclude_q1=True, spline_s=0)
Compute α(q) and f(α) via spline derivative of τ(q) (Legendre transform). Returns DataFrame with q, tau, Dq, alpha, f_alpha.
get_mfs(max_size, max_scales=80, min_points=6, ...)
Full pipeline: get_mass_table → fit_tau_and_D1 → alpha_falpha_from_tau. Returns (df_mass, df_fit, df_spec).
compute_alpha_map(scales=None, roi_mode="center", empty_policy="nan")
Per-pixel Hölder exponent via streaming OLS with nested-grid optimization. Returns (alpha_map, info).
compute_alpha_map_batch(images, ...) [static]
Batch version using nested-grid streaming OLS — low memory, no full mu_stack materialization.
plot(df_mass, df_fit, df_spec)
2×3 subplots: log M(q,ε) heatmap, f(α) vs α, τ(q), D(q), α(q), f(α) vs q.
plot_alpha_map(alpha_map) [static]
Visualize local α-map using jet colormap.
get_batch_mfs(img_list, ...) [static]
Batch CPU MFS; API-compatible with CFAImageMFSGPU.get_batch_mfs. Returns list of (df_mass, df_fit, df_spec).
Theoretical Background
Core Computation
Special Dimensions
- D(0): Capacity (box-counting) dimension
- D(1): Information dimension
- D(2): Correlation dimension
Important Notes
- Preprocessing: Image auto-normalized to [0,1]; use
bg_thresholdorbg_otsu=Truefor background removal - q Range: Negative q → sparse regions; positive q → dense regions; recommend −5 to 5
- Results: Wider f(α) curve → stronger multifractality; Δα = α_max − α_min quantifies heterogeneity
- Performance: Use
CFAImageMFSGPUfor 5–20× speedup
References
- Chhabra, A., & Jensen, R. V. (1989). Physical Review Letters.
- Evertsz, C. J., & Mandelbrot, B. B. (1992). Chaos and Fractals.