function [ handles ] = equalizeDC( handles )
% Forces all filter channels to have an equal DC component, uses the first
% filter as the reference. Rescales filters to have combined maximum 
% transmittance magnitude of 1.

handles = genChannelInversionMatrix(handles);

[row col] = size(handles.Lf);

DCchanInd = floor(col/2) + 1;

% DCref = handles.numXpixels*handles.numYpixels/row;
% DCref = 1/row;
DCref = handles.NUC*handles.MUC/row;

filtValTemp = zeros(size(handles.filtVal{1}));
for k = 1:handles.numFiltersD
    handles.filtVal{k} = DCref./handles.Lf(k,DCchanInd).*handles.filtVal{k};
    filtValTemp = filtValTemp + handles.filtVal{k};
end
maxTrans = max(max(filtValTemp));
for k = 1:handles.numFiltersD
    handles.filtVal{k} = handles.filtVal{k}./maxTrans;    
end
handles = genChannelInversionMatrix(handles);
handles = combineFiltsFromUnitCell(handles);
end

