My code depends on all subjects' data directories being set up the same way. So "${SUBJECT}/analysis/results" would be where the con* images live.
Here are some snippets of the code.
while read s
do
for f in $(find ./$s -type f -name "$PAT" | grep "$SEARCH"); do
ff=$(echo ${f} | sed s:^./::)
echo ln -s $(pwd)/${ff} \
$TARGET/$(echo ${ff} | sed s:/analysis/$SEARCH/:-:)
done
done < $LIST
$LIST is a text file listing all subjects. You can also create this shell variable with e.g. regular expressions, like LIST=$(ls subject[0-9]*)
$TARGET is the target directory (Maybe "GROUP/contrast1" or something like that).
$PAT is a pattern, e.g. con_0001.
$SEARCH is to narrow down the results. For example, for some subjects that have a decent amount of motion I use ArtRepair, and I rename their results folder "results_art". (Otherwise, it would grab the contrasts from both "results" and "results_art".
The output filename would be "${SUBJECT}-$PAT.{hdr,img}". An example would be "watson_c-con_0001.img", if your subject is "watson_c". All of these contrast images will be in $TARGET, so when you go to specify 2nd level, you can just select-all.
So an example use of the script would be
collect.sh -p con_0001* \
-t GROUP/contrast1 \
-l subjects.txt \
-s "results_art"
You will have to insert code to accept options, if you want. It's also easy to use this for multiple experiments; just put "case $EXPERIMENT" in front of the first line above.
Chris
On 12/20/2013 03:47 AM, Andy Yeung wrote:
[log in to unmask]" type="cite">Dear all,
For example I got 100 subjects and several contrasts.At 2nd level analysis I tried to copy and paste all relevant con*.img/hdr collectively into a new folder.But it says error at running specifying 2nd level.Is there a way to quickly allow me to pick up files I want in spm specify 2nd level?Filter button works only when I'm into daughter folder containing the data, doesn't work when I'm in parent folder.
Yours,Andy