function Out=PANOsol(I,mask,init)
% 
%--------------------------------------------------------------------------
% part of codes for
% [1]  Joy A, Paul J S. "Multi-channel MR Image Reconstruction using
%      Statistically Optimized Non-Linear Diffusion", Magnetic Resonance in 
%      Medicine, June 2017, doi:10.1002/mrm.26774.
%
% PBDW to be downloaded from http://www.quxiaobo.org/
% [2] "Qu X, Hou Y, Lam F, Guo D, Zhong J, and Chen Z. Magnetic resonance
%      image reconstruction from undersampled measurements using a
%      patchbased nonlocal operator. Med Image Anal 2014;18(6):843–856."
%
% Coded by : Ajin Joy on March 2017
%--------------------------------------------------------------------------

RLNE            =@(x,y) norm(x(:)-y(:),2)./norm(x(:),2);
[row,column]    = size(mask);
kspace_full     = fft2(I);
U               = U_Operator(ifftshift(mask),row,column);
y               = U*kspace_full;
p.lamda         = 1e6;
p.im_ref_init   = init;
p.iter_optBasis = 1;
tic
Out.Irecon      = solver_PANO_Fast_CS_MRI(y,ifftshift(mask),p);
Out.tim         = toc;
Out.err         = RLNE(I,Out.Irecon);