# AbstractMultiscaleTransforms.jl: Contourlets.jl, Surfacelets.jl, Shearlets.jl

**URL:** <https://discourse.julialang.org/t/abstractmultiscaletransforms-jl-contourlets-jl-surfacelets-jl-shearlets-jl/143138>\
**Category:** Package Announcements\
**Tags:** question, package\
**Created:** [November 23, 2026, 10:21pm UTC](https://discourse.julialang.org/t/abstractmultiscaletransforms-jl-contourlets-jl-surfacelets-jl-shearlets-jl/143138 "2026-11-23T22:21:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hakkelt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hakkelt/32/221659_2.png) [@hakkelt](https://discourse.julialang.org/u/hakkelt)\
**Post date:** [November 23, 2026, 10:21pm UTC](https://discourse.julialang.org/t/abstractmultiscaletransforms-jl-contourlets-jl-surfacelets-jl-shearlets-jl/143138/1 "2026-11-23T22:21:53Z")

</div>

I wanted to experiment with directional multiscale transforms, so I created my own implementations. I haven’t released them yet (except for Contourlets.jl) because I wanted to ask for some opinions on AbstractMultiscaleTransforms. The goal of this package is to have a unified interface for all multiscale transforms, potentially beyond the three mentioned ones (e.g. Wavelets.jl).

# The Proposed Interface

```julia
x = randn(256, 256)
t = BandlimitedShearlets(scales = 3) # transform: parameters only
c = analyze(t, x) # coefficients: an AbstractArray
b = subband(t, c, 2) # view of subband 2 (subband 1 is the lowpass)
synthesize(t, c) ≈ x # true

ws = make_workspace(t, x) # precomputed plans/buffers for this size and eltype
analyze!(c, ws, x) # repeated calls allocate little or nothing

```

### Defined Types

- Transform (`<: AbstractMultiscaleTransform`): an immutable value that holds every parameter (scales, directions, filters) and nothing that depends on the data’s size or element type. One transform therefore works for any admissible size. Transforms with equal parameters return “true” for `==`.

- Workspace (`<: AbstractTransformWorkspace`, produced by `make_workspace(t, x)` or `make_workspace(t, T, dims)`): holds FFT plans, filter responses and scratch buffers for one size, element type and array type (CPU or GPU).

- Coefficients: always an AbstractArray, so generic code can broadcast over them and call `norm`, `dot`, `axpy!` and so on. They come in three layouts:

### The functions

- `analyze(t, x), analyze!(c, t, x)`: forward transform
- `synthesize(t, c), synthesize!(x, t, c)`: inverse transform
- `make_workspace`: create a workspace
- `transform(ws)`: “extracts” the transform object from a workspace
- `similar_coefficients(t, x)`: allocates uninitialized storage for the output of `analyze!`
- `subband`, `nsubbands`, `subband_layout`: helpers for subband access
- `analyze(f, t, x)`, `synthesize!(f, x, t)`: optional streaming: f(i, band) is called per subband instead of storing all coefficients

### Conventions

- synthesize inverts analyze. It is the adjoint only for Parseval frames, and each package documents which of its transforms are Parseval frames.
- Complex data is transformed as its real and imaginary parts, so analyze(t, x + im \* y) ≈ analyze(t, x) + im \* analyze(t, y).
- `analyze`, `synthesize` (and their in-place variants) accept `threaded = nothing | true | false`.
- Invalid input throws `DimensionMismatch` or `ArgumentError` before any work is done.

The proposed API can be studied in more detail on GitHub: [GitHub - hakkelt/AbstractMultiscaleTransforms.jl: Abstract interface for multiscale transforms in Julia · GitHub](https://github.com/hakkelt/AbstractMultiscaleTransforms.jl)

# My Questions

- What other transforms might fit under this API? What would be a suitable scope?
- Is this a good name (that’s a thing I cannot change after registration, so that question always makes me nervous about whether I’ll regret the choice later…)?
- Are there any suggestions to improve the proposed API or to broaden its scope? I’m still not fully convinced whether “analyze/synthesize” and “workspace” are the best choices. Also I considered `ArrayPartition` from RecursiveArrayTools.jl, but it might not be worth adding a heavy dependency.

# Notes

- I just realized, while writing this post, that there was a previous package for Shearlets ([Shearlab.jl](https://github.com/arsenal9971/Shearlab.jl)), but it’s an unmaintained old package for Julia before 1.0.
- To be honest, I have only a user-level understanding of the theory behind these transforms, so I needed to trust my AI agent to implement it faithfully. So help would be really welcome to verify correctness. What I could do was:
  - ensure the code quality,
  - do some comparisons of the output of my packages against the output of the original MATLAB toolboxes (but didn’t allow agents to read their source, because most are GPL-licensed or have no license), and
  - check whether the generated images look similar to those in the papers… 😃

- Here are my packages that implement the proposed interface:
  - [GitHub - hakkelt/Contourlets.jl: Discrete and nonsubsampled contourlet transform in Julia with GPU support · GitHub](https://github.com/hakkelt/Contourlets.jl)
  - [GitHub - hakkelt/Surfacelets.jl: The surfacelet transform in Julia: multiscale, multidirectional transform for volumes, with GPU support · GitHub](https://github.com/hakkelt/Surfacelets.jl)
  - [GitHub - hakkelt/Shearlets.jl: Translation-invariant discrete shearlet transforms of images and volumes in Julia, with GPU support · GitHub](https://github.com/hakkelt/Shearlets.jl)

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [November 24, 2026, 1:09am UTC](https://discourse.julialang.org/t/abstractmultiscaletransforms-jl-contourlets-jl-surfacelets-jl-shearlets-jl/143138/2 "2026-11-24T01:09:39Z")

</div>

Nice. I will try to find some time to take a look.
