function coeffs=wtransform(handles,modes,consmodes,WTval,Wnameval,Order,Shift,DecLevel)

WT2val = WTval{get(handles.popupmenu2,'Value')};
W2nameval = Wnameval{get(handles.popupmenu3,'Value')};
wname=wnameconstruct(W2nameval,Order);

if strcmp(WT2val,'1D Continuous Wavelet Transform')
    scalechk=strfind(Shift,':');
    if isempty(scalechk)
        for j=1:length(consmodes)
            abscoeff=cwt(modes{consmodes(j)},str2num(Shift),wname);
            if (strcmp(W2nameval,'Complex Gaussian') ||strcmp(W2nameval,'Complex Morlet') ||strcmp(W2nameval,'Shannon') ||strcmp(W2nameval,'Frequency B-spline'))
                coeffs{j}=real(abscoeff);
            else
                coeffs{j}=abscoeff;
            end
        end
    else
        scalerang=sscanf(Shift,'%f:%f',[1,inf]);
        for j=1:length(consmodes)
            abscoeff=cwt(modes{consmodes(j)},scalerang(1):scalerang(2),wname);
            if (strcmp(W2nameval,'Complex Gaussian') ||strcmp(W2nameval,'Complex Morlet') ||strcmp(W2nameval,'Shannon') ||strcmp(W2nameval,'Frequency B-spline'))
                coeffs{j}=real(abscoeff);
            else
                coeffs{j}=abscoeff;
            end
        end
    end
    
elseif strcmp(WT2val,'1D Discrete Wavelet Transform')
    for j=1:length(consmodes)
        [C,L]=wavedec(modes{consmodes(j)},str2num(DecLevel),wname);
        coeffs{1,j}=appcoef(C,L,wname,1);
        for i=1:str2num(DecLevel)
            coeffs{i+1,j}=detcoef(C,L,i);
        end
    end
    
elseif strcmp(WT2val,'1D Stationary Wavelet Transform')
    for j=1:length(consmodes)
        [SWA,SWD]=swt(modes{consmodes(j)},str2num(DecLevel),wname);
        coeffs{1,j}=SWA(1,:);
        for i=1:str2num(DecLevel)
            coeffs{i+1,j}=SWD(i,:);
        end
    end
    
elseif strcmp(WT2val,'1D Undecimated Wavelet Transform')
    for j=1:length(consmodes)
        WT=ndwt(modes{consmodes(j)},str2num(DecLevel),wname);
        for i=1:length(WT.dec)
            coeffs{i,j}=WT.dec{1,i};
        end
    end

elseif strcmp(WT2val,'1D Complex Wavelet Transform')
    [Faf, Fsf] = FSfarras;
    [af, sf] = dualfilt1;
    coeffs={};
    for j=1:length(consmodes)
        w=dualtree(modes{consmodes(j)},str2num(DecLevel),Faf,af);
        wcoeffs={};
        for i=1:str2num(DecLevel)
            wcoeffs=[wcoeffs;{w{1,i}{1,1};w{1,i}{1,2}}];
        end
        wcoeffs=[wcoeffs;{w{1,str2num(DecLevel)+1}{1,1};w{1,str2num(DecLevel)+1}{1,2}}];
        coeffs=[coeffs wcoeffs];
    end

elseif (strcmp(WT2val,'1D Discrete Fractional Wavelet Transform') || strcmp(WT2val,'1D Discrete Fractional Wavelet Transform (causal)'))
    coeffs={};
    for j=1:length(consmodes)
        w=analysis1D(modes{consmodes(j)}',str2num(DecLevel),str2num(Order),str2num(Shift));
        wcoeffs={};
        for i=1:str2num(DecLevel)
            wcoeffs=[wcoeffs;{real(w{i})';imag(w{i})'}];
        end
        coeffs=[coeffs wcoeffs];
    end
%-------------------------------------- 2D -----------------------------------------  
elseif strcmp(WT2val,'2D Discrete Wavelet Transform')
    for j=1:length(consmodes)
        [C,L]=wavedec2(modes{consmodes(j)},str2num(DecLevel),wname);
        coeffs{1,j}=appcoef2(C,L,wname,1);
        for i=1:str2num(DecLevel)
            if i==1
                [cH,cV,cD]=detcoef2('all',C,L,i);
                coeffs{i+1,j}=cH;
                coeffs{i+2,j}=cV;
                coeffs{i+3,j}=cD;
            elseif i==2
                [cH,cV,cD]=detcoef2('all',C,L,i);
                coeffs{i+3,j}=cH;
                coeffs{i+4,j}=cV;
                coeffs{i+5,j}=cD;
            elseif i==3
                [cH,cV,cD]=detcoef2('all',C,L,i);
                coeffs{i+5,j}=cH;
                coeffs{i+6,j}=cV;
                coeffs{i+7,j}=cD;
            end
        end
    end
    
elseif strcmp(WT2val,'2D Stationary Wavelet Transform')
    for j=1:length(consmodes)
        [SWA,SWH,SWV,SWD]=swt2(modes{consmodes(j)},str2num(DecLevel),wname);
        coeffs{1,j}=SWA(:,:,1);
        for i=1:str2num(DecLevel)
            if i==1
                coeffs{i+1,j}=SWH(:,:,i);
                coeffs{i+2,j}=SWV(:,:,i);
                coeffs{i+3,j}=SWD(:,:,i);
            elseif i==2
                coeffs{i+3,j}=SWH(:,:,i);
                coeffs{i+4,j}=SWV(:,:,i);
                coeffs{i+5,j}=SWD(:,:,i);
            elseif i==3
                coeffs{i+5,j}=SWH(:,:,i);
                coeffs{i+6,j}=SWV(:,:,i);
                coeffs{i+7,j}=SWD(:,:,i);
            end
        end
    end
    
elseif strcmp(WT2val,'2D Undecimated Wavelet Transform')
    for j=1:length(consmodes)
        WT=ndwt2(modes{consmodes(j)},str2num(DecLevel),wname);
        for i=1:length(WT.dec)
            coeffs{i,j}=WT.dec{i,1};
        end
    end
elseif strcmp(WT2val,'2D Complex Wavelet Transform')
    [Faf, Fsf] = FSfarras;
    [af, sf] = dualfilt1;
    coeffs={};
    for j=1:length(consmodes)
        w=dualtree2D(modes{consmodes(j)},str2num(DecLevel),Faf,af);
        wcoeffs={};
        for i=1:str2num(DecLevel)
            wcoeffs=[wcoeffs;{w{i}{1}{1};w{i}{1}{2};w{i}{1}{3};w{i}{2}{1};w{i}{2}{2};w{i}{2}{3}}];
        end
        wcoeffs=[wcoeffs;{w{str2num(DecLevel)+1}{1};w{str2num(DecLevel)+1}{2}}];
        coeffs=[coeffs wcoeffs];
    end
    
elseif (strcmp(WT2val,'2D Discrete Fractional Wavelet Transform') || strcmp(WT2val,'2D Discrete Fractional Wavelet Transform (causal)'))
    coeffs={};
    for j=1:length(consmodes)
        w=analysis2D(modes{consmodes(j)},str2num(DecLevel),str2num(Order),str2num(Shift));
        wcoeffs={};
        for i=1:str2num(DecLevel)
            wcoeffs=[wcoeffs;{real(w{i}(:,:,1));real(w{i}(:,:,2));real(w{i}(:,:,3));real(w{i}(:,:,4));real(w{i}(:,:,5));real(w{i}(:,:,6));...
                imag(w{i}(:,:,1));imag(w{i}(:,:,2));imag(w{i}(:,:,3));imag(w{i}(:,:,4));imag(w{i}(:,:,5));imag(w{i}(:,:,6))}];
        end
        coeffs=[coeffs wcoeffs];
    end
elseif strcmp(WT2val,'2D Discrete Multiwavelet Transform')
    sizes=size(modes{1});
    for j=1:length(consmodes)
        if strcmp(W2nameval,'Chui-Lian 2')
            [~,d1,d2,d3,d4]=CL(modes{consmodes(j)});
        elseif strcmp(W2nameval,'Lebrun-Vetterli')
            [~,d1,d2,d3,d4]=LV(modes{consmodes(j)});
        elseif strcmp(W2nameval,'Donovan-Geronimo-Hardin-Massopust')
            [~,d1,d2,d3,d4]=DGHM(modes{consmodes(j)});
        end
        coeffs{1,j}=d1(1:sizes(1)/2,1:sizes(2)/2);
        coeffs{2,j}=d1(1:sizes(1)/2,sizes(2)/2+1:sizes(2));
        coeffs{3,j}=d1(sizes(1)/2+1:sizes(1),1:sizes(2)/2);
        coeffs{4,j}=d1(sizes(1)/2+1:sizes(1),sizes(2)/2+1:sizes(2));
        coeffs{5,j}=d2(1:sizes(1)/2,1:sizes(2)/2);
        coeffs{6,j}=d2(1:sizes(1)/2,sizes(2)/2+1:sizes(2));
        coeffs{7,j}=d2(sizes(1)/2+1:sizes(1),1:sizes(2)/2);
        coeffs{8,j}=d2(sizes(1)/2+1:sizes(1),sizes(2)/2+1:sizes(2));
        coeffs{9,j}=d3(1:sizes(1)/2,1:sizes(2)/2);
        coeffs{10,j}=d3(1:sizes(1)/2,sizes(2)/2+1:sizes(2));
        coeffs{11,j}=d3(sizes(1)/2+1:sizes(1),1:sizes(2)/2);
        coeffs{12,j}=d3(sizes(1)/2+1:sizes(1),sizes(2)/2+1:sizes(2));
        coeffs{13,j}=d4(1:sizes(1)/2,1:sizes(2)/2);
        coeffs{14,j}=d4(1:sizes(1)/2,sizes(2)/2+1:sizes(2));
        coeffs{15,j}=d4(sizes(1)/2+1:sizes(1),1:sizes(2)/2);
        coeffs{16,j}=d4(sizes(1)/2+1:sizes(1),sizes(2)/2+1:sizes(2));
    end
elseif strcmp(WT2val,'2D Quincunx Wavelet Transform')
    sizes=size(modes{1});
    Jmin = log2(sizes(1))-str2num(DecLevel);
    options.gamma = str2num(Order);
    TypeSel = get(handles.popupmenu12,'String');
    Type = TypeSel{get(handles.popupmenu12,'Value')};
    options.type = Type;
    for j=1:length(consmodes)
        [MW,options.quincunx_filters] = perform_quincunx_wavelet_transform(modes{consmodes(j)},Jmin,+1,options);
        if Jmin==5
            coeffs{1,j}=MW(1:sizes(1),sizes(1)/2+1:sizes(1));
            coeffs{2,j}=MW(sizes(1)/2+1:sizes(1),1:sizes(1)/2);
            coeffs{3,j}=MW(1:sizes(1)/2,1:sizes(1)/2);
        elseif Jmin==4
            coeffs{1,j}=MW(1:sizes(1),sizes(1)/2+1:sizes(1));
            coeffs{2,j}=MW(sizes(1)/2+1:sizes(1),1:sizes(1)/2);
            coeffs{3,j}=MW(1:sizes(1)/2,sizes(1)/4+1:sizes(1)/2);
            coeffs{4,j}=MW(sizes(1)/4+1:sizes(1)/2,1:sizes(1)/4);
            coeffs{5,j}=MW(1:sizes(1)/4,1:sizes(1)/4);
        elseif Jmin==3
            coeffs{1,j}=MW(1:sizes(1),sizes(1)/2+1:sizes(1));
            coeffs{2,j}=MW(sizes(1)/2+1:sizes(1),1:sizes(1)/2);
            coeffs{3,j}=MW(1:sizes(1)/2,sizes(1)/4+1:sizes(1)/2);
            coeffs{4,j}=MW(sizes(1)/4+1:sizes(1)/2,1:sizes(1)/4);
            coeffs{5,j}=MW(1:sizes(1)/4,sizes(1)/8+1:sizes(1)/4);
            coeffs{6,j}=MW(sizes(1)/8+1:sizes(1)/4,1:sizes(1)/8);
            coeffs{7,j}=MW(1:sizes(1)/8,1:sizes(1)/8);
        end 
    end
%-------------------------------------- 3D -----------------------------------------  
elseif strcmp(WT2val,'3D Discrete Wavelet Transform')
    for j=1:length(consmodes)
        WDEC=wavedec3(modes{consmodes(j)},str2num(DecLevel),wname);
        for i=1:length(WDEC.dec)
            coeffs{i,j}=WDEC.dec{i,1};
        end
    end
elseif strcmp(WT2val,'3D Complex Wavelet Transform')
    [Faf, Fsf] = FSfarras;
    [af, sf] = dualfilt1;
    coeffs={};
    for j=1:length(consmodes)
        w=dualtree3D(modes{consmodes(j)},str2num(DecLevel),Faf,af);
        wcoeffs={};
        for i=1:str2num(DecLevel)
            wcoeffs=[wcoeffs;{w{i}{1}{1};w{i}{1}{2};w{i}{1}{3};w{i}{1}{4};w{i}{1}{5};w{i}{1}{6};w{i}{1}{7};...
                w{i}{2}{1};w{i}{2}{2};w{i}{2}{3};w{i}{2}{4};w{i}{2}{5};w{i}{2}{6};w{i}{2}{7};...
                w{i}{3}{1};w{i}{3}{2};w{i}{3}{3};w{i}{3}{4};w{i}{3}{5};w{i}{3}{6};w{i}{3}{7};...
                w{i}{4}{1};w{i}{4}{2};w{i}{4}{3};w{i}{4}{4};w{i}{4}{5};w{i}{4}{6};w{i}{4}{7}}];
        end
        wcoeffs=[wcoeffs;{w{str2num(DecLevel)+1}{1};w{str2num(DecLevel)+1}{2};w{str2num(DecLevel)+1}{3};w{str2num(DecLevel)+1}{4}}];
        coeffs=[coeffs wcoeffs];
    end
end