function ind = getOriginalInd(ind_combined, nScaleGabor, nOrient, nScaleDoG, sx, sy)


IndFilter = floor((ind_combined-1)/(sx*sy))+1;
IndLocation = mod(ind_combined-1,sx*sy)+1;

numGabor = nOrient*nScaleGabor;
ind=[];

for i=1:length(IndFilter) 
    
   if IndFilter(i)<=numGabor  % Gabor
        iScale=floor((IndFilter(i)-1)/nOrient)+1;
        newfilter=(iScale-1)*nOrient+ IndFilter(i);
        newfilter2=newfilter+nOrient;
        Ind_newfilter = (newfilter-1)*(sx*sy)+ IndLocation(i);
        Ind_newfilter2 = (newfilter2-1)*(sx*sy)+ IndLocation(i);
        ind=[ind, Ind_newfilter, Ind_newfilter2];        
       
   else   % DoG
        newfilter=nScaleGabor*nOrient + IndFilter(i);
        Ind_newfilter = (newfilter-1)*(sx*sy)+ IndLocation(i);
        ind=[ind, Ind_newfilter];
        
   end  

end

