function dop=dopGetData(dop)
% dopOSCCI Mark II: dopGetData ~ 15-8-2010 (last edit)
%
% function to import and process raw data file as well as report on the
% content of the TX file and the success of finding event markers.
%

try
    
    %% Import & Process the data
    [dop.inData dop.inLabels dop.data.foundMarkers dop.data.rawInfo dop.raw.data]=...
        dopProcessRawDataFile(dop.sum.fileNameLoc,...
        'dopChs',dop.def.dopChs,... % doppler left and right channel numbers
        'evChs',dop.def.evChs,... % doppler event channel number/s
        'outSample',dop.def.downHertz,... % desired down sampling rate in hertz
        'epoch',dop.def.epoch,... % lower and upper epoch values for data triming and trial normalisation
        'rawTrim',dop.def.trim,... % request for raw data trimming - yes or no
        'epochNorm',dop.def.epochNorm,... % request for trial normalisation - yes or no
        'markHeight',dop.def.markHeight,...); % height of Multi-dop trigger/marker pulses - look for pulses greater than this (see dopFindRawMarkers)
        'evType',dop.def.evType,...        'evType',2,...% event type: 0 = base, 1 = stim only, 2 = both
        'evMatch',dop.def.evMatch,...); %'evMatch',0,...% if event type = 0 or 1, it needs a match with another 1 or 0 type, only 2 is independent
        'fileName',dop.sum.fileTxt,...% something to id file
        'shortWarn',dop.def.shortWarn); 
    %     'evNames',dop.def.evNames); % % event marker channel names
    %% report on import
    fprintf('%s\n\t%s\n','Import Report:','File info - ');
    if dop.data.foundMarkers
        dop.tmp.txLabels=fieldnames(dop.data.rawInfo);
        for i=1:length(dop.tmp.txLabels)
            dop.tmp.txLab=dop.tmp.txLabels{i};
            dop.tmp.txData=dop.data.rawInfo.(dop.tmp.txLab);
            if ~iscell(dop.tmp.txData)
                dop.tmp.info=[dop.tmp.txLab,': ',dop.tmp.txData];
                if isnumeric(dop.tmp.txData)
                    dop.tmp.info=[dop.tmp.txLab,': ',num2str(dop.tmp.txData)];
                end
                fprintf('\t%s\n',dop.tmp.info);
            end
        end
        %% save raw data for graphing?
        % two options here - raw data for external graphing or raw data for
        % import plot
    else
        %% No markers > skip summary
        fprintf('\t%s\n\t\t%s\n',...
            'No event markers found, therefore skipping:',dop.sum.fileName);
        dop.sum.skip=1;
        dop.sum.skipReason='No event markers found';
    end
    if sum(sum(isnan(dop.inData)))
        dop.sum.skip=1;
        dop.sum.skipReason='Imported data is problematic - not numeric';
    elseif ~sum(dop.inData)
         dop.sum.skip=1;
        dop.sum.skipReason='Imported data is problematic - empty';
    end
catch err
    %% catch dopOSCCI error
    % 
save(dopOSCCIdebug(mfilename));rethrow(err); 
%     dopOSCCIcrash(err,dop,mfilename);
end
