Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ENH] refactor removing date entity and allow to use bids fitler to only convert certain files from source to raw #197

Merged
merged 4 commits into from
Apr 27, 2022

Conversation

Remi-Gau
Copy link
Contributor

@Remi-Gau Remi-Gau commented Apr 16, 2022

fixes #196

@Remi-Gau Remi-Gau changed the base branch from master to dev April 16, 2022 09:00
@Remi-Gau Remi-Gau requested a review from CerenB April 16, 2022 09:00
@codecov
Copy link

codecov bot commented Apr 16, 2022

Codecov Report

Merging #197 (7bc55c0) into dev (627ceef) will decrease coverage by 3.68%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##              dev     #197      +/-   ##
==========================================
- Coverage   81.71%   78.02%   -3.69%     
==========================================
  Files          30       31       +1     
  Lines         678      710      +32     
==========================================
  Hits          554      554              
- Misses        124      156      +32     
Flag Coverage Δ
unittests 78.02% <0.00%> (-3.69%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/convertSourceToRaw.m 0.00% <0.00%> (ø)
src/utils/removeDateEntity.m 0.00% <0.00%> (ø)

📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

%
% Function attempts to convert a source dataset created with CPP_BIDS into a valid
% BIDS data set.
%
%
% USAGE::
%
% convertSourceToRaw(cfg)
% convertSourceToRaw(cfg, 'filter', filter)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should now be possible to use a typical bids.query fitler to only convert a subset of files (only those from beh or from a given subject)

% add dummy README and CHANGE file
templateFolder = fullfile(fileparts(mfilename('fullpath')), '..', 'templates');
% trick use bids matlab copy dataset function
bids.copy_to_derivative(sourceDir, ...
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reuse the bids matlab "copy dataset" function as it was literally made for this.

Comment on lines +1 to +11
function removeDateEntity(varargin)
%
% Removes the date entity from all the files in a BIDS data set
%
%
% USAGE::
%
% removeDateEntity(pathToDataSet, 'filter', filter)
%
%
% (C) Copyright 2022 CPP_BIDS developers
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is now a stand alone function to remove date entities

@CerenB
Copy link
Collaborator

CerenB commented Apr 26, 2022

Thank you! I used removeDateEntity !
with the master branch of CPP-SPM repo, bids-matlab submodule is on a HEAD (detached?) branch. And I was using CPP-BIDS with CPP-SPM submodules together. And it was giving an error during BIDS data reading.
If CPP-SPM is not in the same repo, I bet it'll work as it is.
In my case, I updated bids-matlab branch in CPP-SPM repo to be compatible with CPP-BIDS functions.

BIDS = bids.layout(pathToDataSet,  'use_schema', false);
K>> BIDS = bids.layout(pathToDataSet,  'use_schema', false)
Undefined function or variable 'function_name'.

Error in bids.Schema/load (line 75)
        bids.internal.error_handling(function_name,
        'missingDirectory', msg, false, true);

Error in bids.Schema (line 34)
      obj = load(obj, use_schema);

Error in bids.layout (line 110)
  schema = bids.Schema(use_schema);

@Remi-Gau
Copy link
Contributor Author

yeah there might be a bit of branch juggling indeed.

@Remi-Gau Remi-Gau merged commit e97fcce into cpp-lln-lab:dev Apr 27, 2022
@Remi-Gau
Copy link
Contributor Author

yeah there might be a bit of branch juggling indeed.

@Remi-Gau Remi-Gau deleted the rm_data branch April 27, 2022 06:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants