Skip to content

error when specifying report file path #37

Description

@normanF

Hi,
I encountered an issue with the vers 0.57.0 when batch processing EEG files and trying to specify a report path different from the defaults (the current folder with EEG.filename as suffix to 'Report.pdf' and 'Summary.html'):

  • when handing over an absolute folder path to params.report.summaryFilePath and params.report.sessionFilePath the pipeline crashes downstream.
  • when handing over absolute filepaths (e.g. pointing to a network location) PREP a folder path within the current path and not the actual goal directory.

When tracing that down, I found the following subfunction to be problematic:

function absPath = resolvePath(pathIn)
if isfolder(pathIn) || isfile(pathIn)
% Already exists, maybe absolute
absPath = fullfile(pathIn);
else
% Assume relative to current folder
absPath = fullfile(pwd, pathIn);
end

The if clause returns 1 if pathIn is an absolute folder location. However, this crashes downstream as mentioned above. If pathIn is an absolute file location, the file must exist already. If it doesn't, the input file locaction will be appended to the current working directory (>>fullfile(pwd,pathIn), the second issue mentioned above). If the pipeline pre-allocated the summary and report files, the second issue would be resolved (but not the first), but so far, PREP doesn't do it.

So I currently fixed that by changing the subfunction and getReportOptions in the following way:

function options = getReportOptions(userData, paramsUpdated)
options = struct('reportMode', '', 'consoleFID', '', 'publishOn', '', ...
'summaryFilePath', '', 'sessionFilePath', '' );
options.reportMode = userData.report.reportMode.value;
if isfield(paramsUpdated, 'reportMode')
options.reportMode = paramsUpdated.reportMode;
end
options.consoleFID = userData.report.consoleFID.value;
if isfield(paramsUpdated, 'consoleFID')
options.consoleFID = paramsUpdated.consoleFID;
end
options.publishOn = userData.report.publishOn.value;
if isfield(paramsUpdated, 'publishOn')
options.publishOn = paramsUpdated.publishOn;
end

    options.summaryFilePath = userData.report.summaryFilePath.value;
    if isfield(paramsUpdated, 'summaryFilePath')
        options.summaryFilePath = paramsUpdated.summaryFilePath;
    end
    options.summaryFilePath = resolvePath(options.summaryFilePath,userData.report.summaryFilePath.value);
    
    options.sessionFilePath = userData.report.sessionFilePath.value;
    if isfield(paramsUpdated, 'sessionFilePath')
        options.sessionFilePath = paramsUpdated.sessionFilePath;
    end
    options.sessionFilePath = resolvePath(options.sessionFilePath,userData.report.sessionFilePath.value);
    
    fprintf('summaryFilePath: %s\n', options.summaryFilePath)
    fprintf('sessionFilePath: %s\n', options.sessionFilePath)
end

function absPath = resolvePath(pathIn,value)
if isfolder(pathIn) 
    % Already exists, 
    absPath = fullfile(pathIn,value);
elseif isfile(pathIn)
    % maybe absolute
    absPath = fullfile(pathIn);
else
    % Assume relative to current folder
    absPath = fullfile(pwd, pathIn);
end

I did not test whether this fix holds for all other possible use cases. Furthermore, maybe I misunderstood how to batch the pipeline. In any case, I appreciate any feedback on this or a more detailed documentation on how to batch the pipeline.

Best wishes,
NF

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions