generated from PennLINC/paper-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
78 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -203,3 +203,8 @@ vignettes/*.pdf | |
|
||
# R Environment Variables | ||
.Renviron | ||
|
||
# log files | ||
log/ | ||
/log/ | ||
**/log/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/bin/bash | ||
#SBATCH --job-name=dcm2bids_conversion # Job name | ||
#SBATCH --array=0-230 | ||
#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)) | ||
|
||
# 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) | ||
|
||
# Step 4: Process each session | ||
session_num=1 # Initialize session counter | ||
for session_dir in "${session_dirs[@]}"; do | ||
|
||
~/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/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 |