-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfind_3d_thresh
64 lines (56 loc) · 2.26 KB
/
find_3d_thresh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#! /bin/bash
# ------------------------------------------------------------------------------
# Script name: find_3d_thresh.sh
#
# Description: Find the appropriate thresholding to reconstruct faces from different input modalities.
#
# Author: Caroline Nettekoven, 2020
#
# ------------------------------------------------------------------------------
# ------------------------------------------------------------------------------
input_dir=/Users/CN/Documents/Projects/BOLD_study_local/deidentification/example_subject/sub-650BT/
output_dir=${input_dir}/defaced
tool_dir=/Users/CN/Documents/Projects/BOLD_study_local/bin/
py_dir=/Users/CN/Documents/Projects/Joystick_Cereb_MRS/bin/mrsi_code/env/bin
# ------------------------------------------------------------------------------
images_to_deface=" anat/sub-650BT_T1w_nrm.nii.gz \
anat/sub-650BT_T1w_raw.nii.gz \
dwi/sub-650BT_acq-AP_dwi.nii.gz \
dwi/sub-650BT_acq-AP_sbref.nii.gz \
dwi/sub-650BT_acq-PA_dwi.nii.gz \
dwi/sub-650BT_acq-PA_sbref.nii.gz \
func/sub-650BT_task-nwr_bold.nii.gz \
func/sub-650BT_task-nwr_sbref.nii.gz \
func/sub-650BT_task-rest_bold.nii.gz \
func/sub-650BT_task-rest_sbref.nii.gz \
func/sub-650BT_task-verbgen_bold.nii.gz \
func/sub-650BT_task-verbgen_sbref.nii.gz "
# ------------------------------------------------------------------------------
for image in ${images_to_deface}; do
echo "Generating qc image for ${image}..."
img=${input_dir}/${image}
img_stem=${image#*BT_}
img_stem=${img_stem%.nii*}
# Copy and face reconstruct original image:
dim=`echo "\`${FSLDIR}/bin/fslval ${img} dim3\` /2" |bc ` ;
${FSLDIR}/bin/fslroi ${img} ${output_dir}/${img_stem}_orig 0 -1 0 -1 ${dim} 1;
# Set threshold dependent on modality
# if [[ ${image:0:3} == "ana"]]; then
# thr=35
# elif [[ ${image:0:3} == "fun"]]; then
# thr=55
# elif [[ ${image:0:3} == "dwi"]]; then
# thr=55
# elif [[ ${image:0:3} == "mpm"]]; then
# thr=55
# fi
for thr in 30 35 40 45 50 55 60 65 70 75 80; do
sh ${tool_dir}/fsl_gen_3D_crn_thr \
${img} \
${output_dir}/thresholding/${img_stem}_orig_thr${thr} \
${thr}
done
done
# thresholds to get face reconstruction:
# For functional data: 55
# For anat data: 35