sopt_mltb_vdsmask - Create variable density sampling profile Creates a binary mask generated from a variable density sampling profile for two dimensional images in the frequency domain. The mask contains on average p*N*M ones's. Inputs: - N and M: Size of mask. - p: Coverage percentage. Note: The undersampling ratio is passed as 2*p and then the function only takes samples in half plane to account for signal reality. The range of p is 0 < p <= 0.5. Outputs: - mask: Binary mask with the sampling profile in the frequency domain.
0001 function mask = sopt_mltb_vdsmask(N,M,p) 0002 % sopt_mltb_vdsmask - Create variable density sampling profile 0003 % 0004 % Creates a binary mask generated from a variable density sampling 0005 % profile for two dimensional images in the frequency domain. The mask 0006 % contains on average p*N*M ones's. 0007 % 0008 % Inputs: 0009 % 0010 % - N and M: Size of mask. 0011 % 0012 % - p: Coverage percentage. 0013 % 0014 % Note: The undersampling ratio is passed as 2*p and then the function 0015 % only takes samples in half plane to account for signal reality. The range 0016 % of p is 0 < p <= 0.5. 0017 % 0018 % Outputs: 0019 % 0020 % - mask: Binary mask with the sampling profile in the frequency domain. 0021 0022 p = 2*p; 0023 0024 if p==1 0025 mask=ones(N,M); 0026 else 0027 0028 nb_meas=round(p*N*M); 0029 tol=ceil(p*N*M)-floor(p*N*M); 0030 d=1; 0031 0032 [x,y] = meshgrid(linspace(-1, 1, M), linspace(-1, 1, N)); % Cartesian grid 0033 r = sqrt(x.^2+y.^2); r = r/max(r(:)); % Polar grid 0034 0035 alpha=-1; 0036 it=0; 0037 maxit=20; 0038 while (alpha<-0.01 || alpha>0.01) && it<maxit 0039 pdf = (1-r).^d; 0040 [new_pdf,alpha] = sopt_mltb_modifypdf(pdf, nb_meas); 0041 if alpha<0 0042 d=d+0.1; 0043 else 0044 d=d-0.1; 0045 end 0046 it=it+1; 0047 end 0048 0049 mask = zeros(size(new_pdf)); 0050 while sum(mask(:))>nb_meas+tol || sum(mask(:))<nb_meas-tol 0051 mask = sopt_mltb_genmask(new_pdf); 0052 end 0053 0054 end 0055 0056 %Samples in half plane to account for signal reality. 0057 M1=floor(M/2); 0058 mask(:,1:M1)=0; 0059 mask = ifftshift(mask); 0060 0061 N1=floor(N/2); 0062 mask(N1+1:N,1)=0; 0063