When trying to supply subject name and session to SSWarper as variables, I get the error: set: Variable name must contain alphanumeric characters.
I've tried this with all kinds of variations, e.g., underscores instead of hyphens between ${sub}
and ${session}
; no characters between the two variables in the -input filename and -subid; ${sub}
only; translating my bash script to tcsh in case that's the issue... everything results in:
set: Variable name must contain alphanumeric characters.
#!/bin/bash
# Retrieve subject from the command-line arguments
subject=$1
# Define the sessions to loop over
sessions=("first" "second")
# Base directory where BIDS data is stored
baseDir=/path/to/my/data/bids_data
# Loop over each session
for session in "${sessions[@]}"; do
# Define paths for the anatomical file and output directory
anatPath="$baseDir/sub-${subject}/ses-${session}/anat/"
outDir="/path/to/my/data/preproc/sub-${subject}/ses-${session}"
# Create the output directory if it doesn't exist
mkdir -p "$outDir"
# Check if the anatomical path exists before proceeding
if [ ! -d "$anatPath" ]; then
echo "Error: Directory $anatPath does not exist. Skipping..."
continue
fi
# Navigate to the anatomical path
cd "$anatPath" || exit
# Check if the T1w image exists before running @SSwarper
anatFile="sub-${subject}_ses-${session}_T1w.nii.gz"
if [ ! -f "$anatFile" ]; then
echo "Error: T1w image $anatFile not found in $anatPath. Skipping..."
continue
fi
# Run @SSwarper for this session using tcsh
tcsh -c "@SSwarper -input $anatFile -subid sub-${subject}_ses-${session} -odir ${outDir}"
# also tried just:
# @SSwarper -input $anatFile -subid sub-${subject}_ses-${session} -odir ${outDir}
done
A minimal script in tcsh that yields the same error:
#!/bin/tcsh
cd /path/to/my/data/bids_data/sub-1234/ses-first/anat
set subject = 1234
set sessions = first
foreach session ($sessions)
echo "Running @SSwarper for session $session"
@SSwarper -input sub-${subject}_ses-${session}_T1w.nii.gz -subid sub-${subject}_ses-${session}
end
Or via command line:
@SSwarper -input sub1234firstT1w.nii.gz -subid 1234
++ Starting: @SSwarper v2.33
++ Default OMP_NUM_THREADS is 96
++ Based on input, the output directory will be:
.
set: Variable name must contain alphanumeric characters.
This is driving me crazy; I can't figure out what the issue is.
afni version is 21.0.02