JuliaDSP / Wavelets.jl

A Julia package for fast discrete wavelet transforms and utilities
Other
184 stars 30 forks source link

Question - DWT 3D Wavelet Coefficients Organization #84

Open ktaswell opened 1 year ago

ktaswell commented 1 year ago

I'm trying to implement a soft thresholding method for 3D data which preserves scaling (or approximation) coefficients at each level, then soft thresholds all others. Unfortunately, I have been having trouble identifying indices which correspond to the scaling coefficients. I was trying to make sense of the detailn() and detailindex() functions and it makes sense to me for 1D condition, but I don't understand how to use these to create an index list for higher dimensions, like the 3D condition that I need.

Also to complicate further, I need to handle both dyadic cube and dyadic non-cube dimensions.

Could someone help me with this?

Thanks

ktaswell commented 1 year ago

After working with it some more, I think I actually may have had it correct the first time around while working on it a couple weeks ago and simply had a "wait did I mess up moment". I'll put my notes here for others to confirm/check:

When not specifying a level to transform to, Wavelets.jl automatically transforms up to maximum level.

If I have the right thinking here, please let me know.

JeffFessler commented 1 year ago

I have a 2D example here that might help: https://juliaimagerecon.github.io/Examples/generated/mri/2-cs-wl-l1-2d/ which uses this code: https://github.com/JeffFessler/MIRT.jl/blob/main/src/regularize/Aodwt.jl I did not know about or use detailn or detailindex. See also #80. Hopefully others can offer more advice...

gummif commented 1 year ago

You should be able to use e.g. the detailrange function to get the range at some level and the scaling range at that level you can compute from the detail range (1 to first of detail - 1). Then it is a matter of computing all possible combination of indexes for all levels.

If you can come up with a good solution to iterate the coefficients in higher dimensions rhat would be a great addition to this package.

ktaswell commented 1 year ago

Hi, Thank you both for your comments, I really appreciate the help.

@JeffFessler, I am just starting my journey into medical image processing so thank you for these links! The breakdown of wavelet levels supported what I was thinking, though I'll need to look more carefully at your code to verify.

@gummif I've been thinking about a few different improvements to Wavelets.jl including this suggestion. Hopefully I will get a chance to work on this soon. If I'm am free to, I'll update this thread with a link to my code.