Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Initial commit
- Loading branch information
rhancock
committed
Feb 18, 2020
0 parents
commit 36ac777
Showing
11 changed files
with
162 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
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,5 @@ | ||
*.nii.gz | ||
*.dcm | ||
*.nii | ||
*.json | ||
|
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,45 @@ | ||
# HW2: BIDS Conversion | ||
|
||
Due Feb 23. | ||
|
||
# Data Description | ||
|
||
The raw DICOM data is located in `/scratch/psyc5171/exercises/bidshw` for a single subject, `TD902TD` (note you will need to copy and rename this folder). | ||
|
||
The scans consist of: | ||
|
||
- Series 1-4: AutoAlign scout | ||
- Series 5: T1w MPRAGE | ||
- Series 6-7: One run of the 'music' fMRI task and corresponding singleband reference volume | ||
- Series 8: A physiological recording log. This should be ignored. | ||
- Series 9-10: First run of the 'prosody' fMRI task and corresponding singleband reference volume | ||
- Series 11: A physiological recording log. This should be ignored. | ||
- Series 12-13: Second run of the 'prosody' fMRI task and corresponding singleband reference volume | ||
- Series 14: A physiological recording log. This should be ignored. | ||
|
||
|
||
# Assignment | ||
|
||
1. Fork this repository | ||
2. Clone your fork to the cluster under your `/scratch` directory: `git clone https://github.uconn.edu/$USER/hw2` | ||
3. Convert the provided data to BIDS form using BIDS Coiner. Your resulting bids directory should be under the `hw2` directory so that your changes can be commited using git. | ||
4. Add (`git add -A`) and commit (`git commit`) the resulting changes to your hw2 directory. MRI data will be automatically ignored when add files using `git`. | ||
5. Push changes to your remote (`git push`) | ||
6. Create a pull request to submit your assignment. | ||
|
||
|
||
# Important Changes | ||
|
||
In class, the `sbatch_step1.sh` script renamed DICOM folders and created the `bids/code/bidscoiner/samples` directory. Since running the script twice creates nested DICOM directories which do not work with the conversion step, this has been split into two scripts: | ||
|
||
- `sbatch_step1a.sh` only creates `bids/code/bidscoiner/samples` | ||
- `sbatch_step1b.sh` only renames the DICOM folders. If you run step1b multiple times, you will get nested DICOM directories and the conversion will not work. Remember that DICOM files need to be in subject/series folder structure. | ||
|
||
# Somewhat Useful Tips | ||
|
||
- You will need to copy the provided `TD902TD` folder to your own directory and rename the folder to have the correct prefix. The subject folder should be placed under `raw`. | ||
- No major edits to the YAML file are required. | ||
- A partial `bids` directory tree has been created for you and the same scripts we used in class are under `bids/code` in this repository. You need to edit the scripts to use the appropriate paths, which depend on where you clone the repository to. | ||
|
||
|
||
|
Binary file not shown.
Binary file not shown.
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,10 @@ | ||
#!/bin/bash | ||
# rename DICOM folders to help bidsmap | ||
|
||
for SUBJECT_DIR in `ls -d /data/raw/sub-*`; do | ||
for d in ${SUBJECT_DIR}/*; do | ||
dicomsort.py -r -e .dcm $d | ||
done | ||
mv ${SUBJECT_DIR}/*/* ${SUBJECT_DIR} | ||
m -rf ${SUBJECT_DIR}/[1-9]* | ||
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,22 @@ | ||
#!/bin/bash | ||
##### Job definition | ||
# TODO: Edit email address below | ||
#SBATCH --nodes=1 # OpenMP requires a single node | ||
#SBATCH --ntasks=1 # Run a single serial task | ||
#SBATCH --time=00:10:00 # Time limit hh:mm:ss | ||
#SBATCH -e step1a_error_%A_%a.log # Standard error | ||
#SBATCH -o step1a_output_%A_%a.log # Standard output | ||
#SBATCH --job-name=bidssetup # Descriptive job name | ||
#SBATCH --partition=serial | ||
|
||
##### load required modules | ||
|
||
module load singularity | ||
|
||
##### run container commands | ||
|
||
# create samples under bids/code/bidscoiner | ||
singularity run --bind /scratch/psyc5171/NETID/bidscoiner:/data \ | ||
/scratch/psyc5171/containers/birc-bids_latest.sif \ | ||
bidstrainer.py /data/bids | ||
|
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,25 @@ | ||
#!/bin/bash | ||
##### Job definition | ||
# TODO: Edit email address below | ||
#SBATCH --nodes=1 # OpenMP requires a single node | ||
#SBATCH --ntasks=1 # Run a single serial task | ||
#SBATCH --time=00:10:00 # Time limit hh:mm:ss | ||
#SBATCH -e step1b_error_%A_%a.log # Standard error | ||
#SBATCH -o step1b_output_%A_%a.log # Standard output | ||
#SBATCH --job-name=reorganize # Descriptive job name | ||
#SBATCH --partition=serial | ||
|
||
##### load required modules | ||
|
||
module load singularity | ||
|
||
##### run container commands | ||
|
||
|
||
# reorganize the files | ||
singularity run --bind /scratch/psyc5171/NETID/bidscoiner:/data \ | ||
/scratch/psyc5171/containers/birc-bids_latest.sif \ | ||
/data/bids/code/reorganize.sh | ||
|
||
|
||
|
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,28 @@ | ||
#!/bin/bash | ||
##### Job definition | ||
#SBATCH --nodes=1 # OpenMP requires a single node | ||
#SBATCH --ntasks=1 # Run a single serial task | ||
#SBATCH --time=00:10:00 # Time limit hh:mm:ss | ||
#SBATCH -e step2_error_%A_%a.log # Standard error | ||
#SBATCH -o step2_output_%A_%a.log # Standard output | ||
#SBATCH --job-name=bidstrain # Descriptive job name | ||
#SBATCH --partition=serial | ||
|
||
##### load required modules | ||
|
||
module load singularity | ||
|
||
##### run container commands | ||
|
||
# training on the sample data | ||
singularity run --bind /scratch/psyc5171/roh17004/bidscoiner:/data \ | ||
/scratch/psyc5171/containers/birc-bids_latest.sif \ | ||
bidstrainer.py /data/bids | ||
|
||
|
||
# Create the bidsmap | ||
singularity run --bind /scratch/psyc5171/roh17004/bidscoiner:/data \ | ||
/scratch/psyc5171/containers/birc-bids_latest.sif \ | ||
bidsmapper.py -t /data/bids/code/bidscoin/bidsmap_sample.yaml \ | ||
-i 0 /data/raw /data/bids | ||
|
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,22 @@ | ||
#!/bin/bash | ||
##### Job definition | ||
#SBATCH --nodes=1 # OpenMP requires a single node | ||
#SBATCH --ntasks=1 # Run a single serial task | ||
#SBATCH --time=00:10:00 # Time limit hh:mm:ss | ||
#SBATCH -e step3_error_%A_%a.log # Standard error | ||
#SBATCH -o step3_output_%A_%a.log # Standard output | ||
#SBATCH --job-name=bidscoin # Descriptive job name | ||
#SBATCH --partition=serial | ||
|
||
##### load required modules | ||
|
||
module load singularity | ||
|
||
##### run container commands | ||
|
||
# Run bidscoiner to convert the raw data to BIDSa | ||
singularity run --bind /scratch/psyc5171/roh17004/bidscoiner:/data \ | ||
/scratch/psyc5171/containers/birc-bids_latest.sif \ | ||
bidscoiner.py -f /data/raw /data/bids | ||
|
||
|
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,5 @@ | ||
*.nii.gz | ||
*.dcm | ||
*.nii | ||
*.json | ||
|