function [ handles ] = loadConfigFile( fileName, handles )
% Loads the configuration file for FPA Engineering
%   
if exist(fileName,'file')==2
    load(fileName);
else
    handlesSave.xSizeD = 2;
    handlesSave.ySizeD = 2;    
    handlesSave.xDispD = 1;
    handlesSave.yDispD = 1;
    handlesSave.numFiltersD = 2;
    handlesSave.filtColor{1} = [1 0 0];
    handlesSave.filtColor{2} = [0 1 0];
    handlesSave.colorFiltBoxPos = 1;
    handlesSave.NUC = 8;
    handlesSave.MUC = 8;
    handlesSave.shapeFcnD = @sincShape;
    handlesSave.shapeFcnPos = 1;
    handlesSave.shapeFcnList = {'@sincShape','@sombShape','@gaussShape'};
    handlesSave.xiSizeD = 511;
    handlesSave.etaSizeD = 511;
    handlesSave.filtVal{1} = zeros(handlesSave.ySizeD,handlesSave.xSizeD);
    handlesSave.filtVal{1}(1) = 1;
    handlesSave = filtUpdate( handlesSave, 2,2 );
    handlesSave.showImagCellGeo = false;
    handlesSave.showResults = true;
    handlesSave.eps = ones(1,9).*0.1;
    handlesSave.radius = ones(1,9).*0.25;
    handlesSave.noiseMult = 0;
    handlesSave.numXpixels = 512;
    handlesSave.numYpixels = 512;
    handlesSave.numXUnitCells = 256;
    handlesSave.numYUnitCells = 256;
    handlesSave.shotNoise = true;
    handlesSave.numPElectrons = 25000;
    handlesSave.useSynthTestImg = true;
    handlesSave.applyPixShapeFcnD = false;
    handlesSave.fsMultD = 1;
end

handles.xDispD = handlesSave.xDispD;
handles.yDispD = handlesSave.yDispD;
handles.xSizeD = handlesSave.xSizeD;
handles.ySizeD = handlesSave.ySizeD;
handles.numFiltersD = handlesSave.numFiltersD;
handles.NUC = handlesSave.NUC;
handles.MUC = handlesSave.MUC;
handles.shapeFcnD = handlesSave.shapeFcnD;
handles.shapeFcnPos = handlesSave.shapeFcnPos;
handles.shapeFcnList = handlesSave.shapeFcnList;
handles.xiSizeD = handlesSave.xiSizeD;
handles.etaSizeD = handlesSave.etaSizeD;
handles.filtVal = handlesSave.filtVal;
handles.showImagCellGeo = handlesSave.showImagCellGeo;
handles.showResults = handlesSave.showResults;
handles.filtColor = handlesSave.filtColor;
handles.colorFiltBoxPos = handlesSave.colorFiltBoxPos;
handles.eps = handlesSave.eps;
handles.radius = handlesSave.radius;
handles.noiseMult = handlesSave.noiseMult;
handles.numXpixels = handlesSave.numXpixels;
handles.numYpixels = handlesSave.numYpixels;
handles.numXUnitCells = handlesSave.numXUnitCells;
handles.numYUnitCells = handlesSave.numYUnitCells;
handles.shotNoise = handlesSave.shotNoise;
handles.numPElectrons = handlesSave.numPElectrons;
handles.useSynthTestImg = handlesSave.useSynthTestImg;
handles.applyPixShapeFcnD = handlesSave.applyPixShapeFcnD;
handles.fsMultD = handlesSave.fsMultD;

handles.poissStr = '';
handles.snrStr = '';

handles.hyperReflectanceData = [];
handles.imgTotFFTt = [];

handles.numFilterBoxesGenerated = false;
handles.unitCellPlots(1) = figure(1);
handles.unitCellPlots(2) = figure(2);
handles.unitCellSinglePlot(1) = figure(3);
handles.unitCellSinglePlot(2) = figure(4);
handles.colorArrayPlot = figure(5);
for k = 1:handles.numFiltersD
    handles.filterPlots(k) = figure(k+5);
end

for j = 1:handles.numFiltersD + 2
    handles.filterTestPlots(j) = figure(k+j+5);
end


end

