diff --git a/curation/dcm2bids/dcm2bids_submit.sh b/curation/dcm2bids/dcm2bids_submit.sh index b62ef1c..779c1b7 100644 --- a/curation/dcm2bids/dcm2bids_submit.sh +++ b/curation/dcm2bids/dcm2bids_submit.sh @@ -1,6 +1,6 @@ #!/bin/bash #SBATCH --job-name=dcm2bids_conversion # Job name -#SBATCH --array=0-230 +#SBATCH --array=0-1 #SBATCH --time=24:00:00 # Maximum runtime #SBATCH --cpus-per-task=4 # Number of CPUs per task #SBATCH --mem=8G # Memory per job @@ -11,18 +11,21 @@ bids="/cbica/projects/grmpy/data/bids" # Step 1: Get all subject IDs -subjects=($(ls -d ${bids}/sourcedata/GRMPY_822831/SUBJECTS/* | xargs -n 1 basename)) +# subjects=($(ls -d ${bids}/sourcedata/GRMPY_822831/SUBJECTS/* | xargs -n 1 basename)) +subjects=("95257" "20120") # For debugging # Step 2: Select the current subject based on the SLURM array task ID subID=${subjects[${SLURM_ARRAY_TASK_ID}]} # Step 3: Find all DICOM directories for all sessions of the current subject -session_dirs=$(find ${bids}/sourcedata/GRMPY_822831/SUBJECTS/${subID}/SESSIONS/*/ACQUISITIONS -maxdepth 0 -type d) +mapfile -t session_dirs < <(find ${bids}/sourcedata/GRMPY_822831/SUBJECTS/${subID}/SESSIONS/*/ACQUISITIONS -maxdepth 0 -type d) # Step 4: Process each session session_num=1 # Initialize session counter for session_dir in "${session_dirs[@]}"; do + echo "Processing session ${session_num} for subject ${subID} in directory ${session_dir}" # For debugging + ~/miniforge3/envs/dcmconv/bin/dcm2bids -p ${subID} \ -s ${session_num} \ -c ${bids}/code/dcm2bids/config.json \ diff --git a/curation/dcm2bids/dcm2bids_submit2.sh b/curation/dcm2bids/dcm2bids_submit2.sh deleted file mode 100644 index 779c1b7..0000000 --- a/curation/dcm2bids/dcm2bids_submit2.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash -#SBATCH --job-name=dcm2bids_conversion # Job name -#SBATCH --array=0-1 -#SBATCH --time=24:00:00 # Maximum runtime -#SBATCH --cpus-per-task=4 # Number of CPUs per task -#SBATCH --mem=8G # Memory per job -#SBATCH --output=/cbica/projects/grmpy/data/bids/code/dcm2bids/logs/dcm2bids_%A_%a.out # Output log -#SBATCH --error=/cbica/projects/grmpy/data/bids/code/dcm2bids/logs/dcm2bids_%A_%a.err # Error log - -# Define paths -bids="/cbica/projects/grmpy/data/bids" - -# Step 1: Get all subject IDs -# subjects=($(ls -d ${bids}/sourcedata/GRMPY_822831/SUBJECTS/* | xargs -n 1 basename)) -subjects=("95257" "20120") # For debugging - -# Step 2: Select the current subject based on the SLURM array task ID -subID=${subjects[${SLURM_ARRAY_TASK_ID}]} - -# Step 3: Find all DICOM directories for all sessions of the current subject -mapfile -t session_dirs < <(find ${bids}/sourcedata/GRMPY_822831/SUBJECTS/${subID}/SESSIONS/*/ACQUISITIONS -maxdepth 0 -type d) - -# Step 4: Process each session -session_num=1 # Initialize session counter -for session_dir in "${session_dirs[@]}"; do - - echo "Processing session ${session_num} for subject ${subID} in directory ${session_dir}" # For debugging - - ~/miniforge3/envs/dcmconv/bin/dcm2bids -p ${subID} \ - -s ${session_num} \ - -c ${bids}/code/dcm2bids/config.json \ - -o ${bids} \ - -d ${session_dir} \ - --force_dcm2bids - - ((session_num++)) - -done