Closed Remi-Gau closed 3 years ago
I have also something similar in our lab pipeline though yours seem to have more features. I also know that spmup by @CPernet has something that does some of that.
So that seems like one the obvious low hanging fruit !!
Copied from original issue
@ChristophePhillips: spm_copy and spm_mkdir are tools to help you for what you want to do: https://en.wikibooks.org/wiki/SPM/BIDS#Formatting_datasets_into_BIDS that we used here: https://github.com/spm/MultimodalScripts/blob/master/code/scripted/master_script.m#L49-L76
Actually had opened an issue on one of our repo to get spm_mkdir and spm_copy out of spm. So I would heart to have them as part of bids matlab.
One headache to keep in mind: datasets curated with datalad have their content stored with git annex (I need to finish a PR about that on the datalad handbook). So a simple call to copyfile will not follow the symbolic link and you just end up with just a bunch of broken links.
2 options:
the user must make sure they have run datalad unlock the files to copy
try a system call to cp -L and catch with copyfile if it fails (this is the hacky way of doing things we are currentty using: see here
The second option is going to make Windows users cry though... If they use datalad: no a huge user base at the moment but that too could grow.
Any other ways around this that would make everyone happy?
Origianlly posted by @gllmflndn
I think we should make a system() call only out of necessity. We could test for symlinks within a isunix condition and only use cp -L for these?
There are a few circumstances (see here under) where I would like to initialize the
derivatives
with a copy, complete or partial, of the original full BIDS dataset. I have been working on aprepare_derivatives.m
for that specific purpose with some features, such as:func
data possibly all or some tasks;.nii.gz
files and 4D-to-3D unpacking thefunc
anddwi
images, if requested;derivatives/tool
subfolder will be created, i.e. not necessarily next to the "raw" data in the BIDS folder.Why would I want to do that? Well because, it is convenient to work on a subset of data and/or in a "sandpit", for example
func
data), therefore no need to bring along everythingderivatives
subfolder before any processing. Moreover SPM and some other tools, would prefer dealing with a series of 3D images rather than a single 4D volume, e.g. ditching the 1st few functional images into a "dummy" subfolder.derivatives\some_tool_or_step
data and start working on these. Afterwards, it is straightforward to copy that derivatives folder back on the external storage place.Originally posted by @ChristophePhillips in https://github.com/bids-standard/bids-matlab/issues/60#issuecomment-714505816
dataset_description.json
in the root of that derivatiive folderSee comments:
In other repos: