function main(action,parameterModel)
timeline = getTimeLineParams(parameterModel);
switch action
    case 'COORD-LOOKUP-TABLE'
        runCoordTable(timeline,parameterModel);
    case 'ROI-IMAGE-MASK'
        runROIImageMaskMode(parameterModel);
        disp('DONE');
    case 'FULL-BRAIN'
        error('SVMCrossVal:main:notImplemented','Feature not yet implemented');
    otherwise 
        error('SVMCrossVal:main:actionError','Wrong ''action''. Use the GUI.');
end
end



% generate parameter structs for subroutines
function timelineParams = getTimeLineParams(paramModel)
timelineParams = struct;
timelineParams.frameShiftStart = getDouble(paramModel.txtFrameShiftStart);  % -20;
timelineParams.frameShiftEnd   = getDouble(paramModel.txtFrameShiftEnd); %15;
timelineParams.decodeDuration  = getDouble(paramModel.txtFrameShiftDur);
timelineParams.psthStart       = getDouble(paramModel.txtPSTHStart); % -25;
timelineParams.psthEnd         = getDouble(paramModel.txtPSTHEnd); % 20;
timelineParams.baselineStart   = getDouble(paramModel.txtBaselineStart); % -22;
timelineParams.baselineEnd     = getDouble(paramModel.txtBaselineEnd); % -20;

end

function calculateParams = parseCalculateParams(paramModel)
calculateParams  = struct;
calculateParams.smoothed        = getChkValue(paramModel.chkSmoothed);
calculateParams.svmargs         = get(paramModel.txtSVMopts,'String');
calculateParams.sessionList     = 1:3;

calculateParams.CROSSVAL_METHOD      = CROSSVAL_METHOD_DEF.svmcrossval;
calculateParams.VOXEL_SELECTION_MODE = VOXEL_SELECTION_MODE_DEF.roiImage;
calculateParams.PROJECT_BASE_PATH    = PROJECT_BASE_PATH;
calculateParams.PROJECT_RESULT_PATH  = PROJECT_RESULT_PATH;
calculateParams.RANDOMIZE       = 0;

classStruct = parseClassDef(paramModel);
calculateParams.labelMap        = LabelMap(classStruct.labelCells , classStruct.conditionCells, 'auto'); % LabelMap({'<','>','<+<','>+>','<+>','>+<'},{-2,-1,1,2,3,4}); 0 is autolabel
calculateParams.classList       = getClasses(calculateParams.labelMap);
calculateParams.eventList       = classStruct.eventMatrix; %[9,11,13; 10,12,14];
calculateParams.subjectSelection = subjectSelection;
 
% assignin('base','calculateParams',calculateParams);
end