Skip to content

Commit 250296d

Browse files
committed
🔀reese into main
2 parents db39255 + d8b8cdd commit 250296d

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

dcmtab_bids

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use Data::Dumper;
99
# these are hard coded translations of modality label suffices to BIDS directory
1010
# can also pass e.g. anat/T1w
1111
my %mode_folder = (dwi=>'dwi',
12-
T1w=>'anat', T2w=>'anat',
12+
T1w=>'anat', T2w=>'anat', MTR=>'anat',
1313
bold=>'func', sbref=>'func',
1414
epi=>'fmap',
1515
'magnitude'=>'fmap', 'magnitude1'=>'fmap', 'magnitude2'=>'fmap',

mknii

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ env | grep ^DRYRUN= && DRYRUN=echo || DRYRUN=""
55
[ ! -v VERBOSE ] && VERBOSE=""
66
verbose(){ [ -n "$VERBOSE" ] && echo "$*" >&2 || :; }
77

8+
set_dcm2niix(){
9+
DCM2NIIX="${DCM2NII:-dcm2niix}"
10+
command -v "$DCM2NIIX" >/dev/null || DCM2NIIX=dcm2niix_afni
11+
! command -v "$DCM2NIIX" >/dev/null && warn "cannot find dcm2niix or dcm2niix_afni; try export DCM2NIIX=..." && exit 2
12+
return 0
13+
}
14+
815

916
#
1017
#run dcm2niix with 3dNotes wrapper. check for existing file
@@ -107,6 +114,8 @@ add_json_task(){
107114

108115
main(){
109116
set -euo pipefail
117+
set_dcm2niix # DCM2NIIX might be dcm2niix_afni or given by user
118+
110119
[ $# -ne 2 ] && usage
111120
nii_out="$1"; shift
112121
dcm_folder="$*"; shift
@@ -125,7 +134,7 @@ main(){
125134

126135
#pretimestamp=$(mktemp /tmp/dcmnii_XXXXXX) # -newercm $pretimestamp
127136
# TODO: add trap to cleanup file?
128-
$DRYRUN dcm2niix -z y -b y -f "$outname" -o "$outdir" "$dcm_folder"
137+
$DRYRUN $DCM2NIIX -z y -b y -f "$outname" -o "$outdir" "$dcm_folder"
129138
[ -n "$DRYRUN" ] && exit 0
130139
# if above failed, script would bail (set -e)
131140
# so if we don't have the file it's probably has multiple echos

0 commit comments

Comments
 (0)