function Y = projection(X,imagetype)
%% function of enforcing image constraint

if imagetype == 1          % real positive
    Y  = max(real(X),0);
elseif imagetype == -1     % real
    Y  = real(X);  
elseif imagetype == 2      % complex positive
    newreal  = max(real(X),0);
    newimag  = max(imag(X),0);
    Y  = newreal + sqrt(-1) * newimag;
elseif imagetype == -2     % general complex
    Y = X;
end