0001 function [f_cur, f_scal] = s2let_transform_curvelet_analysis_lm2cur(flm_init, varargin)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041 sz = length(flm_init(:));
0042 Lguessed = sqrt(sz);
0043
0044 p = inputParser;
0045 p.addRequired('flm_init', @isnumeric);
0046 p.addParamValue('B', 2, @isnumeric);
0047 p.addParamValue('L', Lguessed, @isnumeric);
0048 p.addParamValue('J_min', 0, @isnumeric);
0049 p.addParamValue('Spin', 0, @isnumeric);
0050 p.addParamValue('Reality', false, @islogical);
0051 p.addParamValue('Upsample', false, @islogical);
0052 p.addParamValue('SpinLowered', false, @islogical);
0053 p.addParamValue('SpinLoweredFrom', 0, @isnumeric);
0054 p.addParamValue('Sampling', 'MW', @ischar);
0055 p.parse(flm_init, varargin{:});
0056 args = p.Results;
0057
0058 J = s2let_jmax(args.L, args.B);
0059
0060
0061
0062
0063
0064 [cur_lm scal_l] = s2let_curvelet_tiling(args.B, args.L, args.J_min,...
0065 'Spin', args.Spin,...
0066 'SpinLowered', args.SpinLowered, ...
0067 'SpinLoweredFrom', args.SpinLoweredFrom);
0068
0069
0070
0071
0072
0073
0074 [f_cur_lmn, f_scal_lm] = s2let_transform_curvelet_analysis_lm2lmn(flm_init, cur_lm, scal_l,...
0075 'B',args.B, 'L', args.L, 'J_min', args.J_min, ...
0076 'Spin', args.Spin,'Reality', args.Reality,...
0077 'Upsample', args.Upsample, ...
0078 'SpinLowered', args.SpinLowered, ...
0079 'SpinLoweredFrom', args.SpinLoweredFrom, ...
0080 'Sampling', args.Sampling);
0081
0082
0083
0084
0085
0086
0087
0088
0089 alpha = 0;
0090 gamma = 0 ;
0091
0092 for j = args.J_min:J,
0093 band_limit = min([ s2let_bandlimit(j,args.J_min,args.B,args.L) args.L ]);
0094
0095 Nj = band_limit;
0096
0097
0098
0099
0100 if (args.Upsample ~= 0)
0101 beta = acos(-args.Spin/args.B^j);
0102 d = zeros(args.L, 2*args.L-1, 2*args.L-1);
0103 d(1,:,:) = ssht_dl(squeeze(d(1,:,:)), args.L, 0, beta);
0104 for el = 1:args.L-1
0105 d(el+1,:,:) = ssht_dl(squeeze(d(el,:,:)), args.L, el, beta);
0106 end
0107 else
0108 beta = acos(-args.Spin/args.B^j);
0109 d = zeros(band_limit, 2*band_limit-1, 2*band_limit-1);
0110 d(1,:,:) = ssht_dl(squeeze(d(1,:,:)), band_limit, 0, beta);
0111 for el = 1:band_limit-1
0112 d(el+1,:,:) = ssht_dl(squeeze(d(el,:,:)), band_limit, el, beta);
0113 end
0114 end
0115
0116 if (args.Reality == 0)
0117 if (args.Upsample ~= 0)
0118 f_cur_lmn_rotated{j-args.J_min+1} = zeros((2*Nj-1)*args.L^2,1);
0119 else
0120 f_cur_lmn_rotated{j-args.J_min+1} = zeros((2*Nj-1)*band_limit^2,1);
0121 end
0122 for el = abs(args.Spin):(band_limit-1)
0123 for m = -el:el
0124 if (args.Upsample == 0)
0125 ind_lml = so3_elmn2ind(el,m,el,band_limit,Nj);
0126 ind_l_m_nl = so3_elmn2ind(el,m,-el,band_limit,Nj);
0127 else
0128 ind_lml = so3_elmn2ind(el,m,el,args.L,Nj);
0129 ind_l_m_nl = so3_elmn2ind(el,m,-el,args.L,Nj);
0130 end
0131 en_max = min(el, Nj-1);
0132 for k = -en_max:en_max
0133
0134 if (args.Upsample ~= 0)
0135 Dlkl = exp(-1i*k*alpha) * d(el+1,k+args.L,el+args.L) * exp(-1i*el*gamma);
0136 Dlknl = exp(-1i*k*alpha) * d(el+1,k+args.L,-el+args.L) * exp(-1i*(-el)*gamma);
0137 ind_lmk = so3_elmn2ind(el,m,k,args.L,Nj);
0138 else
0139 Dlkl = exp(-1i*k*alpha) * d(el+1,k+band_limit,el+band_limit) * exp(-1i*el*gamma);
0140 Dlknl = exp(-1i*k*alpha) * d(el+1,k+band_limit,-el+band_limit) * exp(-1i*(-el)*gamma);
0141 ind_lmk = so3_elmn2ind(el,m,k,band_limit,Nj);
0142 end
0143 f_cur_lmn_rotated{j-args.J_min+1}(ind_lmk)= conj(Dlkl) * f_cur_lmn{j-args.J_min+1}(ind_lml)+ ...
0144 conj(Dlknl)* f_cur_lmn{j-args.J_min+1}(ind_l_m_nl);
0145 end
0146 end
0147 end
0148 else
0149 if (args.Upsample ~= 0)
0150 f_cur_lmn_rotated{j-args.J_min+1} = zeros(Nj*args.L^2,1);
0151 else
0152 f_cur_lmn_rotated{j-args.J_min+1} = zeros(Nj*band_limit^2,1);
0153 end
0154 for el = 0:(band_limit-1)
0155 for m = -el:el
0156 if (args.Upsample == 0)
0157 ind_lml = so3_elmn2ind(el,m,el,band_limit,Nj, 'Reality', args.Reality);
0158 ind_l_nm_l = so3_elmn2ind(el,-m,el,band_limit,Nj, 'Reality', args.Reality);
0159 else
0160 ind_lml = so3_elmn2ind(el,m,el,args.L,Nj, 'Reality', args.Reality) ;
0161 ind_l_nm_l = so3_elmn2ind(el,-m,el,args.L,Nj, 'Reality', args.Reality) ;
0162 end
0163 if (mod((m+el),2) == 1)
0164 sign = -1;
0165 else
0166 sign = 1;
0167 end
0168 en_max = min(el, Nj-1);
0169 for k = 0:en_max
0170 if (args.Upsample ~= 0)
0171 Dl_k_l = exp(-1i*k*alpha) * d(el+1,k+args.L,el+args.L) * exp(-1i*el*gamma);
0172 Dl_k_nl = exp(-1i*k*alpha) * d(el+1,k+args.L,-el+args.L) * exp(-1i*-el*gamma);
0173 ind_lmk = so3_elmn2ind(el,m,k,args.L,Nj,'Reality', args.Reality);
0174 else
0175 Dl_k_l = exp(-1i*k*alpha) * d(el+1,k+band_limit,el+band_limit) * exp(-1i*el*gamma);
0176 Dl_k_nl = exp(-1i*k*alpha) * d(el+1,k+band_limit,-el+band_limit) * exp(-1i*-el*gamma);
0177 ind_lmk = so3_elmn2ind(el,m,k,band_limit,Nj, 'Reality', args.Reality);
0178 end
0179 f_cur_lmn_rotated{j-args.J_min+1}(ind_lmk)= conj(Dl_k_l) * f_cur_lmn{j-args.J_min+1}(ind_lml)+ ...
0180 sign*conj(Dl_k_nl)* conj(f_cur_lmn{j-args.J_min+1}(ind_l_nm_l));
0181 end
0182 end
0183 end
0184 end
0185 end
0186
0187
0188
0189
0190
0191
0192 if (args.Upsample == 0)
0193 band_limit = min([s2let_bandlimit(args.J_min-1,args.J_min,args.B,args.L) args.L ]);
0194 else
0195 band_limit = args.L ;
0196 end
0197 f_scal = ssht_inverse(f_scal_lm, band_limit, ...
0198 'Method', args.Sampling, ...
0199 'Spin', 0, ...
0200 'Reality', args.Reality);
0201
0202
0203
0204 for j = args.J_min:J,
0205 band_limit = min([s2let_bandlimit(j,args.J_min,args.B,args.L) args.L ]);
0206 Nj = band_limit;
0207 if (args.Upsample == 0)
0208 f_cur{j-args.J_min+1} = so3_inverse_direct(f_cur_lmn_rotated{j-args.J_min+1}, band_limit, Nj, ...
0209 'Sampling', args.Sampling, 'Reality', args.Reality) ;
0210 else
0211 f_cur{j-args.J_min+1} = so3_inverse_direct(f_cur_lmn_rotated{j-args.J_min+1}, args.L, Nj, ...
0212 'Sampling', args.Sampling, 'Reality', args.Reality) ;
0213 end
0214 end
0215
0216
0217
0218
0219
0220 cur_lm = 0;
0221 scal_l = 0;
0222 f_cur_lmn =0;
0223 f_scal_lm =0;
0224
0225 end