function demo_compareSolvers(P2D)
%% GET USER OPTIONS
opts.nDonuts = 5; tooltips.nDonuts = 'Number of donuts to simulate';
opts.brightness = 300; tooltips.brightness = 'photons/donut';
opts.darkRate = 0.1; tooltips.darkRate = 'Dark noise level';
opts.lambda = 0; tooltips.lambda = 'L1 penalty for pixel-space solver';
opts.numIters = 25; tooltips.numIters = 'Number of Richardson-Lucy iterations';
opts.plotFrames = [1 4 10 25]; tooltips.plotFrames = 'Show intermediate solutions at these iterations';
opts.usePrior = true; tooltips.usePrior = 'Set pixels outside the imaged area to 0';

%Update with user inputs
if nargin>3 %if the user specified options
    for field = fieldnames(optsin)'
         opts.(field{1}) = optsin.(field{1});
    end
else %no user options; use a GUI
      opts = optionsGUI(opts, tooltips);
end

%options hidden or not implemented yet
opts.nFrames = 1; tooltips.nFrames = 'number of frames to simulate';
opts.initializeWithGT = false; tooltips.initializeWithGT = 'Initialize to solver with the ground truth, to see where it converges';
opts.dilateForDisplay = 1; tooltips.dilateForDisplay = 'integers>1 make small particles more visible in images';
opts.rOuter = 30; tooltips.rOuter = 'outer donut radius';
opts.rInner = 18; tooltips.rInner = 'inner donut radius';
opts.isSimulation = true;

%% SIMULATIONS

%generate donut data
disp('Generating simulated data...')
[simData, simX, simSeg] = demo_simulateDonuts(P2D, opts);
imRef = reshape(simSeg*simX, [1280 1280]);

%display the measurement data
figure('name', 'simulated SLAP Measurements', 'pos', [500 50 1000 250]);
plot(simData.frames.pmtData); xlabel('Masurement #'); ylabel('Photons');

%solve data in the pixel space
demo_solve(P2D,simData,imRef, opts);

%solve the same data in the segmented space
demo_solveWithSeg(P2D, simData, simSeg, simX, opts);

end