Skip to content

Commit

Permalink
dcm2bids sbatch
Browse files Browse the repository at this point in the history
  • Loading branch information
singlesp committed Dec 16, 2024
1 parent 30a0076 commit 685ce6e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 41 deletions.
9 changes: 6 additions & 3 deletions curation/dcm2bids/dcm2bids_submit.sh
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 \
Expand Down
38 changes: 0 additions & 38 deletions curation/dcm2bids/dcm2bids_submit2.sh

This file was deleted.

0 comments on commit 685ce6e

Please sign in to comment.