-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Maximul level transform for Wavelet operator in non 2^n matrix #12
Comments
I have a working example to use the maximum level transform along each dimension. (I think it is what Bart does) using ImageUtils
using Wavelets
using Plots
ph = shepp_logan(128)
heatmap(ph)
W_ph = dwt(ph,wavelet(WT.db2))
heatmap(abs.(W_ph),clim=(0,1))
## perform Wavelet on rectangular matrix with different maximum deph level
ph2 = ph[:,1:80]
sph2 = size(ph2)
MaxL = Int[]
for (i,val) in enumerate(sph2)
push!(MaxL,maxtransformlevels(val))
end
display(MaxL)
# when using dwt only max level transform is used -> 4
W_ph = dwt(ph2,wavelet(WT.db2))
heatmap(abs.(W_ph),clim=(0,1))
# we can perform dwt along one axis for max transform = 7
res = zeros(Float64,sph2)
for i in 1:sph2[1]
res[i,:] = dwt(ph2[i,:],wavelet(WT.db2))
end
# and then the second axis for maxtransform = 4
for j in 1:sph2[2]
res[:,j] = dwt(res[:,j],wavelet(WT.db2))
end
heatmap(res)
## get back the original image
im = zeros(Float64,sph2)
for j in 1:sph2[2]
im[:,j] = idwt(res[:,j],wavelet(WT.db2))
end
for i in 1:sph2[1]
im[i,:] = idwt(im[i,:],wavelet(WT.db2))
end
heatmap(im) |
Interesting. Ideally that would be implemented in Wavelets.jl. But I would be pragmatic here and would support that we first use you implementation in SparsityOperators.jl. Would be good, however, if this could be implemented using the inlace variant |
I'll share the example in an issue for wavelets.jl and see if I can put
that directly into it.
Le mer. 26 oct. 2022 à 23:55, Tobias Knopp ***@***.***> a
écrit :
… Interesting. Ideally that would be implemented in Wavelets.jl. But I would
be pragmatic here and would support that we first use you implementation in
SparsityOperators.jl. Would be good, however, if this could be implemented
using the inlace variant dwt!. Not sure if that works though.
—
Reply to this email directly, view it on GitHub
<#12 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AC5P7O3OZLBYIYSSZVUVQTLWFGSGHANCNFSM5WATKCBQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
something like that ? ph3 = copy(ph2)
tmp = similar(ph3)
#tmp2 = similar(ph3)
@views for i in 1:sph2[1]
dwt!(tmp[i,:], ph3[i,:],wavelet(WT.db2))
end
heatmap(y)
# and then the second axis for maxtransform = 4
@views for j in 1:sph2[2]
dwt!(ph3[:,j],tmp[:,j],wavelet(WT.db2))
end
heatmap(ph3) I can't do |
The choice of implementation seems more complex than I thought and maybe we should stick to a spectific mri implementation (see : JuliaDSP/Wavelets.jl#80) and bring the discussion back to MRIReco because it will be linked to the specificity of FISTA / ADMM at some point. |
I don't know. Ideally we get the desired feature into Wavelets.jl but this certainly will be a longer process. That there are different possibilities just means that it needs to be configurable. In the mean time you can prototype it within |
We add a discussion with @JeffFessler about the possibility to zero-pad the data before Wavelet transform and he thought it might be a good option for ADMM not for proximal algorithm. MagneticResonanceImaging/MRIReco.jl#78 (comment)
We have a lot of cases available and I really don't know the impact with CS reconstruction :
I can implement some of them here, without optimization and try to benchmark the effect :
|
Well, I totally agree with Jeff that one first has to put some thoughts on what it means to put a non-unitary transform into FISTA / ADMM. But having the option to play around with different Wavelet transforms in SparsityOperators.jl still would be very nice. In particular it would be very helpful to have the variant that BART implements because we can then directly compare. |
Let me add a comment to balance the theoretical and practical considerations here. |
Yes, that are very good points. I also directly though about plug-and-play denoisers and actually we are about to implement just that in the near future (see this paper https://link.springer.com/chapter/10.1007/978-3-031-17247-2_11). Therefore, I am currently thinking about how to get them into RegularizedLeastSquares. But still, to make this clear: This package
Yes indeed. It then needs someone from us diving deeper into that package. I know that this can be a major barrier and therefore did not want to slowdown @aTrotier if it is easier for him to first start a prototype here. But this would just be a stop-gap solution. It definitely belongs into Wavelets.jl. |
Hi,
In the MRIReco example we have to deal with matrix x = 220x160 where the maximum level transform is respectively : 2 x 5
In order to make the code works I made a PR in Wavelets.jl which will perform only a L=2 transform.
My guess is that it is better to have a higher number of level transform for sparsity.
Do you think we should zero-filled to a squared matrix of the nearest above 2^n matrix ?
Something like that (here I just zero-filled the matrix to be squared and not 2^n) :
The text was updated successfully, but these errors were encountered: