From d63abba06b4f58effcf02b246ff9182bfc8bd48e Mon Sep 17 00:00:00 2001 From: Ali Khan Date: Sun, 17 Mar 2019 22:57:47 +0000 Subject: [PATCH 1/3] fix for dicomexpr --- tar2bids | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/tar2bids b/tar2bids index 05378a2..2d3fe58 100755 --- a/tar2bids +++ b/tar2bids @@ -149,14 +149,19 @@ do patient_etc=${date_etc##${date}_} patient=${patient_etc%_[0-9]*.*} + suffix=${patient_etc##${patient}_} + + + echo " PI=$pi Study=$study Date=$date PatientName=$patient" search="${pi}_${study}_${date}_${patientname_search}_[0-9]*.*.t*" subjid=`$execpath/etc/getSubjSessID $patientname_search subject $patient` sessid=`$execpath/etc/getSubjSessID $patientname_search session $patient` #expression for heudiconv - dicom_expr=$folder/${pi}_${study}_????????_${patientname_search}_?.????????.t* - +# dicom_expr=$folder/${pi}_${study}_????????_${patientname_search}_?.????????.t* + dicom_expr=$folder/${pi}_${study}_${date}_${patientname_search}_${suffix} + echo $dicom_expr >> $dicomexpr_list else #if -s specified, then search in tarfile search="${tarfile_search}.t*" @@ -165,6 +170,7 @@ do #expression for heudiconv dicom_expr=$folder/${tarfile_search}.t* + echo $dicom_expr >> $dicomexpr_list fi @@ -185,11 +191,11 @@ do #compile subjid list if [ -n "$sessid" ] then - echo "$subjid" >> $heudiconv_subjlist - echo "$sessid" >> $heudiconv_sesslist + echo "$subjid" >> $heudiconv_subjlist_all + echo "$sessid" >> $heudiconv_sesslist_all # echo "-s $subjid -ss $sessid" >> $heudiconv_subjlist else - echo "$subjid" >> $heudiconv_subjlist + echo "$subjid" >> $heudiconv_subjlist_all fi echo $subjid >> $subjlist @@ -201,8 +207,9 @@ then exit 1 fi -#sort and remove duplicate entries in subjlist -sort -u $heudiconv_subjlist -o $heudiconv_subjlist +##sort and remove duplicate entries in subjlist +sort -u $heudiconv_subjlist_all -o $heudiconv_subjlist +sort -u $heudiconv_sesslist_all -o $heudiconv_sesslist sort -u $subjlist -o $subjlist @@ -221,11 +228,11 @@ if [ -n "$sessid" ] then -parallel -a $heudiconv_subjlist -a $heudiconv_sesslist $popts "heudiconv ${heudi_opts} -b -d ${dicom_expr} -o $output_dir -f $heuristic_file -s {1} -ss {2} | tee $heudi_log.{1}.{2} " +parallel --link -a $heudiconv_subjlist_all -a $heudiconv_sesslist_all -a $dicomexpr_list $popts "heudiconv ${heudi_opts} -b -d {3} -o $output_dir -f $heuristic_file -s {1} -ss {2} | tee $heudi_log.{1}.{2} " else -parallel -a $heudiconv_subjlist $popts "heudiconv ${heudi_opts} -b -d ${dicom_expr} -o $output_dir -f $heuristic_file -s {1} | tee $heudi_log.{1}" +parallel --link -a $heudiconv_subjlist_all -a $dicomexpr_list $popts "heudiconv ${heudi_opts} -b -d {2} -o $output_dir -f $heuristic_file -s {1} | tee $heudi_log.{1}" fi From 730b587b1303b44863e456e30febdccc73f551f6 Mon Sep 17 00:00:00 2001 From: Ali Khan Date: Sun, 17 Mar 2019 23:18:13 +0000 Subject: [PATCH 2/3] fix bug --- tar2bids | 1 + 1 file changed, 1 insertion(+) diff --git a/tar2bids b/tar2bids index 2d3fe58..d14583e 100755 --- a/tar2bids +++ b/tar2bids @@ -113,6 +113,7 @@ heudi_log=$log_dir/logs/heudiconv tuneup_log=$log_dir/logs/tuneup heudiconv_subjlist=$log_dir/subj_args.txt heudiconv_sesslist=$log_dir/sess_args.txt +dicomexpr_list=$log_dir/dicomexpr.txt heudi_opts="$heudi_opts --overwrite" From 2ad066d6db4455bb4ca2f5defe585a98da2083f3 Mon Sep 17 00:00:00 2001 From: Ali Khan Date: Sun, 17 Mar 2019 23:41:09 +0000 Subject: [PATCH 3/3] another fix --- tar2bids | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tar2bids b/tar2bids index d14583e..6fee36c 100755 --- a/tar2bids +++ b/tar2bids @@ -112,7 +112,9 @@ mkdir $log_dir/logs heudi_log=$log_dir/logs/heudiconv tuneup_log=$log_dir/logs/tuneup heudiconv_subjlist=$log_dir/subj_args.txt +heudiconv_subjlist_all=$log_dir/subj_args.all.txt heudiconv_sesslist=$log_dir/sess_args.txt +heudiconv_sesslist_all=$log_dir/sess_args.all.txt dicomexpr_list=$log_dir/dicomexpr.txt heudi_opts="$heudi_opts --overwrite" @@ -210,7 +212,10 @@ fi ##sort and remove duplicate entries in subjlist sort -u $heudiconv_subjlist_all -o $heudiconv_subjlist +if [ -e $heudiconv_sesslist_all ] +then sort -u $heudiconv_sesslist_all -o $heudiconv_sesslist +fi sort -u $subjlist -o $subjlist