function main(model,task)

% parse the GUI and pass parameters as structure
disp('RUN');
% disp('all warnings OFF')
% warn = warning('off','all');

timeLine = getTimeLineParams(model);
subjects = getSubjectCellList(model);
classDef = parseClassDef(model);

mask     = ['^' cell2mat(getImageFileMask(model)) '.*\.img$'];
% images
% normalization

switch task
    case 'COORD'
        disp('COORD');
        coordargs = struct;
        coordargs.subjects = subjects;
        coordargs.timeline = timeLine;
        coordargs.basedir = model.baseDir;
        coordargs.sessionList = 1:3;
        coordargs.eventList = classDef.eventMatrix;
        coordargs.coords = parseCoordinateTextField(model);
        coordargs.mask   = mask;
        
        runCoordTable(coordargs)
        
    case 'ROI'
        disp('ROI');
        roiargs = struct;
        roiargs.subjects    = subjects;
        roiargs.timeline    = timeLine;
        roiargs.classes     = classDef;
        roiargs.mask        = mask;
        roiargs.basedir     = model.baseDir;
        roiargs.sessionList = 1:3;
        roiargs.eventList   = classDef.eventMatrix;
        
        
        assignin('base','roiargs',roiargs);
        
        runROIImageMaskMode(roiargs);
        
    case 'FBS'
        disp('FBS')
end

% disp('warings restored');
% warning('on',warn);
end