diff --git a/.gitignore b/.gitignore index 5ca0973..5aadb40 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ +*.BRIK +*.HEAD +@* +*.jpg .DS_Store - diff --git a/hw2/Exp-1.sh b/hw2/Exp-1.sh new file mode 100755 index 0000000..487e5c6 --- /dev/null +++ b/hw2/Exp-1.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +# 1. Threshold the stats at p <.05 +3dmerge -1zscore -1thresh 1.96 -1noneg \ +-prefix Exp-1/stats.test.thresh \ +'Exp-1/subject_results/group.test/subj.sub_03/sub_03.results/stats.sub_03+tlrc[17]' + +3dmerge -1zscore -1thresh 1.96 -1noneg \ +-prefix Exp-1/stats.retest.thresh \ +'Exp-1/subject_results/group.retest/subj.sub_03/sub_03.results/stats.sub_03+tlrc[17]' + +# 2. Calculate a mask that contains overlapping regions of the brain in both sessions +3dmask_tool -input Exp-1/subject_results/group.*/subj.sub_03/sub_03.results/mask_group+tlrc.HEAD \ +-frac 1.0 -prefix Exp-1/mask + +# 3. Binarize the thresholded images +3dcalc -a Exp-1/stats.test.thresh+tlrc -prefix Exp-1/stats.test.bin -expr 'astep(a,.1)' +3dcalc -a Exp-1/stats.retest.thresh+tlrc -prefix Exp-1/stats.retest.bin -expr 'astep(a,.1)' + +# 4. Calculate the Dice coefficient +3ddot -mask Exp-1/mask+tlrc -dodice Exp-1/stats.test.bin+tlrc Exp-1/stats.retest.bin+tlrc \ No newline at end of file diff --git a/hw2/Exp-1/subject_results/group.retest/subj.sub_03/.orig.cmd.ap.sub_03 b/hw2/Exp-1/subject_results/group.retest/subj.sub_03/.orig.cmd.ap.sub_03 new file mode 100755 index 0000000..4726041 --- /dev/null +++ b/hw2/Exp-1/subject_results/group.retest/subj.sub_03/.orig.cmd.ap.sub_03 @@ -0,0 +1,48 @@ +#!/usr/bin/env tcsh + +# created by uber_subject.py: version 0.40 (March 30, 2017) +# creation date: Thu Aug 3 22:03:06 2017 + +# set data directories +set top_dir = /Users/monicali/Google-Drive/IBRAIN/playground +set anat_dir = $top_dir/sub-03/ses-retest/anat +set epi_dir = $top_dir/sub-03/ses-retest/func + +# set subject and group identifiers +set subj = sub_03 +set group_id = retest + +# run afni_proc.py to create a single subject processing script +afni_proc.py -subj_id $subj \ + -script proc.$subj -scr_overwrite \ + -blocks tshift align tlrc volreg blur mask scale regress \ + -copy_anat $anat_dir/sub-03_ses-retest_T1w.nii.gz \ + -tcat_remove_first_trs 0 \ + -dsets $epi_dir/sub-03_ses-retest_task-linebisection_bold.nii.gz \ + -tlrc_base MNI_avg152T1+tlrc \ + -volreg_align_to third \ + -volreg_align_e2a \ + -volreg_tlrc_warp \ + -blur_size 6.0 \ + -regress_stim_times \ + $top_dir/timing_sub-03_ses-retest_Correct_Task.1D \ + $top_dir/timing_sub-03_ses-retest_Incorrect_Task.1D \ + $top_dir/timing_sub-03_ses-retest_No_Response_Control.1D \ + $top_dir/timing_sub-03_ses-retest_No_Response_Task.1D \ + $top_dir/timing_sub-03_ses-retest_Response_Control.1D \ + -regress_stim_labels \ + Correct_Task Incorrect_Task No_Response_Control No_Response_Task \ + Response_Control \ + -regress_basis 'GAM' \ + -regress_censor_motion 0.3 \ + -regress_censor_outliers 0.5 \ + -regress_apply_mot_types demean deriv \ + -regress_opts_3dD \ + -gltsym 'SYM: 0.333*Correct_Task +0.333*Incorrect_Task \ + +0.333*No_Response_Task -0.5*Response_Control \ + -0.5*No_Response_Control' -glt_label 1 Landmark-Detection \ + -regress_make_ideal_sum sum_ideal.1D \ + -regress_est_blur_epits \ + -regress_est_blur_errts \ + -regress_run_clustsim no + diff --git a/hw2/Exp-1/subject_results/group.retest/subj.sub_03/.orig.cmd.usubj.sub_03 b/hw2/Exp-1/subject_results/group.retest/subj.sub_03/.orig.cmd.usubj.sub_03 new file mode 100644 index 0000000..e94908e --- /dev/null +++ b/hw2/Exp-1/subject_results/group.retest/subj.sub_03/.orig.cmd.usubj.sub_03 @@ -0,0 +1,29 @@ +uber_subject.py \ + -cvar subj_dir subject_results/group.retest/subj.sub_03 \ + -svar anat \ + /Users/monicali/Google-Drive/IBRAIN/playground/sub-03/ses-retest/anat/sub-03_ses-retest_T1w.nii.gz \ + \ + -svar blur_size 6.0 \ + -svar epi \ + /Users/monicali/Google-Drive/IBRAIN/playground/sub-03/ses-retest/func/sub-03_ses-retest_task-linebisection_bold.nii.gz \ + \ + -svar gid retest \ + -svar gltsym '0.333*Correct_Task +0.333*Incorrect_Task \ + +0.333*No_Response_Task -0.5*Response_Control -0.5*No_Response_Control' \ + -svar gltsym_label Landmark-Detection \ + -svar outlier_limit 0.5 \ + -svar regress_mot_deriv yes \ + -svar run_clustsim no \ + -svar sid sub_03 \ + -svar stim \ + /Users/monicali/Google-Drive/IBRAIN/playground/timing_sub-03_ses-retest_Correct_Task.1D \ + /Users/monicali/Google-Drive/IBRAIN/playground/timing_sub-03_ses-retest_Incorrect_Task.1D \ + /Users/monicali/Google-Drive/IBRAIN/playground/timing_sub-03_ses-retest_No_Response_Control.1D \ + /Users/monicali/Google-Drive/IBRAIN/playground/timing_sub-03_ses-retest_No_Response_Task.1D \ + /Users/monicali/Google-Drive/IBRAIN/playground/timing_sub-03_ses-retest_Response_Control.1D \ + \ + -svar stim_basis 'GAM' 'GAM' 'GAM' 'GAM' 'GAM' \ + -svar stim_label Correct_Task Incorrect_Task No_Response_Control \ + No_Response_Task Response_Control \ + -svar stim_type times times times times times \ + -svar tlrc_base MNI_avg152T1+tlrc diff --git a/hw2/Exp-1/subject_results/group.retest/subj.sub_03/.orig.proc.sub_03 b/hw2/Exp-1/subject_results/group.retest/subj.sub_03/.orig.proc.sub_03 new file mode 100755 index 0000000..e883f7a --- /dev/null +++ b/hw2/Exp-1/subject_results/group.retest/subj.sub_03/.orig.proc.sub_03 @@ -0,0 +1,492 @@ +#!/bin/tcsh -xef + +echo "auto-generated by afni_proc.py, Thu Aug 3 22:03:22 2017" +echo "(version 5.15, April 25, 2017)" +echo "execution started: `date`" + +# execute via : +# tcsh -xef proc.sub_03 |& tee output.proc.sub_03 + +# =========================== auto block: setup ============================ +# script setup + +# take note of the AFNI version +afni -ver + +# check that the current AFNI version is recent enough +afni_history -check_date 23 Sep 2016 +if ( $status ) then + echo "** this script requires newer AFNI binaries (than 23 Sep 2016)" + echo " (consider: @update.afni.binaries -defaults)" + exit +endif + +# the user may specify a single subject to run with +if ( $#argv > 0 ) then + set subj = $argv[1] +else + set subj = sub_03 +endif + +# assign output directory name +set output_dir = $subj.results + +# verify that the results directory does not yet exist +if ( -d $output_dir ) then + echo output dir "$subj.results" already exists + exit +endif + +# set list of runs +set runs = (`count -digits 2 1 1`) + +# create results and stimuli directories +mkdir $output_dir +mkdir $output_dir/stimuli + +# copy stim files into stimulus directory +cp \ + /Users/monicali/Google-Drive/IBRAIN/playground/timing_sub-03_ses-retest_Correct_Task.1D \ + /Users/monicali/Google-Drive/IBRAIN/playground/timing_sub-03_ses-retest_Incorrect_Task.1D \ + /Users/monicali/Google-Drive/IBRAIN/playground/timing_sub-03_ses-retest_No_Response_Control.1D \ + /Users/monicali/Google-Drive/IBRAIN/playground/timing_sub-03_ses-retest_No_Response_Task.1D \ + /Users/monicali/Google-Drive/IBRAIN/playground/timing_sub-03_ses-retest_Response_Control.1D \ + $output_dir/stimuli + +# copy anatomy to results dir +3dcopy \ + /Users/monicali/Google-Drive/IBRAIN/playground/sub-03/ses-retest/anat/sub-03_ses-retest_T1w.nii.gz \ + $output_dir/sub-03_ses-retest_T1w + +# ============================ auto block: tcat ============================ +# apply 3dTcat to copy input dsets to results dir, while +# removing the first 0 TRs +3dTcat -prefix $output_dir/pb00.$subj.r01.tcat \ + /Users/monicali/Google-Drive/IBRAIN/playground/sub-03/ses-retest/func/sub-03_ses-retest_task-linebisection_bold.nii.gz'[0..$]' + +# and make note of repetitions (TRs) per run +set tr_counts = ( 238 ) + +# ------------------------------------------------------- +# enter the results directory (can begin processing data) +cd $output_dir + + +# ========================== auto block: outcount ========================== +# data check: compute outlier fraction for each volume +touch out.pre_ss_warn.txt +foreach run ( $runs ) + 3dToutcount -automask -fraction -polort 4 -legendre \ + pb00.$subj.r$run.tcat+orig > outcount.r$run.1D + + # censor outlier TRs per run, ignoring the first 0 TRs + # - censor when more than 0.5 of automask voxels are outliers + # - step() defines which TRs to remove via censoring + 1deval -a outcount.r$run.1D -expr "1-step(a-0.5)" > rm.out.cen.r$run.1D + + # outliers at TR 0 might suggest pre-steady state TRs + if ( `1deval -a outcount.r$run.1D"{0}" -expr "step(a-0.4)"` ) then + echo "** TR #0 outliers: possible pre-steady state TRs in run $run" \ + >> out.pre_ss_warn.txt + endif +end + +# catenate outlier counts into a single time series +cat outcount.r*.1D > outcount_rall.1D + +# catenate outlier censor files into a single time series +cat rm.out.cen.r*.1D > outcount_${subj}_censor.1D + +# ================================= tshift ================================= +# time shift data so all slice timing is the same +foreach run ( $runs ) + 3dTshift -tzero 0 -quintic -prefix pb01.$subj.r$run.tshift \ + pb00.$subj.r$run.tcat+orig +end + +# -------------------------------- +# extract volreg registration base +3dbucket -prefix vr_base pb01.$subj.r01.tshift+orig"[2]" + +# ================================= align ================================== +# for e2a: compute anat alignment transformation to EPI registration base +# (new anat will be intermediate, stripped, sub-03_ses-retest_T1w_ns+orig) +align_epi_anat.py -anat2epi -anat sub-03_ses-retest_T1w+orig \ + -save_skullstrip -suffix _al_junk \ + -epi vr_base+orig -epi_base 0 \ + -epi_strip 3dAutomask \ + -volreg off -tshift off + +# ================================== tlrc ================================== +# warp anatomy to standard space +@auto_tlrc -base MNI_avg152T1+tlrc -input sub-03_ses-retest_T1w_ns+orig -no_ss + +# store forward transformation matrix in a text file +cat_matvec sub-03_ses-retest_T1w_ns+tlrc::WARP_DATA -I > warp.anat.Xat.1D + +# ================================= volreg ================================= +# align each dset to base volume, align to anat, warp to tlrc space + +# verify that we have a +tlrc warp dataset +if ( ! -f sub-03_ses-retest_T1w_ns+tlrc.HEAD ) then + echo "** missing +tlrc warp dataset: sub-03_ses-retest_T1w_ns+tlrc.HEAD" + exit +endif + +# register and warp +foreach run ( $runs ) + # register each volume to the base + 3dvolreg -verbose -zpad 1 -base vr_base+orig \ + -1Dfile dfile.r$run.1D -prefix rm.epi.volreg.r$run \ + -cubic \ + -1Dmatrix_save mat.r$run.vr.aff12.1D \ + pb01.$subj.r$run.tshift+orig + + # create an all-1 dataset to mask the extents of the warp + 3dcalc -overwrite -a pb01.$subj.r$run.tshift+orig -expr 1 \ + -prefix rm.epi.all1 + + # catenate volreg/epi2anat/tlrc xforms + cat_matvec -ONELINE \ + sub-03_ses-retest_T1w_ns+tlrc::WARP_DATA -I \ + sub-03_ses-retest_T1w_al_junk_mat.aff12.1D -I \ + mat.r$run.vr.aff12.1D > mat.r$run.warp.aff12.1D + + # apply catenated xform: volreg/epi2anat/tlrc + 3dAllineate -base sub-03_ses-retest_T1w_ns+tlrc \ + -input pb01.$subj.r$run.tshift+orig \ + -1Dmatrix_apply mat.r$run.warp.aff12.1D \ + -mast_dxyz 4 \ + -prefix rm.epi.nomask.r$run + + # warp the all-1 dataset for extents masking + 3dAllineate -base sub-03_ses-retest_T1w_ns+tlrc \ + -input rm.epi.all1+orig \ + -1Dmatrix_apply mat.r$run.warp.aff12.1D \ + -mast_dxyz 4 -final NN -quiet \ + -prefix rm.epi.1.r$run + + # make an extents intersection mask of this run + 3dTstat -min -prefix rm.epi.min.r$run rm.epi.1.r$run+tlrc +end + +# make a single file of registration params +cat dfile.r*.1D > dfile_rall.1D + +# ---------------------------------------- +# create the extents mask: mask_epi_extents+tlrc +# (this is a mask of voxels that have valid data at every TR) +# (only 1 run, so just use 3dcopy to keep naming straight) +3dcopy rm.epi.min.r01+tlrc mask_epi_extents + +# and apply the extents mask to the EPI data +# (delete any time series with missing data) +foreach run ( $runs ) + 3dcalc -a rm.epi.nomask.r$run+tlrc -b mask_epi_extents+tlrc \ + -expr 'a*b' -prefix pb02.$subj.r$run.volreg +end + +# warp the volreg base EPI dataset to make a final version +cat_matvec -ONELINE \ + sub-03_ses-retest_T1w_ns+tlrc::WARP_DATA -I \ + sub-03_ses-retest_T1w_al_junk_mat.aff12.1D -I > \ + mat.basewarp.aff12.1D + +3dAllineate -base sub-03_ses-retest_T1w_ns+tlrc \ + -input vr_base+orig \ + -1Dmatrix_apply mat.basewarp.aff12.1D \ + -mast_dxyz 4 \ + -prefix final_epi_vr_base + +# create an anat_final dataset, aligned with stats +3dcopy sub-03_ses-retest_T1w_ns+tlrc anat_final.$subj + +# record final registration costs +3dAllineate -base final_epi_vr_base+tlrc -allcostX \ + -input anat_final.$subj+tlrc |& tee out.allcostX.txt + +# ----------------------------------------- +# warp anat follower datasets (affine) +3dAllineate -source sub-03_ses-retest_T1w+orig \ + -master anat_final.$subj+tlrc \ + -final wsinc5 -1Dmatrix_apply warp.anat.Xat.1D \ + -prefix anat_w_skull_warped + +# ================================== blur ================================== +# blur each volume of each run +foreach run ( $runs ) + 3dmerge -1blur_fwhm 6.0 -doall -prefix pb03.$subj.r$run.blur \ + pb02.$subj.r$run.volreg+tlrc +end + +# ================================== mask ================================== +# create 'full_mask' dataset (union mask) +foreach run ( $runs ) + 3dAutomask -dilate 1 -prefix rm.mask_r$run pb03.$subj.r$run.blur+tlrc +end + +# create union of inputs, output type is byte +3dmask_tool -inputs rm.mask_r*+tlrc.HEAD -union -prefix full_mask.$subj + +# ---- create subject anatomy mask, mask_anat.$subj+tlrc ---- +# (resampled from tlrc anat) +3dresample -master full_mask.$subj+tlrc -input sub-03_ses-retest_T1w_ns+tlrc \ + -prefix rm.resam.anat + +# convert to binary anat mask; fill gaps and holes +3dmask_tool -dilate_input 5 -5 -fill_holes -input rm.resam.anat+tlrc \ + -prefix mask_anat.$subj + +# compute overlaps between anat and EPI masks +3dABoverlap -no_automask full_mask.$subj+tlrc mask_anat.$subj+tlrc \ + |& tee out.mask_ae_overlap.txt + +# note Dice coefficient of masks, as well +3ddot -dodice full_mask.$subj+tlrc mask_anat.$subj+tlrc \ + |& tee out.mask_ae_dice.txt + +# ---- create group anatomy mask, mask_group+tlrc ---- +# (resampled from tlrc base anat, MNI_avg152T1+tlrc) +3dresample -master full_mask.$subj+tlrc -prefix ./rm.resam.group \ + -input /Users/monicali/abin/MNI_avg152T1+tlrc + +# convert to binary group mask; fill gaps and holes +3dmask_tool -dilate_input 5 -5 -fill_holes -input rm.resam.group+tlrc \ + -prefix mask_group + +# ================================= scale ================================== +# scale each voxel time series to have a mean of 100 +# (be sure no negatives creep in) +# (subject to a range of [0,200]) +foreach run ( $runs ) + 3dTstat -prefix rm.mean_r$run pb03.$subj.r$run.blur+tlrc + 3dcalc -a pb03.$subj.r$run.blur+tlrc -b rm.mean_r$run+tlrc \ + -c mask_epi_extents+tlrc \ + -expr 'c * min(200, a/b*100)*step(a)*step(b)' \ + -prefix pb04.$subj.r$run.scale +end + +# ================================ regress ================================= + +# compute de-meaned motion parameters (for use in regression) +1d_tool.py -infile dfile_rall.1D -set_nruns 1 \ + -demean -write motion_demean.1D + +# compute motion parameter derivatives (for use in regression) +1d_tool.py -infile dfile_rall.1D -set_nruns 1 \ + -derivative -demean -write motion_deriv.1D + +# create censor file motion_${subj}_censor.1D, for censoring motion +1d_tool.py -infile dfile_rall.1D -set_nruns 1 \ + -show_censor_count -censor_prev_TR \ + -censor_motion 0.3 motion_${subj} + +# combine multiple censor files +1deval -a motion_${subj}_censor.1D -b outcount_${subj}_censor.1D \ + -expr "a*b" > censor_${subj}_combined_2.1D + +# note TRs that were not censored +set ktrs = `1d_tool.py -infile censor_${subj}_combined_2.1D \ + -show_trs_uncensored encoded` + +# ------------------------------ +# run the regression analysis +3dDeconvolve -input pb04.$subj.r*.scale+tlrc.HEAD \ + -censor censor_${subj}_combined_2.1D \ + -polort 4 \ + -num_stimts 17 \ + -stim_times 1 stimuli/timing_sub-03_ses-retest_Correct_Task.1D 'GAM' \ + -stim_label 1 Correct_Task \ + -stim_times 2 stimuli/timing_sub-03_ses-retest_Incorrect_Task.1D 'GAM' \ + -stim_label 2 Incorrect_Task \ + -stim_times 3 stimuli/timing_sub-03_ses-retest_No_Response_Control.1D \ + 'GAM' \ + -stim_label 3 No_Response_Control \ + -stim_times 4 stimuli/timing_sub-03_ses-retest_No_Response_Task.1D 'GAM' \ + -stim_label 4 No_Response_Task \ + -stim_times 5 stimuli/timing_sub-03_ses-retest_Response_Control.1D 'GAM' \ + -stim_label 5 Response_Control \ + -stim_file 6 motion_demean.1D'[0]' -stim_base 6 -stim_label 6 roll_01 \ + -stim_file 7 motion_demean.1D'[1]' -stim_base 7 -stim_label 7 pitch_01 \ + -stim_file 8 motion_demean.1D'[2]' -stim_base 8 -stim_label 8 yaw_01 \ + -stim_file 9 motion_demean.1D'[3]' -stim_base 9 -stim_label 9 dS_01 \ + -stim_file 10 motion_demean.1D'[4]' -stim_base 10 -stim_label 10 dL_01 \ + -stim_file 11 motion_demean.1D'[5]' -stim_base 11 -stim_label 11 dP_01 \ + -stim_file 12 motion_deriv.1D'[0]' -stim_base 12 -stim_label 12 roll_02 \ + -stim_file 13 motion_deriv.1D'[1]' -stim_base 13 -stim_label 13 pitch_02 \ + -stim_file 14 motion_deriv.1D'[2]' -stim_base 14 -stim_label 14 yaw_02 \ + -stim_file 15 motion_deriv.1D'[3]' -stim_base 15 -stim_label 15 dS_02 \ + -stim_file 16 motion_deriv.1D'[4]' -stim_base 16 -stim_label 16 dL_02 \ + -stim_file 17 motion_deriv.1D'[5]' -stim_base 17 -stim_label 17 dP_02 \ + -gltsym 'SYM: 0.333*Correct_Task +0.333*Incorrect_Task \ + +0.333*No_Response_Task -0.5*Response_Control -0.5*No_Response_Control' \ + -glt_label 1 Landmark-Detection \ + -fout -tout -x1D X.xmat.1D -xjpeg X.jpg \ + -x1D_uncensored X.nocensor.xmat.1D \ + -fitts fitts.$subj \ + -errts errts.${subj} \ + -bucket stats.$subj + + +# if 3dDeconvolve fails, terminate the script +if ( $status != 0 ) then + echo '---------------------------------------' + echo '** 3dDeconvolve error, failing...' + echo ' (consider the file 3dDeconvolve.err)' + exit +endif + + +# display any large pairwise correlations from the X-matrix +1d_tool.py -show_cormat_warnings -infile X.xmat.1D |& tee out.cormat_warn.txt + +# create an all_runs dataset to match the fitts, errts, etc. +3dTcat -prefix all_runs.$subj pb04.$subj.r*.scale+tlrc.HEAD + +# -------------------------------------------------- +# create a temporal signal to noise ratio dataset +# signal: if 'scale' block, mean should be 100 +# noise : compute standard deviation of errts +3dTstat -mean -prefix rm.signal.all all_runs.$subj+tlrc"[$ktrs]" +3dTstat -stdev -prefix rm.noise.all errts.${subj}+tlrc"[$ktrs]" +3dcalc -a rm.signal.all+tlrc \ + -b rm.noise.all+tlrc \ + -c full_mask.$subj+tlrc \ + -expr 'c*a/b' -prefix TSNR.$subj + +# --------------------------------------------------- +# compute and store GCOR (global correlation average) +# (sum of squares of global mean of unit errts) +3dTnorm -norm2 -prefix rm.errts.unit errts.${subj}+tlrc +3dmaskave -quiet -mask full_mask.$subj+tlrc rm.errts.unit+tlrc \ + > gmean.errts.unit.1D +3dTstat -sos -prefix - gmean.errts.unit.1D\' > out.gcor.1D +echo "-- GCOR = `cat out.gcor.1D`" + +# --------------------------------------------------- +# compute correlation volume +# (per voxel: average correlation across masked brain) +# (now just dot product with average unit time series) +3dcalc -a rm.errts.unit+tlrc -b gmean.errts.unit.1D -expr 'a*b' -prefix rm.DP +3dTstat -sum -prefix corr_brain rm.DP+tlrc + +# create ideal files for fixed response stim types +1dcat X.nocensor.xmat.1D'[5]' > ideal_Correct_Task.1D +1dcat X.nocensor.xmat.1D'[6]' > ideal_Incorrect_Task.1D +1dcat X.nocensor.xmat.1D'[7]' > ideal_No_Response_Control.1D +1dcat X.nocensor.xmat.1D'[8]' > ideal_No_Response_Task.1D +1dcat X.nocensor.xmat.1D'[9]' > ideal_Response_Control.1D + +# -------------------------------------------------------- +# compute sum of non-baseline regressors from the X-matrix +# (use 1d_tool.py to get list of regressor colums) +set reg_cols = `1d_tool.py -infile X.nocensor.xmat.1D -show_indices_interest` +3dTstat -sum -prefix sum_ideal.1D X.nocensor.xmat.1D"[$reg_cols]" + +# also, create a stimulus-only X-matrix, for easy review +1dcat X.nocensor.xmat.1D"[$reg_cols]" > X.stim.xmat.1D + +# ============================ blur estimation ============================= +# compute blur estimates +touch blur_est.$subj.1D # start with empty file + +# create directory for ACF curve files +mkdir files_ACF + +# -- estimate blur for each run in epits -- +touch blur.epits.1D + +# restrict to uncensored TRs, per run +foreach run ( $runs ) + set trs = `1d_tool.py -infile X.xmat.1D -show_trs_uncensored encoded \ + -show_trs_run $run` + if ( $trs == "" ) continue + 3dFWHMx -detrend -mask full_mask.$subj+tlrc \ + -ACF files_ACF/out.3dFWHMx.ACF.epits.r$run.1D \ + all_runs.$subj+tlrc"[$trs]" >> blur.epits.1D +end + +# compute average FWHM blur (from every other row) and append +set blurs = ( `3dTstat -mean -prefix - blur.epits.1D'{0..$(2)}'\'` ) +echo average epits FWHM blurs: $blurs +echo "$blurs # epits FWHM blur estimates" >> blur_est.$subj.1D + +# compute average ACF blur (from every other row) and append +set blurs = ( `3dTstat -mean -prefix - blur.epits.1D'{1..$(2)}'\'` ) +echo average epits ACF blurs: $blurs +echo "$blurs # epits ACF blur estimates" >> blur_est.$subj.1D + +# -- estimate blur for each run in errts -- +touch blur.errts.1D + +# restrict to uncensored TRs, per run +foreach run ( $runs ) + set trs = `1d_tool.py -infile X.xmat.1D -show_trs_uncensored encoded \ + -show_trs_run $run` + if ( $trs == "" ) continue + 3dFWHMx -detrend -mask full_mask.$subj+tlrc \ + -ACF files_ACF/out.3dFWHMx.ACF.errts.r$run.1D \ + errts.${subj}+tlrc"[$trs]" >> blur.errts.1D +end + +# compute average FWHM blur (from every other row) and append +set blurs = ( `3dTstat -mean -prefix - blur.errts.1D'{0..$(2)}'\'` ) +echo average errts FWHM blurs: $blurs +echo "$blurs # errts FWHM blur estimates" >> blur_est.$subj.1D + +# compute average ACF blur (from every other row) and append +set blurs = ( `3dTstat -mean -prefix - blur.errts.1D'{1..$(2)}'\'` ) +echo average errts ACF blurs: $blurs +echo "$blurs # errts ACF blur estimates" >> blur_est.$subj.1D + + +# ================== auto block: generate review scripts =================== + +# generate a review script for the unprocessed EPI data +gen_epi_review.py -script @epi_review.$subj \ + -dsets pb00.$subj.r*.tcat+orig.HEAD + +# generate scripts to review single subject results +# (try with defaults, but do not allow bad exit status) +gen_ss_review_scripts.py -mot_limit 0.3 -out_limit 0.5 -exit0 + +# ========================== auto block: finalize ========================== + +# remove temporary files +\rm -f rm.* + +# if the basic subject review script is here, run it +# (want this to be the last text output) +if ( -e @ss_review_basic ) ./@ss_review_basic |& tee out.ss_review.$subj.txt + +# return to parent directory +cd .. + +echo "execution finished: `date`" + + + + +# ========================================================================== +# script generated by the command: +# +# afni_proc.py -subj_id sub_03 -script proc.sub_03 -scr_overwrite -blocks \ +# tshift align tlrc volreg blur mask scale regress -copy_anat \ +# /Users/monicali/Google-Drive/IBRAIN/playground/sub-03/ses-retest/anat/sub-03_ses-retest_T1w.nii.gz \ +# -tcat_remove_first_trs 0 -dsets \ +# /Users/monicali/Google-Drive/IBRAIN/playground/sub-03/ses-retest/func/sub-03_ses-retest_task-linebisection_bold.nii.gz \ +# -tlrc_base MNI_avg152T1+tlrc -volreg_align_to third -volreg_align_e2a \ +# -volreg_tlrc_warp -blur_size 6.0 -regress_stim_times \ +# /Users/monicali/Google-Drive/IBRAIN/playground/timing_sub-03_ses-retest_Correct_Task.1D \ +# /Users/monicali/Google-Drive/IBRAIN/playground/timing_sub-03_ses-retest_Incorrect_Task.1D \ +# /Users/monicali/Google-Drive/IBRAIN/playground/timing_sub-03_ses-retest_No_Response_Control.1D \ +# /Users/monicali/Google-Drive/IBRAIN/playground/timing_sub-03_ses-retest_No_Response_Task.1D \ +# /Users/monicali/Google-Drive/IBRAIN/playground/timing_sub-03_ses-retest_Response_Control.1D \ +# -regress_stim_labels Correct_Task Incorrect_Task No_Response_Control \ +# No_Response_Task Response_Control -regress_basis GAM \ +# -regress_censor_motion 0.3 -regress_censor_outliers 0.5 \ +# -regress_apply_mot_types demean deriv -regress_opts_3dD -gltsym 'SYM: \ +# 0.333*Correct_Task +0.333*Incorrect_Task +0.333*No_Response_Task \ +# -0.5*Response_Control -0.5*No_Response_Control' -glt_label 1 \ +# Landmark-Detection -regress_make_ideal_sum sum_ideal.1D \ +# -regress_est_blur_epits -regress_est_blur_errts -regress_run_clustsim no diff --git a/hw2/Exp-1/subject_results/group.retest/subj.sub_03/cmd.ap.sub_03 b/hw2/Exp-1/subject_results/group.retest/subj.sub_03/cmd.ap.sub_03 new file mode 100644 index 0000000..c1ce29f --- /dev/null +++ b/hw2/Exp-1/subject_results/group.retest/subj.sub_03/cmd.ap.sub_03 @@ -0,0 +1,47 @@ +#!/usr/bin/env tcsh + +# created by uber_subject.py: version 0.40 (March 30, 2017) +# creation date: Thu Aug 3 22:03:06 2017 + +# set data directories +set top_dir = /Users/mli/Desktop/playground +set anat_dir = $top_dir/sub-03/ses-retest/anat +set epi_dir = $top_dir/sub-03/ses-retest/func + +# set subject and group identifiers +set subj = sub_03 +set group_id = retest + +# run afni_proc.py to create a single subject processing script +afni_proc.py -subj_id $subj \ + -script proc.$subj -scr_overwrite \ + -blocks tshift align tlrc volreg blur mask scale regress \ + -copy_anat $anat_dir/sub-03_ses-retest_T1w.nii.gz \ + -tcat_remove_first_trs 1 \ + -tshift_opts_ts -tpattern alt+z \ + -dsets $epi_dir/sub-03_ses-retest_task-linebisection_bold.nii.gz \ + -tlrc_base MNI_avg152T1+tlrc \ + -volreg_align_to third \ + -volreg_align_e2a \ + -volreg_tlrc_warp \ + -blur_size 6.0 \ + -regress_stim_times \ + $top_dir/timing_sub-03_ses-retest_Correct_Task.1D \ + $top_dir/timing_sub-03_ses-retest_Incorrect_Task.1D \ + $top_dir/timing_sub-03_ses-retest_No_Response_Control.1D \ + $top_dir/timing_sub-03_ses-retest_No_Response_Task.1D \ + $top_dir/timing_sub-03_ses-retest_Response_Control.1D \ + -regress_stim_labels \ + Correct_Task Incorrect_Task No_Response_Control No_Response_Task \ + Response_Control \ + -regress_basis 'GAM' \ + -regress_censor_motion 0.5 \ + -regress_apply_mot_types demean deriv \ + -regress_opts_3dD \ + -gltsym 'SYM: 0.5*Correct_Task +0.5*Incorrect_Task \ + -Response_Control' -glt_label 1 Landmark-Detection \ + -regress_make_ideal_sum sum_ideal.1D \ + -regress_est_blur_epits \ + -regress_est_blur_errts \ + -regress_run_clustsim no + diff --git a/hw2/Exp-1/subject_results/group.retest/subj.sub_03/output.cmd.ap.sub_03 b/hw2/Exp-1/subject_results/group.retest/subj.sub_03/output.cmd.ap.sub_03 new file mode 100644 index 0000000..ecb6f3a --- /dev/null +++ b/hw2/Exp-1/subject_results/group.retest/subj.sub_03/output.cmd.ap.sub_03 @@ -0,0 +1,30 @@ +set top_dir = /Users/mli/Desktop/playground +set anat_dir = /Users/mli/Desktop/playground/sub-03/ses-retest/anat +set epi_dir = /Users/mli/Desktop/playground/sub-03/ses-retest/func +set subj = sub_03 +set group_id = retest +afni_proc.py -subj_id sub_03 -script proc.sub_03 -scr_overwrite -blocks tshift align tlrc volreg blur mask scale regress -copy_anat /Users/mli/Desktop/playground/sub-03/ses-retest/anat/sub-03_ses-retest_T1w.nii.gz -tcat_remove_first_trs 1 -tshift_opts_ts -tpattern alt+z -dsets /Users/mli/Desktop/playground/sub-03/ses-retest/func/sub-03_ses-retest_task-linebisection_bold.nii.gz -tlrc_base MNI_avg152T1+tlrc -volreg_align_to third -volreg_align_e2a -volreg_tlrc_warp -blur_size 6.0 -regress_stim_times /Users/mli/Desktop/playground/timing_sub-03_ses-retest_Correct_Task.1D /Users/mli/Desktop/playground/timing_sub-03_ses-retest_Incorrect_Task.1D /Users/mli/Desktop/playground/timing_sub-03_ses-retest_No_Response_Control.1D /Users/mli/Desktop/playground/timing_sub-03_ses-retest_No_Response_Task.1D /Users/mli/Desktop/playground/timing_sub-03_ses-retest_Response_Control.1D -regress_stim_labels Correct_Task Incorrect_Task No_Response_Control No_Response_Task Response_Control -regress_basis GAM -regress_censor_motion 0.5 -regress_apply_mot_types demean deriv -regress_opts_3dD -gltsym SYM: 0.5*Correct_Task +0.5*Incorrect_Task + -Response_Control -glt_label 1 Landmark-Detection -regress_make_ideal_sum sum_ideal.1D -regress_est_blur_epits -regress_est_blur_errts -regress_run_clustsim no +-- applying orig view as +orig +** warning: removing first 1 TRs from beginning of each run + --> the stimulus timing files must reflect the removal of these TRs +-- tcat: reps is now 237 +++ updating polort to 4, from run len 592.5 s +-- volreg: using base dset vr_base+orig +++ volreg: applying volreg/epi2anat/tlrc xforms to isotropic 4 mm tlrc voxels +-- applying anat warps to 1 dataset(s): sub-03_ses-retest_T1w +-- masking: group anat = 'MNI_avg152T1+tlrc', exists = 1 +-- have 1 ROI dict entries ... +-- will apply motion types: demean, deriv +-- using default: will not apply EPI Automask + (see 'MASKING NOTE' from the -help for details) + +------------------------------------- +** warning have only 1 run to analyze +------------------------------------- + +--> script is file: proc.sub_03 + consider the script execution command: + + tcsh -xef proc.sub_03 |& tee output.proc.sub_03 + diff --git a/hw2/Exp-1/subject_results/group.retest/subj.sub_03/output.proc.sub_03 b/hw2/Exp-1/subject_results/group.retest/subj.sub_03/output.proc.sub_03 new file mode 100644 index 0000000..f0b205d --- /dev/null +++ b/hw2/Exp-1/subject_results/group.retest/subj.sub_03/output.proc.sub_03 @@ -0,0 +1,929 @@ +echo auto-generated by afni_proc.py, Sat Aug 5 16:05:00 2017 +auto-generated by afni_proc.py, Sat Aug 5 16:05:00 2017 +echo (version 5.15, April 25, 2017) +(version 5.15, April 25, 2017) +echo execution started: `date` +date +execution started: Sat Aug 5 16:05:08 EDT 2017 +afni -ver +Precompiled binary macosx_10.7_local: Jul 27 2017 (Version AFNI_17.2.05) +afni_history -check_date 23 Sep 2016 +-- is current: afni_history as new as: 23 Sep 2016 + most recent entry is: 27 Jul 2017 +if ( 0 ) then +if ( 0 > 0 ) then +set subj = sub_03 +endif +set output_dir = sub_03.results +if ( -d sub_03.results ) then +set runs = ( `count -digits 2 1 1` ) +count -digits 2 1 1 +mkdir sub_03.results +mkdir sub_03.results/stimuli +cp /Users/mli/Desktop/playground/timing_sub-03_ses-retest_Correct_Task.1D /Users/mli/Desktop/playground/timing_sub-03_ses-retest_Incorrect_Task.1D /Users/mli/Desktop/playground/timing_sub-03_ses-retest_No_Response_Control.1D /Users/mli/Desktop/playground/timing_sub-03_ses-retest_No_Response_Task.1D /Users/mli/Desktop/playground/timing_sub-03_ses-retest_Response_Control.1D sub_03.results/stimuli +3dcopy /Users/mli/Desktop/playground/sub-03/ses-retest/anat/sub-03_ses-retest_T1w.nii.gz sub_03.results/sub-03_ses-retest_T1w +++ 3dcopy: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +3dTcat -prefix sub_03.results/pb00.sub_03.r01.tcat /Users/mli/Desktop/playground/sub-03/ses-retest/func/sub-03_ses-retest_task-linebisection_bold.nii.gz[1..$] +++ 3dTcat: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ elapsed time = 0.8 s +set tr_counts = ( 237 ) +cd sub_03.results +touch out.pre_ss_warn.txt +foreach run ( 01 ) +3dToutcount -automask -fraction -polort 4 -legendre pb00.sub_03.r01.tcat+orig +++ 3dToutcount: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +*+ WARNING: If you are performing spatial transformations on an oblique dset, + such as ./pb00.sub_03.r01.tcat+orig.BRIK, + or viewing/combining it with volumes of differing obliquity, + you should consider running: + 3dWarp -deoblique + on this and other oblique datasets in the same session. + See 3dWarp -help for details. +++ Oblique dataset:./pb00.sub_03.r01.tcat+orig.BRIK is 4.947676 degrees from plumb. +++ 18027 voxels passed mask/clip +if ( `1deval -a outcount.r$run.1D"{0}" -expr "step(a-0.4)"` ) then +1deval -a outcount.r01.1D{0} -expr step(a-0.4) +end +cat outcount.r01.1D +foreach run ( 01 ) +3dTshift -tzero 0 -quintic -prefix pb01.sub_03.r01.tshift -tpattern alt+z pb00.sub_03.r01.tcat+orig +++ 3dTshift: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +*+ WARNING: If you are performing spatial transformations on an oblique dset, + such as ./pb00.sub_03.r01.tcat+orig.BRIK, + or viewing/combining it with volumes of differing obliquity, + you should consider running: + 3dWarp -deoblique + on this and other oblique datasets in the same session. + See 3dWarp -help for details. +++ Oblique dataset:./pb00.sub_03.r01.tcat+orig.BRIK is 4.947676 degrees from plumb. +end +3dbucket -prefix vr_base pb01.sub_03.r01.tshift+orig[2] +++ 3dbucket: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +align_epi_anat.py -anat2epi -anat sub-03_ses-retest_T1w+orig -save_skullstrip -suffix _al_junk -epi vr_base+orig -epi_base 0 -epi_strip 3dAutomask -volreg off -tshift off +#++ align_epi_anat version: 1.57 +#++ turning off volume registration +#Script is running (command trimmed): + 3dAttribute DELTA ./vr_base+orig +#Script is running (command trimmed): + 3dAttribute DELTA ./vr_base+orig +#Script is running (command trimmed): + 3dAttribute DELTA ./sub-03_ses-retest_T1w+orig +#++ Multi-cost is lpc +#++ Removing all the temporary files +#Script is running: + \rm -f ./__tt_vr_base* +#Script is running: + \rm -f ./__tt_sub-03_ses-retest_T1w* +#Script is running (command trimmed): + 3dcopy ./sub-03_ses-retest_T1w+orig ./__tt_sub-03_ses-retest_T1w+orig +++ 3dcopy: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +#++ Removing skull from anat data +#Script is running (command trimmed): + 3dSkullStrip -orig_vol -input ./__tt_sub-03_ses-retest_T1w+orig -prefix ./__tt_sub-03_ses-retest_T1w_ns +*+ WARNING: If you are performing spatial transformations on an oblique dset, + such as ./__tt_sub-03_ses-retest_T1w+orig.BRIK, + or viewing/combining it with volumes of differing obliquity, + you should consider running: + 3dWarp -deoblique + on this and other oblique datasets in the same session. + See 3dWarp -help for details. +++ Oblique dataset:./__tt_sub-03_ses-retest_T1w+orig.BRIK is 7.491219 degrees from plumb. +#Script is running (command trimmed): + 3dinfo ./__tt_sub-03_ses-retest_T1w_ns+orig | \grep 'Data Axes Tilt:'|\grep 'Oblique' +#++ Dataset /Users/mli/Desktop/playground/Exp-1/subject_results/group.retest/subj.sub_03/sub_03.results/__tt_sub-03_ses-retest_T1w_ns+orig is ***oblique**** +#Script is running (command trimmed): + 3dAttribute DELTA ./__tt_sub-03_ses-retest_T1w_ns+orig +#++ Spacing for anat to oblique epi alignment is 1.000000 +#++ Matching obliquity of anat to epi +#Script is running (command trimmed): + 3dWarp -verb -card2oblique ./vr_base+orig -prefix ./__tt_sub-03_ses-retest_T1w_ns_ob -newgrid 1.000000 ./__tt_sub-03_ses-retest_T1w_ns+orig | \grep -A 4 '# mat44 Obliquity Transformation ::' > ./__tt_sub-03_ses-retest_T1w_ns_obla2e_mat.1D +++ 3dWarp: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: RW Cox +++ Deobliquing original dataset before obliquing +++ Combining oblique transformations +#++ using 0th sub-brick because only one found +#Script is running (command trimmed): + 3dbucket -prefix ./__tt_vr_base_ts ./vr_base+orig'[0]' +++ 3dbucket: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +#++ resampling epi to match anat data +#Script is running (command trimmed): + 3dresample -master ./__tt_sub-03_ses-retest_T1w_ns_ob+orig -prefix ./__tt_vr_base_ts_rs -inset ./__tt_vr_base_ts+orig'' -rmode Cu +*+ WARNING: If you are performing spatial transformations on an oblique dset, + such as ./__tt_vr_base_ts+orig.BRIK, + or viewing/combining it with volumes of differing obliquity, + you should consider running: + 3dWarp -deoblique + on this and other oblique datasets in the same session. + See 3dWarp -help for details. +++ Oblique dataset:./__tt_vr_base_ts+orig.BRIK is 4.947676 degrees from plumb. +#++ removing skull or area outside brain +#Script is running (command trimmed): + 3dAutomask -apply_prefix ./__tt_vr_base_ts_rs_ns ./__tt_vr_base_ts_rs+orig +++ 3dAutomask: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: Emperor Zhark +++ Loading dataset ./__tt_vr_base_ts_rs+orig +++ Forming automask + + Fixed clip level = 707.124390 + + Used gradual clip level = 618.551697 .. 753.626404 + + Number voxels above clip level = 1151477 + + Clustering voxels ... + + Largest cluster has 1150847 voxels + + Clustering voxels ... + + Largest cluster has 1150422 voxels + + Filled 414 voxels in small holes; now have 1150836 voxels + + Filled 16701 voxels in large holes; now have 1167537 voxels + + Clustering voxels ... + + Largest cluster has 1167504 voxels + + Clustering non-brain voxels ... + + Clustering voxels ... + + Largest cluster has 14352000 voxels + + Mask now has 1167504 voxels +++ 1167504 voxels in the mask [out of 15519504: 7.52%] +++ first 64 x-planes are zero [from R] +++ last 68 x-planes are zero [from L] +++ first 30 y-planes are zero [from A] +++ last 22 y-planes are zero [from P] +++ first 107 z-planes are zero [from I] +++ last 48 z-planes are zero [from S] +++ applying mask to original data +++ Writing masked data +++ CPU time = 3.710000 sec +#++ Computing weight mask +#Script is running (command trimmed): + 3dBrickStat -automask -percentile 90.000000 1 90.000000 ./__tt_vr_base_ts_rs_ns+orig +#++ Applying threshold of 1723.000000 on /Users/mli/Desktop/playground/Exp-1/subject_results/group.retest/subj.sub_03/sub_03.results/__tt_vr_base_ts_rs_ns+orig +#Script is running (command trimmed): + 3dcalc -datum float -prefix ./__tt_vr_base_ts_rs_ns_wt -a ./__tt_vr_base_ts_rs_ns+orig -expr 'min(1,(a/1723.000000))' +++ 3dcalc: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: A cast of thousands +#++ Aligning anat data to epi data +#Script is running (command trimmed): + 3dAllineate -lpc -wtprefix ./__tt_sub-03_ses-retest_T1w_ns_ob_al_junk_wtal -weight ./__tt_vr_base_ts_rs_ns_wt+orig -source ./__tt_sub-03_ses-retest_T1w_ns_ob+orig -prefix ./__tt_sub-03_ses-retest_T1w_ns_ob_temp_al_junk -base ./__tt_vr_base_ts_rs_ns+orig -nocmass -1Dmatrix_save ./sub-03_ses-retest_T1w_al_junk_e2a_only_mat.aff12.1D -master SOURCE -weight_frac 1.0 -maxrot 6 -maxshf 10 -VERB -warp aff -source_automask+4 -onepass +++ 3dAllineate: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: Zhark the Registrator +++ Source dataset: ./__tt_sub-03_ses-retest_T1w_ns_ob+orig.HEAD +++ Base dataset: ./__tt_vr_base_ts_rs_ns+orig.HEAD +++ Loading datasets +++ 1356008 voxels in -source_automask+4 +++ Zero-pad: not needed +++ 1167504 voxels [7.5%] in weight mask +++ Number of points for matching = 1167504 +++ Local correlation: blok type = 'RHDD(6.54321)' +++ shift param auto-range: -84.4..84.4 -70.6..70.6 -85.1..85.1 + + Range param#4 [z-angle] = -6.000000 .. 6.000000 + + Range param#5 [x-angle] = -6.000000 .. 6.000000 + + Range param#6 [y-angle] = -6.000000 .. 6.000000 + + Range param#1 [x-shift] = -10.000000 .. 10.000000 + + Range param#2 [y-shift] = -10.000000 .. 10.000000 + + Range param#3 [z-shift] = -10.000000 .. 10.000000 + + 12 free parameters +++ Normalized convergence radius = 0.001000 +++ OpenMP thread count = 4 +++ ======= Allineation of 1 sub-bricks using Local Pearson Correlation Signed ======= +++ ========== sub-brick #0 ========== [total CPU to here=8.9 s] +++ *** Fine pass begins *** + + * Enter alignment setup routine + + - copying base image + + - copying source image + + - copying weight image + + - using 1167504 points from base image [use_all=0] + + * Exit alignment setup routine + + 1097341 total points stored in 2067 'RHDD(6.54321)' bloks + + - Initial cost = -0.051994 + + - Initial fine Parameters = 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 1.0000 1.0000 0.0000 0.0000 0.0000 +***************************************************************************************************************************************************************** + + - Finalish cost = -0.289529 ; 377 funcs +**** + + - Final cost = -0.289531 ; 107 funcs + + Final fine fit Parameters: + x-shift= 0.2825 y-shift=-0.4994 z-shift=-1.2123 + z-angle= 0.4322 x-angle= 2.0209 y-angle=-5.2935 + x-scale= 0.9675 y-scale= 0.9734 z-scale= 1.0197 + y/x-shear=-0.0002 z/x-shear= 0.0099 z/y-shear= 0.0544 + + - Fine net CPU time = 35.9 s +++ Computing output image +++ image warp: parameters = 0.2825 -0.4994 -1.2123 0.4322 2.0209 -5.2935 0.9675 0.9734 1.0197 -0.0002 0.0099 0.0544 +++ Wrote -1Dmatrix_save ./sub-03_ses-retest_T1w_al_junk_e2a_only_mat.aff12.1D +++ 3dAllineate: total CPU time = 47.4 sec Elapsed = 32.3 +++ ########################################################### +++ # Please check results visually for alignment quality # +++ ########################################################### +++ # '-autoweight' is recommended when using -lpc or -lpa # +++ # If your results are not good, please try again. # +++ ########################################################### +#Script is running (command trimmed): + cat_matvec -ONELINE ./sub-03_ses-retest_T1w_al_junk_e2a_only_mat.aff12.1D ./__tt_sub-03_ses-retest_T1w_ns_obla2e_mat.1D -I > ./sub-03_ses-retest_T1w_al_junk_mat.aff12.1D +#++ Combining anat to epi and oblique transformations +#Script is running (command trimmed): + 3dAllineate -base ./__tt_vr_base_ts_rs_ns+orig -1Dmatrix_apply ./sub-03_ses-retest_T1w_al_junk_mat.aff12.1D -prefix ./sub-03_ses-retest_T1w_al_junk -input ./__tt_sub-03_ses-retest_T1w_ns+orig -master SOURCE -weight_frac 1.0 -maxrot 6 -maxshf 10 -VERB -warp aff -source_automask+4 -onepass +++ 3dAllineate: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: Zhark the Registrator +*+ WARNING: If you are performing spatial transformations on an oblique dset, + such as ./__tt_sub-03_ses-retest_T1w_ns+orig.BRIK, + or viewing/combining it with volumes of differing obliquity, + you should consider running: + 3dWarp -deoblique + on this and other oblique datasets in the same session. + See 3dWarp -help for details. +++ Oblique dataset:./__tt_sub-03_ses-retest_T1w_ns+orig.BRIK is 7.491219 degrees from plumb. +++ Source dataset: ./__tt_sub-03_ses-retest_T1w_ns+orig.HEAD +++ Base dataset: ./__tt_vr_base_ts_rs_ns+orig.HEAD +++ Loading datasets + + Range param#4 [z-angle] = -6.000000 .. 6.000000 + + Range param#5 [x-angle] = -6.000000 .. 6.000000 + + Range param#6 [y-angle] = -6.000000 .. 6.000000 + + Range param#1 [x-shift] = -10.000000 .. 10.000000 + + Range param#2 [y-shift] = -10.000000 .. 10.000000 + + Range param#3 [z-shift] = -10.000000 .. 10.000000 +++ OpenMP thread count = 4 +++ ========== Applying transformation to 1 sub-bricks ========== +++ ========== sub-brick #0 ========== [total CPU to here=0.1 s] + + * Enter alignment setup routine + + - copying base image + + - copying source image + + - no weight image + + - using 11 points from base image [use_all=0] + + * Exit alignment setup routine +++ using -1Dmatrix_apply +++ Computing output image +++ image warp: parameters = 0.9620 0.0446 -0.0982 14.5110 -0.0314 0.9721 -0.0546 -1.5054 0.0907 0.0280 1.0148 -11.6331 +++ 3dAllineate: total CPU time = 2.4 sec Elapsed = 1.7 +++ ########################################################### +#++ Creating final output: skullstripped anat data +copying from dataset /Users/mli/Desktop/playground/Exp-1/subject_results/group.retest/subj.sub_03/sub_03.results/__tt_sub-03_ses-retest_T1w_ns+orig to /Users/mli/Desktop/playground/Exp-1/subject_results/group.retest/subj.sub_03/sub_03.results/sub-03_ses-retest_T1w_ns+orig +#Script is running (command trimmed): + 3dcopy ./__tt_sub-03_ses-retest_T1w_ns+orig sub-03_ses-retest_T1w_ns +++ 3dcopy: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +#++ Creating final output: anat data aligned to epi +# copy is not necessary +#++ Saving history +#Script is running (command trimmed): + 3dNotes -h "align_epi_anat.py -anat2epi -anat sub-03_ses-retest_T1w+orig \ + -save_skullstrip -suffix _al_junk -epi vr_base+orig -epi_base 0 \ + -epi_strip 3dAutomask -volreg off -tshift off" \ + ./sub-03_ses-retest_T1w_al_junk+orig + +#++ Removing all the temporary files +#Script is running: + \rm -f ./__tt_vr_base* +#Script is running: + \rm -f ./__tt_sub-03_ses-retest_T1w* + +# Finished alignment successfully + +@auto_tlrc -base MNI_avg152T1+tlrc -input sub-03_ses-retest_T1w_ns+orig -no_ss +*+ WARNING: If you are performing spatial transformations on an oblique dset, + such as ./sub-03_ses-retest_T1w_ns+orig.BRIK, + or viewing/combining it with volumes of differing obliquity, + you should consider running: + 3dWarp -deoblique + on this and other oblique datasets in the same session. + See 3dWarp -help for details. +++ Oblique dataset:./sub-03_ses-retest_T1w_ns+orig.BRIK is 7.491219 degrees from plumb. +*+ WARNING: If you are performing spatial transformations on an oblique dset, + such as ./sub-03_ses-retest_T1w_ns+orig.BRIK, + or viewing/combining it with volumes of differing obliquity, + you should consider running: + 3dWarp -deoblique + on this and other oblique datasets in the same session. + See 3dWarp -help for details. +++ Oblique dataset:./sub-03_ses-retest_T1w_ns+orig.BRIK is 7.491219 degrees from plumb. +Center distance of 26.068730 mm +Padding ... +++ 3dZeropad: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ output dataset: ./__ats_tmp__ref_MNI_avg152T1_40pad+tlrc.BRIK +Resampling ... +*+ WARNING: If you are performing spatial transformations on an oblique dset, + such as ./sub-03_ses-retest_T1w_ns+orig.BRIK, + or viewing/combining it with volumes of differing obliquity, + you should consider running: + 3dWarp -deoblique + on this and other oblique datasets in the same session. + See 3dWarp -help for details. +++ Oblique dataset:./sub-03_ses-retest_T1w_ns+orig.BRIK is 7.491219 degrees from plumb. +++ 3dcalc: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: A cast of thousands +*+ WARNING: If you are performing spatial transformations on an oblique dset, + such as ./__ats_tmp__resamp_step+orig.BRIK, + or viewing/combining it with volumes of differing obliquity, + you should consider running: + 3dWarp -deoblique + on this and other oblique datasets in the same session. + See 3dWarp -help for details. +++ Oblique dataset:./__ats_tmp__resamp_step+orig.BRIK is 7.491219 degrees from plumb. +++ 3dcalc: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: A cast of thousands +*+ WARNING: If you are performing spatial transformations on an oblique dset, + such as ./sub-03_ses-retest_T1w_ns+orig.BRIK, + or viewing/combining it with volumes of differing obliquity, + you should consider running: + 3dWarp -deoblique + on this and other oblique datasets in the same session. + See 3dWarp -help for details. +++ Oblique dataset:./sub-03_ses-retest_T1w_ns+orig.BRIK is 7.491219 degrees from plumb. +Clipping -0.000100 1013.000100 ... +++ 3dcalc: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: A cast of thousands +++ 3drefit: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: RW Cox +++ Processing AFNI dataset __ats_tmp___rs_sub-03_ses-retest_T1w_ns+tlrc.HEAD + + Changed dataset view type and filenames. +++ 3drefit processed 1 datasets +++ 3drefit: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: RW Cox +++ Processing AFNI dataset __ats_tmp__resamp_NN+tlrc.HEAD + + Changed dataset view type and filenames. +++ 3drefit processed 1 datasets +++ 3drefit: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: RW Cox +++ Processing AFNI dataset __ats_tmp__resamp_edge_art+tlrc.HEAD + + Changed dataset view type and filenames. +++ 3drefit processed 1 datasets +Registration (linear final interpolation) ... +++ 3dWarpDrive: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: RW Cox +++ Initial scale factor set to 0.30/247.56=8.3e+02 +RMS[0] = 0.364249 0.163911 ITER = 6/137 +0.364249 + +Warping has converged. + +++ 3dcopy: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ 3dWarp: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: RW Cox +*+ WARNING: If you are performing spatial transformations on an oblique dset, + such as ./sub-03_ses-retest_T1w_ns+orig.BRIK, + or viewing/combining it with volumes of differing obliquity, + you should consider running: + 3dWarp -deoblique + on this and other oblique datasets in the same session. + See 3dWarp -help for details. +++ Oblique dataset:./sub-03_ses-retest_T1w_ns+orig.BRIK is 7.491219 degrees from plumb. +++ 7.491219 degrees from plumb. +*+ WARNING: Deoblique datasets with 3dWarp before proceeding with other transformations +Applying brain mask +++ 3dcalc: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: A cast of thousands +++ 3dWarp: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: RW Cox +++ 3drename: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ THD_rename_dataset_files: rename __ats_tmp___pad40_sub-03_ses-retest_T1w_ns+orig.HEAD -> __ats_tmp___pad40_sub-03_ses-retest_T1w_ns.skl+orig.HEAD +++ THD_rename_dataset_files: rename __ats_tmp___pad40_sub-03_ses-retest_T1w_ns+orig.BRIK.gz -> __ats_tmp___pad40_sub-03_ses-retest_T1w_ns.skl+orig.BRIK.gz +++ 3dcalc: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: A cast of thousands +Unpadding ... +++ 3dZeropad: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ output dataset: ./__ats_tmp___upad40_sub-03_ses-retest_T1w_ns+orig.BRIK +++ 3drefit: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: RW Cox +++ Processing AFNI dataset __ats_tmp___upad40_sub-03_ses-retest_T1w_ns+orig +*+ WARNING: Changing the space of an ORIG view dataset may cause confusion! +*+ WARNING: NIFTI copies will be interpreted as TLRC view (not TLRC space). +*+ WARNING: Consider changing the view of the dataset to TLRC view also +++ 3drefit processed 1 datasets +Changing view of transformed anatomy +++ 3drefit: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: RW Cox +++ Processing AFNI dataset __ats_tmp___upad40_sub-03_ses-retest_T1w_ns+orig.HEAD + + Changed dataset view type and filenames. +++ 3drefit processed 1 datasets +Setting parent with 3drefit -wset sub-03_ses-retest_T1w_ns+orig __ats_tmp___upad40_sub-03_ses-retest_T1w_ns+tlrc +++ 3drefit: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: RW Cox +++ Processing AFNI dataset __ats_tmp___upad40_sub-03_ses-retest_T1w_ns+tlrc +++ 3drefit processed 1 datasets +++ 3drename: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Warning: ignoring +tlrc on new_prefix. +++ THD_rename_dataset_files: rename __ats_tmp___upad40_sub-03_ses-retest_T1w_ns+tlrc.HEAD -> sub-03_ses-retest_T1w_ns+tlrc.HEAD +++ THD_rename_dataset_files: rename __ats_tmp___upad40_sub-03_ses-retest_T1w_ns+tlrc.BRIK -> sub-03_ses-retest_T1w_ns+tlrc.BRIK +Cleanup ... +cat_matvec sub-03_ses-retest_T1w_ns+tlrc::WARP_DATA -I +if ( ! -f sub-03_ses-retest_T1w_ns+tlrc.HEAD ) then +foreach run ( 01 ) +3dvolreg -verbose -zpad 1 -base vr_base+orig -1Dfile dfile.r01.1D -prefix rm.epi.volreg.r01 -cubic -1Dmatrix_save mat.r01.vr.aff12.1D pb01.sub_03.r01.tshift+orig +++ 3dvolreg: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: RW Cox +*+ WARNING: If you are performing spatial transformations on an oblique dset, + such as ./vr_base+orig.BRIK, + or viewing/combining it with volumes of differing obliquity, + you should consider running: + 3dWarp -deoblique + on this and other oblique datasets in the same session. + See 3dWarp -help for details. +++ Oblique dataset:./vr_base+orig.BRIK is 4.947676 degrees from plumb. +++ Reading in base dataset ./vr_base+orig.BRIK +++ Oblique dataset:./pb01.sub_03.r01.tshift+orig.BRIK is 4.947676 degrees from plumb. +++ Reading input dataset ./pb01.sub_03.r01.tshift+orig.BRIK +++ Edging: x=3 y=3 z=2 +++ Creating mask for -maxdisp + + Automask has 19058 voxels + + 3364 voxels left in -maxdisp mask after erosion +++ Initializing alignment base +++ Starting final pass on 237 sub-bricks: 0..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..65..66..67..68..69..70..71..72..73..74..75..76..77..78..79..80..81..82..83..84..85..86..87..88..89..90..91..92..93..94..95..96..97..98..99..100..101..102..103..104..105..106..107..108..109..110..111..112..113..114..115..116..117..118..119..120..121..122..123..124..125..126..127..128..129..130..131..132..133..134..135..136..137..138..139..140..141..142..143..144..145..146..147..148..149..150..151..152..153..154..155..156..157..158..159..160..161..162..163..164..165..166..167..168..169..170..171..172..173..174..175..176..177..178..179..180..181..182..183..184..185..186..187..188..189..190..191..192..193..194..195..196..197..198..199..200..201..202..203..204..205..206..207..208..209..210..211..212..213..214..215..216..217..218..219..220..221..222..223..224..225..226..227..228..229..230..231..232..233..234..235..236.. +++ CPU time for realignment=6.46 s [=0.0273 s/sub-brick] +++ Min : roll=-0.181 pitch=-0.341 yaw=-0.016 dS=-0.709 dL=-0.130 dP=-0.130 +++ Mean: roll=-0.081 pitch=+0.020 yaw=+0.496 dS=-0.184 dL=+0.212 dP=+0.033 +++ Max : roll=+0.032 pitch=+0.458 yaw=+0.971 dS=+0.453 dL=+0.674 dP=+0.194 +++ Max displacements (mm) for each sub-brick: + 0.30(0.00) 0.20(0.44) 0.00(0.20) 0.23(0.23) 0.26(0.09) 0.39(0.15) 0.18(0.32) 0.23(0.16) 0.35(0.15) 0.20(0.21) 0.26(0.16) 0.36(0.13) 0.47(0.18) 0.64(0.20) 0.80(0.18) 0.89(0.10) 1.01(0.17) 0.97(0.08) 0.92(0.09) 0.59(0.48) 0.64(0.07) 0.54(0.11) 0.54(0.13) 0.60(0.11) 0.60(0.06) 0.61(0.07) 0.56(0.15) 0.56(0.09) 0.53(0.05) 0.62(0.09) 0.65(0.14) 0.60(0.08) 0.52(0.10) 0.48(0.09) 0.45(0.08) 0.54(0.18) 0.56(0.12) 0.61(0.07) 0.60(0.07) 0.62(0.07) 0.65(0.04) 0.69(0.06) 0.58(0.24) 0.63(0.06) 0.66(0.12) 0.68(0.08) 0.63(0.15) 0.64(0.03) 0.64(0.10) 0.67(0.08) 0.59(0.11) 0.52(0.13) 0.45(0.11) 0.44(0.09) 0.44(0.12) 0.42(0.07) 0.53(0.13) 0.57(0.05) 0.56(0.07) 0.61(0.07) 0.61(0.05) 0.66(0.11) 0.57(0.22) 0.66(0.13) 0.69(0.05) 0.70(0.07) 0.74(0.11) 0.71(0.12) 0.75(0.24) 0.68(0.19) 0.82(0.15) 0.74(0.28) 0.81(0.21) 0.90(0.13) 0.72(0.18) 0.79(0.08) 0.81(0.04) 0.86(0.08) 0.78(0.18) 0.79(0.04) 0.74(0.06) 0.84(0.12) 0.94(0.34) 0.75(0.20) 0.78(0.08) 0.83(0.09) 0.88(0.06) 0.90(0.04) 0.81(0.14) 0.83(0.09) 0.78(0.10) 0.80(0.05) 0.70(0.11) 0.75(0.09) 0.74(0.06) 0.72(0.04) 0.75(0.07) 0.72(0.10) 0.87(0.23) 0.80(0.07) 0.80(0.13) 0.73(0.16) 0.80(0.06) 0.75(0.08) 0.73(0.08) 0.77(0.05) 0.78(0.08) 0.77(0.05) 0.67(0.16) 0.68(0.06) 0.68(0.19) 0.70(0.16) 0.68(0.13) 0.64(0.17) 0.64(0.09) 0.67(0.05) 0.66(0.04) 0.63(0.07) 0.67(0.14) 0.64(0.14) 0.73(0.18) 0.83(0.22) 1.01(0.23) 0.85(0.19) 0.87(0.05) 0.81(0.14) 0.81(0.07) 0.85(0.07) 0.78(0.09) 0.84(0.09) 0.77(0.12) 0.85(0.08) 0.85(0.03) 0.87(0.05) 0.90(0.06) 0.91(0.04) 0.97(0.09) 0.92(0.09) 1.01(0.09) 0.95(0.07) 0.95(0.04) 0.86(0.10) 0.95(0.11) 0.92(0.07) 0.92(0.10) 0.95(0.06) 0.97(0.04) 0.94(0.10) 1.07(0.14) 0.97(0.13) 1.11(0.16) 1.14(0.08) 1.31(0.19) 1.19(0.15) 1.24(0.11) 1.24(0.05) 1.25(0.06) 1.31(0.06) 1.23(0.10) 1.28(0.10) 1.20(0.09) 1.40(0.21) 1.25(0.17) 1.23(0.08) 1.32(0.10) 1.26(0.11) 1.34(0.12) 1.31(0.11) 1.39(0.13) 1.27(0.15) 1.32(0.07) 1.29(0.04) 1.35(0.06) 1.37(0.03) 1.39(0.05) 1.46(0.07) 1.41(0.06) 1.52(0.20) 1.46(0.14) 1.42(0.07) 1.44(0.07) 1.49(0.09) 1.49(0.07) 1.51(0.06) 1.56(0.06) 1.52(0.08) 1.55(0.09) 1.45(0.10) 1.58(0.13) 1.58(0.03) 1.59(0.07) 1.57(0.15) 1.34(0.33) 1.36(0.09) 1.34(0.09) 1.40(0.11) 1.36(0.05) 1.37(0.05) 1.33(0.06) 1.36(0.11) 1.30(0.09) 1.33(0.05) 1.45(0.19) 1.51(0.09) 1.42(0.18) 1.56(0.21) 1.63(0.07) 1.66(0.05) 1.67(0.04) 1.75(0.13) 1.71(0.10) 1.75(0.04) 1.77(0.07) 1.79(0.12) 1.80(0.09) 1.90(0.11) 1.91(0.05) 1.90(0.12) 2.01(0.13) 2.12(0.15) 2.00(0.15) 1.91(0.16) 1.74(0.26) 1.70(0.32) 1.75(0.18) 1.58(0.19) 1.53(0.17) 1.41(0.23) 1.23(0.22) 1.43(0.44) 1.00(0.47) 0.85(0.20) 1.02(0.28) 1.09(0.09) 1.24(0.15) 1.18(0.15) 1.21(0.11) +++ Max displacement in automask = 2.12 (mm) at sub-brick 219 +++ Max delta displ in automask = 0.48 (mm) at sub-brick 19 +++ Wrote dataset to disk in ./rm.epi.volreg.r01+orig.BRIK +3dcalc -overwrite -a pb01.sub_03.r01.tshift+orig -expr 1 -prefix rm.epi.all1 +++ 3dcalc: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: A cast of thousands +*+ WARNING: input 'a' is not used in the expression +cat_matvec -ONELINE sub-03_ses-retest_T1w_ns+tlrc::WARP_DATA -I sub-03_ses-retest_T1w_al_junk_mat.aff12.1D -I mat.r01.vr.aff12.1D +3dAllineate -base sub-03_ses-retest_T1w_ns+tlrc -input pb01.sub_03.r01.tshift+orig -1Dmatrix_apply mat.r01.warp.aff12.1D -mast_dxyz 4 -prefix rm.epi.nomask.r01 +++ 3dAllineate: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: Zhark the Registrator +*+ WARNING: If you are performing spatial transformations on an oblique dset, + such as ./pb01.sub_03.r01.tshift+orig.BRIK, + or viewing/combining it with volumes of differing obliquity, + you should consider running: + 3dWarp -deoblique + on this and other oblique datasets in the same session. + See 3dWarp -help for details. +++ Oblique dataset:./pb01.sub_03.r01.tshift+orig.BRIK is 4.947676 degrees from plumb. +++ Source dataset: ./pb01.sub_03.r01.tshift+orig.HEAD +++ Base dataset: ./sub-03_ses-retest_T1w_ns+tlrc.HEAD +++ Loading datasets +++ NOTE: base and source coordinate systems have different handedness + + Orientations: base=Right handed (LPI); source=Left handed (RPI) +++ master dataset for output = base +++ changing output grid spacing to 4.0000 mm +++ OpenMP thread count = 4 +++ ========== Applying transformation to 237 sub-bricks ========== +volume 0..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..65..66..67..68..69..70..71..72..73..74..75..76..77..78..79..80..81..82..83..84..85..86..87..88..89..90..91..92..93..94..95..96..97..98..99..100..101..102..103..104..105..106..107..108..109..110..111..112..113..114..115..116..117..118..119..120..121..122..123..124..125..126..127..128..129..130..131..132..133..134..135..136..137..138..139..140..141..142..143..144..145..146..147..148..149..150..151..152..153..154..155..156..157..158..159..160..161..162..163..164..165..166..167..168..169..170..171..172..173..174..175..176..177..178..179..180..181..182..183..184..185..186..187..188..189..190..191..192..193..194..195..196..197..198..199..200..201..202..203..204..205..206..207..208..209..210..211..212..213..214..215..216..217..218..219..220..221..222..223..224..225..226..227..228..229..230..231..232..233..234..235..236Ø++ Output dataset ./rm.epi.nomask.r01+tlrc.BRIK +++ 3dAllineate: total CPU time = 6.1 sec Elapsed = 3.9 +++ ########################################################### +3dAllineate -base sub-03_ses-retest_T1w_ns+tlrc -input rm.epi.all1+orig -1Dmatrix_apply mat.r01.warp.aff12.1D -mast_dxyz 4 -final NN -quiet -prefix rm.epi.1.r01 +++ 3dAllineate: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: Zhark the Registrator +*+ WARNING: If you are performing spatial transformations on an oblique dset, + such as ./rm.epi.all1+orig.BRIK, + or viewing/combining it with volumes of differing obliquity, + you should consider running: + 3dWarp -deoblique + on this and other oblique datasets in the same session. + See 3dWarp -help for details. +++ Oblique dataset:./rm.epi.all1+orig.BRIK is 4.947676 degrees from plumb. +++ NOTE: base and source coordinate systems have different handedness + + Orientations: base=Right handed (LPI); source=Left handed (RPI) +++ 3dAllineate: total CPU time = 3.6 sec Elapsed = 3.2 +3dTstat -min -prefix rm.epi.min.r01 rm.epi.1.r01+tlrc +++ 3dTstat: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: KR Hammett & RW Cox +end +cat dfile.r01.1D +3dcopy rm.epi.min.r01+tlrc mask_epi_extents +++ 3dcopy: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +foreach run ( 01 ) +3dcalc -a rm.epi.nomask.r01+tlrc -b mask_epi_extents+tlrc -expr a*b -prefix pb02.sub_03.r01.volreg +++ 3dcalc: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: A cast of thousands +++ Output dataset ./pb02.sub_03.r01.volreg+tlrc.BRIK +end +cat_matvec -ONELINE sub-03_ses-retest_T1w_ns+tlrc::WARP_DATA -I sub-03_ses-retest_T1w_al_junk_mat.aff12.1D -I +3dAllineate -base sub-03_ses-retest_T1w_ns+tlrc -input vr_base+orig -1Dmatrix_apply mat.basewarp.aff12.1D -mast_dxyz 4 -prefix final_epi_vr_base +++ 3dAllineate: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: Zhark the Registrator +*+ WARNING: If you are performing spatial transformations on an oblique dset, + such as ./vr_base+orig.BRIK, + or viewing/combining it with volumes of differing obliquity, + you should consider running: + 3dWarp -deoblique + on this and other oblique datasets in the same session. + See 3dWarp -help for details. +++ Oblique dataset:./vr_base+orig.BRIK is 4.947676 degrees from plumb. +++ Source dataset: ./vr_base+orig.HEAD +++ Base dataset: ./sub-03_ses-retest_T1w_ns+tlrc.HEAD +++ Loading datasets +++ NOTE: base and source coordinate systems have different handedness + + Orientations: base=Right handed (LPI); source=Left handed (RPI) +++ master dataset for output = base +++ changing output grid spacing to 4.0000 mm +++ OpenMP thread count = 4 +++ ========== Applying transformation to 1 sub-bricks ========== +volume 0Ø++ Output dataset ./final_epi_vr_base+tlrc.BRIK +++ 3dAllineate: total CPU time = 0.0 sec Elapsed = 0.1 +++ ########################################################### +3dcopy sub-03_ses-retest_T1w_ns+tlrc anat_final.sub_03 +++ 3dcopy: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +3dAllineate -base final_epi_vr_base+tlrc -allcostX -input anat_final.sub_03+tlrc +tee out.allcostX.txt +++ 3dAllineate: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: Zhark the Registrator +++ Source dataset: ./anat_final.sub_03+tlrc.HEAD +++ Base dataset: ./final_epi_vr_base+tlrc.HEAD +++ Loading datasets +++ 222503 voxels in source_automask+0 +++ Zero-pad: xbot=1 xtop=2 +++ Zero-pad: ybot=0 ytop=1 +++ Zero-pad: zbot=2 ztop=1 +++ Computing -autobox +++ 113307 voxels [89.4%] in weight mask +++ Number of points for matching = 53254 +++ Local correlation: blok type = 'RHDD(14.76)' +*+ WARNING: No output dataset will be calculated +++ OpenMP thread count = 4 +volume 0Ø + initial Parameters = 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 1.0000 1.0000 0.0000 0.0000 0.0000 +++ allcost output: init #0 + ls = 0.183506 + sp = 0.306723 + mi = -0.532442 + crM = 0.0787207 + nmi = 0.868505 + je = 3.51671 + hel = -0.106397 + crA = 0.281314 + crU = 0.301726 + lss = 0.816494 + lpc = 0.300018 + lpa = 0.699982 + lpc+ = 0.497814 + ncd = 1 +++ 3dAllineate: total CPU time = 0.3 sec Elapsed = 0.4 +++ ########################################################### +3dAllineate -source sub-03_ses-retest_T1w+orig -master anat_final.sub_03+tlrc -final wsinc5 -1Dmatrix_apply warp.anat.Xat.1D -prefix anat_w_skull_warped +++ 3dAllineate: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: Zhark the Registrator +*+ WARNING: If you are performing spatial transformations on an oblique dset, + such as ./sub-03_ses-retest_T1w+orig.BRIK, + or viewing/combining it with volumes of differing obliquity, + you should consider running: + 3dWarp -deoblique + on this and other oblique datasets in the same session. + See 3dWarp -help for details. +++ Oblique dataset:./sub-03_ses-retest_T1w+orig.BRIK is 7.491219 degrees from plumb. +++ -1Dmatrix_apply: converting input 3x4 array to 1 row of 12 numbers +++ Source dataset: ./sub-03_ses-retest_T1w+orig.HEAD +++ Base dataset: (not given) +++ Loading datasets +++ OpenMP thread count = 4 +++ ========== Applying transformation to 1 sub-bricks ========== +volume 0Ø++ wsinc5 interpolation setup: + + taper function = Min sidelobe 3 term + + taper cut point = 0.000 + + window radius = 5 voxels + + window shape = Cubical + + The above can be altered via the AFNI_WSINC5_* environment variables. + + (To avoid this message, 'setenv AFNI_WSINC5_SILENT YES'.) + + wsinc5 CUBE(5) mask has 1000 points +++ Output dataset ./anat_w_skull_warped+tlrc.BRIK +++ 3dAllineate: total CPU time = 3.2 sec Elapsed = 1.3 +++ ########################################################### +foreach run ( 01 ) +3dmerge -1blur_fwhm 6.0 -doall -prefix pb03.sub_03.r01.blur pb02.sub_03.r01.volreg+tlrc +++ 3dmerge: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ default -1dindex = 0 +++ default -1tindex = 1 +Program 3dmerge +3dmerge: edit and combine 3D datasets, by RW Cox +++ editing input dataset in memory (49.4 MB) +.............................................................................................................................................................................................................................................-- Wrote edited dataset: ./pb03.sub_03.r01.blur+tlrc.BRIK + +end +foreach run ( 01 ) +3dAutomask -dilate 1 -prefix rm.mask_r01 pb03.sub_03.r01.blur+tlrc +++ 3dAutomask: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: Emperor Zhark +++ Loading dataset pb03.sub_03.r01.blur+tlrc +++ Forming automask + + Fixed clip level = 697.172363 + + Used gradual clip level = 616.337708 .. 741.789307 + + Number voxels above clip level = 28281 + + Clustering voxels ... + + Largest cluster has 28280 voxels + + Clustering voxels ... + + Largest cluster has 28217 voxels + + Filled 55 voxels in small holes; now have 28272 voxels + + Clustering voxels ... + + Largest cluster has 28272 voxels + + Clustering non-brain voxels ... + + Clustering voxels ... + + Largest cluster has 81078 voxels + + Mask now has 28272 voxels +++ Dilating automask + + Clustering voxels ... + + Largest cluster has 76021 voxels +++ 33329 voxels in the mask [out of 109350: 30.48%] +++ first 4 x-planes are zero [from L] +++ last 3 x-planes are zero [from R] +++ first 4 y-planes are zero [from P] +++ last 2 y-planes are zero [from A] +++ first 3 z-planes are zero [from I] +++ last 3 z-planes are zero [from S] +++ CPU time = 0.270000 sec +end +3dmask_tool -inputs rm.mask_r01+tlrc.HEAD -union -prefix full_mask.sub_03 +++ processing 1 input datasets... +++ padding all datasets by 0 (for dilations) +++ frac 0 over 1 volumes gives min count 0 +++ voxel limits: 0 clipped, 33329 survived, 76021 were zero +++ writing result full_mask.sub_03... +3dresample -master full_mask.sub_03+tlrc -input sub-03_ses-retest_T1w_ns+tlrc -prefix rm.resam.anat +3dmask_tool -dilate_input 5 -5 -fill_holes -input rm.resam.anat+tlrc -prefix mask_anat.sub_03 +++ no -frac option: defaulting to -union +++ processing 1 input datasets... +++ padding all datasets by 5 (for dilations) +++ frac 0 over 1 volumes gives min count 0 +++ voxel limits: 0 clipped, 30574 survived, 78776 were zero +++ filled 0 holes (0 voxels) +++ writing result mask_anat.sub_03... +3dABoverlap -no_automask full_mask.sub_03+tlrc mask_anat.sub_03+tlrc +tee out.mask_ae_overlap.txt +++ 3dOverlap: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +#A=./full_mask.sub_03+tlrc.BRIK B=./mask_anat.sub_03+tlrc.BRIK +#A #B #(A uni B) #(A int B) #(A \ B) #(B \ A) %(A \ B) %(B \ A) Rx(B/A) Ry(B/A) Rz(B/A) +33329 30574 35778 28125 5204 2449 15.6140 8.0101 0.9411 0.9238 0.9653 +3ddot -dodice full_mask.sub_03+tlrc mask_anat.sub_03+tlrc +tee out.mask_ae_dice.txt +0.88024 +3dresample -master full_mask.sub_03+tlrc -prefix ./rm.resam.group -input /Users/mli/abin/MNI_avg152T1+tlrc +3dmask_tool -dilate_input 5 -5 -fill_holes -input rm.resam.group+tlrc -prefix mask_group +++ no -frac option: defaulting to -union +++ processing 1 input datasets... +++ padding all datasets by 5 (for dilations) +++ frac 0 over 1 volumes gives min count 0 +++ voxel limits: 0 clipped, 30980 survived, 78370 were zero +++ filled 0 holes (0 voxels) +++ writing result mask_group... +foreach run ( 01 ) +3dTstat -prefix rm.mean_r01 pb03.sub_03.r01.blur+tlrc +++ 3dTstat: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: KR Hammett & RW Cox +++ Output dataset ./rm.mean_r01+tlrc.BRIK +3dcalc -a pb03.sub_03.r01.blur+tlrc -b rm.mean_r01+tlrc -c mask_epi_extents+tlrc -expr c * min(200, a/b*100)*step(a)*step(b) -prefix pb04.sub_03.r01.scale +++ 3dcalc: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: A cast of thousands +++ Output dataset ./pb04.sub_03.r01.scale+tlrc.BRIK +end +1d_tool.py -infile dfile_rall.1D -set_nruns 1 -demean -write motion_demean.1D +1d_tool.py -infile dfile_rall.1D -set_nruns 1 -derivative -demean -write motion_deriv.1D +1d_tool.py -infile dfile_rall.1D -set_nruns 1 -show_censor_count -censor_prev_TR -censor_motion 0.5 motion_sub_03 +total number of censored TRs (simple form) = 0 +set ktrs = `1d_tool.py -infile motion_${subj}_censor.1D + -show_trs_uncensored encoded` +1d_tool.py -infile motion_sub_03_censor.1D -show_trs_uncensored encoded +3dDeconvolve -input pb04.sub_03.r01.scale+tlrc.HEAD -censor motion_sub_03_censor.1D -polort 4 -num_stimts 17 -stim_times 1 stimuli/timing_sub-03_ses-retest_Correct_Task.1D GAM -stim_label 1 Correct_Task -stim_times 2 stimuli/timing_sub-03_ses-retest_Incorrect_Task.1D GAM -stim_label 2 Incorrect_Task -stim_times 3 stimuli/timing_sub-03_ses-retest_No_Response_Control.1D GAM -stim_label 3 No_Response_Control -stim_times 4 stimuli/timing_sub-03_ses-retest_No_Response_Task.1D GAM -stim_label 4 No_Response_Task -stim_times 5 stimuli/timing_sub-03_ses-retest_Response_Control.1D GAM -stim_label 5 Response_Control -stim_file 6 motion_demean.1D[0] -stim_base 6 -stim_label 6 roll_01 -stim_file 7 motion_demean.1D[1] -stim_base 7 -stim_label 7 pitch_01 -stim_file 8 motion_demean.1D[2] -stim_base 8 -stim_label 8 yaw_01 -stim_file 9 motion_demean.1D[3] -stim_base 9 -stim_label 9 dS_01 -stim_file 10 motion_demean.1D[4] -stim_base 10 -stim_label 10 dL_01 -stim_file 11 motion_demean.1D[5] -stim_base 11 -stim_label 11 dP_01 -stim_file 12 motion_deriv.1D[0] -stim_base 12 -stim_label 12 roll_02 -stim_file 13 motion_deriv.1D[1] -stim_base 13 -stim_label 13 pitch_02 -stim_file 14 motion_deriv.1D[2] -stim_base 14 -stim_label 14 yaw_02 -stim_file 15 motion_deriv.1D[3] -stim_base 15 -stim_label 15 dS_02 -stim_file 16 motion_deriv.1D[4] -stim_base 16 -stim_label 16 dL_02 -stim_file 17 motion_deriv.1D[5] -stim_base 17 -stim_label 17 dP_02 -gltsym SYM: 0.5*Correct_Task +0.5*Incorrect_Task -Response_Control -glt_label 1 Landmark-Detection -fout -tout -x1D X.xmat.1D -xjpeg X.jpg -x1D_uncensored X.nocensor.xmat.1D -fitts fitts.sub_03 -errts errts.sub_03 -bucket stats.sub_03 +++ 3dDeconvolve: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: B. Douglas Ward, et al. +++ loading dataset pb04.sub_03.r01.scale+tlrc.HEAD +++ STAT automask has 100230 voxels (out of 109350 = 91.7%) +++ Skipping check for initial transients +++ Input polort=4; Longest run=592.5 s; Recommended minimum polort=4 ++ OK ++ +++ -stim_times using TR=2.5 s for stimulus timing conversion +++ -stim_times using TR=2.5 s for any -iresp output datasets +++ [you can alter the -iresp TR via the -TR_times option] +++ ** -stim_times NOTE ** guessing GLOBAL times if 1 time per line; LOCAL otherwise +++ ** GUESSED ** -stim_times 1 using LOCAL times +++ ** GUESSED ** -stim_times 2 using LOCAL times +++ ** GUESSED ** -stim_times 3 using LOCAL times +++ ** GUESSED ** -stim_times 4 using LOCAL times +++ ** GUESSED ** -stim_times 5 using LOCAL times +------------------------------------------------------------ +GLT matrix from 'SYM: 0.5*Correct_Task +0.5*Incorrect_Task -Response_Control': + 0 0 0 0 0 0.5 0.5 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 + +++ Number of time points: 237 (no censoring) + + Number of parameters: 22 [17 baseline ; 5 signal] +++ Memory required for output bricks = 215,638,200 bytes (about 216 million [mega]) +++ Wrote matrix image to file X.jpg +++ Wrote matrix values to file X.xmat.1D +++ ========= Things you can do with the matrix file ========= +++ (a) Linear regression with ARMA(1,1) modeling of serial correlation: + +3dREMLfit -matrix X.xmat.1D -input pb04.sub_03.r01.scale+tlrc.HEAD \ + -fout -tout -Rbuck stats.sub_03_REML -Rvar stats.sub_03_REMLvar \ + -Rfitts fitts.sub_03_REML -Rerrts errts.sub_03_REML -verb + +++ N.B.: 3dREMLfit command above written to file stats.REML_cmd +++ (b) Visualization/analysis of the matrix via ExamineXmat.R +++ (c) Synthesis of sub-model datasets using 3dSynthesize +++ ========================================================== +++ Wrote matrix values to file X.nocensor.xmat.1D +++ ----- Signal+Baseline matrix condition [X] (237x22): 5.15025 ++ VERY GOOD ++ +++ ----- Signal-only matrix condition [X] (237x5): 1.40108 ++ VERY GOOD ++ +++ ----- Baseline-only matrix condition [X] (237x17): 5.05637 ++ VERY GOOD ++ +++ ----- stim_base-only matrix condition [X] (237x12): 3.89229 ++ VERY GOOD ++ +++ ----- polort-only matrix condition [X] (237x5): 1.01409 ++ VERY GOOD ++ +++ +++++ Matrix inverse average error = 2.52458e-15 ++ VERY GOOD ++ +++ Matrix setup time = 0.64 s +++ Calculations starting; elapsed time=1.336 +++ voxel loop:0123456789.0123456789.0123456789.0123456789.0123456789. +++ Calculations finished; elapsed time=16.363 +++ Smallest FDR q [0 Full_Fstat] = 8.19701e-14 +++ Smallest FDR q [2 Correct_Task#0_Tstat] = 5.99871e-13 +++ Smallest FDR q [3 Correct_Task_Fstat] = 5.99903e-13 +++ Smallest FDR q [5 Incorrect_Task#0_Tstat] = 9.32686e-06 +++ Smallest FDR q [6 Incorrect_Task_Fstat] = 9.32779e-06 +++ Smallest FDR q [8 No_Response_Control#0_Tstat] = 0.000445298 +++ Smallest FDR q [9 No_Response_Control_Fstat] = 0.000445278 +++ Smallest FDR q [11 No_Response_Task#0_Tstat] = 0.000323183 +++ Smallest FDR q [12 No_Response_Task_Fstat] = 0.000323173 +++ Smallest FDR q [14 Response_Control#0_Tstat] = 2.49688e-13 +++ Smallest FDR q [15 Response_Control_Fstat] = 2.49674e-13 +++ Smallest FDR q [17 Landmark-Detection_GLT#0_Tstat] = 0.0019913 +++ Smallest FDR q [18 Landmark-Detection_GLT_Fstat] = 0.00199136 +++ Wrote bucket dataset into ./stats.sub_03+tlrc.BRIK + + created 13 FDR curves in bucket header +++ Wrote 3D+time dataset into ./fitts.sub_03+tlrc.BRIK +++ Wrote 3D+time dataset into ./errts.sub_03+tlrc.BRIK +++ #Flops=4.33688e+10 Average Dot Product=37.4925 +if ( 0 != 0 ) then +1d_tool.py -show_cormat_warnings -infile X.xmat.1D +tee out.cormat_warn.txt + +Warnings regarding Correlation Matrix: X.xmat.1D + + severity correlation cosine regressor pair + -------- ----------- ------ ---------------------------------------- + medium: 0.447 0.539 ( 5 vs. 6) Correct_Task#0 vs. Incorrect_Task#0 + +3dTcat -prefix all_runs.sub_03 pb04.sub_03.r01.scale+tlrc.HEAD +++ 3dTcat: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ elapsed time = 0.3 s +3dTstat -mean -prefix rm.signal.all all_runs.sub_03+tlrc[0..236] +++ 3dTstat: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: KR Hammett & RW Cox +++ Output dataset ./rm.signal.all+tlrc.BRIK +3dTstat -stdev -prefix rm.noise.all errts.sub_03+tlrc[0..236] +++ 3dTstat: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: KR Hammett & RW Cox +++ Output dataset ./rm.noise.all+tlrc.BRIK +3dcalc -a rm.signal.all+tlrc -b rm.noise.all+tlrc -c full_mask.sub_03+tlrc -expr c*a/b -prefix TSNR.sub_03 +++ 3dcalc: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: A cast of thousands +++ Output dataset ./TSNR.sub_03+tlrc.BRIK +3dTnorm -norm2 -prefix rm.errts.unit errts.sub_03+tlrc +++ 3dTnorm: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: RW Cox +++ Output dataset ./rm.errts.unit+tlrc.BRIK +3dmaskave -quiet -mask full_mask.sub_03+tlrc rm.errts.unit+tlrc +++ 3dmaskave: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] ++++ 33329 voxels survive the mask +3dTstat -sos -prefix - gmean.errts.unit.1D' +++ 3dTstat: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: KR Hammett & RW Cox +*+ WARNING: Input dataset is not 3D+time; assuming TR=1.0 +echo -- GCOR = `cat out.gcor.1D` +cat out.gcor.1D +-- GCOR = 0.123131 +3dcalc -a rm.errts.unit+tlrc -b gmean.errts.unit.1D -expr a*b -prefix rm.DP +++ 3dcalc: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: A cast of thousands +++ Output dataset ./rm.DP+tlrc.BRIK +3dTstat -sum -prefix corr_brain rm.DP+tlrc +++ 3dTstat: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: KR Hammett & RW Cox +++ Output dataset ./corr_brain+tlrc.BRIK +1dcat X.nocensor.xmat.1D[5] +1dcat X.nocensor.xmat.1D[6] +1dcat X.nocensor.xmat.1D[7] +1dcat X.nocensor.xmat.1D[8] +1dcat X.nocensor.xmat.1D[9] +set reg_cols = `1d_tool.py -infile X.nocensor.xmat.1D -show_indices_interest` +1d_tool.py -infile X.nocensor.xmat.1D -show_indices_interest +3dTstat -sum -prefix sum_ideal.1D X.nocensor.xmat.1D[5..9] +++ 3dTstat: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: KR Hammett & RW Cox +*+ WARNING: Input dataset is not 3D+time; assuming TR=1.0 +++ Output dataset ./sum_ideal.1D +1dcat X.nocensor.xmat.1D[5..9] +touch blur_est.sub_03.1D +mkdir files_ACF +touch blur.epits.1D +foreach run ( 01 ) +set trs = `1d_tool.py -infile X.xmat.1D -show_trs_uncensored encoded + -show_trs_run $run` +1d_tool.py -infile X.xmat.1D -show_trs_uncensored encoded -show_trs_run 01 +if ( 0..236 == ) continue +3dFWHMx -detrend -mask full_mask.sub_03+tlrc -ACF files_ACF/out.3dFWHMx.ACF.epits.r01.1D all_runs.sub_03+tlrc[0..236] +++ 3dFWHMx: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: The Bob +++ Number of voxels in mask = 33329 +*+ WARNING: removed 218 voxels from mask because they are constant in time +++ detrending start: 17 baseline funcs, 237 time points + + detrending done (2.83 CPU s thus far) +++ start ACF calculations out to radius = 28.17 mm + + ACF done (66.11 CPU s thus far) +++ ACF 1D file [radius ACF mixed_model gaussian_NEWmodel] written to files_ACF/out.3dFWHMx.ACF.epits.r01.1D +++ 1dplot: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: RWC et al. + + and 1dplot-ed to file files_ACF/out.3dFWHMx.ACF.epits.r01.1D.png +end +set blurs = ( `3dTstat -mean -prefix - blur.epits.1D'{0..$(2)}'\'` ) +3dTstat -mean -prefix - blur.epits.1D{0..$(2)}' +++ 3dTstat: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: KR Hammett & RW Cox +*+ WARNING: Input dataset has 1 sub-brick ==> -tdiff is turned off +*+ WARNING: Input dataset is not 3D+time; assuming TR=1.0 +echo average epits FWHM blurs: 0 0 0 0 +average epits FWHM blurs: 0 0 0 0 +echo 0 0 0 0 # epits FWHM blur estimates +set blurs = ( `3dTstat -mean -prefix - blur.epits.1D'{1..$(2)}'\'` ) +3dTstat -mean -prefix - blur.epits.1D{1..$(2)}' +++ 3dTstat: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: KR Hammett & RW Cox +*+ WARNING: Input dataset has 1 sub-brick ==> -tdiff is turned off +*+ WARNING: Input dataset is not 3D+time; assuming TR=1.0 +echo average epits ACF blurs: 0.595014 5.44304 12.6085 13.8182 +average epits ACF blurs: 0.595014 5.44304 12.6085 13.8182 +echo 0.595014 5.44304 12.6085 13.8182 # epits ACF blur estimates +touch blur.errts.1D +foreach run ( 01 ) +set trs = `1d_tool.py -infile X.xmat.1D -show_trs_uncensored encoded + -show_trs_run $run` +1d_tool.py -infile X.xmat.1D -show_trs_uncensored encoded -show_trs_run 01 +if ( 0..236 == ) continue +3dFWHMx -detrend -mask full_mask.sub_03+tlrc -ACF files_ACF/out.3dFWHMx.ACF.errts.r01.1D errts.sub_03+tlrc[0..236] +++ 3dFWHMx: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: The Bob +++ Number of voxels in mask = 33329 +*+ WARNING: removed 218 voxels from mask because they are constant in time +++ detrending start: 17 baseline funcs, 237 time points + + detrending done (2.86 CPU s thus far) +++ start ACF calculations out to radius = 27.61 mm + + ACF done (64.28 CPU s thus far) +++ ACF 1D file [radius ACF mixed_model gaussian_NEWmodel] written to files_ACF/out.3dFWHMx.ACF.errts.r01.1D +++ 1dplot: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: RWC et al. + + and 1dplot-ed to file files_ACF/out.3dFWHMx.ACF.errts.r01.1D.png +end +set blurs = ( `3dTstat -mean -prefix - blur.errts.1D'{0..$(2)}'\'` ) +3dTstat -mean -prefix - blur.errts.1D{0..$(2)}' +++ 3dTstat: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: KR Hammett & RW Cox +*+ WARNING: Input dataset has 1 sub-brick ==> -tdiff is turned off +*+ WARNING: Input dataset is not 3D+time; assuming TR=1.0 +echo average errts FWHM blurs: 0 0 0 0 +average errts FWHM blurs: 0 0 0 0 +echo 0 0 0 0 # errts FWHM blur estimates +set blurs = ( `3dTstat -mean -prefix - blur.errts.1D'{1..$(2)}'\'` ) +3dTstat -mean -prefix - blur.errts.1D{1..$(2)}' +++ 3dTstat: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: KR Hammett & RW Cox +*+ WARNING: Input dataset has 1 sub-brick ==> -tdiff is turned off +*+ WARNING: Input dataset is not 3D+time; assuming TR=1.0 +echo average errts ACF blurs: 0.677865 5.3313 12.8334 13.3773 +average errts ACF blurs: 0.677865 5.3313 12.8334 13.3773 +echo 0.677865 5.3313 12.8334 13.3773 # errts ACF blur estimates +gen_epi_review.py -script @epi_review.sub_03 -dsets pb00.sub_03.r01.tcat+orig.HEAD +gen_ss_review_scripts.py -mot_limit 0.5 -exit0 +++ writing ss review basic: @ss_review_basic +++ writing ss review driver: @ss_review_driver +++ writing ss review drive commands: @ss_review_driver_commands +rm -f rm.DP+tlrc.BRIK rm.DP+tlrc.HEAD rm.epi.1.r01+tlrc.BRIK.gz rm.epi.1.r01+tlrc.HEAD rm.epi.all1+orig.BRIK.gz rm.epi.all1+orig.HEAD rm.epi.min.r01+tlrc.BRIK.gz rm.epi.min.r01+tlrc.HEAD rm.epi.nomask.r01+tlrc.BRIK rm.epi.nomask.r01+tlrc.HEAD rm.epi.volreg.r01+orig.BRIK rm.epi.volreg.r01+orig.HEAD rm.errts.unit+tlrc.BRIK rm.errts.unit+tlrc.HEAD rm.mask_r01+tlrc.BRIK.gz rm.mask_r01+tlrc.HEAD rm.mean_r01+tlrc.BRIK rm.mean_r01+tlrc.HEAD rm.noise.all+tlrc.BRIK rm.noise.all+tlrc.HEAD rm.resam.anat+tlrc.BRIK rm.resam.anat+tlrc.HEAD rm.resam.group+tlrc.BRIK rm.resam.group+tlrc.HEAD rm.signal.all+tlrc.BRIK rm.signal.all+tlrc.HEAD +tee out.ss_review.sub_03.txt +if ( -e @ss_review_basic ) ./@ss_review_basic +./@ss_review_basic + +subject ID : sub_03 +TRs removed (per run) : 1 +num stim classes provided : 5 +final anatomy dset : anat_final.sub_03+tlrc.HEAD +final stats dset : stats.sub_03+tlrc.HEAD +final voxel resolution : 4.000000 4.000000 4.000000 + +motion limit : 0.5 +num TRs above mot limit : 0 +average motion (per TR) : 0.0785451 +average censored motion : 0.0785451 +max motion displacement : 1.72403 +max censored displacement : 1.72403 +outlier limit : 0.1 +average outlier frac (TR) : 0.0019311 +num TRs above out limit : 0 + +num runs found : 1 +num TRs per run : 237 +num TRs per run (applied) : 237 +num TRs per run (censored): 0 +fraction censored per run : 0 +TRs total (uncensored) : 237 +TRs total : 237 +degrees of freedom used : 22 +degrees of freedom left : 215 + +TRs censored : 0 +censor fraction : 0.000000 +num regs of interest : 5 +num TRs per stim (orig) : 78 56 46 19 79 +num TRs censored per stim : 0 0 0 0 0 +fraction TRs censored : 0.000 0.000 0.000 0.000 0.000 +ave mot per sresp (orig) : 0.074047 0.073782 0.065246 0.067506 0.063698 +ave mot per sresp (cens) : 0.074047 0.073782 0.065246 0.067506 0.063698 + +TSNR average : 254.187 +global correlation (GCOR) : 0.123131 +anat/EPI mask Dice coef : 0.88024 +maximum F-stat (masked) : 82.8417 +blur estimates (ACF) : 0.677865 5.3313 12.8334 +blur estimates (FWHM) : 0 0 0 + + +cd .. +echo execution finished: `date` +date +execution finished: Sat Aug 5 16:09:40 EDT 2017 diff --git a/hw2/Exp-1/subject_results/group.retest/subj.sub_03/proc.sub_03 b/hw2/Exp-1/subject_results/group.retest/subj.sub_03/proc.sub_03 new file mode 100755 index 0000000..14b69d7 --- /dev/null +++ b/hw2/Exp-1/subject_results/group.retest/subj.sub_03/proc.sub_03 @@ -0,0 +1,478 @@ +#!/bin/tcsh -xef + +echo "auto-generated by afni_proc.py, Sat Aug 5 16:05:00 2017" +echo "(version 5.15, April 25, 2017)" +echo "execution started: `date`" + +# execute via : +# tcsh -xef proc.sub_03 |& tee output.proc.sub_03 + +# =========================== auto block: setup ============================ +# script setup + +# take note of the AFNI version +afni -ver + +# check that the current AFNI version is recent enough +afni_history -check_date 23 Sep 2016 +if ( $status ) then + echo "** this script requires newer AFNI binaries (than 23 Sep 2016)" + echo " (consider: @update.afni.binaries -defaults)" + exit +endif + +# the user may specify a single subject to run with +if ( $#argv > 0 ) then + set subj = $argv[1] +else + set subj = sub_03 +endif + +# assign output directory name +set output_dir = $subj.results + +# verify that the results directory does not yet exist +if ( -d $output_dir ) then + echo output dir "$subj.results" already exists + exit +endif + +# set list of runs +set runs = (`count -digits 2 1 1`) + +# create results and stimuli directories +mkdir $output_dir +mkdir $output_dir/stimuli + +# copy stim files into stimulus directory +cp /Users/mli/Desktop/playground/timing_sub-03_ses-retest_Correct_Task.1D \ + /Users/mli/Desktop/playground/timing_sub-03_ses-retest_Incorrect_Task.1D \ + /Users/mli/Desktop/playground/timing_sub-03_ses-retest_No_Response_Control.1D \ + /Users/mli/Desktop/playground/timing_sub-03_ses-retest_No_Response_Task.1D \ + /Users/mli/Desktop/playground/timing_sub-03_ses-retest_Response_Control.1D \ + $output_dir/stimuli + +# copy anatomy to results dir +3dcopy \ + /Users/mli/Desktop/playground/sub-03/ses-retest/anat/sub-03_ses-retest_T1w.nii.gz \ + $output_dir/sub-03_ses-retest_T1w + +# ============================ auto block: tcat ============================ +# apply 3dTcat to copy input dsets to results dir, while +# removing the first 1 TRs +3dTcat -prefix $output_dir/pb00.$subj.r01.tcat \ + /Users/mli/Desktop/playground/sub-03/ses-retest/func/sub-03_ses-retest_task-linebisection_bold.nii.gz'[1..$]' + +# and make note of repetitions (TRs) per run +set tr_counts = ( 237 ) + +# ------------------------------------------------------- +# enter the results directory (can begin processing data) +cd $output_dir + + +# ========================== auto block: outcount ========================== +# data check: compute outlier fraction for each volume +touch out.pre_ss_warn.txt +foreach run ( $runs ) + 3dToutcount -automask -fraction -polort 4 -legendre \ + pb00.$subj.r$run.tcat+orig > outcount.r$run.1D + + # outliers at TR 0 might suggest pre-steady state TRs + if ( `1deval -a outcount.r$run.1D"{0}" -expr "step(a-0.4)"` ) then + echo "** TR #0 outliers: possible pre-steady state TRs in run $run" \ + >> out.pre_ss_warn.txt + endif +end + +# catenate outlier counts into a single time series +cat outcount.r*.1D > outcount_rall.1D + +# ================================= tshift ================================= +# time shift data so all slice timing is the same +foreach run ( $runs ) + 3dTshift -tzero 0 -quintic -prefix pb01.$subj.r$run.tshift \ + -tpattern alt+z \ + pb00.$subj.r$run.tcat+orig +end + +# -------------------------------- +# extract volreg registration base +3dbucket -prefix vr_base pb01.$subj.r01.tshift+orig"[2]" + +# ================================= align ================================== +# for e2a: compute anat alignment transformation to EPI registration base +# (new anat will be intermediate, stripped, sub-03_ses-retest_T1w_ns+orig) +align_epi_anat.py -anat2epi -anat sub-03_ses-retest_T1w+orig \ + -save_skullstrip -suffix _al_junk \ + -epi vr_base+orig -epi_base 0 \ + -epi_strip 3dAutomask \ + -volreg off -tshift off + +# ================================== tlrc ================================== +# warp anatomy to standard space +@auto_tlrc -base MNI_avg152T1+tlrc -input sub-03_ses-retest_T1w_ns+orig -no_ss + +# store forward transformation matrix in a text file +cat_matvec sub-03_ses-retest_T1w_ns+tlrc::WARP_DATA -I > warp.anat.Xat.1D + +# ================================= volreg ================================= +# align each dset to base volume, align to anat, warp to tlrc space + +# verify that we have a +tlrc warp dataset +if ( ! -f sub-03_ses-retest_T1w_ns+tlrc.HEAD ) then + echo "** missing +tlrc warp dataset: sub-03_ses-retest_T1w_ns+tlrc.HEAD" + exit +endif + +# register and warp +foreach run ( $runs ) + # register each volume to the base + 3dvolreg -verbose -zpad 1 -base vr_base+orig \ + -1Dfile dfile.r$run.1D -prefix rm.epi.volreg.r$run \ + -cubic \ + -1Dmatrix_save mat.r$run.vr.aff12.1D \ + pb01.$subj.r$run.tshift+orig + + # create an all-1 dataset to mask the extents of the warp + 3dcalc -overwrite -a pb01.$subj.r$run.tshift+orig -expr 1 \ + -prefix rm.epi.all1 + + # catenate volreg/epi2anat/tlrc xforms + cat_matvec -ONELINE \ + sub-03_ses-retest_T1w_ns+tlrc::WARP_DATA -I \ + sub-03_ses-retest_T1w_al_junk_mat.aff12.1D -I \ + mat.r$run.vr.aff12.1D > mat.r$run.warp.aff12.1D + + # apply catenated xform: volreg/epi2anat/tlrc + 3dAllineate -base sub-03_ses-retest_T1w_ns+tlrc \ + -input pb01.$subj.r$run.tshift+orig \ + -1Dmatrix_apply mat.r$run.warp.aff12.1D \ + -mast_dxyz 4 \ + -prefix rm.epi.nomask.r$run + + # warp the all-1 dataset for extents masking + 3dAllineate -base sub-03_ses-retest_T1w_ns+tlrc \ + -input rm.epi.all1+orig \ + -1Dmatrix_apply mat.r$run.warp.aff12.1D \ + -mast_dxyz 4 -final NN -quiet \ + -prefix rm.epi.1.r$run + + # make an extents intersection mask of this run + 3dTstat -min -prefix rm.epi.min.r$run rm.epi.1.r$run+tlrc +end + +# make a single file of registration params +cat dfile.r*.1D > dfile_rall.1D + +# ---------------------------------------- +# create the extents mask: mask_epi_extents+tlrc +# (this is a mask of voxels that have valid data at every TR) +# (only 1 run, so just use 3dcopy to keep naming straight) +3dcopy rm.epi.min.r01+tlrc mask_epi_extents + +# and apply the extents mask to the EPI data +# (delete any time series with missing data) +foreach run ( $runs ) + 3dcalc -a rm.epi.nomask.r$run+tlrc -b mask_epi_extents+tlrc \ + -expr 'a*b' -prefix pb02.$subj.r$run.volreg +end + +# warp the volreg base EPI dataset to make a final version +cat_matvec -ONELINE \ + sub-03_ses-retest_T1w_ns+tlrc::WARP_DATA -I \ + sub-03_ses-retest_T1w_al_junk_mat.aff12.1D -I > \ + mat.basewarp.aff12.1D + +3dAllineate -base sub-03_ses-retest_T1w_ns+tlrc \ + -input vr_base+orig \ + -1Dmatrix_apply mat.basewarp.aff12.1D \ + -mast_dxyz 4 \ + -prefix final_epi_vr_base + +# create an anat_final dataset, aligned with stats +3dcopy sub-03_ses-retest_T1w_ns+tlrc anat_final.$subj + +# record final registration costs +3dAllineate -base final_epi_vr_base+tlrc -allcostX \ + -input anat_final.$subj+tlrc |& tee out.allcostX.txt + +# ----------------------------------------- +# warp anat follower datasets (affine) +3dAllineate -source sub-03_ses-retest_T1w+orig \ + -master anat_final.$subj+tlrc \ + -final wsinc5 -1Dmatrix_apply warp.anat.Xat.1D \ + -prefix anat_w_skull_warped + +# ================================== blur ================================== +# blur each volume of each run +foreach run ( $runs ) + 3dmerge -1blur_fwhm 6.0 -doall -prefix pb03.$subj.r$run.blur \ + pb02.$subj.r$run.volreg+tlrc +end + +# ================================== mask ================================== +# create 'full_mask' dataset (union mask) +foreach run ( $runs ) + 3dAutomask -dilate 1 -prefix rm.mask_r$run pb03.$subj.r$run.blur+tlrc +end + +# create union of inputs, output type is byte +3dmask_tool -inputs rm.mask_r*+tlrc.HEAD -union -prefix full_mask.$subj + +# ---- create subject anatomy mask, mask_anat.$subj+tlrc ---- +# (resampled from tlrc anat) +3dresample -master full_mask.$subj+tlrc -input sub-03_ses-retest_T1w_ns+tlrc \ + -prefix rm.resam.anat + +# convert to binary anat mask; fill gaps and holes +3dmask_tool -dilate_input 5 -5 -fill_holes -input rm.resam.anat+tlrc \ + -prefix mask_anat.$subj + +# compute overlaps between anat and EPI masks +3dABoverlap -no_automask full_mask.$subj+tlrc mask_anat.$subj+tlrc \ + |& tee out.mask_ae_overlap.txt + +# note Dice coefficient of masks, as well +3ddot -dodice full_mask.$subj+tlrc mask_anat.$subj+tlrc \ + |& tee out.mask_ae_dice.txt + +# ---- create group anatomy mask, mask_group+tlrc ---- +# (resampled from tlrc base anat, MNI_avg152T1+tlrc) +3dresample -master full_mask.$subj+tlrc -prefix ./rm.resam.group \ + -input /Users/mli/abin/MNI_avg152T1+tlrc + +# convert to binary group mask; fill gaps and holes +3dmask_tool -dilate_input 5 -5 -fill_holes -input rm.resam.group+tlrc \ + -prefix mask_group + +# ================================= scale ================================== +# scale each voxel time series to have a mean of 100 +# (be sure no negatives creep in) +# (subject to a range of [0,200]) +foreach run ( $runs ) + 3dTstat -prefix rm.mean_r$run pb03.$subj.r$run.blur+tlrc + 3dcalc -a pb03.$subj.r$run.blur+tlrc -b rm.mean_r$run+tlrc \ + -c mask_epi_extents+tlrc \ + -expr 'c * min(200, a/b*100)*step(a)*step(b)' \ + -prefix pb04.$subj.r$run.scale +end + +# ================================ regress ================================= + +# compute de-meaned motion parameters (for use in regression) +1d_tool.py -infile dfile_rall.1D -set_nruns 1 \ + -demean -write motion_demean.1D + +# compute motion parameter derivatives (for use in regression) +1d_tool.py -infile dfile_rall.1D -set_nruns 1 \ + -derivative -demean -write motion_deriv.1D + +# create censor file motion_${subj}_censor.1D, for censoring motion +1d_tool.py -infile dfile_rall.1D -set_nruns 1 \ + -show_censor_count -censor_prev_TR \ + -censor_motion 0.5 motion_${subj} + +# note TRs that were not censored +set ktrs = `1d_tool.py -infile motion_${subj}_censor.1D \ + -show_trs_uncensored encoded` + +# ------------------------------ +# run the regression analysis +3dDeconvolve -input pb04.$subj.r*.scale+tlrc.HEAD \ + -censor motion_${subj}_censor.1D \ + -polort 4 \ + -num_stimts 17 \ + -stim_times 1 stimuli/timing_sub-03_ses-retest_Correct_Task.1D 'GAM' \ + -stim_label 1 Correct_Task \ + -stim_times 2 stimuli/timing_sub-03_ses-retest_Incorrect_Task.1D 'GAM' \ + -stim_label 2 Incorrect_Task \ + -stim_times 3 stimuli/timing_sub-03_ses-retest_No_Response_Control.1D \ + 'GAM' \ + -stim_label 3 No_Response_Control \ + -stim_times 4 stimuli/timing_sub-03_ses-retest_No_Response_Task.1D 'GAM' \ + -stim_label 4 No_Response_Task \ + -stim_times 5 stimuli/timing_sub-03_ses-retest_Response_Control.1D 'GAM' \ + -stim_label 5 Response_Control \ + -stim_file 6 motion_demean.1D'[0]' -stim_base 6 -stim_label 6 roll_01 \ + -stim_file 7 motion_demean.1D'[1]' -stim_base 7 -stim_label 7 pitch_01 \ + -stim_file 8 motion_demean.1D'[2]' -stim_base 8 -stim_label 8 yaw_01 \ + -stim_file 9 motion_demean.1D'[3]' -stim_base 9 -stim_label 9 dS_01 \ + -stim_file 10 motion_demean.1D'[4]' -stim_base 10 -stim_label 10 dL_01 \ + -stim_file 11 motion_demean.1D'[5]' -stim_base 11 -stim_label 11 dP_01 \ + -stim_file 12 motion_deriv.1D'[0]' -stim_base 12 -stim_label 12 roll_02 \ + -stim_file 13 motion_deriv.1D'[1]' -stim_base 13 -stim_label 13 pitch_02 \ + -stim_file 14 motion_deriv.1D'[2]' -stim_base 14 -stim_label 14 yaw_02 \ + -stim_file 15 motion_deriv.1D'[3]' -stim_base 15 -stim_label 15 dS_02 \ + -stim_file 16 motion_deriv.1D'[4]' -stim_base 16 -stim_label 16 dL_02 \ + -stim_file 17 motion_deriv.1D'[5]' -stim_base 17 -stim_label 17 dP_02 \ + -gltsym 'SYM: 0.5*Correct_Task +0.5*Incorrect_Task -Response_Control' \ + -glt_label 1 Landmark-Detection \ + -fout -tout -x1D X.xmat.1D -xjpeg X.jpg \ + -x1D_uncensored X.nocensor.xmat.1D \ + -fitts fitts.$subj \ + -errts errts.${subj} \ + -bucket stats.$subj + + +# if 3dDeconvolve fails, terminate the script +if ( $status != 0 ) then + echo '---------------------------------------' + echo '** 3dDeconvolve error, failing...' + echo ' (consider the file 3dDeconvolve.err)' + exit +endif + + +# display any large pairwise correlations from the X-matrix +1d_tool.py -show_cormat_warnings -infile X.xmat.1D |& tee out.cormat_warn.txt + +# create an all_runs dataset to match the fitts, errts, etc. +3dTcat -prefix all_runs.$subj pb04.$subj.r*.scale+tlrc.HEAD + +# -------------------------------------------------- +# create a temporal signal to noise ratio dataset +# signal: if 'scale' block, mean should be 100 +# noise : compute standard deviation of errts +3dTstat -mean -prefix rm.signal.all all_runs.$subj+tlrc"[$ktrs]" +3dTstat -stdev -prefix rm.noise.all errts.${subj}+tlrc"[$ktrs]" +3dcalc -a rm.signal.all+tlrc \ + -b rm.noise.all+tlrc \ + -c full_mask.$subj+tlrc \ + -expr 'c*a/b' -prefix TSNR.$subj + +# --------------------------------------------------- +# compute and store GCOR (global correlation average) +# (sum of squares of global mean of unit errts) +3dTnorm -norm2 -prefix rm.errts.unit errts.${subj}+tlrc +3dmaskave -quiet -mask full_mask.$subj+tlrc rm.errts.unit+tlrc \ + > gmean.errts.unit.1D +3dTstat -sos -prefix - gmean.errts.unit.1D\' > out.gcor.1D +echo "-- GCOR = `cat out.gcor.1D`" + +# --------------------------------------------------- +# compute correlation volume +# (per voxel: average correlation across masked brain) +# (now just dot product with average unit time series) +3dcalc -a rm.errts.unit+tlrc -b gmean.errts.unit.1D -expr 'a*b' -prefix rm.DP +3dTstat -sum -prefix corr_brain rm.DP+tlrc + +# create ideal files for fixed response stim types +1dcat X.nocensor.xmat.1D'[5]' > ideal_Correct_Task.1D +1dcat X.nocensor.xmat.1D'[6]' > ideal_Incorrect_Task.1D +1dcat X.nocensor.xmat.1D'[7]' > ideal_No_Response_Control.1D +1dcat X.nocensor.xmat.1D'[8]' > ideal_No_Response_Task.1D +1dcat X.nocensor.xmat.1D'[9]' > ideal_Response_Control.1D + +# -------------------------------------------------------- +# compute sum of non-baseline regressors from the X-matrix +# (use 1d_tool.py to get list of regressor colums) +set reg_cols = `1d_tool.py -infile X.nocensor.xmat.1D -show_indices_interest` +3dTstat -sum -prefix sum_ideal.1D X.nocensor.xmat.1D"[$reg_cols]" + +# also, create a stimulus-only X-matrix, for easy review +1dcat X.nocensor.xmat.1D"[$reg_cols]" > X.stim.xmat.1D + +# ============================ blur estimation ============================= +# compute blur estimates +touch blur_est.$subj.1D # start with empty file + +# create directory for ACF curve files +mkdir files_ACF + +# -- estimate blur for each run in epits -- +touch blur.epits.1D + +# restrict to uncensored TRs, per run +foreach run ( $runs ) + set trs = `1d_tool.py -infile X.xmat.1D -show_trs_uncensored encoded \ + -show_trs_run $run` + if ( $trs == "" ) continue + 3dFWHMx -detrend -mask full_mask.$subj+tlrc \ + -ACF files_ACF/out.3dFWHMx.ACF.epits.r$run.1D \ + all_runs.$subj+tlrc"[$trs]" >> blur.epits.1D +end + +# compute average FWHM blur (from every other row) and append +set blurs = ( `3dTstat -mean -prefix - blur.epits.1D'{0..$(2)}'\'` ) +echo average epits FWHM blurs: $blurs +echo "$blurs # epits FWHM blur estimates" >> blur_est.$subj.1D + +# compute average ACF blur (from every other row) and append +set blurs = ( `3dTstat -mean -prefix - blur.epits.1D'{1..$(2)}'\'` ) +echo average epits ACF blurs: $blurs +echo "$blurs # epits ACF blur estimates" >> blur_est.$subj.1D + +# -- estimate blur for each run in errts -- +touch blur.errts.1D + +# restrict to uncensored TRs, per run +foreach run ( $runs ) + set trs = `1d_tool.py -infile X.xmat.1D -show_trs_uncensored encoded \ + -show_trs_run $run` + if ( $trs == "" ) continue + 3dFWHMx -detrend -mask full_mask.$subj+tlrc \ + -ACF files_ACF/out.3dFWHMx.ACF.errts.r$run.1D \ + errts.${subj}+tlrc"[$trs]" >> blur.errts.1D +end + +# compute average FWHM blur (from every other row) and append +set blurs = ( `3dTstat -mean -prefix - blur.errts.1D'{0..$(2)}'\'` ) +echo average errts FWHM blurs: $blurs +echo "$blurs # errts FWHM blur estimates" >> blur_est.$subj.1D + +# compute average ACF blur (from every other row) and append +set blurs = ( `3dTstat -mean -prefix - blur.errts.1D'{1..$(2)}'\'` ) +echo average errts ACF blurs: $blurs +echo "$blurs # errts ACF blur estimates" >> blur_est.$subj.1D + + +# ================== auto block: generate review scripts =================== + +# generate a review script for the unprocessed EPI data +gen_epi_review.py -script @epi_review.$subj \ + -dsets pb00.$subj.r*.tcat+orig.HEAD + +# generate scripts to review single subject results +# (try with defaults, but do not allow bad exit status) +gen_ss_review_scripts.py -mot_limit 0.5 -exit0 + +# ========================== auto block: finalize ========================== + +# remove temporary files +\rm -f rm.* + +# if the basic subject review script is here, run it +# (want this to be the last text output) +if ( -e @ss_review_basic ) ./@ss_review_basic |& tee out.ss_review.$subj.txt + +# return to parent directory +cd .. + +echo "execution finished: `date`" + + + + +# ========================================================================== +# script generated by the command: +# +# afni_proc.py -subj_id sub_03 -script proc.sub_03 -scr_overwrite -blocks \ +# tshift align tlrc volreg blur mask scale regress -copy_anat \ +# /Users/mli/Desktop/playground/sub-03/ses-retest/anat/sub-03_ses-retest_T1w.nii.gz \ +# -tcat_remove_first_trs 1 -tshift_opts_ts -tpattern alt+z -dsets \ +# /Users/mli/Desktop/playground/sub-03/ses-retest/func/sub-03_ses-retest_task-linebisection_bold.nii.gz \ +# -tlrc_base MNI_avg152T1+tlrc -volreg_align_to third -volreg_align_e2a \ +# -volreg_tlrc_warp -blur_size 6.0 -regress_stim_times \ +# /Users/mli/Desktop/playground/timing_sub-03_ses-retest_Correct_Task.1D \ +# /Users/mli/Desktop/playground/timing_sub-03_ses-retest_Incorrect_Task.1D \ +# /Users/mli/Desktop/playground/timing_sub-03_ses-retest_No_Response_Control.1D \ +# /Users/mli/Desktop/playground/timing_sub-03_ses-retest_No_Response_Task.1D \ +# /Users/mli/Desktop/playground/timing_sub-03_ses-retest_Response_Control.1D \ +# -regress_stim_labels Correct_Task Incorrect_Task No_Response_Control \ +# No_Response_Task Response_Control -regress_basis GAM \ +# -regress_censor_motion 0.5 -regress_apply_mot_types demean deriv \ +# -regress_opts_3dD -gltsym 'SYM: 0.5*Correct_Task +0.5*Incorrect_Task \ +# -Response_Control' -glt_label 1 Landmark-Detection \ +# -regress_make_ideal_sum sum_ideal.1D -regress_est_blur_epits \ +# -regress_est_blur_errts -regress_run_clustsim no diff --git a/hw2/Exp-1/subject_results/group.test/subj.sub_03/.orig.cmd.ap.sub_03 b/hw2/Exp-1/subject_results/group.test/subj.sub_03/.orig.cmd.ap.sub_03 new file mode 100755 index 0000000..70784fa --- /dev/null +++ b/hw2/Exp-1/subject_results/group.test/subj.sub_03/.orig.cmd.ap.sub_03 @@ -0,0 +1,48 @@ +#!/usr/bin/env tcsh + +# created by uber_subject.py: version 0.40 (March 30, 2017) +# creation date: Thu Aug 3 22:01:15 2017 + +# set data directories +set top_dir = /Users/monicali/Google-Drive/IBRAIN/playground +set anat_dir = $top_dir/sub-03/ses-test/anat +set epi_dir = $top_dir/sub-03/ses-test/func + +# set subject and group identifiers +set subj = sub_03 +set group_id = test + +# run afni_proc.py to create a single subject processing script +afni_proc.py -subj_id $subj \ + -script proc.$subj -scr_overwrite \ + -blocks tshift align tlrc volreg blur mask scale regress \ + -copy_anat $anat_dir/sub-03_ses-test_T1w.nii.gz \ + -tcat_remove_first_trs 0 \ + -dsets $epi_dir/sub-03_ses-test_task-linebisection_bold.nii.gz \ + -tlrc_base MNI_avg152T1+tlrc \ + -volreg_align_to third \ + -volreg_align_e2a \ + -volreg_tlrc_warp \ + -blur_size 6.0 \ + -regress_stim_times \ + $top_dir/timing_sub-03_ses-test_Correct_Task.1D \ + $top_dir/timing_sub-03_ses-test_Incorrect_Task.1D \ + $top_dir/timing_sub-03_ses-test_No_Response_Control.1D \ + $top_dir/timing_sub-03_ses-test_No_Response_Task.1D \ + $top_dir/timing_sub-03_ses-test_Response_Control.1D \ + -regress_stim_labels \ + Correct_Task Incorrect_Task No_Response_Control No_Response_Task \ + Response_Control \ + -regress_basis 'GAM' \ + -regress_censor_motion 0.3 \ + -regress_censor_outliers 0.5 \ + -regress_apply_mot_types demean deriv \ + -regress_opts_3dD \ + -gltsym 'SYM: 0.333*Correct_Task +0.333*Incorrect_Task \ + +0.333*No_Response_Task -0.5*Response_Control \ + -0.5*No_Response_Control' -glt_label 1 Landmark-Detection \ + -regress_make_ideal_sum sum_ideal.1D \ + -regress_est_blur_epits \ + -regress_est_blur_errts \ + -regress_run_clustsim no + diff --git a/hw2/Exp-1/subject_results/group.test/subj.sub_03/.orig.cmd.usubj.sub_03 b/hw2/Exp-1/subject_results/group.test/subj.sub_03/.orig.cmd.usubj.sub_03 new file mode 100644 index 0000000..8b80dbd --- /dev/null +++ b/hw2/Exp-1/subject_results/group.test/subj.sub_03/.orig.cmd.usubj.sub_03 @@ -0,0 +1,29 @@ +uber_subject.py \ + -cvar subj_dir subject_results/group.test/subj.sub_03 \ + -svar anat \ + /Users/monicali/Google-Drive/IBRAIN/playground/sub-03/ses-test/anat/sub-03_ses-test_T1w.nii.gz \ + \ + -svar blur_size 6.0 \ + -svar epi \ + /Users/monicali/Google-Drive/IBRAIN/playground/sub-03/ses-test/func/sub-03_ses-test_task-linebisection_bold.nii.gz \ + \ + -svar gid test \ + -svar gltsym '0.333*Correct_Task +0.333*Incorrect_Task \ + +0.333*No_Response_Task -0.5*Response_Control -0.5*No_Response_Control' \ + -svar gltsym_label Landmark-Detection \ + -svar outlier_limit 0.5 \ + -svar regress_mot_deriv yes \ + -svar run_clustsim no \ + -svar sid sub_03 \ + -svar stim \ + /Users/monicali/Google-Drive/IBRAIN/playground/timing_sub-03_ses-test_Correct_Task.1D \ + /Users/monicali/Google-Drive/IBRAIN/playground/timing_sub-03_ses-test_Incorrect_Task.1D \ + /Users/monicali/Google-Drive/IBRAIN/playground/timing_sub-03_ses-test_No_Response_Control.1D \ + /Users/monicali/Google-Drive/IBRAIN/playground/timing_sub-03_ses-test_No_Response_Task.1D \ + /Users/monicali/Google-Drive/IBRAIN/playground/timing_sub-03_ses-test_Response_Control.1D \ + \ + -svar stim_basis 'GAM' 'GAM' 'GAM' 'GAM' 'GAM' \ + -svar stim_label Correct_Task Incorrect_Task No_Response_Control \ + No_Response_Task Response_Control \ + -svar stim_type times times times times times \ + -svar tlrc_base MNI_avg152T1+tlrc diff --git a/hw2/Exp-1/subject_results/group.test/subj.sub_03/.orig.proc.sub_03 b/hw2/Exp-1/subject_results/group.test/subj.sub_03/.orig.proc.sub_03 new file mode 100755 index 0000000..bb99a95 --- /dev/null +++ b/hw2/Exp-1/subject_results/group.test/subj.sub_03/.orig.proc.sub_03 @@ -0,0 +1,491 @@ +#!/bin/tcsh -xef + +echo "auto-generated by afni_proc.py, Thu Aug 3 22:01:23 2017" +echo "(version 5.15, April 25, 2017)" +echo "execution started: `date`" + +# execute via : +# tcsh -xef proc.sub_03 |& tee output.proc.sub_03 + +# =========================== auto block: setup ============================ +# script setup + +# take note of the AFNI version +afni -ver + +# check that the current AFNI version is recent enough +afni_history -check_date 23 Sep 2016 +if ( $status ) then + echo "** this script requires newer AFNI binaries (than 23 Sep 2016)" + echo " (consider: @update.afni.binaries -defaults)" + exit +endif + +# the user may specify a single subject to run with +if ( $#argv > 0 ) then + set subj = $argv[1] +else + set subj = sub_03 +endif + +# assign output directory name +set output_dir = $subj.results + +# verify that the results directory does not yet exist +if ( -d $output_dir ) then + echo output dir "$subj.results" already exists + exit +endif + +# set list of runs +set runs = (`count -digits 2 1 1`) + +# create results and stimuli directories +mkdir $output_dir +mkdir $output_dir/stimuli + +# copy stim files into stimulus directory +cp \ + /Users/monicali/Google-Drive/IBRAIN/playground/timing_sub-03_ses-test_Correct_Task.1D \ + /Users/monicali/Google-Drive/IBRAIN/playground/timing_sub-03_ses-test_Incorrect_Task.1D \ + /Users/monicali/Google-Drive/IBRAIN/playground/timing_sub-03_ses-test_No_Response_Control.1D \ + /Users/monicali/Google-Drive/IBRAIN/playground/timing_sub-03_ses-test_No_Response_Task.1D \ + /Users/monicali/Google-Drive/IBRAIN/playground/timing_sub-03_ses-test_Response_Control.1D \ + $output_dir/stimuli + +# copy anatomy to results dir +3dcopy \ + /Users/monicali/Google-Drive/IBRAIN/playground/sub-03/ses-test/anat/sub-03_ses-test_T1w.nii.gz \ + $output_dir/sub-03_ses-test_T1w + +# ============================ auto block: tcat ============================ +# apply 3dTcat to copy input dsets to results dir, while +# removing the first 0 TRs +3dTcat -prefix $output_dir/pb00.$subj.r01.tcat \ + /Users/monicali/Google-Drive/IBRAIN/playground/sub-03/ses-test/func/sub-03_ses-test_task-linebisection_bold.nii.gz'[0..$]' + +# and make note of repetitions (TRs) per run +set tr_counts = ( 238 ) + +# ------------------------------------------------------- +# enter the results directory (can begin processing data) +cd $output_dir + + +# ========================== auto block: outcount ========================== +# data check: compute outlier fraction for each volume +touch out.pre_ss_warn.txt +foreach run ( $runs ) + 3dToutcount -automask -fraction -polort 4 -legendre \ + pb00.$subj.r$run.tcat+orig > outcount.r$run.1D + + # censor outlier TRs per run, ignoring the first 0 TRs + # - censor when more than 0.5 of automask voxels are outliers + # - step() defines which TRs to remove via censoring + 1deval -a outcount.r$run.1D -expr "1-step(a-0.5)" > rm.out.cen.r$run.1D + + # outliers at TR 0 might suggest pre-steady state TRs + if ( `1deval -a outcount.r$run.1D"{0}" -expr "step(a-0.4)"` ) then + echo "** TR #0 outliers: possible pre-steady state TRs in run $run" \ + >> out.pre_ss_warn.txt + endif +end + +# catenate outlier counts into a single time series +cat outcount.r*.1D > outcount_rall.1D + +# catenate outlier censor files into a single time series +cat rm.out.cen.r*.1D > outcount_${subj}_censor.1D + +# ================================= tshift ================================= +# time shift data so all slice timing is the same +foreach run ( $runs ) + 3dTshift -tzero 0 -quintic -prefix pb01.$subj.r$run.tshift \ + pb00.$subj.r$run.tcat+orig +end + +# -------------------------------- +# extract volreg registration base +3dbucket -prefix vr_base pb01.$subj.r01.tshift+orig"[2]" + +# ================================= align ================================== +# for e2a: compute anat alignment transformation to EPI registration base +# (new anat will be intermediate, stripped, sub-03_ses-test_T1w_ns+orig) +align_epi_anat.py -anat2epi -anat sub-03_ses-test_T1w+orig \ + -save_skullstrip -suffix _al_junk \ + -epi vr_base+orig -epi_base 0 \ + -epi_strip 3dAutomask \ + -volreg off -tshift off + +# ================================== tlrc ================================== +# warp anatomy to standard space +@auto_tlrc -base MNI_avg152T1+tlrc -input sub-03_ses-test_T1w_ns+orig -no_ss + +# store forward transformation matrix in a text file +cat_matvec sub-03_ses-test_T1w_ns+tlrc::WARP_DATA -I > warp.anat.Xat.1D + +# ================================= volreg ================================= +# align each dset to base volume, align to anat, warp to tlrc space + +# verify that we have a +tlrc warp dataset +if ( ! -f sub-03_ses-test_T1w_ns+tlrc.HEAD ) then + echo "** missing +tlrc warp dataset: sub-03_ses-test_T1w_ns+tlrc.HEAD" + exit +endif + +# register and warp +foreach run ( $runs ) + # register each volume to the base + 3dvolreg -verbose -zpad 1 -base vr_base+orig \ + -1Dfile dfile.r$run.1D -prefix rm.epi.volreg.r$run \ + -cubic \ + -1Dmatrix_save mat.r$run.vr.aff12.1D \ + pb01.$subj.r$run.tshift+orig + + # create an all-1 dataset to mask the extents of the warp + 3dcalc -overwrite -a pb01.$subj.r$run.tshift+orig -expr 1 \ + -prefix rm.epi.all1 + + # catenate volreg/epi2anat/tlrc xforms + cat_matvec -ONELINE \ + sub-03_ses-test_T1w_ns+tlrc::WARP_DATA -I \ + sub-03_ses-test_T1w_al_junk_mat.aff12.1D -I \ + mat.r$run.vr.aff12.1D > mat.r$run.warp.aff12.1D + + # apply catenated xform: volreg/epi2anat/tlrc + 3dAllineate -base sub-03_ses-test_T1w_ns+tlrc \ + -input pb01.$subj.r$run.tshift+orig \ + -1Dmatrix_apply mat.r$run.warp.aff12.1D \ + -mast_dxyz 4 \ + -prefix rm.epi.nomask.r$run + + # warp the all-1 dataset for extents masking + 3dAllineate -base sub-03_ses-test_T1w_ns+tlrc \ + -input rm.epi.all1+orig \ + -1Dmatrix_apply mat.r$run.warp.aff12.1D \ + -mast_dxyz 4 -final NN -quiet \ + -prefix rm.epi.1.r$run + + # make an extents intersection mask of this run + 3dTstat -min -prefix rm.epi.min.r$run rm.epi.1.r$run+tlrc +end + +# make a single file of registration params +cat dfile.r*.1D > dfile_rall.1D + +# ---------------------------------------- +# create the extents mask: mask_epi_extents+tlrc +# (this is a mask of voxels that have valid data at every TR) +# (only 1 run, so just use 3dcopy to keep naming straight) +3dcopy rm.epi.min.r01+tlrc mask_epi_extents + +# and apply the extents mask to the EPI data +# (delete any time series with missing data) +foreach run ( $runs ) + 3dcalc -a rm.epi.nomask.r$run+tlrc -b mask_epi_extents+tlrc \ + -expr 'a*b' -prefix pb02.$subj.r$run.volreg +end + +# warp the volreg base EPI dataset to make a final version +cat_matvec -ONELINE \ + sub-03_ses-test_T1w_ns+tlrc::WARP_DATA -I \ + sub-03_ses-test_T1w_al_junk_mat.aff12.1D -I > \ + mat.basewarp.aff12.1D + +3dAllineate -base sub-03_ses-test_T1w_ns+tlrc \ + -input vr_base+orig \ + -1Dmatrix_apply mat.basewarp.aff12.1D \ + -mast_dxyz 4 \ + -prefix final_epi_vr_base + +# create an anat_final dataset, aligned with stats +3dcopy sub-03_ses-test_T1w_ns+tlrc anat_final.$subj + +# record final registration costs +3dAllineate -base final_epi_vr_base+tlrc -allcostX \ + -input anat_final.$subj+tlrc |& tee out.allcostX.txt + +# ----------------------------------------- +# warp anat follower datasets (affine) +3dAllineate -source sub-03_ses-test_T1w+orig \ + -master anat_final.$subj+tlrc \ + -final wsinc5 -1Dmatrix_apply warp.anat.Xat.1D \ + -prefix anat_w_skull_warped + +# ================================== blur ================================== +# blur each volume of each run +foreach run ( $runs ) + 3dmerge -1blur_fwhm 6.0 -doall -prefix pb03.$subj.r$run.blur \ + pb02.$subj.r$run.volreg+tlrc +end + +# ================================== mask ================================== +# create 'full_mask' dataset (union mask) +foreach run ( $runs ) + 3dAutomask -dilate 1 -prefix rm.mask_r$run pb03.$subj.r$run.blur+tlrc +end + +# create union of inputs, output type is byte +3dmask_tool -inputs rm.mask_r*+tlrc.HEAD -union -prefix full_mask.$subj + +# ---- create subject anatomy mask, mask_anat.$subj+tlrc ---- +# (resampled from tlrc anat) +3dresample -master full_mask.$subj+tlrc -input sub-03_ses-test_T1w_ns+tlrc \ + -prefix rm.resam.anat + +# convert to binary anat mask; fill gaps and holes +3dmask_tool -dilate_input 5 -5 -fill_holes -input rm.resam.anat+tlrc \ + -prefix mask_anat.$subj + +# compute overlaps between anat and EPI masks +3dABoverlap -no_automask full_mask.$subj+tlrc mask_anat.$subj+tlrc \ + |& tee out.mask_ae_overlap.txt + +# note Dice coefficient of masks, as well +3ddot -dodice full_mask.$subj+tlrc mask_anat.$subj+tlrc \ + |& tee out.mask_ae_dice.txt + +# ---- create group anatomy mask, mask_group+tlrc ---- +# (resampled from tlrc base anat, MNI_avg152T1+tlrc) +3dresample -master full_mask.$subj+tlrc -prefix ./rm.resam.group \ + -input /Users/monicali/abin/MNI_avg152T1+tlrc + +# convert to binary group mask; fill gaps and holes +3dmask_tool -dilate_input 5 -5 -fill_holes -input rm.resam.group+tlrc \ + -prefix mask_group + +# ================================= scale ================================== +# scale each voxel time series to have a mean of 100 +# (be sure no negatives creep in) +# (subject to a range of [0,200]) +foreach run ( $runs ) + 3dTstat -prefix rm.mean_r$run pb03.$subj.r$run.blur+tlrc + 3dcalc -a pb03.$subj.r$run.blur+tlrc -b rm.mean_r$run+tlrc \ + -c mask_epi_extents+tlrc \ + -expr 'c * min(200, a/b*100)*step(a)*step(b)' \ + -prefix pb04.$subj.r$run.scale +end + +# ================================ regress ================================= + +# compute de-meaned motion parameters (for use in regression) +1d_tool.py -infile dfile_rall.1D -set_nruns 1 \ + -demean -write motion_demean.1D + +# compute motion parameter derivatives (for use in regression) +1d_tool.py -infile dfile_rall.1D -set_nruns 1 \ + -derivative -demean -write motion_deriv.1D + +# create censor file motion_${subj}_censor.1D, for censoring motion +1d_tool.py -infile dfile_rall.1D -set_nruns 1 \ + -show_censor_count -censor_prev_TR \ + -censor_motion 0.3 motion_${subj} + +# combine multiple censor files +1deval -a motion_${subj}_censor.1D -b outcount_${subj}_censor.1D \ + -expr "a*b" > censor_${subj}_combined_2.1D + +# note TRs that were not censored +set ktrs = `1d_tool.py -infile censor_${subj}_combined_2.1D \ + -show_trs_uncensored encoded` + +# ------------------------------ +# run the regression analysis +3dDeconvolve -input pb04.$subj.r*.scale+tlrc.HEAD \ + -censor censor_${subj}_combined_2.1D \ + -polort 4 \ + -num_stimts 17 \ + -stim_times 1 stimuli/timing_sub-03_ses-test_Correct_Task.1D 'GAM' \ + -stim_label 1 Correct_Task \ + -stim_times 2 stimuli/timing_sub-03_ses-test_Incorrect_Task.1D 'GAM' \ + -stim_label 2 Incorrect_Task \ + -stim_times 3 stimuli/timing_sub-03_ses-test_No_Response_Control.1D 'GAM' \ + -stim_label 3 No_Response_Control \ + -stim_times 4 stimuli/timing_sub-03_ses-test_No_Response_Task.1D 'GAM' \ + -stim_label 4 No_Response_Task \ + -stim_times 5 stimuli/timing_sub-03_ses-test_Response_Control.1D 'GAM' \ + -stim_label 5 Response_Control \ + -stim_file 6 motion_demean.1D'[0]' -stim_base 6 -stim_label 6 roll_01 \ + -stim_file 7 motion_demean.1D'[1]' -stim_base 7 -stim_label 7 pitch_01 \ + -stim_file 8 motion_demean.1D'[2]' -stim_base 8 -stim_label 8 yaw_01 \ + -stim_file 9 motion_demean.1D'[3]' -stim_base 9 -stim_label 9 dS_01 \ + -stim_file 10 motion_demean.1D'[4]' -stim_base 10 -stim_label 10 dL_01 \ + -stim_file 11 motion_demean.1D'[5]' -stim_base 11 -stim_label 11 dP_01 \ + -stim_file 12 motion_deriv.1D'[0]' -stim_base 12 -stim_label 12 roll_02 \ + -stim_file 13 motion_deriv.1D'[1]' -stim_base 13 -stim_label 13 pitch_02 \ + -stim_file 14 motion_deriv.1D'[2]' -stim_base 14 -stim_label 14 yaw_02 \ + -stim_file 15 motion_deriv.1D'[3]' -stim_base 15 -stim_label 15 dS_02 \ + -stim_file 16 motion_deriv.1D'[4]' -stim_base 16 -stim_label 16 dL_02 \ + -stim_file 17 motion_deriv.1D'[5]' -stim_base 17 -stim_label 17 dP_02 \ + -gltsym 'SYM: 0.333*Correct_Task +0.333*Incorrect_Task \ + +0.333*No_Response_Task -0.5*Response_Control -0.5*No_Response_Control' \ + -glt_label 1 Landmark-Detection \ + -fout -tout -x1D X.xmat.1D -xjpeg X.jpg \ + -x1D_uncensored X.nocensor.xmat.1D \ + -fitts fitts.$subj \ + -errts errts.${subj} \ + -bucket stats.$subj + + +# if 3dDeconvolve fails, terminate the script +if ( $status != 0 ) then + echo '---------------------------------------' + echo '** 3dDeconvolve error, failing...' + echo ' (consider the file 3dDeconvolve.err)' + exit +endif + + +# display any large pairwise correlations from the X-matrix +1d_tool.py -show_cormat_warnings -infile X.xmat.1D |& tee out.cormat_warn.txt + +# create an all_runs dataset to match the fitts, errts, etc. +3dTcat -prefix all_runs.$subj pb04.$subj.r*.scale+tlrc.HEAD + +# -------------------------------------------------- +# create a temporal signal to noise ratio dataset +# signal: if 'scale' block, mean should be 100 +# noise : compute standard deviation of errts +3dTstat -mean -prefix rm.signal.all all_runs.$subj+tlrc"[$ktrs]" +3dTstat -stdev -prefix rm.noise.all errts.${subj}+tlrc"[$ktrs]" +3dcalc -a rm.signal.all+tlrc \ + -b rm.noise.all+tlrc \ + -c full_mask.$subj+tlrc \ + -expr 'c*a/b' -prefix TSNR.$subj + +# --------------------------------------------------- +# compute and store GCOR (global correlation average) +# (sum of squares of global mean of unit errts) +3dTnorm -norm2 -prefix rm.errts.unit errts.${subj}+tlrc +3dmaskave -quiet -mask full_mask.$subj+tlrc rm.errts.unit+tlrc \ + > gmean.errts.unit.1D +3dTstat -sos -prefix - gmean.errts.unit.1D\' > out.gcor.1D +echo "-- GCOR = `cat out.gcor.1D`" + +# --------------------------------------------------- +# compute correlation volume +# (per voxel: average correlation across masked brain) +# (now just dot product with average unit time series) +3dcalc -a rm.errts.unit+tlrc -b gmean.errts.unit.1D -expr 'a*b' -prefix rm.DP +3dTstat -sum -prefix corr_brain rm.DP+tlrc + +# create ideal files for fixed response stim types +1dcat X.nocensor.xmat.1D'[5]' > ideal_Correct_Task.1D +1dcat X.nocensor.xmat.1D'[6]' > ideal_Incorrect_Task.1D +1dcat X.nocensor.xmat.1D'[7]' > ideal_No_Response_Control.1D +1dcat X.nocensor.xmat.1D'[8]' > ideal_No_Response_Task.1D +1dcat X.nocensor.xmat.1D'[9]' > ideal_Response_Control.1D + +# -------------------------------------------------------- +# compute sum of non-baseline regressors from the X-matrix +# (use 1d_tool.py to get list of regressor colums) +set reg_cols = `1d_tool.py -infile X.nocensor.xmat.1D -show_indices_interest` +3dTstat -sum -prefix sum_ideal.1D X.nocensor.xmat.1D"[$reg_cols]" + +# also, create a stimulus-only X-matrix, for easy review +1dcat X.nocensor.xmat.1D"[$reg_cols]" > X.stim.xmat.1D + +# ============================ blur estimation ============================= +# compute blur estimates +touch blur_est.$subj.1D # start with empty file + +# create directory for ACF curve files +mkdir files_ACF + +# -- estimate blur for each run in epits -- +touch blur.epits.1D + +# restrict to uncensored TRs, per run +foreach run ( $runs ) + set trs = `1d_tool.py -infile X.xmat.1D -show_trs_uncensored encoded \ + -show_trs_run $run` + if ( $trs == "" ) continue + 3dFWHMx -detrend -mask full_mask.$subj+tlrc \ + -ACF files_ACF/out.3dFWHMx.ACF.epits.r$run.1D \ + all_runs.$subj+tlrc"[$trs]" >> blur.epits.1D +end + +# compute average FWHM blur (from every other row) and append +set blurs = ( `3dTstat -mean -prefix - blur.epits.1D'{0..$(2)}'\'` ) +echo average epits FWHM blurs: $blurs +echo "$blurs # epits FWHM blur estimates" >> blur_est.$subj.1D + +# compute average ACF blur (from every other row) and append +set blurs = ( `3dTstat -mean -prefix - blur.epits.1D'{1..$(2)}'\'` ) +echo average epits ACF blurs: $blurs +echo "$blurs # epits ACF blur estimates" >> blur_est.$subj.1D + +# -- estimate blur for each run in errts -- +touch blur.errts.1D + +# restrict to uncensored TRs, per run +foreach run ( $runs ) + set trs = `1d_tool.py -infile X.xmat.1D -show_trs_uncensored encoded \ + -show_trs_run $run` + if ( $trs == "" ) continue + 3dFWHMx -detrend -mask full_mask.$subj+tlrc \ + -ACF files_ACF/out.3dFWHMx.ACF.errts.r$run.1D \ + errts.${subj}+tlrc"[$trs]" >> blur.errts.1D +end + +# compute average FWHM blur (from every other row) and append +set blurs = ( `3dTstat -mean -prefix - blur.errts.1D'{0..$(2)}'\'` ) +echo average errts FWHM blurs: $blurs +echo "$blurs # errts FWHM blur estimates" >> blur_est.$subj.1D + +# compute average ACF blur (from every other row) and append +set blurs = ( `3dTstat -mean -prefix - blur.errts.1D'{1..$(2)}'\'` ) +echo average errts ACF blurs: $blurs +echo "$blurs # errts ACF blur estimates" >> blur_est.$subj.1D + + +# ================== auto block: generate review scripts =================== + +# generate a review script for the unprocessed EPI data +gen_epi_review.py -script @epi_review.$subj \ + -dsets pb00.$subj.r*.tcat+orig.HEAD + +# generate scripts to review single subject results +# (try with defaults, but do not allow bad exit status) +gen_ss_review_scripts.py -mot_limit 0.3 -out_limit 0.5 -exit0 + +# ========================== auto block: finalize ========================== + +# remove temporary files +\rm -f rm.* + +# if the basic subject review script is here, run it +# (want this to be the last text output) +if ( -e @ss_review_basic ) ./@ss_review_basic |& tee out.ss_review.$subj.txt + +# return to parent directory +cd .. + +echo "execution finished: `date`" + + + + +# ========================================================================== +# script generated by the command: +# +# afni_proc.py -subj_id sub_03 -script proc.sub_03 -scr_overwrite -blocks \ +# tshift align tlrc volreg blur mask scale regress -copy_anat \ +# /Users/monicali/Google-Drive/IBRAIN/playground/sub-03/ses-test/anat/sub-03_ses-test_T1w.nii.gz \ +# -tcat_remove_first_trs 0 -dsets \ +# /Users/monicali/Google-Drive/IBRAIN/playground/sub-03/ses-test/func/sub-03_ses-test_task-linebisection_bold.nii.gz \ +# -tlrc_base MNI_avg152T1+tlrc -volreg_align_to third -volreg_align_e2a \ +# -volreg_tlrc_warp -blur_size 6.0 -regress_stim_times \ +# /Users/monicali/Google-Drive/IBRAIN/playground/timing_sub-03_ses-test_Correct_Task.1D \ +# /Users/monicali/Google-Drive/IBRAIN/playground/timing_sub-03_ses-test_Incorrect_Task.1D \ +# /Users/monicali/Google-Drive/IBRAIN/playground/timing_sub-03_ses-test_No_Response_Control.1D \ +# /Users/monicali/Google-Drive/IBRAIN/playground/timing_sub-03_ses-test_No_Response_Task.1D \ +# /Users/monicali/Google-Drive/IBRAIN/playground/timing_sub-03_ses-test_Response_Control.1D \ +# -regress_stim_labels Correct_Task Incorrect_Task No_Response_Control \ +# No_Response_Task Response_Control -regress_basis GAM \ +# -regress_censor_motion 0.3 -regress_censor_outliers 0.5 \ +# -regress_apply_mot_types demean deriv -regress_opts_3dD -gltsym 'SYM: \ +# 0.333*Correct_Task +0.333*Incorrect_Task +0.333*No_Response_Task \ +# -0.5*Response_Control -0.5*No_Response_Control' -glt_label 1 \ +# Landmark-Detection -regress_make_ideal_sum sum_ideal.1D \ +# -regress_est_blur_epits -regress_est_blur_errts -regress_run_clustsim no diff --git a/hw2/Exp-1/subject_results/group.test/subj.sub_03/cmd.ap.sub_03 b/hw2/Exp-1/subject_results/group.test/subj.sub_03/cmd.ap.sub_03 new file mode 100644 index 0000000..6240d91 --- /dev/null +++ b/hw2/Exp-1/subject_results/group.test/subj.sub_03/cmd.ap.sub_03 @@ -0,0 +1,47 @@ +#!/usr/bin/env tcsh + +# created by uber_subject.py: version 0.40 (March 30, 2017) +# creation date: Thu Aug 3 22:01:15 2017 + +# set data directories +set top_dir = /Users/mli/Desktop/playground +set anat_dir = $top_dir/sub-03/ses-test/anat +set epi_dir = $top_dir/sub-03/ses-test/func + +# set subject and group identifiers +set subj = sub_03 +set group_id = test + +# run afni_proc.py to create a single subject processing script +afni_proc.py -subj_id $subj \ + -script proc.$subj -scr_overwrite \ + -blocks tshift align tlrc volreg blur mask scale regress \ + -copy_anat $anat_dir/sub-03_ses-test_T1w.nii.gz \ + -tcat_remove_first_trs 1 \ + -tshift_opts_ts -tpattern alt+z \ + -dsets $epi_dir/sub-03_ses-test_task-linebisection_bold.nii.gz \ + -tlrc_base MNI_avg152T1+tlrc \ + -volreg_align_to third \ + -volreg_align_e2a \ + -volreg_tlrc_warp \ + -blur_size 6.0 \ + -regress_stim_times \ + $top_dir/timing_sub-03_ses-test_Correct_Task.1D \ + $top_dir/timing_sub-03_ses-test_Incorrect_Task.1D \ + $top_dir/timing_sub-03_ses-test_No_Response_Control.1D \ + $top_dir/timing_sub-03_ses-test_No_Response_Task.1D \ + $top_dir/timing_sub-03_ses-test_Response_Control.1D \ + -regress_stim_labels \ + Correct_Task Incorrect_Task No_Response_Control No_Response_Task \ + Response_Control \ + -regress_basis 'GAM' \ + -regress_censor_motion 0.5 \ + -regress_apply_mot_types demean deriv \ + -regress_opts_3dD \ + -gltsym 'SYM: 0.5*Correct_Task +0.5*Incorrect_Task \ + -Response_Control' -glt_label 1 Landmark-Detection \ + -regress_make_ideal_sum sum_ideal.1D \ + -regress_est_blur_epits \ + -regress_est_blur_errts \ + -regress_run_clustsim no + diff --git a/hw2/Exp-1/subject_results/group.test/subj.sub_03/output.cmd.ap.sub_03 b/hw2/Exp-1/subject_results/group.test/subj.sub_03/output.cmd.ap.sub_03 new file mode 100644 index 0000000..bb288d0 --- /dev/null +++ b/hw2/Exp-1/subject_results/group.test/subj.sub_03/output.cmd.ap.sub_03 @@ -0,0 +1,30 @@ +set top_dir = /Users/mli/Desktop/playground +set anat_dir = /Users/mli/Desktop/playground/sub-03/ses-test/anat +set epi_dir = /Users/mli/Desktop/playground/sub-03/ses-test/func +set subj = sub_03 +set group_id = test +afni_proc.py -subj_id sub_03 -script proc.sub_03 -scr_overwrite -blocks tshift align tlrc volreg blur mask scale regress -copy_anat /Users/mli/Desktop/playground/sub-03/ses-test/anat/sub-03_ses-test_T1w.nii.gz -tcat_remove_first_trs 1 -tshift_opts_ts -tpattern alt+z -dsets /Users/mli/Desktop/playground/sub-03/ses-test/func/sub-03_ses-test_task-linebisection_bold.nii.gz -tlrc_base MNI_avg152T1+tlrc -volreg_align_to third -volreg_align_e2a -volreg_tlrc_warp -blur_size 6.0 -regress_stim_times /Users/mli/Desktop/playground/timing_sub-03_ses-test_Correct_Task.1D /Users/mli/Desktop/playground/timing_sub-03_ses-test_Incorrect_Task.1D /Users/mli/Desktop/playground/timing_sub-03_ses-test_No_Response_Control.1D /Users/mli/Desktop/playground/timing_sub-03_ses-test_No_Response_Task.1D /Users/mli/Desktop/playground/timing_sub-03_ses-test_Response_Control.1D -regress_stim_labels Correct_Task Incorrect_Task No_Response_Control No_Response_Task Response_Control -regress_basis GAM -regress_censor_motion 0.5 -regress_apply_mot_types demean deriv -regress_opts_3dD -gltsym SYM: 0.5*Correct_Task +0.5*Incorrect_Task + -Response_Control -glt_label 1 Landmark-Detection -regress_make_ideal_sum sum_ideal.1D -regress_est_blur_epits -regress_est_blur_errts -regress_run_clustsim no +-- applying orig view as +orig +** warning: removing first 1 TRs from beginning of each run + --> the stimulus timing files must reflect the removal of these TRs +-- tcat: reps is now 237 +++ updating polort to 4, from run len 592.5 s +-- volreg: using base dset vr_base+orig +++ volreg: applying volreg/epi2anat/tlrc xforms to isotropic 4 mm tlrc voxels +-- applying anat warps to 1 dataset(s): sub-03_ses-test_T1w +-- masking: group anat = 'MNI_avg152T1+tlrc', exists = 1 +-- have 1 ROI dict entries ... +-- will apply motion types: demean, deriv +-- using default: will not apply EPI Automask + (see 'MASKING NOTE' from the -help for details) + +------------------------------------- +** warning have only 1 run to analyze +------------------------------------- + +--> script is file: proc.sub_03 + consider the script execution command: + + tcsh -xef proc.sub_03 |& tee output.proc.sub_03 + diff --git a/hw2/Exp-1/subject_results/group.test/subj.sub_03/output.proc.sub_03 b/hw2/Exp-1/subject_results/group.test/subj.sub_03/output.proc.sub_03 new file mode 100644 index 0000000..0fc01ea --- /dev/null +++ b/hw2/Exp-1/subject_results/group.test/subj.sub_03/output.proc.sub_03 @@ -0,0 +1,939 @@ +echo auto-generated by afni_proc.py, Sat Aug 5 16:29:05 2017 +auto-generated by afni_proc.py, Sat Aug 5 16:29:05 2017 +echo (version 5.15, April 25, 2017) +(version 5.15, April 25, 2017) +echo execution started: `date` +date +execution started: Sat Aug 5 16:29:06 EDT 2017 +afni -ver +Precompiled binary macosx_10.7_local: Jul 27 2017 (Version AFNI_17.2.05) +afni_history -check_date 23 Sep 2016 +-- is current: afni_history as new as: 23 Sep 2016 + most recent entry is: 27 Jul 2017 +if ( 0 ) then +if ( 0 > 0 ) then +set subj = sub_03 +endif +set output_dir = sub_03.results +if ( -d sub_03.results ) then +set runs = ( `count -digits 2 1 1` ) +count -digits 2 1 1 +mkdir sub_03.results +mkdir sub_03.results/stimuli +cp /Users/mli/Desktop/playground/timing_sub-03_ses-test_Correct_Task.1D /Users/mli/Desktop/playground/timing_sub-03_ses-test_Incorrect_Task.1D /Users/mli/Desktop/playground/timing_sub-03_ses-test_No_Response_Control.1D /Users/mli/Desktop/playground/timing_sub-03_ses-test_No_Response_Task.1D /Users/mli/Desktop/playground/timing_sub-03_ses-test_Response_Control.1D sub_03.results/stimuli +3dcopy /Users/mli/Desktop/playground/sub-03/ses-test/anat/sub-03_ses-test_T1w.nii.gz sub_03.results/sub-03_ses-test_T1w +++ 3dcopy: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +3dTcat -prefix sub_03.results/pb00.sub_03.r01.tcat /Users/mli/Desktop/playground/sub-03/ses-test/func/sub-03_ses-test_task-linebisection_bold.nii.gz[1..$] +++ 3dTcat: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ elapsed time = 0.8 s +set tr_counts = ( 237 ) +cd sub_03.results +touch out.pre_ss_warn.txt +foreach run ( 01 ) +3dToutcount -automask -fraction -polort 4 -legendre pb00.sub_03.r01.tcat+orig +++ 3dToutcount: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +*+ WARNING: If you are performing spatial transformations on an oblique dset, + such as ./pb00.sub_03.r01.tcat+orig.BRIK, + or viewing/combining it with volumes of differing obliquity, + you should consider running: + 3dWarp -deoblique + on this and other oblique datasets in the same session. + See 3dWarp -help for details. +++ Oblique dataset:./pb00.sub_03.r01.tcat+orig.BRIK is 6.153038 degrees from plumb. +++ 17835 voxels passed mask/clip +if ( `1deval -a outcount.r$run.1D"{0}" -expr "step(a-0.4)"` ) then +1deval -a outcount.r01.1D{0} -expr step(a-0.4) +end +cat outcount.r01.1D +foreach run ( 01 ) +3dTshift -tzero 0 -quintic -prefix pb01.sub_03.r01.tshift -tpattern alt+z pb00.sub_03.r01.tcat+orig +++ 3dTshift: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +*+ WARNING: If you are performing spatial transformations on an oblique dset, + such as ./pb00.sub_03.r01.tcat+orig.BRIK, + or viewing/combining it with volumes of differing obliquity, + you should consider running: + 3dWarp -deoblique + on this and other oblique datasets in the same session. + See 3dWarp -help for details. +++ Oblique dataset:./pb00.sub_03.r01.tcat+orig.BRIK is 6.153038 degrees from plumb. +end +3dbucket -prefix vr_base pb01.sub_03.r01.tshift+orig[2] +++ 3dbucket: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +align_epi_anat.py -anat2epi -anat sub-03_ses-test_T1w+orig -save_skullstrip -suffix _al_junk -epi vr_base+orig -epi_base 0 -epi_strip 3dAutomask -volreg off -tshift off +#++ align_epi_anat version: 1.57 +#++ turning off volume registration +#Script is running (command trimmed): + 3dAttribute DELTA ./vr_base+orig +#Script is running (command trimmed): + 3dAttribute DELTA ./vr_base+orig +#Script is running (command trimmed): + 3dAttribute DELTA ./sub-03_ses-test_T1w+orig +#++ Multi-cost is lpc +#++ Removing all the temporary files +#Script is running: + \rm -f ./__tt_vr_base* +#Script is running: + \rm -f ./__tt_sub-03_ses-test_T1w* +#Script is running (command trimmed): + 3dcopy ./sub-03_ses-test_T1w+orig ./__tt_sub-03_ses-test_T1w+orig +++ 3dcopy: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +#++ Removing skull from anat data +#Script is running (command trimmed): + 3dSkullStrip -orig_vol -input ./__tt_sub-03_ses-test_T1w+orig -prefix ./__tt_sub-03_ses-test_T1w_ns +*+ WARNING: If you are performing spatial transformations on an oblique dset, + such as ./__tt_sub-03_ses-test_T1w+orig.BRIK, + or viewing/combining it with volumes of differing obliquity, + you should consider running: + 3dWarp -deoblique + on this and other oblique datasets in the same session. + See 3dWarp -help for details. +++ Oblique dataset:./__tt_sub-03_ses-test_T1w+orig.BRIK is 6.455733 degrees from plumb. +#Script is running (command trimmed): + 3dinfo ./__tt_sub-03_ses-test_T1w_ns+orig | \grep 'Data Axes Tilt:'|\grep 'Oblique' +#++ Dataset /Users/mli/Desktop/playground/Exp-1/subject_results/group.test/subj.sub_03/sub_03.results/__tt_sub-03_ses-test_T1w_ns+orig is ***oblique**** +#Script is running (command trimmed): + 3dAttribute DELTA ./__tt_sub-03_ses-test_T1w_ns+orig +#++ Spacing for anat to oblique epi alignment is 1.000000 +#++ Matching obliquity of anat to epi +#Script is running (command trimmed): + 3dWarp -verb -card2oblique ./vr_base+orig -prefix ./__tt_sub-03_ses-test_T1w_ns_ob -newgrid 1.000000 ./__tt_sub-03_ses-test_T1w_ns+orig | \grep -A 4 '# mat44 Obliquity Transformation ::' > ./__tt_sub-03_ses-test_T1w_ns_obla2e_mat.1D +++ 3dWarp: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: RW Cox +++ Deobliquing original dataset before obliquing +++ Combining oblique transformations +#++ using 0th sub-brick because only one found +#Script is running (command trimmed): + 3dbucket -prefix ./__tt_vr_base_ts ./vr_base+orig'[0]' +++ 3dbucket: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +#++ resampling epi to match anat data +#Script is running (command trimmed): + 3dresample -master ./__tt_sub-03_ses-test_T1w_ns_ob+orig -prefix ./__tt_vr_base_ts_rs -inset ./__tt_vr_base_ts+orig'' -rmode Cu +*+ WARNING: If you are performing spatial transformations on an oblique dset, + such as ./__tt_vr_base_ts+orig.BRIK, + or viewing/combining it with volumes of differing obliquity, + you should consider running: + 3dWarp -deoblique + on this and other oblique datasets in the same session. + See 3dWarp -help for details. +++ Oblique dataset:./__tt_vr_base_ts+orig.BRIK is 6.153038 degrees from plumb. +#++ removing skull or area outside brain +#Script is running (command trimmed): + 3dAutomask -apply_prefix ./__tt_vr_base_ts_rs_ns ./__tt_vr_base_ts_rs+orig +++ 3dAutomask: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: Emperor Zhark +++ Loading dataset ./__tt_vr_base_ts_rs+orig +++ Forming automask + + Fixed clip level = 720.187500 + + Used gradual clip level = 622.540100 .. 825.700012 + + Number voxels above clip level = 1139151 + + Clustering voxels ... + + Largest cluster has 1137868 voxels + + Clustering voxels ... + + Largest cluster has 1137453 voxels + + Filled 420 voxels in small holes; now have 1137873 voxels + + Filled 17758 voxels in large holes; now have 1155631 voxels + + Clustering voxels ... + + Largest cluster has 1155621 voxels + + Clustering non-brain voxels ... + + Clustering voxels ... + + Largest cluster has 15251532 voxels + + Mask now has 1155621 voxels +++ 1155621 voxels in the mask [out of 16407153: 7.04%] +++ first 71 x-planes are zero [from R] +++ last 75 x-planes are zero [from L] +++ first 33 y-planes are zero [from A] +++ last 17 y-planes are zero [from P] +++ first 123 z-planes are zero [from I] +++ last 36 z-planes are zero [from S] +++ applying mask to original data +++ Writing masked data +++ CPU time = 3.600000 sec +#++ Computing weight mask +#Script is running (command trimmed): + 3dBrickStat -automask -percentile 90.000000 1 90.000000 ./__tt_vr_base_ts_rs_ns+orig +#++ Applying threshold of 1884.000000 on /Users/mli/Desktop/playground/Exp-1/subject_results/group.test/subj.sub_03/sub_03.results/__tt_vr_base_ts_rs_ns+orig +#Script is running (command trimmed): + 3dcalc -datum float -prefix ./__tt_vr_base_ts_rs_ns_wt -a ./__tt_vr_base_ts_rs_ns+orig -expr 'min(1,(a/1884.000000))' +++ 3dcalc: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: A cast of thousands +#++ Aligning anat data to epi data +#Script is running (command trimmed): + 3dAllineate -lpc -wtprefix ./__tt_sub-03_ses-test_T1w_ns_ob_al_junk_wtal -weight ./__tt_vr_base_ts_rs_ns_wt+orig -source ./__tt_sub-03_ses-test_T1w_ns_ob+orig -prefix ./__tt_sub-03_ses-test_T1w_ns_ob_temp_al_junk -base ./__tt_vr_base_ts_rs_ns+orig -nocmass -1Dmatrix_save ./sub-03_ses-test_T1w_al_junk_e2a_only_mat.aff12.1D -master SOURCE -weight_frac 1.0 -maxrot 6 -maxshf 10 -VERB -warp aff -source_automask+4 -onepass +++ 3dAllineate: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: Zhark the Registrator +++ Source dataset: ./__tt_sub-03_ses-test_T1w_ns_ob+orig.HEAD +++ Base dataset: ./__tt_vr_base_ts_rs_ns+orig.HEAD +++ Loading datasets +++ 1350442 voxels in -source_automask+4 +++ Zero-pad: not needed +++ 1155621 voxels [7.0%] in weight mask +++ Number of points for matching = 1155621 +++ Local correlation: blok type = 'RHDD(6.54321)' +++ shift param auto-range: -89.2..89.2 -69.3..69.3 -86.7..86.7 + + Range param#4 [z-angle] = -6.000000 .. 6.000000 + + Range param#5 [x-angle] = -6.000000 .. 6.000000 + + Range param#6 [y-angle] = -6.000000 .. 6.000000 + + Range param#1 [x-shift] = -10.000000 .. 10.000000 + + Range param#2 [y-shift] = -10.000000 .. 10.000000 + + Range param#3 [z-shift] = -10.000000 .. 10.000000 + + 12 free parameters +++ Normalized convergence radius = 0.001000 +++ OpenMP thread count = 4 +++ ======= Allineation of 1 sub-bricks using Local Pearson Correlation Signed ======= +++ ========== sub-brick #0 ========== [total CPU to here=9.9 s] +++ *** Fine pass begins *** + + * Enter alignment setup routine + + - copying base image + + - copying source image + + - copying weight image + + - using 1155621 points from base image [use_all=0] + + * Exit alignment setup routine + + 1095318 total points stored in 2076 'RHDD(6.54321)' bloks + + - Initial cost = -0.091164 + + - Initial fine Parameters = 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 1.0000 1.0000 0.0000 0.0000 0.0000 +************************************************************************************************************************************************************************************************************** + + - Finalish cost = -0.223788 ; 478 funcs +* + + - Final cost = -0.223788 ; 109 funcs + + Final fine fit Parameters: + x-shift= 0.1988 y-shift=-0.6640 z-shift=-1.7061 + z-angle=-0.6160 x-angle= 4.7517 y-angle=-1.0181 + x-scale= 0.9680 y-scale= 0.9748 z-scale= 1.0199 + y/x-shear=-0.0035 z/x-shear= 0.0100 z/y-shear= 0.0924 + + - Fine net CPU time = 39.7 s +++ Computing output image +++ image warp: parameters = 0.1988 -0.6640 -1.7061 -0.6160 4.7517 -1.0181 0.9680 0.9748 1.0199 -0.0035 0.0100 0.0924 +++ Wrote -1Dmatrix_save ./sub-03_ses-test_T1w_al_junk_e2a_only_mat.aff12.1D +++ 3dAllineate: total CPU time = 52.3 sec Elapsed = 35.0 +++ ########################################################### +++ # Please check results visually for alignment quality # +++ ########################################################### +++ # '-autoweight' is recommended when using -lpc or -lpa # +++ # If your results are not good, please try again. # +++ ########################################################### +#Script is running (command trimmed): + cat_matvec -ONELINE ./sub-03_ses-test_T1w_al_junk_e2a_only_mat.aff12.1D ./__tt_sub-03_ses-test_T1w_ns_obla2e_mat.1D -I > ./sub-03_ses-test_T1w_al_junk_mat.aff12.1D +#++ Combining anat to epi and oblique transformations +#Script is running (command trimmed): + 3dAllineate -base ./__tt_vr_base_ts_rs_ns+orig -1Dmatrix_apply ./sub-03_ses-test_T1w_al_junk_mat.aff12.1D -prefix ./sub-03_ses-test_T1w_al_junk -input ./__tt_sub-03_ses-test_T1w_ns+orig -master SOURCE -weight_frac 1.0 -maxrot 6 -maxshf 10 -VERB -warp aff -source_automask+4 -onepass +++ 3dAllineate: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: Zhark the Registrator +*+ WARNING: If you are performing spatial transformations on an oblique dset, + such as ./__tt_sub-03_ses-test_T1w_ns+orig.BRIK, + or viewing/combining it with volumes of differing obliquity, + you should consider running: + 3dWarp -deoblique + on this and other oblique datasets in the same session. + See 3dWarp -help for details. +++ Oblique dataset:./__tt_sub-03_ses-test_T1w_ns+orig.BRIK is 6.455733 degrees from plumb. +++ Source dataset: ./__tt_sub-03_ses-test_T1w_ns+orig.HEAD +++ Base dataset: ./__tt_vr_base_ts_rs_ns+orig.HEAD +++ Loading datasets + + Range param#4 [z-angle] = -6.000000 .. 6.000000 + + Range param#5 [x-angle] = -6.000000 .. 6.000000 + + Range param#6 [y-angle] = -6.000000 .. 6.000000 + + Range param#1 [x-shift] = -10.000000 .. 10.000000 + + Range param#2 [y-shift] = -10.000000 .. 10.000000 + + Range param#3 [z-shift] = -10.000000 .. 10.000000 +++ OpenMP thread count = 4 +++ ========== Applying transformation to 1 sub-bricks ========== +++ ========== sub-brick #0 ========== [total CPU to here=0.1 s] + + * Enter alignment setup routine + + - copying base image + + - copying source image + + - no weight image + + - using 11 points from base image [use_all=0] + + * Exit alignment setup routine +++ using -1Dmatrix_apply +++ Computing output image +++ image warp: parameters = 0.9647 -0.0767 -0.0644 8.2560 0.0414 0.9697 -0.0702 -8.0361 0.0573 0.0012 1.0210 -4.6777 +++ 3dAllineate: total CPU time = 2.3 sec Elapsed = 1.9 +++ ########################################################### +#++ Creating final output: skullstripped anat data +copying from dataset /Users/mli/Desktop/playground/Exp-1/subject_results/group.test/subj.sub_03/sub_03.results/__tt_sub-03_ses-test_T1w_ns+orig to /Users/mli/Desktop/playground/Exp-1/subject_results/group.test/subj.sub_03/sub_03.results/sub-03_ses-test_T1w_ns+orig +#Script is running (command trimmed): + 3dcopy ./__tt_sub-03_ses-test_T1w_ns+orig sub-03_ses-test_T1w_ns +++ 3dcopy: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +#++ Creating final output: anat data aligned to epi +# copy is not necessary +#++ Saving history +#Script is running (command trimmed): + 3dNotes -h "align_epi_anat.py -anat2epi -anat sub-03_ses-test_T1w+orig \ + -save_skullstrip -suffix _al_junk -epi vr_base+orig -epi_base 0 \ + -epi_strip 3dAutomask -volreg off -tshift off" \ + ./sub-03_ses-test_T1w_al_junk+orig + +#++ Removing all the temporary files +#Script is running: + \rm -f ./__tt_vr_base* +#Script is running: + \rm -f ./__tt_sub-03_ses-test_T1w* + +# Finished alignment successfully + +@auto_tlrc -base MNI_avg152T1+tlrc -input sub-03_ses-test_T1w_ns+orig -no_ss +*+ WARNING: If you are performing spatial transformations on an oblique dset, + such as ./sub-03_ses-test_T1w_ns+orig.BRIK, + or viewing/combining it with volumes of differing obliquity, + you should consider running: + 3dWarp -deoblique + on this and other oblique datasets in the same session. + See 3dWarp -help for details. +++ Oblique dataset:./sub-03_ses-test_T1w_ns+orig.BRIK is 6.455733 degrees from plumb. +*+ WARNING: If you are performing spatial transformations on an oblique dset, + such as ./sub-03_ses-test_T1w_ns+orig.BRIK, + or viewing/combining it with volumes of differing obliquity, + you should consider running: + 3dWarp -deoblique + on this and other oblique datasets in the same session. + See 3dWarp -help for details. +++ Oblique dataset:./sub-03_ses-test_T1w_ns+orig.BRIK is 6.455733 degrees from plumb. + +*********** Warning ************* +Dataset centers are 52.843487 mm +apart. If registration fails, or if +parts of the original anatomy gets +cropped, try adding option + -init_xform AUTO_CENTER +to your @auto_tlrc command. + +********************************* + +Padding ... +++ 3dZeropad: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ output dataset: ./__ats_tmp__ref_MNI_avg152T1_40pad+tlrc.BRIK +Resampling ... +*+ WARNING: If you are performing spatial transformations on an oblique dset, + such as ./sub-03_ses-test_T1w_ns+orig.BRIK, + or viewing/combining it with volumes of differing obliquity, + you should consider running: + 3dWarp -deoblique + on this and other oblique datasets in the same session. + See 3dWarp -help for details. +++ Oblique dataset:./sub-03_ses-test_T1w_ns+orig.BRIK is 6.455733 degrees from plumb. +++ 3dcalc: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: A cast of thousands +*+ WARNING: If you are performing spatial transformations on an oblique dset, + such as ./__ats_tmp__resamp_step+orig.BRIK, + or viewing/combining it with volumes of differing obliquity, + you should consider running: + 3dWarp -deoblique + on this and other oblique datasets in the same session. + See 3dWarp -help for details. +++ Oblique dataset:./__ats_tmp__resamp_step+orig.BRIK is 6.455733 degrees from plumb. +++ 3dcalc: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: A cast of thousands +*+ WARNING: If you are performing spatial transformations on an oblique dset, + such as ./sub-03_ses-test_T1w_ns+orig.BRIK, + or viewing/combining it with volumes of differing obliquity, + you should consider running: + 3dWarp -deoblique + on this and other oblique datasets in the same session. + See 3dWarp -help for details. +++ Oblique dataset:./sub-03_ses-test_T1w_ns+orig.BRIK is 6.455733 degrees from plumb. +Clipping -0.000100 1158.000100 ... +++ 3dcalc: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: A cast of thousands +++ 3drefit: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: RW Cox +++ Processing AFNI dataset __ats_tmp___rs_sub-03_ses-test_T1w_ns+tlrc.HEAD + + Changed dataset view type and filenames. +++ 3drefit processed 1 datasets +++ 3drefit: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: RW Cox +++ Processing AFNI dataset __ats_tmp__resamp_NN+tlrc.HEAD + + Changed dataset view type and filenames. +++ 3drefit processed 1 datasets +++ 3drefit: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: RW Cox +++ Processing AFNI dataset __ats_tmp__resamp_edge_art+tlrc.HEAD + + Changed dataset view type and filenames. +++ 3drefit processed 1 datasets +Registration (linear final interpolation) ... +++ 3dWarpDrive: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: RW Cox +++ Initial scale factor set to 0.30/273.95=9.2e+02 +RMS[0] = 0.384861 0.16449 ITER = 6/137 +0.384861 + +Warping has converged. + +++ 3dcopy: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ 3dWarp: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: RW Cox +*+ WARNING: If you are performing spatial transformations on an oblique dset, + such as ./sub-03_ses-test_T1w_ns+orig.BRIK, + or viewing/combining it with volumes of differing obliquity, + you should consider running: + 3dWarp -deoblique + on this and other oblique datasets in the same session. + See 3dWarp -help for details. +++ Oblique dataset:./sub-03_ses-test_T1w_ns+orig.BRIK is 6.455733 degrees from plumb. +++ 6.455733 degrees from plumb. +*+ WARNING: Deoblique datasets with 3dWarp before proceeding with other transformations +Applying brain mask +++ 3dcalc: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: A cast of thousands +++ 3dWarp: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: RW Cox +++ 3drename: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ THD_rename_dataset_files: rename __ats_tmp___pad40_sub-03_ses-test_T1w_ns+orig.HEAD -> __ats_tmp___pad40_sub-03_ses-test_T1w_ns.skl+orig.HEAD +++ THD_rename_dataset_files: rename __ats_tmp___pad40_sub-03_ses-test_T1w_ns+orig.BRIK.gz -> __ats_tmp___pad40_sub-03_ses-test_T1w_ns.skl+orig.BRIK.gz +++ 3dcalc: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: A cast of thousands +Unpadding ... +++ 3dZeropad: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ output dataset: ./__ats_tmp___upad40_sub-03_ses-test_T1w_ns+orig.BRIK +++ 3drefit: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: RW Cox +++ Processing AFNI dataset __ats_tmp___upad40_sub-03_ses-test_T1w_ns+orig +*+ WARNING: Changing the space of an ORIG view dataset may cause confusion! +*+ WARNING: NIFTI copies will be interpreted as TLRC view (not TLRC space). +*+ WARNING: Consider changing the view of the dataset to TLRC view also +++ 3drefit processed 1 datasets +Changing view of transformed anatomy +++ 3drefit: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: RW Cox +++ Processing AFNI dataset __ats_tmp___upad40_sub-03_ses-test_T1w_ns+orig.HEAD + + Changed dataset view type and filenames. +++ 3drefit processed 1 datasets +Setting parent with 3drefit -wset sub-03_ses-test_T1w_ns+orig __ats_tmp___upad40_sub-03_ses-test_T1w_ns+tlrc +++ 3drefit: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: RW Cox +++ Processing AFNI dataset __ats_tmp___upad40_sub-03_ses-test_T1w_ns+tlrc +++ 3drefit processed 1 datasets +++ 3drename: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Warning: ignoring +tlrc on new_prefix. +++ THD_rename_dataset_files: rename __ats_tmp___upad40_sub-03_ses-test_T1w_ns+tlrc.HEAD -> sub-03_ses-test_T1w_ns+tlrc.HEAD +++ THD_rename_dataset_files: rename __ats_tmp___upad40_sub-03_ses-test_T1w_ns+tlrc.BRIK -> sub-03_ses-test_T1w_ns+tlrc.BRIK +Cleanup ... +cat_matvec sub-03_ses-test_T1w_ns+tlrc::WARP_DATA -I +if ( ! -f sub-03_ses-test_T1w_ns+tlrc.HEAD ) then +foreach run ( 01 ) +3dvolreg -verbose -zpad 1 -base vr_base+orig -1Dfile dfile.r01.1D -prefix rm.epi.volreg.r01 -cubic -1Dmatrix_save mat.r01.vr.aff12.1D pb01.sub_03.r01.tshift+orig +++ 3dvolreg: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: RW Cox +*+ WARNING: If you are performing spatial transformations on an oblique dset, + such as ./vr_base+orig.BRIK, + or viewing/combining it with volumes of differing obliquity, + you should consider running: + 3dWarp -deoblique + on this and other oblique datasets in the same session. + See 3dWarp -help for details. +++ Oblique dataset:./vr_base+orig.BRIK is 6.153038 degrees from plumb. +++ Reading in base dataset ./vr_base+orig.BRIK +++ Oblique dataset:./pb01.sub_03.r01.tshift+orig.BRIK is 6.153038 degrees from plumb. +++ Reading input dataset ./pb01.sub_03.r01.tshift+orig.BRIK +++ Edging: x=3 y=3 z=2 +++ Creating mask for -maxdisp + + Automask has 18925 voxels + + 3320 voxels left in -maxdisp mask after erosion +++ Initializing alignment base +++ Starting final pass on 237 sub-bricks: 0..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..65..66..67..68..69..70..71..72..73..74..75..76..77..78..79..80..81..82..83..84..85..86..87..88..89..90..91..92..93..94..95..96..97..98..99..100..101..102..103..104..105..106..107..108..109..110..111..112..113..114..115..116..117..118..119..120..121..122..123..124..125..126..127..128..129..130..131..132..133..134..135..136..137..138..139..140..141..142..143..144..145..146..147..148..149..150..151..152..153..154..155..156..157..158..159..160..161..162..163..164..165..166..167..168..169..170..171..172..173..174..175..176..177..178..179..180..181..182..183..184..185..186..187..188..189..190..191..192..193..194..195..196..197..198..199..200..201..202..203..204..205..206..207..208..209..210..211..212..213..214..215..216..217..218..219..220..221..222..223..224..225..226..227..228..229..230..231..232..233..234..235..236.. +++ CPU time for realignment=9.23 s [=0.0389 s/sub-brick] +++ Min : roll=-0.099 pitch=-0.764 yaw=-0.000 dS=-0.132 dL=-0.087 dP=-0.636 +++ Mean: roll=+0.252 pitch=-0.320 yaw=+1.503 dS=+1.540 dL=+0.638 dP=-0.281 +++ Max : roll=+0.752 pitch=+1.091 yaw=+2.787 dS=+2.524 dL=+1.597 dP=+0.138 +++ Max displacements (mm) for each sub-brick: + 0.39(0.00) 0.36(0.73) 0.00(0.36) 0.63(0.63) 0.68(0.12) 0.32(0.39) 0.49(0.19) 0.69(0.22) 0.80(0.17) 0.77(0.07) 0.87(0.11) 1.05(0.21) 1.19(0.18) 1.18(0.10) 1.20(0.06) 1.23(0.03) 1.31(0.12) 1.33(0.10) 1.29(0.05) 1.34(0.08) 1.30(0.16) 1.25(0.18) 1.38(0.16) 1.41(0.06) 1.39(0.05) 1.47(0.08) 1.44(0.10) 1.57(0.15) 1.50(0.11) 1.56(0.08) 1.52(0.08) 1.57(0.08) 1.57(0.11) 1.70(0.15) 1.78(0.09) 1.83(0.09) 1.93(0.10) 1.96(0.05) 2.01(0.12) 2.07(0.10) 2.02(0.15) 2.12(0.14) 2.12(0.08) 2.15(0.06) 2.19(0.17) 2.21(0.08) 2.19(0.10) 2.18(0.12) 1.95(0.43) 1.65(1.28) 1.81(1.18) 0.91(1.59) 0.84(0.26) 1.58(1.54) 1.51(1.33) 2.08(1.14) 2.54(2.35) 4.01(2.10) 3.02(1.06) 3.51(0.78) 3.27(0.29) 3.24(0.12) 2.33(1.09) 2.04(0.58) 2.77(1.27) 2.07(0.91) 1.23(1.41) 2.13(1.65) 2.55(0.48) 2.61(0.10) 2.79(0.21) 2.87(0.10) 2.69(0.63) 2.86(0.46) 2.78(0.20) 2.80(0.09) 2.86(0.10) 2.74(0.19) 2.71(0.23) 2.69(0.07) 2.77(0.09) 2.81(0.09) 2.84(0.06) 3.03(0.22) 2.87(0.20) 3.06(0.19) 3.20(0.15) 3.24(0.05) 3.37(0.18) 3.40(0.05) 3.51(0.12) 3.48(0.05) 3.62(0.16) 3.55(0.08) 3.53(0.16) 3.33(0.44) 3.18(0.42) 3.17(0.09) 3.29(0.30) 3.36(0.08) 3.42(0.11) 3.09(0.86) 3.16(0.30) 3.64(0.63) 3.61(0.19) 3.70(0.14) 3.81(0.18) 3.81(0.09) 3.82(0.05) 3.78(0.13) 3.72(0.11) 3.57(0.23) 3.56(0.07) 3.63(0.12) 3.78(0.23) 3.90(0.18) 3.95(0.11) 4.10(0.18) 3.99(0.23) 4.25(0.31) 4.11(0.21) 4.14(0.07) 4.20(0.15) 3.91(0.41) 3.78(0.20) 3.72(0.13) 3.61(0.37) 3.73(0.29) 3.84(0.14) 3.84(0.03) 4.10(0.33) 4.06(0.10) 4.12(0.08) 4.08(0.14) 4.05(0.12) 4.20(0.20) 4.04(0.21) 4.41(0.43) 4.12(0.54) 4.20(0.16) 4.38(0.22) 4.53(0.19) 4.86(0.35) 4.55(0.38) 4.62(0.12) 4.52(0.17) 4.57(0.11) 4.52(0.18) 4.52(0.11) 4.77(0.38) 4.63(0.18) 4.55(0.20) 4.40(0.22) 4.57(0.23) 4.59(0.02) 4.52(0.07) 4.65(0.14) 4.57(0.13) 4.72(0.18) 4.82(0.10) 4.90(0.24) 5.30(0.79) 5.50(0.43) 4.99(1.04) 5.21(0.24) 5.46(0.32) 5.64(0.36) 5.66(0.07) 5.83(0.19) 5.76(0.14) 5.76(0.16) 5.73(0.05) 5.73(0.12) 5.58(0.27) 5.46(0.28) 5.45(0.40) 5.46(0.25) 5.37(0.21) 5.32(0.09) 5.45(0.18) 5.51(0.08) 5.68(0.25) 5.56(0.16) 5.63(0.07) 5.66(0.05) 5.57(0.25) 5.19(0.64) 5.48(0.78) 5.32(0.22) 4.57(1.04) 4.55(0.14) 4.88(0.39) 5.27(0.59) 5.64(0.60) 5.82(0.26) 5.70(0.27) 5.88(0.33) 5.87(0.05) 5.80(0.19) 5.75(0.11) 5.78(0.23) 5.98(0.27) 5.96(0.11) 5.92(0.10) 6.02(0.29) 6.04(0.11) 6.10(0.12) 6.10(0.10) 6.10(0.06) 6.10(0.08) 6.11(0.03) 6.03(0.13) 6.13(0.13) 6.12(0.15) 6.07(0.13) 6.13(0.15) 6.03(0.17) 6.10(0.14) 6.03(0.09) 6.01(0.05) 6.16(0.23) 5.98(0.22) 5.86(0.22) 5.94(0.10) 5.83(0.15) 5.68(0.26) 5.88(0.46) 6.00(0.25) 5.97(0.26) 6.05(0.12) 6.24(0.32) 6.26(0.17) 6.33(0.24) 6.15(0.32) 5.98(0.38) 6.01(0.05) 6.10(0.15) +++ Max displacement in automask = 6.33 (mm) at sub-brick 232 +++ Max delta displ in automask = 2.35 (mm) at sub-brick 56 +++ Wrote dataset to disk in ./rm.epi.volreg.r01+orig.BRIK +3dcalc -overwrite -a pb01.sub_03.r01.tshift+orig -expr 1 -prefix rm.epi.all1 +++ 3dcalc: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: A cast of thousands +*+ WARNING: input 'a' is not used in the expression +cat_matvec -ONELINE sub-03_ses-test_T1w_ns+tlrc::WARP_DATA -I sub-03_ses-test_T1w_al_junk_mat.aff12.1D -I mat.r01.vr.aff12.1D +3dAllineate -base sub-03_ses-test_T1w_ns+tlrc -input pb01.sub_03.r01.tshift+orig -1Dmatrix_apply mat.r01.warp.aff12.1D -mast_dxyz 4 -prefix rm.epi.nomask.r01 +++ 3dAllineate: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: Zhark the Registrator +*+ WARNING: If you are performing spatial transformations on an oblique dset, + such as ./pb01.sub_03.r01.tshift+orig.BRIK, + or viewing/combining it with volumes of differing obliquity, + you should consider running: + 3dWarp -deoblique + on this and other oblique datasets in the same session. + See 3dWarp -help for details. +++ Oblique dataset:./pb01.sub_03.r01.tshift+orig.BRIK is 6.153038 degrees from plumb. +++ Source dataset: ./pb01.sub_03.r01.tshift+orig.HEAD +++ Base dataset: ./sub-03_ses-test_T1w_ns+tlrc.HEAD +++ Loading datasets +++ NOTE: base and source coordinate systems have different handedness + + Orientations: base=Right handed (LPI); source=Left handed (RPI) +++ master dataset for output = base +++ changing output grid spacing to 4.0000 mm +++ OpenMP thread count = 4 +++ ========== Applying transformation to 237 sub-bricks ========== +volume 0..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..65..66..67..68..69..70..71..72..73..74..75..76..77..78..79..80..81..82..83..84..85..86..87..88..89..90..91..92..93..94..95..96..97..98..99..100..101..102..103..104..105..106..107..108..109..110..111..112..113..114..115..116..117..118..119..120..121..122..123..124..125..126..127..128..129..130..131..132..133..134..135..136..137..138..139..140..141..142..143..144..145..146..147..148..149..150..151..152..153..154..155..156..157..158..159..160..161..162..163..164..165..166..167..168..169..170..171..172..173..174..175..176..177..178..179..180..181..182..183..184..185..186..187..188..189..190..191..192..193..194..195..196..197..198..199..200..201..202..203..204..205..206..207..208..209..210..211..212..213..214..215..216..217..218..219..220..221..222..223..224..225..226..227..228..229..230..231..232..233..234..235..236Ø++ Output dataset ./rm.epi.nomask.r01+tlrc.BRIK +++ 3dAllineate: total CPU time = 6.0 sec Elapsed = 4.1 +++ ########################################################### +3dAllineate -base sub-03_ses-test_T1w_ns+tlrc -input rm.epi.all1+orig -1Dmatrix_apply mat.r01.warp.aff12.1D -mast_dxyz 4 -final NN -quiet -prefix rm.epi.1.r01 +++ 3dAllineate: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: Zhark the Registrator +*+ WARNING: If you are performing spatial transformations on an oblique dset, + such as ./rm.epi.all1+orig.BRIK, + or viewing/combining it with volumes of differing obliquity, + you should consider running: + 3dWarp -deoblique + on this and other oblique datasets in the same session. + See 3dWarp -help for details. +++ Oblique dataset:./rm.epi.all1+orig.BRIK is 6.153038 degrees from plumb. +++ NOTE: base and source coordinate systems have different handedness + + Orientations: base=Right handed (LPI); source=Left handed (RPI) +++ 3dAllineate: total CPU time = 3.5 sec Elapsed = 3.1 +3dTstat -min -prefix rm.epi.min.r01 rm.epi.1.r01+tlrc +++ 3dTstat: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: KR Hammett & RW Cox +end +cat dfile.r01.1D +3dcopy rm.epi.min.r01+tlrc mask_epi_extents +++ 3dcopy: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +foreach run ( 01 ) +3dcalc -a rm.epi.nomask.r01+tlrc -b mask_epi_extents+tlrc -expr a*b -prefix pb02.sub_03.r01.volreg +++ 3dcalc: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: A cast of thousands +++ Output dataset ./pb02.sub_03.r01.volreg+tlrc.BRIK +end +cat_matvec -ONELINE sub-03_ses-test_T1w_ns+tlrc::WARP_DATA -I sub-03_ses-test_T1w_al_junk_mat.aff12.1D -I +3dAllineate -base sub-03_ses-test_T1w_ns+tlrc -input vr_base+orig -1Dmatrix_apply mat.basewarp.aff12.1D -mast_dxyz 4 -prefix final_epi_vr_base +++ 3dAllineate: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: Zhark the Registrator +*+ WARNING: If you are performing spatial transformations on an oblique dset, + such as ./vr_base+orig.BRIK, + or viewing/combining it with volumes of differing obliquity, + you should consider running: + 3dWarp -deoblique + on this and other oblique datasets in the same session. + See 3dWarp -help for details. +++ Oblique dataset:./vr_base+orig.BRIK is 6.153038 degrees from plumb. +++ Source dataset: ./vr_base+orig.HEAD +++ Base dataset: ./sub-03_ses-test_T1w_ns+tlrc.HEAD +++ Loading datasets +++ NOTE: base and source coordinate systems have different handedness + + Orientations: base=Right handed (LPI); source=Left handed (RPI) +++ master dataset for output = base +++ changing output grid spacing to 4.0000 mm +++ OpenMP thread count = 4 +++ ========== Applying transformation to 1 sub-bricks ========== +volume 0Ø++ Output dataset ./final_epi_vr_base+tlrc.BRIK +++ 3dAllineate: total CPU time = 0.0 sec Elapsed = 0.1 +++ ########################################################### +3dcopy sub-03_ses-test_T1w_ns+tlrc anat_final.sub_03 +++ 3dcopy: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +3dAllineate -base final_epi_vr_base+tlrc -allcostX -input anat_final.sub_03+tlrc +tee out.allcostX.txt +++ 3dAllineate: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: Zhark the Registrator +++ Source dataset: ./anat_final.sub_03+tlrc.HEAD +++ Base dataset: ./final_epi_vr_base+tlrc.HEAD +++ Loading datasets +++ 223015 voxels in source_automask+0 +++ Zero-pad: xbot=1 xtop=2 +++ Zero-pad: ybot=0 ytop=1 +++ Zero-pad: zbot=1 ztop=1 +++ Computing -autobox +++ 111006 voxels [89.5%] in weight mask +++ Number of points for matching = 52172 +++ Local correlation: blok type = 'RHDD(14.76)' +*+ WARNING: No output dataset will be calculated +++ OpenMP thread count = 4 +volume 0Ø + initial Parameters = 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 1.0000 1.0000 0.0000 0.0000 0.0000 +++ allcost output: init #0 + ls = 0.18269 + sp = 0.302214 + mi = -0.542443 + crM = 0.0831465 + nmi = 0.868037 + je = 3.5681 + hel = -0.108642 + crA = 0.288642 + crU = 0.301598 + lss = 0.81731 + lpc = 0.373345 + lpa = 0.626655 + lpc+ = 0.57125 + ncd = 0.966558 +++ 3dAllineate: total CPU time = 0.3 sec Elapsed = 0.4 +++ ########################################################### +3dAllineate -source sub-03_ses-test_T1w+orig -master anat_final.sub_03+tlrc -final wsinc5 -1Dmatrix_apply warp.anat.Xat.1D -prefix anat_w_skull_warped +++ 3dAllineate: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: Zhark the Registrator +*+ WARNING: If you are performing spatial transformations on an oblique dset, + such as ./sub-03_ses-test_T1w+orig.BRIK, + or viewing/combining it with volumes of differing obliquity, + you should consider running: + 3dWarp -deoblique + on this and other oblique datasets in the same session. + See 3dWarp -help for details. +++ Oblique dataset:./sub-03_ses-test_T1w+orig.BRIK is 6.455733 degrees from plumb. +++ -1Dmatrix_apply: converting input 3x4 array to 1 row of 12 numbers +++ Source dataset: ./sub-03_ses-test_T1w+orig.HEAD +++ Base dataset: (not given) +++ Loading datasets +++ OpenMP thread count = 4 +++ ========== Applying transformation to 1 sub-bricks ========== +volume 0Ø++ wsinc5 interpolation setup: + + taper function = Min sidelobe 3 term + + taper cut point = 0.000 + + window radius = 5 voxels + + window shape = Cubical + + The above can be altered via the AFNI_WSINC5_* environment variables. + + (To avoid this message, 'setenv AFNI_WSINC5_SILENT YES'.) + + wsinc5 CUBE(5) mask has 1000 points +++ Output dataset ./anat_w_skull_warped+tlrc.BRIK +++ 3dAllineate: total CPU time = 3.1 sec Elapsed = 1.3 +++ ########################################################### +foreach run ( 01 ) +3dmerge -1blur_fwhm 6.0 -doall -prefix pb03.sub_03.r01.blur pb02.sub_03.r01.volreg+tlrc +++ 3dmerge: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ default -1dindex = 0 +++ default -1tindex = 1 +Program 3dmerge +3dmerge: edit and combine 3D datasets, by RW Cox +++ editing input dataset in memory (49.4 MB) +.............................................................................................................................................................................................................................................-- Wrote edited dataset: ./pb03.sub_03.r01.blur+tlrc.BRIK + +end +foreach run ( 01 ) +3dAutomask -dilate 1 -prefix rm.mask_r01 pb03.sub_03.r01.blur+tlrc +++ 3dAutomask: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: Emperor Zhark +++ Loading dataset pb03.sub_03.r01.blur+tlrc +++ Forming automask + + Fixed clip level = 709.231506 + + Used gradual clip level = 629.214294 .. 792.803772 + + Number voxels above clip level = 28213 + + Clustering voxels ... + + Largest cluster has 28213 voxels + + Clustering voxels ... + + Largest cluster has 28129 voxels + + Filled 49 voxels in small holes; now have 28178 voxels + + Clustering voxels ... + + Largest cluster has 28178 voxels + + Clustering non-brain voxels ... + + Clustering voxels ... + + Largest cluster has 81172 voxels + + Mask now has 28178 voxels +++ Dilating automask + + Clustering voxels ... + + Largest cluster has 76144 voxels +++ 33206 voxels in the mask [out of 109350: 30.37%] +++ first 4 x-planes are zero [from L] +++ last 3 x-planes are zero [from R] +++ first 4 y-planes are zero [from P] +++ last 3 y-planes are zero [from A] +++ first 3 z-planes are zero [from I] +++ last 3 z-planes are zero [from S] +++ CPU time = 0.240000 sec +end +3dmask_tool -inputs rm.mask_r01+tlrc.HEAD -union -prefix full_mask.sub_03 +++ processing 1 input datasets... +++ padding all datasets by 0 (for dilations) +++ frac 0 over 1 volumes gives min count 0 +++ voxel limits: 0 clipped, 33206 survived, 76144 were zero +++ writing result full_mask.sub_03... +3dresample -master full_mask.sub_03+tlrc -input sub-03_ses-test_T1w_ns+tlrc -prefix rm.resam.anat +3dmask_tool -dilate_input 5 -5 -fill_holes -input rm.resam.anat+tlrc -prefix mask_anat.sub_03 +++ no -frac option: defaulting to -union +++ processing 1 input datasets... +++ padding all datasets by 5 (for dilations) +++ frac 0 over 1 volumes gives min count 0 +++ voxel limits: 0 clipped, 30704 survived, 78646 were zero +++ filled 0 holes (0 voxels) +++ writing result mask_anat.sub_03... +3dABoverlap -no_automask full_mask.sub_03+tlrc mask_anat.sub_03+tlrc +tee out.mask_ae_overlap.txt +++ 3dOverlap: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +#A=./full_mask.sub_03+tlrc.BRIK B=./mask_anat.sub_03+tlrc.BRIK +#A #B #(A uni B) #(A int B) #(A \ B) #(B \ A) %(A \ B) %(B \ A) Rx(B/A) Ry(B/A) Rz(B/A) +33206 30704 35986 27924 5282 2780 15.9068 9.0542 0.9454 0.9214 0.9826 +3ddot -dodice full_mask.sub_03+tlrc mask_anat.sub_03+tlrc +tee out.mask_ae_dice.txt +0.873854 +3dresample -master full_mask.sub_03+tlrc -prefix ./rm.resam.group -input /Users/mli/abin/MNI_avg152T1+tlrc +3dmask_tool -dilate_input 5 -5 -fill_holes -input rm.resam.group+tlrc -prefix mask_group +++ no -frac option: defaulting to -union +++ processing 1 input datasets... +++ padding all datasets by 5 (for dilations) +++ frac 0 over 1 volumes gives min count 0 +++ voxel limits: 0 clipped, 30980 survived, 78370 were zero +++ filled 0 holes (0 voxels) +++ writing result mask_group... +foreach run ( 01 ) +3dTstat -prefix rm.mean_r01 pb03.sub_03.r01.blur+tlrc +++ 3dTstat: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: KR Hammett & RW Cox +++ Output dataset ./rm.mean_r01+tlrc.BRIK +3dcalc -a pb03.sub_03.r01.blur+tlrc -b rm.mean_r01+tlrc -c mask_epi_extents+tlrc -expr c * min(200, a/b*100)*step(a)*step(b) -prefix pb04.sub_03.r01.scale +++ 3dcalc: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: A cast of thousands +++ Output dataset ./pb04.sub_03.r01.scale+tlrc.BRIK +end +1d_tool.py -infile dfile_rall.1D -set_nruns 1 -demean -write motion_demean.1D +1d_tool.py -infile dfile_rall.1D -set_nruns 1 -derivative -demean -write motion_deriv.1D +1d_tool.py -infile dfile_rall.1D -set_nruns 1 -show_censor_count -censor_prev_TR -censor_motion 0.5 motion_sub_03 +total number of censored TRs (simple form) = 22 +set ktrs = `1d_tool.py -infile motion_${subj}_censor.1D + -show_trs_uncensored encoded` +1d_tool.py -infile motion_sub_03_censor.1D -show_trs_uncensored encoded +3dDeconvolve -input pb04.sub_03.r01.scale+tlrc.HEAD -censor motion_sub_03_censor.1D -polort 4 -num_stimts 17 -stim_times 1 stimuli/timing_sub-03_ses-test_Correct_Task.1D GAM -stim_label 1 Correct_Task -stim_times 2 stimuli/timing_sub-03_ses-test_Incorrect_Task.1D GAM -stim_label 2 Incorrect_Task -stim_times 3 stimuli/timing_sub-03_ses-test_No_Response_Control.1D GAM -stim_label 3 No_Response_Control -stim_times 4 stimuli/timing_sub-03_ses-test_No_Response_Task.1D GAM -stim_label 4 No_Response_Task -stim_times 5 stimuli/timing_sub-03_ses-test_Response_Control.1D GAM -stim_label 5 Response_Control -stim_file 6 motion_demean.1D[0] -stim_base 6 -stim_label 6 roll_01 -stim_file 7 motion_demean.1D[1] -stim_base 7 -stim_label 7 pitch_01 -stim_file 8 motion_demean.1D[2] -stim_base 8 -stim_label 8 yaw_01 -stim_file 9 motion_demean.1D[3] -stim_base 9 -stim_label 9 dS_01 -stim_file 10 motion_demean.1D[4] -stim_base 10 -stim_label 10 dL_01 -stim_file 11 motion_demean.1D[5] -stim_base 11 -stim_label 11 dP_01 -stim_file 12 motion_deriv.1D[0] -stim_base 12 -stim_label 12 roll_02 -stim_file 13 motion_deriv.1D[1] -stim_base 13 -stim_label 13 pitch_02 -stim_file 14 motion_deriv.1D[2] -stim_base 14 -stim_label 14 yaw_02 -stim_file 15 motion_deriv.1D[3] -stim_base 15 -stim_label 15 dS_02 -stim_file 16 motion_deriv.1D[4] -stim_base 16 -stim_label 16 dL_02 -stim_file 17 motion_deriv.1D[5] -stim_base 17 -stim_label 17 dP_02 -gltsym SYM: 0.5*Correct_Task +0.5*Incorrect_Task -Response_Control -glt_label 1 Landmark-Detection -fout -tout -x1D X.xmat.1D -xjpeg X.jpg -x1D_uncensored X.nocensor.xmat.1D -fitts fitts.sub_03 -errts errts.sub_03 -bucket stats.sub_03 +++ 3dDeconvolve: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: B. Douglas Ward, et al. +++ loading dataset pb04.sub_03.r01.scale+tlrc.HEAD +++ STAT automask has 97106 voxels (out of 109350 = 88.8%) +++ Skipping check for initial transients +++ Input polort=4; Longest run=592.5 s; Recommended minimum polort=4 ++ OK ++ +++ -stim_times using TR=2.5 s for stimulus timing conversion +++ -stim_times using TR=2.5 s for any -iresp output datasets +++ [you can alter the -iresp TR via the -TR_times option] +++ ** -stim_times NOTE ** guessing GLOBAL times if 1 time per line; LOCAL otherwise +++ ** GUESSED ** -stim_times 1 using LOCAL times +++ ** GUESSED ** -stim_times 2 using LOCAL times +++ ** GUESSED ** -stim_times 3 using LOCAL times +++ ** GUESSED ** -stim_times 4 using LOCAL times +++ ** GUESSED ** -stim_times 5 using LOCAL times +------------------------------------------------------------ +GLT matrix from 'SYM: 0.5*Correct_Task +0.5*Incorrect_Task -Response_Control': + 0 0 0 0 0 0.5 0.5 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 + +++ Number of time points: 237 (before censor) ; 215 (after) + + Number of parameters: 22 [17 baseline ; 5 signal] +++ Memory required for output bricks = 215,638,200 bytes (about 216 million [mega]) +++ Wrote matrix image to file X.jpg +++ Wrote matrix values to file X.xmat.1D +++ ========= Things you can do with the matrix file ========= +++ (a) Linear regression with ARMA(1,1) modeling of serial correlation: + +3dREMLfit -matrix X.xmat.1D -input pb04.sub_03.r01.scale+tlrc.HEAD \ + -fout -tout -Rbuck stats.sub_03_REML -Rvar stats.sub_03_REMLvar \ + -Rfitts fitts.sub_03_REML -Rerrts errts.sub_03_REML -verb + +++ N.B.: 3dREMLfit command above written to file stats.REML_cmd +++ (b) Visualization/analysis of the matrix via ExamineXmat.R +++ (c) Synthesis of sub-model datasets using 3dSynthesize +++ ========================================================== +++ Wrote matrix values to file X.nocensor.xmat.1D +++ ----- Signal+Baseline matrix condition [X] (215x22): 7.47726 ++ VERY GOOD ++ +++ ----- Signal-only matrix condition [X] (215x5): 1.47181 ++ VERY GOOD ++ +++ ----- Baseline-only matrix condition [X] (215x17): 7.3131 ++ VERY GOOD ++ +++ ----- stim_base-only matrix condition [X] (215x12): 6.12753 ++ VERY GOOD ++ +++ ----- polort-only matrix condition [X] (215x5): 1.09962 ++ VERY GOOD ++ +++ +++++ Matrix inverse average error = 9.39256e-15 ++ VERY GOOD ++ +++ Matrix setup time = 0.57 s +++ Calculations starting; elapsed time=1.180 +++ voxel loop:0123456789.0123456789.0123456789.0123456789.0123456789. +++ Calculations finished; elapsed time=15.307 +++ Smallest FDR q [0 Full_Fstat] = 3.64156e-13 +++ Smallest FDR q [2 Correct_Task#0_Tstat] = 3.53829e-12 +++ Smallest FDR q [3 Correct_Task_Fstat] = 3.53752e-12 +++ Smallest FDR q [5 Incorrect_Task#0_Tstat] = 0.0769233 +++ Smallest FDR q [6 Incorrect_Task_Fstat] = 0.0769143 +++ Smallest FDR q [8 No_Response_Control#0_Tstat] = 0.000784632 +++ Smallest FDR q [9 No_Response_Control_Fstat] = 0.000784632 +++ Smallest FDR q [11 No_Response_Task#0_Tstat] = 8.9263e-12 +++ Smallest FDR q [12 No_Response_Task_Fstat] = 8.92772e-12 +++ Smallest FDR q [14 Response_Control#0_Tstat] = 2.6772e-11 +++ Smallest FDR q [15 Response_Control_Fstat] = 2.67706e-11 +++ Smallest FDR q [17 Landmark-Detection_GLT#0_Tstat] = 0.0684832 +++ Smallest FDR q [18 Landmark-Detection_GLT_Fstat] = 0.068483 +++ Wrote bucket dataset into ./stats.sub_03+tlrc.BRIK + + created 13 FDR curves in bucket header +++ Wrote 3D+time dataset into ./fitts.sub_03+tlrc.BRIK +++ Wrote 3D+time dataset into ./errts.sub_03+tlrc.BRIK +++ #Flops=3.93533e+10 Average Dot Product=37.1935 +if ( 0 != 0 ) then +1d_tool.py -show_cormat_warnings -infile X.xmat.1D +tee out.cormat_warn.txt + +Warnings regarding Correlation Matrix: X.xmat.1D + + severity correlation cosine regressor pair + -------- ----------- ------ ---------------------------------------- + medium: 0.570 0.649 ( 7 vs. 9) No_Response_Control#0 vs. Response_Control#0 + +3dTcat -prefix all_runs.sub_03 pb04.sub_03.r01.scale+tlrc.HEAD +++ 3dTcat: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ elapsed time = 0.5 s +3dTstat -mean -prefix rm.signal.all all_runs.sub_03+tlrc[0..47,59,60,68..161,164..187,190..236] +++ 3dTstat: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: KR Hammett & RW Cox +++ Output dataset ./rm.signal.all+tlrc.BRIK +3dTstat -stdev -prefix rm.noise.all errts.sub_03+tlrc[0..47,59,60,68..161,164..187,190..236] +++ 3dTstat: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: KR Hammett & RW Cox +++ Output dataset ./rm.noise.all+tlrc.BRIK +3dcalc -a rm.signal.all+tlrc -b rm.noise.all+tlrc -c full_mask.sub_03+tlrc -expr c*a/b -prefix TSNR.sub_03 +++ 3dcalc: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: A cast of thousands +++ Output dataset ./TSNR.sub_03+tlrc.BRIK +3dTnorm -norm2 -prefix rm.errts.unit errts.sub_03+tlrc +++ 3dTnorm: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: RW Cox +++ Output dataset ./rm.errts.unit+tlrc.BRIK +3dmaskave -quiet -mask full_mask.sub_03+tlrc rm.errts.unit+tlrc +++ 3dmaskave: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] ++++ 33206 voxels survive the mask +3dTstat -sos -prefix - gmean.errts.unit.1D' +++ 3dTstat: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: KR Hammett & RW Cox +*+ WARNING: Input dataset is not 3D+time; assuming TR=1.0 +echo -- GCOR = `cat out.gcor.1D` +cat out.gcor.1D +-- GCOR = 0.158995 +3dcalc -a rm.errts.unit+tlrc -b gmean.errts.unit.1D -expr a*b -prefix rm.DP +++ 3dcalc: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: A cast of thousands +++ Output dataset ./rm.DP+tlrc.BRIK +3dTstat -sum -prefix corr_brain rm.DP+tlrc +++ 3dTstat: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: KR Hammett & RW Cox +++ Output dataset ./corr_brain+tlrc.BRIK +1dcat X.nocensor.xmat.1D[5] +1dcat X.nocensor.xmat.1D[6] +1dcat X.nocensor.xmat.1D[7] +1dcat X.nocensor.xmat.1D[8] +1dcat X.nocensor.xmat.1D[9] +set reg_cols = `1d_tool.py -infile X.nocensor.xmat.1D -show_indices_interest` +1d_tool.py -infile X.nocensor.xmat.1D -show_indices_interest +3dTstat -sum -prefix sum_ideal.1D X.nocensor.xmat.1D[5..9] +++ 3dTstat: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: KR Hammett & RW Cox +*+ WARNING: Input dataset is not 3D+time; assuming TR=1.0 +++ Output dataset ./sum_ideal.1D +1dcat X.nocensor.xmat.1D[5..9] +touch blur_est.sub_03.1D +mkdir files_ACF +touch blur.epits.1D +foreach run ( 01 ) +set trs = `1d_tool.py -infile X.xmat.1D -show_trs_uncensored encoded + -show_trs_run $run` +1d_tool.py -infile X.xmat.1D -show_trs_uncensored encoded -show_trs_run 01 +if ( 0..47,59,60,68..161,164..187,190..236 == ) continue +3dFWHMx -detrend -mask full_mask.sub_03+tlrc -ACF files_ACF/out.3dFWHMx.ACF.epits.r01.1D all_runs.sub_03+tlrc[0..47,59,60,68..161,164..187,190..236] +++ 3dFWHMx: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: The Bob +++ Number of voxels in mask = 33206 +*+ WARNING: removed 236 voxels from mask because they are constant in time +++ detrending start: 17 baseline funcs, 215 time points + + detrending done (2.53 CPU s thus far) +++ start ACF calculations out to radius = 28.19 mm + + ACF done (58.93 CPU s thus far) +++ ACF 1D file [radius ACF mixed_model gaussian_NEWmodel] written to files_ACF/out.3dFWHMx.ACF.epits.r01.1D +++ 1dplot: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: RWC et al. + + and 1dplot-ed to file files_ACF/out.3dFWHMx.ACF.epits.r01.1D.png +end +set blurs = ( `3dTstat -mean -prefix - blur.epits.1D'{0..$(2)}'\'` ) +3dTstat -mean -prefix - blur.epits.1D{0..$(2)}' +++ 3dTstat: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: KR Hammett & RW Cox +*+ WARNING: Input dataset has 1 sub-brick ==> -tdiff is turned off +*+ WARNING: Input dataset is not 3D+time; assuming TR=1.0 +echo average epits FWHM blurs: 0 0 0 0 +average epits FWHM blurs: 0 0 0 0 +echo 0 0 0 0 # epits FWHM blur estimates +set blurs = ( `3dTstat -mean -prefix - blur.epits.1D'{1..$(2)}'\'` ) +3dTstat -mean -prefix - blur.epits.1D{1..$(2)}' +++ 3dTstat: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: KR Hammett & RW Cox +*+ WARNING: Input dataset has 1 sub-brick ==> -tdiff is turned off +*+ WARNING: Input dataset is not 3D+time; assuming TR=1.0 +echo average epits ACF blurs: 0.600388 5.30928 13.65 13.7777 +average epits ACF blurs: 0.600388 5.30928 13.65 13.7777 +echo 0.600388 5.30928 13.65 13.7777 # epits ACF blur estimates +touch blur.errts.1D +foreach run ( 01 ) +set trs = `1d_tool.py -infile X.xmat.1D -show_trs_uncensored encoded + -show_trs_run $run` +1d_tool.py -infile X.xmat.1D -show_trs_uncensored encoded -show_trs_run 01 +if ( 0..47,59,60,68..161,164..187,190..236 == ) continue +3dFWHMx -detrend -mask full_mask.sub_03+tlrc -ACF files_ACF/out.3dFWHMx.ACF.errts.r01.1D errts.sub_03+tlrc[0..47,59,60,68..161,164..187,190..236] +++ 3dFWHMx: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: The Bob +++ Number of voxels in mask = 33206 +*+ WARNING: removed 236 voxels from mask because they are constant in time +++ detrending start: 17 baseline funcs, 215 time points + + detrending done (2.59 CPU s thus far) +++ start ACF calculations out to radius = 27.70 mm + + ACF done (58.17 CPU s thus far) +++ ACF 1D file [radius ACF mixed_model gaussian_NEWmodel] written to files_ACF/out.3dFWHMx.ACF.errts.r01.1D +++ 1dplot: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: RWC et al. + + and 1dplot-ed to file files_ACF/out.3dFWHMx.ACF.errts.r01.1D.png +end +set blurs = ( `3dTstat -mean -prefix - blur.errts.1D'{0..$(2)}'\'` ) +3dTstat -mean -prefix - blur.errts.1D{0..$(2)}' +++ 3dTstat: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: KR Hammett & RW Cox +*+ WARNING: Input dataset has 1 sub-brick ==> -tdiff is turned off +*+ WARNING: Input dataset is not 3D+time; assuming TR=1.0 +echo average errts FWHM blurs: 0 0 0 0 +average errts FWHM blurs: 0 0 0 0 +echo 0 0 0 0 # errts FWHM blur estimates +set blurs = ( `3dTstat -mean -prefix - blur.errts.1D'{1..$(2)}'\'` ) +3dTstat -mean -prefix - blur.errts.1D{1..$(2)}' +++ 3dTstat: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: KR Hammett & RW Cox +*+ WARNING: Input dataset has 1 sub-brick ==> -tdiff is turned off +*+ WARNING: Input dataset is not 3D+time; assuming TR=1.0 +echo average errts ACF blurs: 0.669971 5.25102 13.8287 13.4065 +average errts ACF blurs: 0.669971 5.25102 13.8287 13.4065 +echo 0.669971 5.25102 13.8287 13.4065 # errts ACF blur estimates +gen_epi_review.py -script @epi_review.sub_03 -dsets pb00.sub_03.r01.tcat+orig.HEAD +gen_ss_review_scripts.py -mot_limit 0.5 -exit0 +++ writing ss review basic: @ss_review_basic +++ writing ss review driver: @ss_review_driver +++ writing ss review drive commands: @ss_review_driver_commands +rm -f rm.DP+tlrc.BRIK rm.DP+tlrc.HEAD rm.epi.1.r01+tlrc.BRIK.gz rm.epi.1.r01+tlrc.HEAD rm.epi.all1+orig.BRIK.gz rm.epi.all1+orig.HEAD rm.epi.min.r01+tlrc.BRIK.gz rm.epi.min.r01+tlrc.HEAD rm.epi.nomask.r01+tlrc.BRIK rm.epi.nomask.r01+tlrc.HEAD rm.epi.volreg.r01+orig.BRIK rm.epi.volreg.r01+orig.HEAD rm.errts.unit+tlrc.BRIK rm.errts.unit+tlrc.HEAD rm.mask_r01+tlrc.BRIK.gz rm.mask_r01+tlrc.HEAD rm.mean_r01+tlrc.BRIK rm.mean_r01+tlrc.HEAD rm.noise.all+tlrc.BRIK rm.noise.all+tlrc.HEAD rm.resam.anat+tlrc.BRIK rm.resam.anat+tlrc.HEAD rm.resam.group+tlrc.BRIK rm.resam.group+tlrc.HEAD rm.signal.all+tlrc.BRIK rm.signal.all+tlrc.HEAD +tee out.ss_review.sub_03.txt +if ( -e @ss_review_basic ) ./@ss_review_basic +./@ss_review_basic + +subject ID : sub_03 +TRs removed (per run) : 1 +num stim classes provided : 5 +final anatomy dset : anat_final.sub_03+tlrc.HEAD +final stats dset : stats.sub_03+tlrc.HEAD +final voxel resolution : 4.000000 4.000000 4.000000 + +motion limit : 0.5 +num TRs above mot limit : 16 +average motion (per TR) : 0.160024 +average censored motion : 0.115175 +max motion displacement : 4.03483 +max censored displacement : 4.03483 +outlier limit : 0.1 +average outlier frac (TR) : 0.0119293 +num TRs above out limit : 8 + +num runs found : 1 +num TRs per run : 237 +num TRs per run (applied) : 215 +num TRs per run (censored): 22 +fraction censored per run : 0.092827 +TRs total (uncensored) : 237 +TRs total : 215 +degrees of freedom used : 22 +degrees of freedom left : 193 + +TRs censored : 22 +censor fraction : 0.092827 +num regs of interest : 5 +num TRs per stim (orig) : 71 43 64 28 79 +num TRs censored per stim : 0 0 13 7 11 +fraction TRs censored : 0.000 0.000 0.203 0.250 0.139 +ave mot per sresp (orig) : 0.105296 0.103826 0.216156 0.210735 0.179376 +ave mot per sresp (cens) : 0.105296 0.103826 0.108428 0.100787 0.100622 + +TSNR average : 210.84 +global correlation (GCOR) : 0.158995 +anat/EPI mask Dice coef : 0.873854 +maximum F-stat (masked) : 61.5622 +blur estimates (ACF) : 0.669971 5.25102 13.8287 +blur estimates (FWHM) : 0 0 0 + + +cd .. +echo execution finished: `date` +date +execution finished: Sat Aug 5 16:33:35 EDT 2017 diff --git a/hw2/Exp-1/subject_results/group.test/subj.sub_03/proc.sub_03 b/hw2/Exp-1/subject_results/group.test/subj.sub_03/proc.sub_03 new file mode 100755 index 0000000..96f1d92 --- /dev/null +++ b/hw2/Exp-1/subject_results/group.test/subj.sub_03/proc.sub_03 @@ -0,0 +1,477 @@ +#!/bin/tcsh -xef + +echo "auto-generated by afni_proc.py, Sat Aug 5 16:29:05 2017" +echo "(version 5.15, April 25, 2017)" +echo "execution started: `date`" + +# execute via : +# tcsh -xef proc.sub_03 |& tee output.proc.sub_03 + +# =========================== auto block: setup ============================ +# script setup + +# take note of the AFNI version +afni -ver + +# check that the current AFNI version is recent enough +afni_history -check_date 23 Sep 2016 +if ( $status ) then + echo "** this script requires newer AFNI binaries (than 23 Sep 2016)" + echo " (consider: @update.afni.binaries -defaults)" + exit +endif + +# the user may specify a single subject to run with +if ( $#argv > 0 ) then + set subj = $argv[1] +else + set subj = sub_03 +endif + +# assign output directory name +set output_dir = $subj.results + +# verify that the results directory does not yet exist +if ( -d $output_dir ) then + echo output dir "$subj.results" already exists + exit +endif + +# set list of runs +set runs = (`count -digits 2 1 1`) + +# create results and stimuli directories +mkdir $output_dir +mkdir $output_dir/stimuli + +# copy stim files into stimulus directory +cp /Users/mli/Desktop/playground/timing_sub-03_ses-test_Correct_Task.1D \ + /Users/mli/Desktop/playground/timing_sub-03_ses-test_Incorrect_Task.1D \ + /Users/mli/Desktop/playground/timing_sub-03_ses-test_No_Response_Control.1D \ + /Users/mli/Desktop/playground/timing_sub-03_ses-test_No_Response_Task.1D \ + /Users/mli/Desktop/playground/timing_sub-03_ses-test_Response_Control.1D \ + $output_dir/stimuli + +# copy anatomy to results dir +3dcopy \ + /Users/mli/Desktop/playground/sub-03/ses-test/anat/sub-03_ses-test_T1w.nii.gz \ + $output_dir/sub-03_ses-test_T1w + +# ============================ auto block: tcat ============================ +# apply 3dTcat to copy input dsets to results dir, while +# removing the first 1 TRs +3dTcat -prefix $output_dir/pb00.$subj.r01.tcat \ + /Users/mli/Desktop/playground/sub-03/ses-test/func/sub-03_ses-test_task-linebisection_bold.nii.gz'[1..$]' + +# and make note of repetitions (TRs) per run +set tr_counts = ( 237 ) + +# ------------------------------------------------------- +# enter the results directory (can begin processing data) +cd $output_dir + + +# ========================== auto block: outcount ========================== +# data check: compute outlier fraction for each volume +touch out.pre_ss_warn.txt +foreach run ( $runs ) + 3dToutcount -automask -fraction -polort 4 -legendre \ + pb00.$subj.r$run.tcat+orig > outcount.r$run.1D + + # outliers at TR 0 might suggest pre-steady state TRs + if ( `1deval -a outcount.r$run.1D"{0}" -expr "step(a-0.4)"` ) then + echo "** TR #0 outliers: possible pre-steady state TRs in run $run" \ + >> out.pre_ss_warn.txt + endif +end + +# catenate outlier counts into a single time series +cat outcount.r*.1D > outcount_rall.1D + +# ================================= tshift ================================= +# time shift data so all slice timing is the same +foreach run ( $runs ) + 3dTshift -tzero 0 -quintic -prefix pb01.$subj.r$run.tshift \ + -tpattern alt+z \ + pb00.$subj.r$run.tcat+orig +end + +# -------------------------------- +# extract volreg registration base +3dbucket -prefix vr_base pb01.$subj.r01.tshift+orig"[2]" + +# ================================= align ================================== +# for e2a: compute anat alignment transformation to EPI registration base +# (new anat will be intermediate, stripped, sub-03_ses-test_T1w_ns+orig) +align_epi_anat.py -anat2epi -anat sub-03_ses-test_T1w+orig \ + -save_skullstrip -suffix _al_junk \ + -epi vr_base+orig -epi_base 0 \ + -epi_strip 3dAutomask \ + -volreg off -tshift off + +# ================================== tlrc ================================== +# warp anatomy to standard space +@auto_tlrc -base MNI_avg152T1+tlrc -input sub-03_ses-test_T1w_ns+orig -no_ss + +# store forward transformation matrix in a text file +cat_matvec sub-03_ses-test_T1w_ns+tlrc::WARP_DATA -I > warp.anat.Xat.1D + +# ================================= volreg ================================= +# align each dset to base volume, align to anat, warp to tlrc space + +# verify that we have a +tlrc warp dataset +if ( ! -f sub-03_ses-test_T1w_ns+tlrc.HEAD ) then + echo "** missing +tlrc warp dataset: sub-03_ses-test_T1w_ns+tlrc.HEAD" + exit +endif + +# register and warp +foreach run ( $runs ) + # register each volume to the base + 3dvolreg -verbose -zpad 1 -base vr_base+orig \ + -1Dfile dfile.r$run.1D -prefix rm.epi.volreg.r$run \ + -cubic \ + -1Dmatrix_save mat.r$run.vr.aff12.1D \ + pb01.$subj.r$run.tshift+orig + + # create an all-1 dataset to mask the extents of the warp + 3dcalc -overwrite -a pb01.$subj.r$run.tshift+orig -expr 1 \ + -prefix rm.epi.all1 + + # catenate volreg/epi2anat/tlrc xforms + cat_matvec -ONELINE \ + sub-03_ses-test_T1w_ns+tlrc::WARP_DATA -I \ + sub-03_ses-test_T1w_al_junk_mat.aff12.1D -I \ + mat.r$run.vr.aff12.1D > mat.r$run.warp.aff12.1D + + # apply catenated xform: volreg/epi2anat/tlrc + 3dAllineate -base sub-03_ses-test_T1w_ns+tlrc \ + -input pb01.$subj.r$run.tshift+orig \ + -1Dmatrix_apply mat.r$run.warp.aff12.1D \ + -mast_dxyz 4 \ + -prefix rm.epi.nomask.r$run + + # warp the all-1 dataset for extents masking + 3dAllineate -base sub-03_ses-test_T1w_ns+tlrc \ + -input rm.epi.all1+orig \ + -1Dmatrix_apply mat.r$run.warp.aff12.1D \ + -mast_dxyz 4 -final NN -quiet \ + -prefix rm.epi.1.r$run + + # make an extents intersection mask of this run + 3dTstat -min -prefix rm.epi.min.r$run rm.epi.1.r$run+tlrc +end + +# make a single file of registration params +cat dfile.r*.1D > dfile_rall.1D + +# ---------------------------------------- +# create the extents mask: mask_epi_extents+tlrc +# (this is a mask of voxels that have valid data at every TR) +# (only 1 run, so just use 3dcopy to keep naming straight) +3dcopy rm.epi.min.r01+tlrc mask_epi_extents + +# and apply the extents mask to the EPI data +# (delete any time series with missing data) +foreach run ( $runs ) + 3dcalc -a rm.epi.nomask.r$run+tlrc -b mask_epi_extents+tlrc \ + -expr 'a*b' -prefix pb02.$subj.r$run.volreg +end + +# warp the volreg base EPI dataset to make a final version +cat_matvec -ONELINE \ + sub-03_ses-test_T1w_ns+tlrc::WARP_DATA -I \ + sub-03_ses-test_T1w_al_junk_mat.aff12.1D -I > \ + mat.basewarp.aff12.1D + +3dAllineate -base sub-03_ses-test_T1w_ns+tlrc \ + -input vr_base+orig \ + -1Dmatrix_apply mat.basewarp.aff12.1D \ + -mast_dxyz 4 \ + -prefix final_epi_vr_base + +# create an anat_final dataset, aligned with stats +3dcopy sub-03_ses-test_T1w_ns+tlrc anat_final.$subj + +# record final registration costs +3dAllineate -base final_epi_vr_base+tlrc -allcostX \ + -input anat_final.$subj+tlrc |& tee out.allcostX.txt + +# ----------------------------------------- +# warp anat follower datasets (affine) +3dAllineate -source sub-03_ses-test_T1w+orig \ + -master anat_final.$subj+tlrc \ + -final wsinc5 -1Dmatrix_apply warp.anat.Xat.1D \ + -prefix anat_w_skull_warped + +# ================================== blur ================================== +# blur each volume of each run +foreach run ( $runs ) + 3dmerge -1blur_fwhm 6.0 -doall -prefix pb03.$subj.r$run.blur \ + pb02.$subj.r$run.volreg+tlrc +end + +# ================================== mask ================================== +# create 'full_mask' dataset (union mask) +foreach run ( $runs ) + 3dAutomask -dilate 1 -prefix rm.mask_r$run pb03.$subj.r$run.blur+tlrc +end + +# create union of inputs, output type is byte +3dmask_tool -inputs rm.mask_r*+tlrc.HEAD -union -prefix full_mask.$subj + +# ---- create subject anatomy mask, mask_anat.$subj+tlrc ---- +# (resampled from tlrc anat) +3dresample -master full_mask.$subj+tlrc -input sub-03_ses-test_T1w_ns+tlrc \ + -prefix rm.resam.anat + +# convert to binary anat mask; fill gaps and holes +3dmask_tool -dilate_input 5 -5 -fill_holes -input rm.resam.anat+tlrc \ + -prefix mask_anat.$subj + +# compute overlaps between anat and EPI masks +3dABoverlap -no_automask full_mask.$subj+tlrc mask_anat.$subj+tlrc \ + |& tee out.mask_ae_overlap.txt + +# note Dice coefficient of masks, as well +3ddot -dodice full_mask.$subj+tlrc mask_anat.$subj+tlrc \ + |& tee out.mask_ae_dice.txt + +# ---- create group anatomy mask, mask_group+tlrc ---- +# (resampled from tlrc base anat, MNI_avg152T1+tlrc) +3dresample -master full_mask.$subj+tlrc -prefix ./rm.resam.group \ + -input /Users/mli/abin/MNI_avg152T1+tlrc + +# convert to binary group mask; fill gaps and holes +3dmask_tool -dilate_input 5 -5 -fill_holes -input rm.resam.group+tlrc \ + -prefix mask_group + +# ================================= scale ================================== +# scale each voxel time series to have a mean of 100 +# (be sure no negatives creep in) +# (subject to a range of [0,200]) +foreach run ( $runs ) + 3dTstat -prefix rm.mean_r$run pb03.$subj.r$run.blur+tlrc + 3dcalc -a pb03.$subj.r$run.blur+tlrc -b rm.mean_r$run+tlrc \ + -c mask_epi_extents+tlrc \ + -expr 'c * min(200, a/b*100)*step(a)*step(b)' \ + -prefix pb04.$subj.r$run.scale +end + +# ================================ regress ================================= + +# compute de-meaned motion parameters (for use in regression) +1d_tool.py -infile dfile_rall.1D -set_nruns 1 \ + -demean -write motion_demean.1D + +# compute motion parameter derivatives (for use in regression) +1d_tool.py -infile dfile_rall.1D -set_nruns 1 \ + -derivative -demean -write motion_deriv.1D + +# create censor file motion_${subj}_censor.1D, for censoring motion +1d_tool.py -infile dfile_rall.1D -set_nruns 1 \ + -show_censor_count -censor_prev_TR \ + -censor_motion 0.5 motion_${subj} + +# note TRs that were not censored +set ktrs = `1d_tool.py -infile motion_${subj}_censor.1D \ + -show_trs_uncensored encoded` + +# ------------------------------ +# run the regression analysis +3dDeconvolve -input pb04.$subj.r*.scale+tlrc.HEAD \ + -censor motion_${subj}_censor.1D \ + -polort 4 \ + -num_stimts 17 \ + -stim_times 1 stimuli/timing_sub-03_ses-test_Correct_Task.1D 'GAM' \ + -stim_label 1 Correct_Task \ + -stim_times 2 stimuli/timing_sub-03_ses-test_Incorrect_Task.1D 'GAM' \ + -stim_label 2 Incorrect_Task \ + -stim_times 3 stimuli/timing_sub-03_ses-test_No_Response_Control.1D 'GAM' \ + -stim_label 3 No_Response_Control \ + -stim_times 4 stimuli/timing_sub-03_ses-test_No_Response_Task.1D 'GAM' \ + -stim_label 4 No_Response_Task \ + -stim_times 5 stimuli/timing_sub-03_ses-test_Response_Control.1D 'GAM' \ + -stim_label 5 Response_Control \ + -stim_file 6 motion_demean.1D'[0]' -stim_base 6 -stim_label 6 roll_01 \ + -stim_file 7 motion_demean.1D'[1]' -stim_base 7 -stim_label 7 pitch_01 \ + -stim_file 8 motion_demean.1D'[2]' -stim_base 8 -stim_label 8 yaw_01 \ + -stim_file 9 motion_demean.1D'[3]' -stim_base 9 -stim_label 9 dS_01 \ + -stim_file 10 motion_demean.1D'[4]' -stim_base 10 -stim_label 10 dL_01 \ + -stim_file 11 motion_demean.1D'[5]' -stim_base 11 -stim_label 11 dP_01 \ + -stim_file 12 motion_deriv.1D'[0]' -stim_base 12 -stim_label 12 roll_02 \ + -stim_file 13 motion_deriv.1D'[1]' -stim_base 13 -stim_label 13 pitch_02 \ + -stim_file 14 motion_deriv.1D'[2]' -stim_base 14 -stim_label 14 yaw_02 \ + -stim_file 15 motion_deriv.1D'[3]' -stim_base 15 -stim_label 15 dS_02 \ + -stim_file 16 motion_deriv.1D'[4]' -stim_base 16 -stim_label 16 dL_02 \ + -stim_file 17 motion_deriv.1D'[5]' -stim_base 17 -stim_label 17 dP_02 \ + -gltsym 'SYM: 0.5*Correct_Task +0.5*Incorrect_Task -Response_Control' \ + -glt_label 1 Landmark-Detection \ + -fout -tout -x1D X.xmat.1D -xjpeg X.jpg \ + -x1D_uncensored X.nocensor.xmat.1D \ + -fitts fitts.$subj \ + -errts errts.${subj} \ + -bucket stats.$subj + + +# if 3dDeconvolve fails, terminate the script +if ( $status != 0 ) then + echo '---------------------------------------' + echo '** 3dDeconvolve error, failing...' + echo ' (consider the file 3dDeconvolve.err)' + exit +endif + + +# display any large pairwise correlations from the X-matrix +1d_tool.py -show_cormat_warnings -infile X.xmat.1D |& tee out.cormat_warn.txt + +# create an all_runs dataset to match the fitts, errts, etc. +3dTcat -prefix all_runs.$subj pb04.$subj.r*.scale+tlrc.HEAD + +# -------------------------------------------------- +# create a temporal signal to noise ratio dataset +# signal: if 'scale' block, mean should be 100 +# noise : compute standard deviation of errts +3dTstat -mean -prefix rm.signal.all all_runs.$subj+tlrc"[$ktrs]" +3dTstat -stdev -prefix rm.noise.all errts.${subj}+tlrc"[$ktrs]" +3dcalc -a rm.signal.all+tlrc \ + -b rm.noise.all+tlrc \ + -c full_mask.$subj+tlrc \ + -expr 'c*a/b' -prefix TSNR.$subj + +# --------------------------------------------------- +# compute and store GCOR (global correlation average) +# (sum of squares of global mean of unit errts) +3dTnorm -norm2 -prefix rm.errts.unit errts.${subj}+tlrc +3dmaskave -quiet -mask full_mask.$subj+tlrc rm.errts.unit+tlrc \ + > gmean.errts.unit.1D +3dTstat -sos -prefix - gmean.errts.unit.1D\' > out.gcor.1D +echo "-- GCOR = `cat out.gcor.1D`" + +# --------------------------------------------------- +# compute correlation volume +# (per voxel: average correlation across masked brain) +# (now just dot product with average unit time series) +3dcalc -a rm.errts.unit+tlrc -b gmean.errts.unit.1D -expr 'a*b' -prefix rm.DP +3dTstat -sum -prefix corr_brain rm.DP+tlrc + +# create ideal files for fixed response stim types +1dcat X.nocensor.xmat.1D'[5]' > ideal_Correct_Task.1D +1dcat X.nocensor.xmat.1D'[6]' > ideal_Incorrect_Task.1D +1dcat X.nocensor.xmat.1D'[7]' > ideal_No_Response_Control.1D +1dcat X.nocensor.xmat.1D'[8]' > ideal_No_Response_Task.1D +1dcat X.nocensor.xmat.1D'[9]' > ideal_Response_Control.1D + +# -------------------------------------------------------- +# compute sum of non-baseline regressors from the X-matrix +# (use 1d_tool.py to get list of regressor colums) +set reg_cols = `1d_tool.py -infile X.nocensor.xmat.1D -show_indices_interest` +3dTstat -sum -prefix sum_ideal.1D X.nocensor.xmat.1D"[$reg_cols]" + +# also, create a stimulus-only X-matrix, for easy review +1dcat X.nocensor.xmat.1D"[$reg_cols]" > X.stim.xmat.1D + +# ============================ blur estimation ============================= +# compute blur estimates +touch blur_est.$subj.1D # start with empty file + +# create directory for ACF curve files +mkdir files_ACF + +# -- estimate blur for each run in epits -- +touch blur.epits.1D + +# restrict to uncensored TRs, per run +foreach run ( $runs ) + set trs = `1d_tool.py -infile X.xmat.1D -show_trs_uncensored encoded \ + -show_trs_run $run` + if ( $trs == "" ) continue + 3dFWHMx -detrend -mask full_mask.$subj+tlrc \ + -ACF files_ACF/out.3dFWHMx.ACF.epits.r$run.1D \ + all_runs.$subj+tlrc"[$trs]" >> blur.epits.1D +end + +# compute average FWHM blur (from every other row) and append +set blurs = ( `3dTstat -mean -prefix - blur.epits.1D'{0..$(2)}'\'` ) +echo average epits FWHM blurs: $blurs +echo "$blurs # epits FWHM blur estimates" >> blur_est.$subj.1D + +# compute average ACF blur (from every other row) and append +set blurs = ( `3dTstat -mean -prefix - blur.epits.1D'{1..$(2)}'\'` ) +echo average epits ACF blurs: $blurs +echo "$blurs # epits ACF blur estimates" >> blur_est.$subj.1D + +# -- estimate blur for each run in errts -- +touch blur.errts.1D + +# restrict to uncensored TRs, per run +foreach run ( $runs ) + set trs = `1d_tool.py -infile X.xmat.1D -show_trs_uncensored encoded \ + -show_trs_run $run` + if ( $trs == "" ) continue + 3dFWHMx -detrend -mask full_mask.$subj+tlrc \ + -ACF files_ACF/out.3dFWHMx.ACF.errts.r$run.1D \ + errts.${subj}+tlrc"[$trs]" >> blur.errts.1D +end + +# compute average FWHM blur (from every other row) and append +set blurs = ( `3dTstat -mean -prefix - blur.errts.1D'{0..$(2)}'\'` ) +echo average errts FWHM blurs: $blurs +echo "$blurs # errts FWHM blur estimates" >> blur_est.$subj.1D + +# compute average ACF blur (from every other row) and append +set blurs = ( `3dTstat -mean -prefix - blur.errts.1D'{1..$(2)}'\'` ) +echo average errts ACF blurs: $blurs +echo "$blurs # errts ACF blur estimates" >> blur_est.$subj.1D + + +# ================== auto block: generate review scripts =================== + +# generate a review script for the unprocessed EPI data +gen_epi_review.py -script @epi_review.$subj \ + -dsets pb00.$subj.r*.tcat+orig.HEAD + +# generate scripts to review single subject results +# (try with defaults, but do not allow bad exit status) +gen_ss_review_scripts.py -mot_limit 0.5 -exit0 + +# ========================== auto block: finalize ========================== + +# remove temporary files +\rm -f rm.* + +# if the basic subject review script is here, run it +# (want this to be the last text output) +if ( -e @ss_review_basic ) ./@ss_review_basic |& tee out.ss_review.$subj.txt + +# return to parent directory +cd .. + +echo "execution finished: `date`" + + + + +# ========================================================================== +# script generated by the command: +# +# afni_proc.py -subj_id sub_03 -script proc.sub_03 -scr_overwrite -blocks \ +# tshift align tlrc volreg blur mask scale regress -copy_anat \ +# /Users/mli/Desktop/playground/sub-03/ses-test/anat/sub-03_ses-test_T1w.nii.gz \ +# -tcat_remove_first_trs 1 -tshift_opts_ts -tpattern alt+z -dsets \ +# /Users/mli/Desktop/playground/sub-03/ses-test/func/sub-03_ses-test_task-linebisection_bold.nii.gz \ +# -tlrc_base MNI_avg152T1+tlrc -volreg_align_to third -volreg_align_e2a \ +# -volreg_tlrc_warp -blur_size 6.0 -regress_stim_times \ +# /Users/mli/Desktop/playground/timing_sub-03_ses-test_Correct_Task.1D \ +# /Users/mli/Desktop/playground/timing_sub-03_ses-test_Incorrect_Task.1D \ +# /Users/mli/Desktop/playground/timing_sub-03_ses-test_No_Response_Control.1D \ +# /Users/mli/Desktop/playground/timing_sub-03_ses-test_No_Response_Task.1D \ +# /Users/mli/Desktop/playground/timing_sub-03_ses-test_Response_Control.1D \ +# -regress_stim_labels Correct_Task Incorrect_Task No_Response_Control \ +# No_Response_Task Response_Control -regress_basis GAM \ +# -regress_censor_motion 0.5 -regress_apply_mot_types demean deriv \ +# -regress_opts_3dD -gltsym 'SYM: 0.5*Correct_Task +0.5*Incorrect_Task \ +# -Response_Control' -glt_label 1 Landmark-Detection \ +# -regress_make_ideal_sum sum_ideal.1D -regress_est_blur_epits \ +# -regress_est_blur_errts -regress_run_clustsim no diff --git a/hw2/Exp-2.sh b/hw2/Exp-2.sh new file mode 100755 index 0000000..0dafb4e --- /dev/null +++ b/hw2/Exp-2.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +# 1. Threshold the stats at p <.05 +3dmerge -1zscore -1thresh 1.96 -1noneg \ +-prefix Exp-2/stats.test.thresh \ +'Exp-2/subject_results/group.test/subj.sub_03/sub_03.results/stats.sub_03+tlrc[17]' + +3dmerge -1zscore -1thresh 1.96 -1noneg \ +-prefix Exp-2/stats.retest.thresh \ +'Exp-2/subject_results/group.retest/subj.sub_03/sub_03.results/stats.sub_03+tlrc[17]' + +# 2. Calculate a mask that contains overlapping regions of the brain in both sessions +3dmask_tool -input Exp-2/subject_results/group.*/subj.sub_03/sub_03.results/mask_group+tlrc.HEAD \ +-frac 1.0 -prefix Exp-2/mask + +# 3. Binarize the thresholded images +3dcalc -a Exp-2/stats.test.thresh+tlrc -prefix Exp-2/stats.test.bin -expr 'astep(a,.1)' +3dcalc -a Exp-2/stats.retest.thresh+tlrc -prefix Exp-2/stats.retest.bin -expr 'astep(a,.1)' + +# 4. Calculate the Dice coefficient +3ddot -mask Exp-2/mask+tlrc -dodice Exp-2/stats.test.bin+tlrc Exp-2/stats.retest.bin+tlrc \ No newline at end of file diff --git a/hw2/Exp-2/subject_results/group.retest/subj.sub_03/.orig.cmd.ap.sub_03 b/hw2/Exp-2/subject_results/group.retest/subj.sub_03/.orig.cmd.ap.sub_03 new file mode 100755 index 0000000..4726041 --- /dev/null +++ b/hw2/Exp-2/subject_results/group.retest/subj.sub_03/.orig.cmd.ap.sub_03 @@ -0,0 +1,48 @@ +#!/usr/bin/env tcsh + +# created by uber_subject.py: version 0.40 (March 30, 2017) +# creation date: Thu Aug 3 22:03:06 2017 + +# set data directories +set top_dir = /Users/monicali/Google-Drive/IBRAIN/playground +set anat_dir = $top_dir/sub-03/ses-retest/anat +set epi_dir = $top_dir/sub-03/ses-retest/func + +# set subject and group identifiers +set subj = sub_03 +set group_id = retest + +# run afni_proc.py to create a single subject processing script +afni_proc.py -subj_id $subj \ + -script proc.$subj -scr_overwrite \ + -blocks tshift align tlrc volreg blur mask scale regress \ + -copy_anat $anat_dir/sub-03_ses-retest_T1w.nii.gz \ + -tcat_remove_first_trs 0 \ + -dsets $epi_dir/sub-03_ses-retest_task-linebisection_bold.nii.gz \ + -tlrc_base MNI_avg152T1+tlrc \ + -volreg_align_to third \ + -volreg_align_e2a \ + -volreg_tlrc_warp \ + -blur_size 6.0 \ + -regress_stim_times \ + $top_dir/timing_sub-03_ses-retest_Correct_Task.1D \ + $top_dir/timing_sub-03_ses-retest_Incorrect_Task.1D \ + $top_dir/timing_sub-03_ses-retest_No_Response_Control.1D \ + $top_dir/timing_sub-03_ses-retest_No_Response_Task.1D \ + $top_dir/timing_sub-03_ses-retest_Response_Control.1D \ + -regress_stim_labels \ + Correct_Task Incorrect_Task No_Response_Control No_Response_Task \ + Response_Control \ + -regress_basis 'GAM' \ + -regress_censor_motion 0.3 \ + -regress_censor_outliers 0.5 \ + -regress_apply_mot_types demean deriv \ + -regress_opts_3dD \ + -gltsym 'SYM: 0.333*Correct_Task +0.333*Incorrect_Task \ + +0.333*No_Response_Task -0.5*Response_Control \ + -0.5*No_Response_Control' -glt_label 1 Landmark-Detection \ + -regress_make_ideal_sum sum_ideal.1D \ + -regress_est_blur_epits \ + -regress_est_blur_errts \ + -regress_run_clustsim no + diff --git a/hw2/Exp-2/subject_results/group.retest/subj.sub_03/.orig.cmd.usubj.sub_03 b/hw2/Exp-2/subject_results/group.retest/subj.sub_03/.orig.cmd.usubj.sub_03 new file mode 100644 index 0000000..e94908e --- /dev/null +++ b/hw2/Exp-2/subject_results/group.retest/subj.sub_03/.orig.cmd.usubj.sub_03 @@ -0,0 +1,29 @@ +uber_subject.py \ + -cvar subj_dir subject_results/group.retest/subj.sub_03 \ + -svar anat \ + /Users/monicali/Google-Drive/IBRAIN/playground/sub-03/ses-retest/anat/sub-03_ses-retest_T1w.nii.gz \ + \ + -svar blur_size 6.0 \ + -svar epi \ + /Users/monicali/Google-Drive/IBRAIN/playground/sub-03/ses-retest/func/sub-03_ses-retest_task-linebisection_bold.nii.gz \ + \ + -svar gid retest \ + -svar gltsym '0.333*Correct_Task +0.333*Incorrect_Task \ + +0.333*No_Response_Task -0.5*Response_Control -0.5*No_Response_Control' \ + -svar gltsym_label Landmark-Detection \ + -svar outlier_limit 0.5 \ + -svar regress_mot_deriv yes \ + -svar run_clustsim no \ + -svar sid sub_03 \ + -svar stim \ + /Users/monicali/Google-Drive/IBRAIN/playground/timing_sub-03_ses-retest_Correct_Task.1D \ + /Users/monicali/Google-Drive/IBRAIN/playground/timing_sub-03_ses-retest_Incorrect_Task.1D \ + /Users/monicali/Google-Drive/IBRAIN/playground/timing_sub-03_ses-retest_No_Response_Control.1D \ + /Users/monicali/Google-Drive/IBRAIN/playground/timing_sub-03_ses-retest_No_Response_Task.1D \ + /Users/monicali/Google-Drive/IBRAIN/playground/timing_sub-03_ses-retest_Response_Control.1D \ + \ + -svar stim_basis 'GAM' 'GAM' 'GAM' 'GAM' 'GAM' \ + -svar stim_label Correct_Task Incorrect_Task No_Response_Control \ + No_Response_Task Response_Control \ + -svar stim_type times times times times times \ + -svar tlrc_base MNI_avg152T1+tlrc diff --git a/hw2/Exp-2/subject_results/group.retest/subj.sub_03/.orig.proc.sub_03 b/hw2/Exp-2/subject_results/group.retest/subj.sub_03/.orig.proc.sub_03 new file mode 100755 index 0000000..e883f7a --- /dev/null +++ b/hw2/Exp-2/subject_results/group.retest/subj.sub_03/.orig.proc.sub_03 @@ -0,0 +1,492 @@ +#!/bin/tcsh -xef + +echo "auto-generated by afni_proc.py, Thu Aug 3 22:03:22 2017" +echo "(version 5.15, April 25, 2017)" +echo "execution started: `date`" + +# execute via : +# tcsh -xef proc.sub_03 |& tee output.proc.sub_03 + +# =========================== auto block: setup ============================ +# script setup + +# take note of the AFNI version +afni -ver + +# check that the current AFNI version is recent enough +afni_history -check_date 23 Sep 2016 +if ( $status ) then + echo "** this script requires newer AFNI binaries (than 23 Sep 2016)" + echo " (consider: @update.afni.binaries -defaults)" + exit +endif + +# the user may specify a single subject to run with +if ( $#argv > 0 ) then + set subj = $argv[1] +else + set subj = sub_03 +endif + +# assign output directory name +set output_dir = $subj.results + +# verify that the results directory does not yet exist +if ( -d $output_dir ) then + echo output dir "$subj.results" already exists + exit +endif + +# set list of runs +set runs = (`count -digits 2 1 1`) + +# create results and stimuli directories +mkdir $output_dir +mkdir $output_dir/stimuli + +# copy stim files into stimulus directory +cp \ + /Users/monicali/Google-Drive/IBRAIN/playground/timing_sub-03_ses-retest_Correct_Task.1D \ + /Users/monicali/Google-Drive/IBRAIN/playground/timing_sub-03_ses-retest_Incorrect_Task.1D \ + /Users/monicali/Google-Drive/IBRAIN/playground/timing_sub-03_ses-retest_No_Response_Control.1D \ + /Users/monicali/Google-Drive/IBRAIN/playground/timing_sub-03_ses-retest_No_Response_Task.1D \ + /Users/monicali/Google-Drive/IBRAIN/playground/timing_sub-03_ses-retest_Response_Control.1D \ + $output_dir/stimuli + +# copy anatomy to results dir +3dcopy \ + /Users/monicali/Google-Drive/IBRAIN/playground/sub-03/ses-retest/anat/sub-03_ses-retest_T1w.nii.gz \ + $output_dir/sub-03_ses-retest_T1w + +# ============================ auto block: tcat ============================ +# apply 3dTcat to copy input dsets to results dir, while +# removing the first 0 TRs +3dTcat -prefix $output_dir/pb00.$subj.r01.tcat \ + /Users/monicali/Google-Drive/IBRAIN/playground/sub-03/ses-retest/func/sub-03_ses-retest_task-linebisection_bold.nii.gz'[0..$]' + +# and make note of repetitions (TRs) per run +set tr_counts = ( 238 ) + +# ------------------------------------------------------- +# enter the results directory (can begin processing data) +cd $output_dir + + +# ========================== auto block: outcount ========================== +# data check: compute outlier fraction for each volume +touch out.pre_ss_warn.txt +foreach run ( $runs ) + 3dToutcount -automask -fraction -polort 4 -legendre \ + pb00.$subj.r$run.tcat+orig > outcount.r$run.1D + + # censor outlier TRs per run, ignoring the first 0 TRs + # - censor when more than 0.5 of automask voxels are outliers + # - step() defines which TRs to remove via censoring + 1deval -a outcount.r$run.1D -expr "1-step(a-0.5)" > rm.out.cen.r$run.1D + + # outliers at TR 0 might suggest pre-steady state TRs + if ( `1deval -a outcount.r$run.1D"{0}" -expr "step(a-0.4)"` ) then + echo "** TR #0 outliers: possible pre-steady state TRs in run $run" \ + >> out.pre_ss_warn.txt + endif +end + +# catenate outlier counts into a single time series +cat outcount.r*.1D > outcount_rall.1D + +# catenate outlier censor files into a single time series +cat rm.out.cen.r*.1D > outcount_${subj}_censor.1D + +# ================================= tshift ================================= +# time shift data so all slice timing is the same +foreach run ( $runs ) + 3dTshift -tzero 0 -quintic -prefix pb01.$subj.r$run.tshift \ + pb00.$subj.r$run.tcat+orig +end + +# -------------------------------- +# extract volreg registration base +3dbucket -prefix vr_base pb01.$subj.r01.tshift+orig"[2]" + +# ================================= align ================================== +# for e2a: compute anat alignment transformation to EPI registration base +# (new anat will be intermediate, stripped, sub-03_ses-retest_T1w_ns+orig) +align_epi_anat.py -anat2epi -anat sub-03_ses-retest_T1w+orig \ + -save_skullstrip -suffix _al_junk \ + -epi vr_base+orig -epi_base 0 \ + -epi_strip 3dAutomask \ + -volreg off -tshift off + +# ================================== tlrc ================================== +# warp anatomy to standard space +@auto_tlrc -base MNI_avg152T1+tlrc -input sub-03_ses-retest_T1w_ns+orig -no_ss + +# store forward transformation matrix in a text file +cat_matvec sub-03_ses-retest_T1w_ns+tlrc::WARP_DATA -I > warp.anat.Xat.1D + +# ================================= volreg ================================= +# align each dset to base volume, align to anat, warp to tlrc space + +# verify that we have a +tlrc warp dataset +if ( ! -f sub-03_ses-retest_T1w_ns+tlrc.HEAD ) then + echo "** missing +tlrc warp dataset: sub-03_ses-retest_T1w_ns+tlrc.HEAD" + exit +endif + +# register and warp +foreach run ( $runs ) + # register each volume to the base + 3dvolreg -verbose -zpad 1 -base vr_base+orig \ + -1Dfile dfile.r$run.1D -prefix rm.epi.volreg.r$run \ + -cubic \ + -1Dmatrix_save mat.r$run.vr.aff12.1D \ + pb01.$subj.r$run.tshift+orig + + # create an all-1 dataset to mask the extents of the warp + 3dcalc -overwrite -a pb01.$subj.r$run.tshift+orig -expr 1 \ + -prefix rm.epi.all1 + + # catenate volreg/epi2anat/tlrc xforms + cat_matvec -ONELINE \ + sub-03_ses-retest_T1w_ns+tlrc::WARP_DATA -I \ + sub-03_ses-retest_T1w_al_junk_mat.aff12.1D -I \ + mat.r$run.vr.aff12.1D > mat.r$run.warp.aff12.1D + + # apply catenated xform: volreg/epi2anat/tlrc + 3dAllineate -base sub-03_ses-retest_T1w_ns+tlrc \ + -input pb01.$subj.r$run.tshift+orig \ + -1Dmatrix_apply mat.r$run.warp.aff12.1D \ + -mast_dxyz 4 \ + -prefix rm.epi.nomask.r$run + + # warp the all-1 dataset for extents masking + 3dAllineate -base sub-03_ses-retest_T1w_ns+tlrc \ + -input rm.epi.all1+orig \ + -1Dmatrix_apply mat.r$run.warp.aff12.1D \ + -mast_dxyz 4 -final NN -quiet \ + -prefix rm.epi.1.r$run + + # make an extents intersection mask of this run + 3dTstat -min -prefix rm.epi.min.r$run rm.epi.1.r$run+tlrc +end + +# make a single file of registration params +cat dfile.r*.1D > dfile_rall.1D + +# ---------------------------------------- +# create the extents mask: mask_epi_extents+tlrc +# (this is a mask of voxels that have valid data at every TR) +# (only 1 run, so just use 3dcopy to keep naming straight) +3dcopy rm.epi.min.r01+tlrc mask_epi_extents + +# and apply the extents mask to the EPI data +# (delete any time series with missing data) +foreach run ( $runs ) + 3dcalc -a rm.epi.nomask.r$run+tlrc -b mask_epi_extents+tlrc \ + -expr 'a*b' -prefix pb02.$subj.r$run.volreg +end + +# warp the volreg base EPI dataset to make a final version +cat_matvec -ONELINE \ + sub-03_ses-retest_T1w_ns+tlrc::WARP_DATA -I \ + sub-03_ses-retest_T1w_al_junk_mat.aff12.1D -I > \ + mat.basewarp.aff12.1D + +3dAllineate -base sub-03_ses-retest_T1w_ns+tlrc \ + -input vr_base+orig \ + -1Dmatrix_apply mat.basewarp.aff12.1D \ + -mast_dxyz 4 \ + -prefix final_epi_vr_base + +# create an anat_final dataset, aligned with stats +3dcopy sub-03_ses-retest_T1w_ns+tlrc anat_final.$subj + +# record final registration costs +3dAllineate -base final_epi_vr_base+tlrc -allcostX \ + -input anat_final.$subj+tlrc |& tee out.allcostX.txt + +# ----------------------------------------- +# warp anat follower datasets (affine) +3dAllineate -source sub-03_ses-retest_T1w+orig \ + -master anat_final.$subj+tlrc \ + -final wsinc5 -1Dmatrix_apply warp.anat.Xat.1D \ + -prefix anat_w_skull_warped + +# ================================== blur ================================== +# blur each volume of each run +foreach run ( $runs ) + 3dmerge -1blur_fwhm 6.0 -doall -prefix pb03.$subj.r$run.blur \ + pb02.$subj.r$run.volreg+tlrc +end + +# ================================== mask ================================== +# create 'full_mask' dataset (union mask) +foreach run ( $runs ) + 3dAutomask -dilate 1 -prefix rm.mask_r$run pb03.$subj.r$run.blur+tlrc +end + +# create union of inputs, output type is byte +3dmask_tool -inputs rm.mask_r*+tlrc.HEAD -union -prefix full_mask.$subj + +# ---- create subject anatomy mask, mask_anat.$subj+tlrc ---- +# (resampled from tlrc anat) +3dresample -master full_mask.$subj+tlrc -input sub-03_ses-retest_T1w_ns+tlrc \ + -prefix rm.resam.anat + +# convert to binary anat mask; fill gaps and holes +3dmask_tool -dilate_input 5 -5 -fill_holes -input rm.resam.anat+tlrc \ + -prefix mask_anat.$subj + +# compute overlaps between anat and EPI masks +3dABoverlap -no_automask full_mask.$subj+tlrc mask_anat.$subj+tlrc \ + |& tee out.mask_ae_overlap.txt + +# note Dice coefficient of masks, as well +3ddot -dodice full_mask.$subj+tlrc mask_anat.$subj+tlrc \ + |& tee out.mask_ae_dice.txt + +# ---- create group anatomy mask, mask_group+tlrc ---- +# (resampled from tlrc base anat, MNI_avg152T1+tlrc) +3dresample -master full_mask.$subj+tlrc -prefix ./rm.resam.group \ + -input /Users/monicali/abin/MNI_avg152T1+tlrc + +# convert to binary group mask; fill gaps and holes +3dmask_tool -dilate_input 5 -5 -fill_holes -input rm.resam.group+tlrc \ + -prefix mask_group + +# ================================= scale ================================== +# scale each voxel time series to have a mean of 100 +# (be sure no negatives creep in) +# (subject to a range of [0,200]) +foreach run ( $runs ) + 3dTstat -prefix rm.mean_r$run pb03.$subj.r$run.blur+tlrc + 3dcalc -a pb03.$subj.r$run.blur+tlrc -b rm.mean_r$run+tlrc \ + -c mask_epi_extents+tlrc \ + -expr 'c * min(200, a/b*100)*step(a)*step(b)' \ + -prefix pb04.$subj.r$run.scale +end + +# ================================ regress ================================= + +# compute de-meaned motion parameters (for use in regression) +1d_tool.py -infile dfile_rall.1D -set_nruns 1 \ + -demean -write motion_demean.1D + +# compute motion parameter derivatives (for use in regression) +1d_tool.py -infile dfile_rall.1D -set_nruns 1 \ + -derivative -demean -write motion_deriv.1D + +# create censor file motion_${subj}_censor.1D, for censoring motion +1d_tool.py -infile dfile_rall.1D -set_nruns 1 \ + -show_censor_count -censor_prev_TR \ + -censor_motion 0.3 motion_${subj} + +# combine multiple censor files +1deval -a motion_${subj}_censor.1D -b outcount_${subj}_censor.1D \ + -expr "a*b" > censor_${subj}_combined_2.1D + +# note TRs that were not censored +set ktrs = `1d_tool.py -infile censor_${subj}_combined_2.1D \ + -show_trs_uncensored encoded` + +# ------------------------------ +# run the regression analysis +3dDeconvolve -input pb04.$subj.r*.scale+tlrc.HEAD \ + -censor censor_${subj}_combined_2.1D \ + -polort 4 \ + -num_stimts 17 \ + -stim_times 1 stimuli/timing_sub-03_ses-retest_Correct_Task.1D 'GAM' \ + -stim_label 1 Correct_Task \ + -stim_times 2 stimuli/timing_sub-03_ses-retest_Incorrect_Task.1D 'GAM' \ + -stim_label 2 Incorrect_Task \ + -stim_times 3 stimuli/timing_sub-03_ses-retest_No_Response_Control.1D \ + 'GAM' \ + -stim_label 3 No_Response_Control \ + -stim_times 4 stimuli/timing_sub-03_ses-retest_No_Response_Task.1D 'GAM' \ + -stim_label 4 No_Response_Task \ + -stim_times 5 stimuli/timing_sub-03_ses-retest_Response_Control.1D 'GAM' \ + -stim_label 5 Response_Control \ + -stim_file 6 motion_demean.1D'[0]' -stim_base 6 -stim_label 6 roll_01 \ + -stim_file 7 motion_demean.1D'[1]' -stim_base 7 -stim_label 7 pitch_01 \ + -stim_file 8 motion_demean.1D'[2]' -stim_base 8 -stim_label 8 yaw_01 \ + -stim_file 9 motion_demean.1D'[3]' -stim_base 9 -stim_label 9 dS_01 \ + -stim_file 10 motion_demean.1D'[4]' -stim_base 10 -stim_label 10 dL_01 \ + -stim_file 11 motion_demean.1D'[5]' -stim_base 11 -stim_label 11 dP_01 \ + -stim_file 12 motion_deriv.1D'[0]' -stim_base 12 -stim_label 12 roll_02 \ + -stim_file 13 motion_deriv.1D'[1]' -stim_base 13 -stim_label 13 pitch_02 \ + -stim_file 14 motion_deriv.1D'[2]' -stim_base 14 -stim_label 14 yaw_02 \ + -stim_file 15 motion_deriv.1D'[3]' -stim_base 15 -stim_label 15 dS_02 \ + -stim_file 16 motion_deriv.1D'[4]' -stim_base 16 -stim_label 16 dL_02 \ + -stim_file 17 motion_deriv.1D'[5]' -stim_base 17 -stim_label 17 dP_02 \ + -gltsym 'SYM: 0.333*Correct_Task +0.333*Incorrect_Task \ + +0.333*No_Response_Task -0.5*Response_Control -0.5*No_Response_Control' \ + -glt_label 1 Landmark-Detection \ + -fout -tout -x1D X.xmat.1D -xjpeg X.jpg \ + -x1D_uncensored X.nocensor.xmat.1D \ + -fitts fitts.$subj \ + -errts errts.${subj} \ + -bucket stats.$subj + + +# if 3dDeconvolve fails, terminate the script +if ( $status != 0 ) then + echo '---------------------------------------' + echo '** 3dDeconvolve error, failing...' + echo ' (consider the file 3dDeconvolve.err)' + exit +endif + + +# display any large pairwise correlations from the X-matrix +1d_tool.py -show_cormat_warnings -infile X.xmat.1D |& tee out.cormat_warn.txt + +# create an all_runs dataset to match the fitts, errts, etc. +3dTcat -prefix all_runs.$subj pb04.$subj.r*.scale+tlrc.HEAD + +# -------------------------------------------------- +# create a temporal signal to noise ratio dataset +# signal: if 'scale' block, mean should be 100 +# noise : compute standard deviation of errts +3dTstat -mean -prefix rm.signal.all all_runs.$subj+tlrc"[$ktrs]" +3dTstat -stdev -prefix rm.noise.all errts.${subj}+tlrc"[$ktrs]" +3dcalc -a rm.signal.all+tlrc \ + -b rm.noise.all+tlrc \ + -c full_mask.$subj+tlrc \ + -expr 'c*a/b' -prefix TSNR.$subj + +# --------------------------------------------------- +# compute and store GCOR (global correlation average) +# (sum of squares of global mean of unit errts) +3dTnorm -norm2 -prefix rm.errts.unit errts.${subj}+tlrc +3dmaskave -quiet -mask full_mask.$subj+tlrc rm.errts.unit+tlrc \ + > gmean.errts.unit.1D +3dTstat -sos -prefix - gmean.errts.unit.1D\' > out.gcor.1D +echo "-- GCOR = `cat out.gcor.1D`" + +# --------------------------------------------------- +# compute correlation volume +# (per voxel: average correlation across masked brain) +# (now just dot product with average unit time series) +3dcalc -a rm.errts.unit+tlrc -b gmean.errts.unit.1D -expr 'a*b' -prefix rm.DP +3dTstat -sum -prefix corr_brain rm.DP+tlrc + +# create ideal files for fixed response stim types +1dcat X.nocensor.xmat.1D'[5]' > ideal_Correct_Task.1D +1dcat X.nocensor.xmat.1D'[6]' > ideal_Incorrect_Task.1D +1dcat X.nocensor.xmat.1D'[7]' > ideal_No_Response_Control.1D +1dcat X.nocensor.xmat.1D'[8]' > ideal_No_Response_Task.1D +1dcat X.nocensor.xmat.1D'[9]' > ideal_Response_Control.1D + +# -------------------------------------------------------- +# compute sum of non-baseline regressors from the X-matrix +# (use 1d_tool.py to get list of regressor colums) +set reg_cols = `1d_tool.py -infile X.nocensor.xmat.1D -show_indices_interest` +3dTstat -sum -prefix sum_ideal.1D X.nocensor.xmat.1D"[$reg_cols]" + +# also, create a stimulus-only X-matrix, for easy review +1dcat X.nocensor.xmat.1D"[$reg_cols]" > X.stim.xmat.1D + +# ============================ blur estimation ============================= +# compute blur estimates +touch blur_est.$subj.1D # start with empty file + +# create directory for ACF curve files +mkdir files_ACF + +# -- estimate blur for each run in epits -- +touch blur.epits.1D + +# restrict to uncensored TRs, per run +foreach run ( $runs ) + set trs = `1d_tool.py -infile X.xmat.1D -show_trs_uncensored encoded \ + -show_trs_run $run` + if ( $trs == "" ) continue + 3dFWHMx -detrend -mask full_mask.$subj+tlrc \ + -ACF files_ACF/out.3dFWHMx.ACF.epits.r$run.1D \ + all_runs.$subj+tlrc"[$trs]" >> blur.epits.1D +end + +# compute average FWHM blur (from every other row) and append +set blurs = ( `3dTstat -mean -prefix - blur.epits.1D'{0..$(2)}'\'` ) +echo average epits FWHM blurs: $blurs +echo "$blurs # epits FWHM blur estimates" >> blur_est.$subj.1D + +# compute average ACF blur (from every other row) and append +set blurs = ( `3dTstat -mean -prefix - blur.epits.1D'{1..$(2)}'\'` ) +echo average epits ACF blurs: $blurs +echo "$blurs # epits ACF blur estimates" >> blur_est.$subj.1D + +# -- estimate blur for each run in errts -- +touch blur.errts.1D + +# restrict to uncensored TRs, per run +foreach run ( $runs ) + set trs = `1d_tool.py -infile X.xmat.1D -show_trs_uncensored encoded \ + -show_trs_run $run` + if ( $trs == "" ) continue + 3dFWHMx -detrend -mask full_mask.$subj+tlrc \ + -ACF files_ACF/out.3dFWHMx.ACF.errts.r$run.1D \ + errts.${subj}+tlrc"[$trs]" >> blur.errts.1D +end + +# compute average FWHM blur (from every other row) and append +set blurs = ( `3dTstat -mean -prefix - blur.errts.1D'{0..$(2)}'\'` ) +echo average errts FWHM blurs: $blurs +echo "$blurs # errts FWHM blur estimates" >> blur_est.$subj.1D + +# compute average ACF blur (from every other row) and append +set blurs = ( `3dTstat -mean -prefix - blur.errts.1D'{1..$(2)}'\'` ) +echo average errts ACF blurs: $blurs +echo "$blurs # errts ACF blur estimates" >> blur_est.$subj.1D + + +# ================== auto block: generate review scripts =================== + +# generate a review script for the unprocessed EPI data +gen_epi_review.py -script @epi_review.$subj \ + -dsets pb00.$subj.r*.tcat+orig.HEAD + +# generate scripts to review single subject results +# (try with defaults, but do not allow bad exit status) +gen_ss_review_scripts.py -mot_limit 0.3 -out_limit 0.5 -exit0 + +# ========================== auto block: finalize ========================== + +# remove temporary files +\rm -f rm.* + +# if the basic subject review script is here, run it +# (want this to be the last text output) +if ( -e @ss_review_basic ) ./@ss_review_basic |& tee out.ss_review.$subj.txt + +# return to parent directory +cd .. + +echo "execution finished: `date`" + + + + +# ========================================================================== +# script generated by the command: +# +# afni_proc.py -subj_id sub_03 -script proc.sub_03 -scr_overwrite -blocks \ +# tshift align tlrc volreg blur mask scale regress -copy_anat \ +# /Users/monicali/Google-Drive/IBRAIN/playground/sub-03/ses-retest/anat/sub-03_ses-retest_T1w.nii.gz \ +# -tcat_remove_first_trs 0 -dsets \ +# /Users/monicali/Google-Drive/IBRAIN/playground/sub-03/ses-retest/func/sub-03_ses-retest_task-linebisection_bold.nii.gz \ +# -tlrc_base MNI_avg152T1+tlrc -volreg_align_to third -volreg_align_e2a \ +# -volreg_tlrc_warp -blur_size 6.0 -regress_stim_times \ +# /Users/monicali/Google-Drive/IBRAIN/playground/timing_sub-03_ses-retest_Correct_Task.1D \ +# /Users/monicali/Google-Drive/IBRAIN/playground/timing_sub-03_ses-retest_Incorrect_Task.1D \ +# /Users/monicali/Google-Drive/IBRAIN/playground/timing_sub-03_ses-retest_No_Response_Control.1D \ +# /Users/monicali/Google-Drive/IBRAIN/playground/timing_sub-03_ses-retest_No_Response_Task.1D \ +# /Users/monicali/Google-Drive/IBRAIN/playground/timing_sub-03_ses-retest_Response_Control.1D \ +# -regress_stim_labels Correct_Task Incorrect_Task No_Response_Control \ +# No_Response_Task Response_Control -regress_basis GAM \ +# -regress_censor_motion 0.3 -regress_censor_outliers 0.5 \ +# -regress_apply_mot_types demean deriv -regress_opts_3dD -gltsym 'SYM: \ +# 0.333*Correct_Task +0.333*Incorrect_Task +0.333*No_Response_Task \ +# -0.5*Response_Control -0.5*No_Response_Control' -glt_label 1 \ +# Landmark-Detection -regress_make_ideal_sum sum_ideal.1D \ +# -regress_est_blur_epits -regress_est_blur_errts -regress_run_clustsim no diff --git a/hw2/Exp-2/subject_results/group.retest/subj.sub_03/cmd.ap.sub_03 b/hw2/Exp-2/subject_results/group.retest/subj.sub_03/cmd.ap.sub_03 new file mode 100644 index 0000000..c2e5946 --- /dev/null +++ b/hw2/Exp-2/subject_results/group.retest/subj.sub_03/cmd.ap.sub_03 @@ -0,0 +1,47 @@ +#!/usr/bin/env tcsh + +# created by uber_subject.py: version 0.40 (March 30, 2017) +# creation date: Thu Aug 3 22:03:06 2017 + +# set data directories +set top_dir = /Users/mli/Desktop/playground +set anat_dir = $top_dir/sub-03/ses-retest/anat +set epi_dir = $top_dir/sub-03/ses-retest/func + +# set subject and group identifiers +set subj = sub_03 +set group_id = retest + +# run afni_proc.py to create a single subject processing script +afni_proc.py -subj_id $subj \ + -script proc.$subj -scr_overwrite \ + -blocks tshift align tlrc volreg blur mask scale regress \ + -copy_anat $anat_dir/sub-03_ses-retest_T1w.nii.gz \ + -tcat_remove_first_trs 1 \ + -tshift_opts_ts -tpattern alt+z \ + -dsets $epi_dir/sub-03_ses-retest_task-linebisection_bold.nii.gz \ + -tlrc_base MNI_avg152T1+tlrc \ + -volreg_align_to third \ + -volreg_align_e2a \ + -volreg_tlrc_warp \ + -blur_size 3.0 \ + -regress_stim_times \ + $top_dir/timing_sub-03_ses-retest_Correct_Task.1D \ + $top_dir/timing_sub-03_ses-retest_Incorrect_Task.1D \ + $top_dir/timing_sub-03_ses-retest_No_Response_Control.1D \ + $top_dir/timing_sub-03_ses-retest_No_Response_Task.1D \ + $top_dir/timing_sub-03_ses-retest_Response_Control.1D \ + -regress_stim_labels \ + Correct_Task Incorrect_Task No_Response_Control No_Response_Task \ + Response_Control \ + -regress_basis 'GAM' \ + -regress_censor_motion 0.5 \ + -regress_apply_mot_types demean deriv \ + -regress_opts_3dD \ + -gltsym 'SYM: 0.5*Correct_Task +0.5*Incorrect_Task \ + -Response_Control' -glt_label 1 Landmark-Detection \ + -regress_make_ideal_sum sum_ideal.1D \ + -regress_est_blur_epits \ + -regress_est_blur_errts \ + -regress_run_clustsim no + diff --git a/hw2/Exp-2/subject_results/group.retest/subj.sub_03/output.cmd.ap.sub_03 b/hw2/Exp-2/subject_results/group.retest/subj.sub_03/output.cmd.ap.sub_03 new file mode 100644 index 0000000..106d34d --- /dev/null +++ b/hw2/Exp-2/subject_results/group.retest/subj.sub_03/output.cmd.ap.sub_03 @@ -0,0 +1,30 @@ +set top_dir = /Users/mli/Desktop/playground +set anat_dir = /Users/mli/Desktop/playground/sub-03/ses-retest/anat +set epi_dir = /Users/mli/Desktop/playground/sub-03/ses-retest/func +set subj = sub_03 +set group_id = retest +afni_proc.py -subj_id sub_03 -script proc.sub_03 -scr_overwrite -blocks tshift align tlrc volreg blur mask scale regress -copy_anat /Users/mli/Desktop/playground/sub-03/ses-retest/anat/sub-03_ses-retest_T1w.nii.gz -tcat_remove_first_trs 1 -tshift_opts_ts -tpattern alt+z -dsets /Users/mli/Desktop/playground/sub-03/ses-retest/func/sub-03_ses-retest_task-linebisection_bold.nii.gz -tlrc_base MNI_avg152T1+tlrc -volreg_align_to third -volreg_align_e2a -volreg_tlrc_warp -blur_size 3.0 -regress_stim_times /Users/mli/Desktop/playground/timing_sub-03_ses-retest_Correct_Task.1D /Users/mli/Desktop/playground/timing_sub-03_ses-retest_Incorrect_Task.1D /Users/mli/Desktop/playground/timing_sub-03_ses-retest_No_Response_Control.1D /Users/mli/Desktop/playground/timing_sub-03_ses-retest_No_Response_Task.1D /Users/mli/Desktop/playground/timing_sub-03_ses-retest_Response_Control.1D -regress_stim_labels Correct_Task Incorrect_Task No_Response_Control No_Response_Task Response_Control -regress_basis GAM -regress_censor_motion 0.5 -regress_apply_mot_types demean deriv -regress_opts_3dD -gltsym SYM: 0.5*Correct_Task +0.5*Incorrect_Task + -Response_Control -glt_label 1 Landmark-Detection -regress_make_ideal_sum sum_ideal.1D -regress_est_blur_epits -regress_est_blur_errts -regress_run_clustsim no +-- applying orig view as +orig +** warning: removing first 1 TRs from beginning of each run + --> the stimulus timing files must reflect the removal of these TRs +-- tcat: reps is now 237 +++ updating polort to 4, from run len 592.5 s +-- volreg: using base dset vr_base+orig +++ volreg: applying volreg/epi2anat/tlrc xforms to isotropic 4 mm tlrc voxels +-- applying anat warps to 1 dataset(s): sub-03_ses-retest_T1w +-- masking: group anat = 'MNI_avg152T1+tlrc', exists = 1 +-- have 1 ROI dict entries ... +-- will apply motion types: demean, deriv +-- using default: will not apply EPI Automask + (see 'MASKING NOTE' from the -help for details) + +------------------------------------- +** warning have only 1 run to analyze +------------------------------------- + +--> script is file: proc.sub_03 + consider the script execution command: + + tcsh -xef proc.sub_03 |& tee output.proc.sub_03 + diff --git a/hw2/Exp-2/subject_results/group.retest/subj.sub_03/output.proc.sub_03 b/hw2/Exp-2/subject_results/group.retest/subj.sub_03/output.proc.sub_03 new file mode 100644 index 0000000..b6a975a --- /dev/null +++ b/hw2/Exp-2/subject_results/group.retest/subj.sub_03/output.proc.sub_03 @@ -0,0 +1,929 @@ +echo auto-generated by afni_proc.py, Sat Aug 5 16:37:42 2017 +auto-generated by afni_proc.py, Sat Aug 5 16:37:42 2017 +echo (version 5.15, April 25, 2017) +(version 5.15, April 25, 2017) +echo execution started: `date` +date +execution started: Sat Aug 5 16:37:43 EDT 2017 +afni -ver +Precompiled binary macosx_10.7_local: Jul 27 2017 (Version AFNI_17.2.05) +afni_history -check_date 23 Sep 2016 +-- is current: afni_history as new as: 23 Sep 2016 + most recent entry is: 27 Jul 2017 +if ( 0 ) then +if ( 0 > 0 ) then +set subj = sub_03 +endif +set output_dir = sub_03.results +if ( -d sub_03.results ) then +set runs = ( `count -digits 2 1 1` ) +count -digits 2 1 1 +mkdir sub_03.results +mkdir sub_03.results/stimuli +cp /Users/mli/Desktop/playground/timing_sub-03_ses-retest_Correct_Task.1D /Users/mli/Desktop/playground/timing_sub-03_ses-retest_Incorrect_Task.1D /Users/mli/Desktop/playground/timing_sub-03_ses-retest_No_Response_Control.1D /Users/mli/Desktop/playground/timing_sub-03_ses-retest_No_Response_Task.1D /Users/mli/Desktop/playground/timing_sub-03_ses-retest_Response_Control.1D sub_03.results/stimuli +3dcopy /Users/mli/Desktop/playground/sub-03/ses-retest/anat/sub-03_ses-retest_T1w.nii.gz sub_03.results/sub-03_ses-retest_T1w +++ 3dcopy: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +3dTcat -prefix sub_03.results/pb00.sub_03.r01.tcat /Users/mli/Desktop/playground/sub-03/ses-retest/func/sub-03_ses-retest_task-linebisection_bold.nii.gz[1..$] +++ 3dTcat: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ elapsed time = 0.8 s +set tr_counts = ( 237 ) +cd sub_03.results +touch out.pre_ss_warn.txt +foreach run ( 01 ) +3dToutcount -automask -fraction -polort 4 -legendre pb00.sub_03.r01.tcat+orig +++ 3dToutcount: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +*+ WARNING: If you are performing spatial transformations on an oblique dset, + such as ./pb00.sub_03.r01.tcat+orig.BRIK, + or viewing/combining it with volumes of differing obliquity, + you should consider running: + 3dWarp -deoblique + on this and other oblique datasets in the same session. + See 3dWarp -help for details. +++ Oblique dataset:./pb00.sub_03.r01.tcat+orig.BRIK is 4.947676 degrees from plumb. +++ 18027 voxels passed mask/clip +if ( `1deval -a outcount.r$run.1D"{0}" -expr "step(a-0.4)"` ) then +1deval -a outcount.r01.1D{0} -expr step(a-0.4) +end +cat outcount.r01.1D +foreach run ( 01 ) +3dTshift -tzero 0 -quintic -prefix pb01.sub_03.r01.tshift -tpattern alt+z pb00.sub_03.r01.tcat+orig +++ 3dTshift: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +*+ WARNING: If you are performing spatial transformations on an oblique dset, + such as ./pb00.sub_03.r01.tcat+orig.BRIK, + or viewing/combining it with volumes of differing obliquity, + you should consider running: + 3dWarp -deoblique + on this and other oblique datasets in the same session. + See 3dWarp -help for details. +++ Oblique dataset:./pb00.sub_03.r01.tcat+orig.BRIK is 4.947676 degrees from plumb. +end +3dbucket -prefix vr_base pb01.sub_03.r01.tshift+orig[2] +++ 3dbucket: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +align_epi_anat.py -anat2epi -anat sub-03_ses-retest_T1w+orig -save_skullstrip -suffix _al_junk -epi vr_base+orig -epi_base 0 -epi_strip 3dAutomask -volreg off -tshift off +#++ align_epi_anat version: 1.57 +#++ turning off volume registration +#Script is running (command trimmed): + 3dAttribute DELTA ./vr_base+orig +#Script is running (command trimmed): + 3dAttribute DELTA ./vr_base+orig +#Script is running (command trimmed): + 3dAttribute DELTA ./sub-03_ses-retest_T1w+orig +#++ Multi-cost is lpc +#++ Removing all the temporary files +#Script is running: + \rm -f ./__tt_vr_base* +#Script is running: + \rm -f ./__tt_sub-03_ses-retest_T1w* +#Script is running (command trimmed): + 3dcopy ./sub-03_ses-retest_T1w+orig ./__tt_sub-03_ses-retest_T1w+orig +++ 3dcopy: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +#++ Removing skull from anat data +#Script is running (command trimmed): + 3dSkullStrip -orig_vol -input ./__tt_sub-03_ses-retest_T1w+orig -prefix ./__tt_sub-03_ses-retest_T1w_ns +*+ WARNING: If you are performing spatial transformations on an oblique dset, + such as ./__tt_sub-03_ses-retest_T1w+orig.BRIK, + or viewing/combining it with volumes of differing obliquity, + you should consider running: + 3dWarp -deoblique + on this and other oblique datasets in the same session. + See 3dWarp -help for details. +++ Oblique dataset:./__tt_sub-03_ses-retest_T1w+orig.BRIK is 7.491219 degrees from plumb. +#Script is running (command trimmed): + 3dinfo ./__tt_sub-03_ses-retest_T1w_ns+orig | \grep 'Data Axes Tilt:'|\grep 'Oblique' +#++ Dataset /Users/mli/Desktop/playground/Exp-2/subject_results/group.retest/subj.sub_03/sub_03.results/__tt_sub-03_ses-retest_T1w_ns+orig is ***oblique**** +#Script is running (command trimmed): + 3dAttribute DELTA ./__tt_sub-03_ses-retest_T1w_ns+orig +#++ Spacing for anat to oblique epi alignment is 1.000000 +#++ Matching obliquity of anat to epi +#Script is running (command trimmed): + 3dWarp -verb -card2oblique ./vr_base+orig -prefix ./__tt_sub-03_ses-retest_T1w_ns_ob -newgrid 1.000000 ./__tt_sub-03_ses-retest_T1w_ns+orig | \grep -A 4 '# mat44 Obliquity Transformation ::' > ./__tt_sub-03_ses-retest_T1w_ns_obla2e_mat.1D +++ 3dWarp: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: RW Cox +++ Deobliquing original dataset before obliquing +++ Combining oblique transformations +#++ using 0th sub-brick because only one found +#Script is running (command trimmed): + 3dbucket -prefix ./__tt_vr_base_ts ./vr_base+orig'[0]' +++ 3dbucket: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +#++ resampling epi to match anat data +#Script is running (command trimmed): + 3dresample -master ./__tt_sub-03_ses-retest_T1w_ns_ob+orig -prefix ./__tt_vr_base_ts_rs -inset ./__tt_vr_base_ts+orig'' -rmode Cu +*+ WARNING: If you are performing spatial transformations on an oblique dset, + such as ./__tt_vr_base_ts+orig.BRIK, + or viewing/combining it with volumes of differing obliquity, + you should consider running: + 3dWarp -deoblique + on this and other oblique datasets in the same session. + See 3dWarp -help for details. +++ Oblique dataset:./__tt_vr_base_ts+orig.BRIK is 4.947676 degrees from plumb. +#++ removing skull or area outside brain +#Script is running (command trimmed): + 3dAutomask -apply_prefix ./__tt_vr_base_ts_rs_ns ./__tt_vr_base_ts_rs+orig +++ 3dAutomask: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: Emperor Zhark +++ Loading dataset ./__tt_vr_base_ts_rs+orig +++ Forming automask + + Fixed clip level = 707.124390 + + Used gradual clip level = 618.551697 .. 753.626404 + + Number voxels above clip level = 1151477 + + Clustering voxels ... + + Largest cluster has 1150847 voxels + + Clustering voxels ... + + Largest cluster has 1150422 voxels + + Filled 414 voxels in small holes; now have 1150836 voxels + + Filled 16701 voxels in large holes; now have 1167537 voxels + + Clustering voxels ... + + Largest cluster has 1167504 voxels + + Clustering non-brain voxels ... + + Clustering voxels ... + + Largest cluster has 14352000 voxels + + Mask now has 1167504 voxels +++ 1167504 voxels in the mask [out of 15519504: 7.52%] +++ first 64 x-planes are zero [from R] +++ last 68 x-planes are zero [from L] +++ first 30 y-planes are zero [from A] +++ last 22 y-planes are zero [from P] +++ first 107 z-planes are zero [from I] +++ last 48 z-planes are zero [from S] +++ applying mask to original data +++ Writing masked data +++ CPU time = 4.020000 sec +#++ Computing weight mask +#Script is running (command trimmed): + 3dBrickStat -automask -percentile 90.000000 1 90.000000 ./__tt_vr_base_ts_rs_ns+orig +#++ Applying threshold of 1723.000000 on /Users/mli/Desktop/playground/Exp-2/subject_results/group.retest/subj.sub_03/sub_03.results/__tt_vr_base_ts_rs_ns+orig +#Script is running (command trimmed): + 3dcalc -datum float -prefix ./__tt_vr_base_ts_rs_ns_wt -a ./__tt_vr_base_ts_rs_ns+orig -expr 'min(1,(a/1723.000000))' +++ 3dcalc: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: A cast of thousands +#++ Aligning anat data to epi data +#Script is running (command trimmed): + 3dAllineate -lpc -wtprefix ./__tt_sub-03_ses-retest_T1w_ns_ob_al_junk_wtal -weight ./__tt_vr_base_ts_rs_ns_wt+orig -source ./__tt_sub-03_ses-retest_T1w_ns_ob+orig -prefix ./__tt_sub-03_ses-retest_T1w_ns_ob_temp_al_junk -base ./__tt_vr_base_ts_rs_ns+orig -nocmass -1Dmatrix_save ./sub-03_ses-retest_T1w_al_junk_e2a_only_mat.aff12.1D -master SOURCE -weight_frac 1.0 -maxrot 6 -maxshf 10 -VERB -warp aff -source_automask+4 -onepass +++ 3dAllineate: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: Zhark the Registrator +++ Source dataset: ./__tt_sub-03_ses-retest_T1w_ns_ob+orig.HEAD +++ Base dataset: ./__tt_vr_base_ts_rs_ns+orig.HEAD +++ Loading datasets +++ 1356008 voxels in -source_automask+4 +++ Zero-pad: not needed +++ 1167504 voxels [7.5%] in weight mask +++ Number of points for matching = 1167504 +++ Local correlation: blok type = 'RHDD(6.54321)' +++ shift param auto-range: -84.4..84.4 -70.6..70.6 -85.1..85.1 + + Range param#4 [z-angle] = -6.000000 .. 6.000000 + + Range param#5 [x-angle] = -6.000000 .. 6.000000 + + Range param#6 [y-angle] = -6.000000 .. 6.000000 + + Range param#1 [x-shift] = -10.000000 .. 10.000000 + + Range param#2 [y-shift] = -10.000000 .. 10.000000 + + Range param#3 [z-shift] = -10.000000 .. 10.000000 + + 12 free parameters +++ Normalized convergence radius = 0.001000 +++ OpenMP thread count = 4 +++ ======= Allineation of 1 sub-bricks using Local Pearson Correlation Signed ======= +++ ========== sub-brick #0 ========== [total CPU to here=9.5 s] +++ *** Fine pass begins *** + + * Enter alignment setup routine + + - copying base image + + - copying source image + + - copying weight image + + - using 1167504 points from base image [use_all=0] + + * Exit alignment setup routine + + 1097341 total points stored in 2067 'RHDD(6.54321)' bloks + + - Initial cost = -0.051994 + + - Initial fine Parameters = 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 1.0000 1.0000 0.0000 0.0000 0.0000 +***************************************************************************************************************************************************************** + + - Finalish cost = -0.289529 ; 377 funcs +**** + + - Final cost = -0.289531 ; 107 funcs + + Final fine fit Parameters: + x-shift= 0.2825 y-shift=-0.4994 z-shift=-1.2123 + z-angle= 0.4322 x-angle= 2.0209 y-angle=-5.2935 + x-scale= 0.9675 y-scale= 0.9734 z-scale= 1.0197 + y/x-shear=-0.0002 z/x-shear= 0.0099 z/y-shear= 0.0544 + + - Fine net CPU time = 37.4 s +++ Computing output image +++ image warp: parameters = 0.2825 -0.4994 -1.2123 0.4322 2.0209 -5.2935 0.9675 0.9734 1.0197 -0.0002 0.0099 0.0544 +++ Wrote -1Dmatrix_save ./sub-03_ses-retest_T1w_al_junk_e2a_only_mat.aff12.1D +++ 3dAllineate: total CPU time = 49.5 sec Elapsed = 32.5 +++ ########################################################### +++ # Please check results visually for alignment quality # +++ ########################################################### +++ # '-autoweight' is recommended when using -lpc or -lpa # +++ # If your results are not good, please try again. # +++ ########################################################### +#Script is running (command trimmed): + cat_matvec -ONELINE ./sub-03_ses-retest_T1w_al_junk_e2a_only_mat.aff12.1D ./__tt_sub-03_ses-retest_T1w_ns_obla2e_mat.1D -I > ./sub-03_ses-retest_T1w_al_junk_mat.aff12.1D +#++ Combining anat to epi and oblique transformations +#Script is running (command trimmed): + 3dAllineate -base ./__tt_vr_base_ts_rs_ns+orig -1Dmatrix_apply ./sub-03_ses-retest_T1w_al_junk_mat.aff12.1D -prefix ./sub-03_ses-retest_T1w_al_junk -input ./__tt_sub-03_ses-retest_T1w_ns+orig -master SOURCE -weight_frac 1.0 -maxrot 6 -maxshf 10 -VERB -warp aff -source_automask+4 -onepass +++ 3dAllineate: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: Zhark the Registrator +*+ WARNING: If you are performing spatial transformations on an oblique dset, + such as ./__tt_sub-03_ses-retest_T1w_ns+orig.BRIK, + or viewing/combining it with volumes of differing obliquity, + you should consider running: + 3dWarp -deoblique + on this and other oblique datasets in the same session. + See 3dWarp -help for details. +++ Oblique dataset:./__tt_sub-03_ses-retest_T1w_ns+orig.BRIK is 7.491219 degrees from plumb. +++ Source dataset: ./__tt_sub-03_ses-retest_T1w_ns+orig.HEAD +++ Base dataset: ./__tt_vr_base_ts_rs_ns+orig.HEAD +++ Loading datasets + + Range param#4 [z-angle] = -6.000000 .. 6.000000 + + Range param#5 [x-angle] = -6.000000 .. 6.000000 + + Range param#6 [y-angle] = -6.000000 .. 6.000000 + + Range param#1 [x-shift] = -10.000000 .. 10.000000 + + Range param#2 [y-shift] = -10.000000 .. 10.000000 + + Range param#3 [z-shift] = -10.000000 .. 10.000000 +++ OpenMP thread count = 4 +++ ========== Applying transformation to 1 sub-bricks ========== +++ ========== sub-brick #0 ========== [total CPU to here=0.1 s] + + * Enter alignment setup routine + + - copying base image + + - copying source image + + - no weight image + + - using 11 points from base image [use_all=0] + + * Exit alignment setup routine +++ using -1Dmatrix_apply +++ Computing output image +++ image warp: parameters = 0.9620 0.0446 -0.0982 14.5110 -0.0314 0.9721 -0.0546 -1.5054 0.0907 0.0280 1.0148 -11.6331 +++ 3dAllineate: total CPU time = 2.2 sec Elapsed = 1.7 +++ ########################################################### +#++ Creating final output: skullstripped anat data +copying from dataset /Users/mli/Desktop/playground/Exp-2/subject_results/group.retest/subj.sub_03/sub_03.results/__tt_sub-03_ses-retest_T1w_ns+orig to /Users/mli/Desktop/playground/Exp-2/subject_results/group.retest/subj.sub_03/sub_03.results/sub-03_ses-retest_T1w_ns+orig +#Script is running (command trimmed): + 3dcopy ./__tt_sub-03_ses-retest_T1w_ns+orig sub-03_ses-retest_T1w_ns +++ 3dcopy: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +#++ Creating final output: anat data aligned to epi +# copy is not necessary +#++ Saving history +#Script is running (command trimmed): + 3dNotes -h "align_epi_anat.py -anat2epi -anat sub-03_ses-retest_T1w+orig \ + -save_skullstrip -suffix _al_junk -epi vr_base+orig -epi_base 0 \ + -epi_strip 3dAutomask -volreg off -tshift off" \ + ./sub-03_ses-retest_T1w_al_junk+orig + +#++ Removing all the temporary files +#Script is running: + \rm -f ./__tt_vr_base* +#Script is running: + \rm -f ./__tt_sub-03_ses-retest_T1w* + +# Finished alignment successfully + +@auto_tlrc -base MNI_avg152T1+tlrc -input sub-03_ses-retest_T1w_ns+orig -no_ss +*+ WARNING: If you are performing spatial transformations on an oblique dset, + such as ./sub-03_ses-retest_T1w_ns+orig.BRIK, + or viewing/combining it with volumes of differing obliquity, + you should consider running: + 3dWarp -deoblique + on this and other oblique datasets in the same session. + See 3dWarp -help for details. +++ Oblique dataset:./sub-03_ses-retest_T1w_ns+orig.BRIK is 7.491219 degrees from plumb. +*+ WARNING: If you are performing spatial transformations on an oblique dset, + such as ./sub-03_ses-retest_T1w_ns+orig.BRIK, + or viewing/combining it with volumes of differing obliquity, + you should consider running: + 3dWarp -deoblique + on this and other oblique datasets in the same session. + See 3dWarp -help for details. +++ Oblique dataset:./sub-03_ses-retest_T1w_ns+orig.BRIK is 7.491219 degrees from plumb. +Center distance of 26.068730 mm +Padding ... +++ 3dZeropad: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ output dataset: ./__ats_tmp__ref_MNI_avg152T1_40pad+tlrc.BRIK +Resampling ... +*+ WARNING: If you are performing spatial transformations on an oblique dset, + such as ./sub-03_ses-retest_T1w_ns+orig.BRIK, + or viewing/combining it with volumes of differing obliquity, + you should consider running: + 3dWarp -deoblique + on this and other oblique datasets in the same session. + See 3dWarp -help for details. +++ Oblique dataset:./sub-03_ses-retest_T1w_ns+orig.BRIK is 7.491219 degrees from plumb. +++ 3dcalc: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: A cast of thousands +*+ WARNING: If you are performing spatial transformations on an oblique dset, + such as ./__ats_tmp__resamp_step+orig.BRIK, + or viewing/combining it with volumes of differing obliquity, + you should consider running: + 3dWarp -deoblique + on this and other oblique datasets in the same session. + See 3dWarp -help for details. +++ Oblique dataset:./__ats_tmp__resamp_step+orig.BRIK is 7.491219 degrees from plumb. +++ 3dcalc: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: A cast of thousands +*+ WARNING: If you are performing spatial transformations on an oblique dset, + such as ./sub-03_ses-retest_T1w_ns+orig.BRIK, + or viewing/combining it with volumes of differing obliquity, + you should consider running: + 3dWarp -deoblique + on this and other oblique datasets in the same session. + See 3dWarp -help for details. +++ Oblique dataset:./sub-03_ses-retest_T1w_ns+orig.BRIK is 7.491219 degrees from plumb. +Clipping -0.000100 1013.000100 ... +++ 3dcalc: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: A cast of thousands +++ 3drefit: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: RW Cox +++ Processing AFNI dataset __ats_tmp___rs_sub-03_ses-retest_T1w_ns+tlrc.HEAD + + Changed dataset view type and filenames. +++ 3drefit processed 1 datasets +++ 3drefit: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: RW Cox +++ Processing AFNI dataset __ats_tmp__resamp_NN+tlrc.HEAD + + Changed dataset view type and filenames. +++ 3drefit processed 1 datasets +++ 3drefit: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: RW Cox +++ Processing AFNI dataset __ats_tmp__resamp_edge_art+tlrc.HEAD + + Changed dataset view type and filenames. +++ 3drefit processed 1 datasets +Registration (linear final interpolation) ... +++ 3dWarpDrive: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: RW Cox +++ Initial scale factor set to 0.30/247.56=8.3e+02 +RMS[0] = 0.364249 0.163911 ITER = 6/137 +0.364249 + +Warping has converged. + +++ 3dcopy: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ 3dWarp: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: RW Cox +*+ WARNING: If you are performing spatial transformations on an oblique dset, + such as ./sub-03_ses-retest_T1w_ns+orig.BRIK, + or viewing/combining it with volumes of differing obliquity, + you should consider running: + 3dWarp -deoblique + on this and other oblique datasets in the same session. + See 3dWarp -help for details. +++ Oblique dataset:./sub-03_ses-retest_T1w_ns+orig.BRIK is 7.491219 degrees from plumb. +++ 7.491219 degrees from plumb. +*+ WARNING: Deoblique datasets with 3dWarp before proceeding with other transformations +Applying brain mask +++ 3dcalc: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: A cast of thousands +++ 3dWarp: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: RW Cox +++ 3drename: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ THD_rename_dataset_files: rename __ats_tmp___pad40_sub-03_ses-retest_T1w_ns+orig.HEAD -> __ats_tmp___pad40_sub-03_ses-retest_T1w_ns.skl+orig.HEAD +++ THD_rename_dataset_files: rename __ats_tmp___pad40_sub-03_ses-retest_T1w_ns+orig.BRIK.gz -> __ats_tmp___pad40_sub-03_ses-retest_T1w_ns.skl+orig.BRIK.gz +++ 3dcalc: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: A cast of thousands +Unpadding ... +++ 3dZeropad: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ output dataset: ./__ats_tmp___upad40_sub-03_ses-retest_T1w_ns+orig.BRIK +++ 3drefit: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: RW Cox +++ Processing AFNI dataset __ats_tmp___upad40_sub-03_ses-retest_T1w_ns+orig +*+ WARNING: Changing the space of an ORIG view dataset may cause confusion! +*+ WARNING: NIFTI copies will be interpreted as TLRC view (not TLRC space). +*+ WARNING: Consider changing the view of the dataset to TLRC view also +++ 3drefit processed 1 datasets +Changing view of transformed anatomy +++ 3drefit: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: RW Cox +++ Processing AFNI dataset __ats_tmp___upad40_sub-03_ses-retest_T1w_ns+orig.HEAD + + Changed dataset view type and filenames. +++ 3drefit processed 1 datasets +Setting parent with 3drefit -wset sub-03_ses-retest_T1w_ns+orig __ats_tmp___upad40_sub-03_ses-retest_T1w_ns+tlrc +++ 3drefit: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: RW Cox +++ Processing AFNI dataset __ats_tmp___upad40_sub-03_ses-retest_T1w_ns+tlrc +++ 3drefit processed 1 datasets +++ 3drename: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Warning: ignoring +tlrc on new_prefix. +++ THD_rename_dataset_files: rename __ats_tmp___upad40_sub-03_ses-retest_T1w_ns+tlrc.HEAD -> sub-03_ses-retest_T1w_ns+tlrc.HEAD +++ THD_rename_dataset_files: rename __ats_tmp___upad40_sub-03_ses-retest_T1w_ns+tlrc.BRIK -> sub-03_ses-retest_T1w_ns+tlrc.BRIK +Cleanup ... +cat_matvec sub-03_ses-retest_T1w_ns+tlrc::WARP_DATA -I +if ( ! -f sub-03_ses-retest_T1w_ns+tlrc.HEAD ) then +foreach run ( 01 ) +3dvolreg -verbose -zpad 1 -base vr_base+orig -1Dfile dfile.r01.1D -prefix rm.epi.volreg.r01 -cubic -1Dmatrix_save mat.r01.vr.aff12.1D pb01.sub_03.r01.tshift+orig +++ 3dvolreg: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: RW Cox +*+ WARNING: If you are performing spatial transformations on an oblique dset, + such as ./vr_base+orig.BRIK, + or viewing/combining it with volumes of differing obliquity, + you should consider running: + 3dWarp -deoblique + on this and other oblique datasets in the same session. + See 3dWarp -help for details. +++ Oblique dataset:./vr_base+orig.BRIK is 4.947676 degrees from plumb. +++ Reading in base dataset ./vr_base+orig.BRIK +++ Oblique dataset:./pb01.sub_03.r01.tshift+orig.BRIK is 4.947676 degrees from plumb. +++ Reading input dataset ./pb01.sub_03.r01.tshift+orig.BRIK +++ Edging: x=3 y=3 z=2 +++ Creating mask for -maxdisp + + Automask has 19058 voxels + + 3364 voxels left in -maxdisp mask after erosion +++ Initializing alignment base +++ Starting final pass on 237 sub-bricks: 0..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..65..66..67..68..69..70..71..72..73..74..75..76..77..78..79..80..81..82..83..84..85..86..87..88..89..90..91..92..93..94..95..96..97..98..99..100..101..102..103..104..105..106..107..108..109..110..111..112..113..114..115..116..117..118..119..120..121..122..123..124..125..126..127..128..129..130..131..132..133..134..135..136..137..138..139..140..141..142..143..144..145..146..147..148..149..150..151..152..153..154..155..156..157..158..159..160..161..162..163..164..165..166..167..168..169..170..171..172..173..174..175..176..177..178..179..180..181..182..183..184..185..186..187..188..189..190..191..192..193..194..195..196..197..198..199..200..201..202..203..204..205..206..207..208..209..210..211..212..213..214..215..216..217..218..219..220..221..222..223..224..225..226..227..228..229..230..231..232..233..234..235..236.. +++ CPU time for realignment=6.8 s [=0.0287 s/sub-brick] +++ Min : roll=-0.181 pitch=-0.341 yaw=-0.016 dS=-0.709 dL=-0.130 dP=-0.130 +++ Mean: roll=-0.081 pitch=+0.020 yaw=+0.496 dS=-0.184 dL=+0.212 dP=+0.033 +++ Max : roll=+0.032 pitch=+0.458 yaw=+0.971 dS=+0.453 dL=+0.674 dP=+0.194 +++ Max displacements (mm) for each sub-brick: + 0.30(0.00) 0.20(0.44) 0.00(0.20) 0.23(0.23) 0.26(0.09) 0.39(0.15) 0.18(0.32) 0.23(0.16) 0.35(0.15) 0.20(0.21) 0.26(0.16) 0.36(0.13) 0.47(0.18) 0.64(0.20) 0.80(0.18) 0.89(0.10) 1.01(0.17) 0.97(0.08) 0.92(0.09) 0.59(0.48) 0.64(0.07) 0.54(0.11) 0.54(0.13) 0.60(0.11) 0.60(0.06) 0.61(0.07) 0.56(0.15) 0.56(0.09) 0.53(0.05) 0.62(0.09) 0.65(0.14) 0.60(0.08) 0.52(0.10) 0.48(0.09) 0.45(0.08) 0.54(0.18) 0.56(0.12) 0.61(0.07) 0.60(0.07) 0.62(0.07) 0.65(0.04) 0.69(0.06) 0.58(0.24) 0.63(0.06) 0.66(0.12) 0.68(0.08) 0.63(0.15) 0.64(0.03) 0.64(0.10) 0.67(0.08) 0.59(0.11) 0.52(0.13) 0.45(0.11) 0.44(0.09) 0.44(0.12) 0.42(0.07) 0.53(0.13) 0.57(0.05) 0.56(0.07) 0.61(0.07) 0.61(0.05) 0.66(0.11) 0.57(0.22) 0.66(0.13) 0.69(0.05) 0.70(0.07) 0.74(0.11) 0.71(0.12) 0.75(0.24) 0.68(0.19) 0.82(0.15) 0.74(0.28) 0.81(0.21) 0.90(0.13) 0.72(0.18) 0.79(0.08) 0.81(0.04) 0.86(0.08) 0.78(0.18) 0.79(0.04) 0.74(0.06) 0.84(0.12) 0.94(0.34) 0.75(0.20) 0.78(0.08) 0.83(0.09) 0.88(0.06) 0.90(0.04) 0.81(0.14) 0.83(0.09) 0.78(0.10) 0.80(0.05) 0.70(0.11) 0.75(0.09) 0.74(0.06) 0.72(0.04) 0.75(0.07) 0.72(0.10) 0.87(0.23) 0.80(0.07) 0.80(0.13) 0.73(0.16) 0.80(0.06) 0.75(0.08) 0.73(0.08) 0.77(0.05) 0.78(0.08) 0.77(0.05) 0.67(0.16) 0.68(0.06) 0.68(0.19) 0.70(0.16) 0.68(0.13) 0.64(0.17) 0.64(0.09) 0.67(0.05) 0.66(0.04) 0.63(0.07) 0.67(0.14) 0.64(0.14) 0.73(0.18) 0.83(0.22) 1.01(0.23) 0.85(0.19) 0.87(0.05) 0.81(0.14) 0.81(0.07) 0.85(0.07) 0.78(0.09) 0.84(0.09) 0.77(0.12) 0.85(0.08) 0.85(0.03) 0.87(0.05) 0.90(0.06) 0.91(0.04) 0.97(0.09) 0.92(0.09) 1.01(0.09) 0.95(0.07) 0.95(0.04) 0.86(0.10) 0.95(0.11) 0.92(0.07) 0.92(0.10) 0.95(0.06) 0.97(0.04) 0.94(0.10) 1.07(0.14) 0.97(0.13) 1.11(0.16) 1.14(0.08) 1.31(0.19) 1.19(0.15) 1.24(0.11) 1.24(0.05) 1.25(0.06) 1.31(0.06) 1.23(0.10) 1.28(0.10) 1.20(0.09) 1.40(0.21) 1.25(0.17) 1.23(0.08) 1.32(0.10) 1.26(0.11) 1.34(0.12) 1.31(0.11) 1.39(0.13) 1.27(0.15) 1.32(0.07) 1.29(0.04) 1.35(0.06) 1.37(0.03) 1.39(0.05) 1.46(0.07) 1.41(0.06) 1.52(0.20) 1.46(0.14) 1.42(0.07) 1.44(0.07) 1.49(0.09) 1.49(0.07) 1.51(0.06) 1.56(0.06) 1.52(0.08) 1.55(0.09) 1.45(0.10) 1.58(0.13) 1.58(0.03) 1.59(0.07) 1.57(0.15) 1.34(0.33) 1.36(0.09) 1.34(0.09) 1.40(0.11) 1.36(0.05) 1.37(0.05) 1.33(0.06) 1.36(0.11) 1.30(0.09) 1.33(0.05) 1.45(0.19) 1.51(0.09) 1.42(0.18) 1.56(0.21) 1.63(0.07) 1.66(0.05) 1.67(0.04) 1.75(0.13) 1.71(0.10) 1.75(0.04) 1.77(0.07) 1.79(0.12) 1.80(0.09) 1.90(0.11) 1.91(0.05) 1.90(0.12) 2.01(0.13) 2.12(0.15) 2.00(0.15) 1.91(0.16) 1.74(0.26) 1.70(0.32) 1.75(0.18) 1.58(0.19) 1.53(0.17) 1.41(0.23) 1.23(0.22) 1.43(0.44) 1.00(0.47) 0.85(0.20) 1.02(0.28) 1.09(0.09) 1.24(0.15) 1.18(0.15) 1.21(0.11) +++ Max displacement in automask = 2.12 (mm) at sub-brick 219 +++ Max delta displ in automask = 0.48 (mm) at sub-brick 19 +++ Wrote dataset to disk in ./rm.epi.volreg.r01+orig.BRIK +3dcalc -overwrite -a pb01.sub_03.r01.tshift+orig -expr 1 -prefix rm.epi.all1 +++ 3dcalc: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: A cast of thousands +*+ WARNING: input 'a' is not used in the expression +cat_matvec -ONELINE sub-03_ses-retest_T1w_ns+tlrc::WARP_DATA -I sub-03_ses-retest_T1w_al_junk_mat.aff12.1D -I mat.r01.vr.aff12.1D +3dAllineate -base sub-03_ses-retest_T1w_ns+tlrc -input pb01.sub_03.r01.tshift+orig -1Dmatrix_apply mat.r01.warp.aff12.1D -mast_dxyz 4 -prefix rm.epi.nomask.r01 +++ 3dAllineate: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: Zhark the Registrator +*+ WARNING: If you are performing spatial transformations on an oblique dset, + such as ./pb01.sub_03.r01.tshift+orig.BRIK, + or viewing/combining it with volumes of differing obliquity, + you should consider running: + 3dWarp -deoblique + on this and other oblique datasets in the same session. + See 3dWarp -help for details. +++ Oblique dataset:./pb01.sub_03.r01.tshift+orig.BRIK is 4.947676 degrees from plumb. +++ Source dataset: ./pb01.sub_03.r01.tshift+orig.HEAD +++ Base dataset: ./sub-03_ses-retest_T1w_ns+tlrc.HEAD +++ Loading datasets +++ NOTE: base and source coordinate systems have different handedness + + Orientations: base=Right handed (LPI); source=Left handed (RPI) +++ master dataset for output = base +++ changing output grid spacing to 4.0000 mm +++ OpenMP thread count = 4 +++ ========== Applying transformation to 237 sub-bricks ========== +volume 0..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..65..66..67..68..69..70..71..72..73..74..75..76..77..78..79..80..81..82..83..84..85..86..87..88..89..90..91..92..93..94..95..96..97..98..99..100..101..102..103..104..105..106..107..108..109..110..111..112..113..114..115..116..117..118..119..120..121..122..123..124..125..126..127..128..129..130..131..132..133..134..135..136..137..138..139..140..141..142..143..144..145..146..147..148..149..150..151..152..153..154..155..156..157..158..159..160..161..162..163..164..165..166..167..168..169..170..171..172..173..174..175..176..177..178..179..180..181..182..183..184..185..186..187..188..189..190..191..192..193..194..195..196..197..198..199..200..201..202..203..204..205..206..207..208..209..210..211..212..213..214..215..216..217..218..219..220..221..222..223..224..225..226..227..228..229..230..231..232..233..234..235..236Ø++ Output dataset ./rm.epi.nomask.r01+tlrc.BRIK +++ 3dAllineate: total CPU time = 6.2 sec Elapsed = 4.2 +++ ########################################################### +3dAllineate -base sub-03_ses-retest_T1w_ns+tlrc -input rm.epi.all1+orig -1Dmatrix_apply mat.r01.warp.aff12.1D -mast_dxyz 4 -final NN -quiet -prefix rm.epi.1.r01 +++ 3dAllineate: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: Zhark the Registrator +*+ WARNING: If you are performing spatial transformations on an oblique dset, + such as ./rm.epi.all1+orig.BRIK, + or viewing/combining it with volumes of differing obliquity, + you should consider running: + 3dWarp -deoblique + on this and other oblique datasets in the same session. + See 3dWarp -help for details. +++ Oblique dataset:./rm.epi.all1+orig.BRIK is 4.947676 degrees from plumb. +++ NOTE: base and source coordinate systems have different handedness + + Orientations: base=Right handed (LPI); source=Left handed (RPI) +++ 3dAllineate: total CPU time = 3.7 sec Elapsed = 3.7 +3dTstat -min -prefix rm.epi.min.r01 rm.epi.1.r01+tlrc +++ 3dTstat: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: KR Hammett & RW Cox +end +cat dfile.r01.1D +3dcopy rm.epi.min.r01+tlrc mask_epi_extents +++ 3dcopy: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +foreach run ( 01 ) +3dcalc -a rm.epi.nomask.r01+tlrc -b mask_epi_extents+tlrc -expr a*b -prefix pb02.sub_03.r01.volreg +++ 3dcalc: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: A cast of thousands +++ Output dataset ./pb02.sub_03.r01.volreg+tlrc.BRIK +end +cat_matvec -ONELINE sub-03_ses-retest_T1w_ns+tlrc::WARP_DATA -I sub-03_ses-retest_T1w_al_junk_mat.aff12.1D -I +3dAllineate -base sub-03_ses-retest_T1w_ns+tlrc -input vr_base+orig -1Dmatrix_apply mat.basewarp.aff12.1D -mast_dxyz 4 -prefix final_epi_vr_base +++ 3dAllineate: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: Zhark the Registrator +*+ WARNING: If you are performing spatial transformations on an oblique dset, + such as ./vr_base+orig.BRIK, + or viewing/combining it with volumes of differing obliquity, + you should consider running: + 3dWarp -deoblique + on this and other oblique datasets in the same session. + See 3dWarp -help for details. +++ Oblique dataset:./vr_base+orig.BRIK is 4.947676 degrees from plumb. +++ Source dataset: ./vr_base+orig.HEAD +++ Base dataset: ./sub-03_ses-retest_T1w_ns+tlrc.HEAD +++ Loading datasets +++ NOTE: base and source coordinate systems have different handedness + + Orientations: base=Right handed (LPI); source=Left handed (RPI) +++ master dataset for output = base +++ changing output grid spacing to 4.0000 mm +++ OpenMP thread count = 4 +++ ========== Applying transformation to 1 sub-bricks ========== +volume 0Ø++ Output dataset ./final_epi_vr_base+tlrc.BRIK +++ 3dAllineate: total CPU time = 0.0 sec Elapsed = 0.1 +++ ########################################################### +3dcopy sub-03_ses-retest_T1w_ns+tlrc anat_final.sub_03 +++ 3dcopy: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +3dAllineate -base final_epi_vr_base+tlrc -allcostX -input anat_final.sub_03+tlrc +tee out.allcostX.txt +++ 3dAllineate: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: Zhark the Registrator +++ Source dataset: ./anat_final.sub_03+tlrc.HEAD +++ Base dataset: ./final_epi_vr_base+tlrc.HEAD +++ Loading datasets +++ 222503 voxels in source_automask+0 +++ Zero-pad: xbot=1 xtop=2 +++ Zero-pad: ybot=0 ytop=1 +++ Zero-pad: zbot=2 ztop=1 +++ Computing -autobox +++ 113307 voxels [89.4%] in weight mask +++ Number of points for matching = 53254 +++ Local correlation: blok type = 'RHDD(14.76)' +*+ WARNING: No output dataset will be calculated +++ OpenMP thread count = 4 +volume 0Ø + initial Parameters = 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 1.0000 1.0000 0.0000 0.0000 0.0000 +++ allcost output: init #0 + ls = 0.183506 + sp = 0.306723 + mi = -0.532442 + crM = 0.0787207 + nmi = 0.868505 + je = 3.51671 + hel = -0.106397 + crA = 0.281314 + crU = 0.301726 + lss = 0.816494 + lpc = 0.300018 + lpa = 0.699982 + lpc+ = 0.497814 + ncd = 1 +++ 3dAllineate: total CPU time = 0.3 sec Elapsed = 0.4 +++ ########################################################### +3dAllineate -source sub-03_ses-retest_T1w+orig -master anat_final.sub_03+tlrc -final wsinc5 -1Dmatrix_apply warp.anat.Xat.1D -prefix anat_w_skull_warped +++ 3dAllineate: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: Zhark the Registrator +*+ WARNING: If you are performing spatial transformations on an oblique dset, + such as ./sub-03_ses-retest_T1w+orig.BRIK, + or viewing/combining it with volumes of differing obliquity, + you should consider running: + 3dWarp -deoblique + on this and other oblique datasets in the same session. + See 3dWarp -help for details. +++ Oblique dataset:./sub-03_ses-retest_T1w+orig.BRIK is 7.491219 degrees from plumb. +++ -1Dmatrix_apply: converting input 3x4 array to 1 row of 12 numbers +++ Source dataset: ./sub-03_ses-retest_T1w+orig.HEAD +++ Base dataset: (not given) +++ Loading datasets +++ OpenMP thread count = 4 +++ ========== Applying transformation to 1 sub-bricks ========== +volume 0Ø++ wsinc5 interpolation setup: + + taper function = Min sidelobe 3 term + + taper cut point = 0.000 + + window radius = 5 voxels + + window shape = Cubical + + The above can be altered via the AFNI_WSINC5_* environment variables. + + (To avoid this message, 'setenv AFNI_WSINC5_SILENT YES'.) + + wsinc5 CUBE(5) mask has 1000 points +++ Output dataset ./anat_w_skull_warped+tlrc.BRIK +++ 3dAllineate: total CPU time = 3.2 sec Elapsed = 1.5 +++ ########################################################### +foreach run ( 01 ) +3dmerge -1blur_fwhm 3.0 -doall -prefix pb03.sub_03.r01.blur pb02.sub_03.r01.volreg+tlrc +++ 3dmerge: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ default -1dindex = 0 +++ default -1tindex = 1 +Program 3dmerge +3dmerge: edit and combine 3D datasets, by RW Cox +++ editing input dataset in memory (49.4 MB) +.............................................................................................................................................................................................................................................-- Wrote edited dataset: ./pb03.sub_03.r01.blur+tlrc.BRIK + +end +foreach run ( 01 ) +3dAutomask -dilate 1 -prefix rm.mask_r01 pb03.sub_03.r01.blur+tlrc +++ 3dAutomask: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: Emperor Zhark +++ Loading dataset pb03.sub_03.r01.blur+tlrc +++ Forming automask + + Fixed clip level = 704.767273 + + Used gradual clip level = 625.530457 .. 750.232300 + + Number voxels above clip level = 28088 + + Clustering voxels ... + + Largest cluster has 28054 voxels + + Clustering voxels ... + + Largest cluster has 27922 voxels + + Filled 97 voxels in small holes; now have 28019 voxels + + Clustering voxels ... + + Largest cluster has 28019 voxels + + Clustering non-brain voxels ... + + Clustering voxels ... + + Largest cluster has 81331 voxels + + Mask now has 28019 voxels +++ Dilating automask + + Clustering voxels ... + + Largest cluster has 76177 voxels +++ 33173 voxels in the mask [out of 109350: 30.34%] +++ first 4 x-planes are zero [from L] +++ last 3 x-planes are zero [from R] +++ first 4 y-planes are zero [from P] +++ last 3 y-planes are zero [from A] +++ first 3 z-planes are zero [from I] +++ last 3 z-planes are zero [from S] +++ CPU time = 0.300000 sec +end +3dmask_tool -inputs rm.mask_r01+tlrc.HEAD -union -prefix full_mask.sub_03 +++ processing 1 input datasets... +++ padding all datasets by 0 (for dilations) +++ frac 0 over 1 volumes gives min count 0 +++ voxel limits: 0 clipped, 33173 survived, 76177 were zero +++ writing result full_mask.sub_03... +3dresample -master full_mask.sub_03+tlrc -input sub-03_ses-retest_T1w_ns+tlrc -prefix rm.resam.anat +3dmask_tool -dilate_input 5 -5 -fill_holes -input rm.resam.anat+tlrc -prefix mask_anat.sub_03 +++ no -frac option: defaulting to -union +++ processing 1 input datasets... +++ padding all datasets by 5 (for dilations) +++ frac 0 over 1 volumes gives min count 0 +++ voxel limits: 0 clipped, 30574 survived, 78776 were zero +++ filled 0 holes (0 voxels) +++ writing result mask_anat.sub_03... +3dABoverlap -no_automask full_mask.sub_03+tlrc mask_anat.sub_03+tlrc +tee out.mask_ae_overlap.txt +++ 3dOverlap: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +#A=./full_mask.sub_03+tlrc.BRIK B=./mask_anat.sub_03+tlrc.BRIK +#A #B #(A uni B) #(A int B) #(A \ B) #(B \ A) %(A \ B) %(B \ A) Rx(B/A) Ry(B/A) Rz(B/A) +33173 30574 35634 28113 5060 2461 15.2534 8.0493 0.9466 0.9314 0.9581 +3ddot -dodice full_mask.sub_03+tlrc mask_anat.sub_03+tlrc +tee out.mask_ae_dice.txt +0.882018 +3dresample -master full_mask.sub_03+tlrc -prefix ./rm.resam.group -input /Users/mli/abin/MNI_avg152T1+tlrc +3dmask_tool -dilate_input 5 -5 -fill_holes -input rm.resam.group+tlrc -prefix mask_group +++ no -frac option: defaulting to -union +++ processing 1 input datasets... +++ padding all datasets by 5 (for dilations) +++ frac 0 over 1 volumes gives min count 0 +++ voxel limits: 0 clipped, 30980 survived, 78370 were zero +++ filled 0 holes (0 voxels) +++ writing result mask_group... +foreach run ( 01 ) +3dTstat -prefix rm.mean_r01 pb03.sub_03.r01.blur+tlrc +++ 3dTstat: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: KR Hammett & RW Cox +++ Output dataset ./rm.mean_r01+tlrc.BRIK +3dcalc -a pb03.sub_03.r01.blur+tlrc -b rm.mean_r01+tlrc -c mask_epi_extents+tlrc -expr c * min(200, a/b*100)*step(a)*step(b) -prefix pb04.sub_03.r01.scale +++ 3dcalc: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: A cast of thousands +++ Output dataset ./pb04.sub_03.r01.scale+tlrc.BRIK +end +1d_tool.py -infile dfile_rall.1D -set_nruns 1 -demean -write motion_demean.1D +1d_tool.py -infile dfile_rall.1D -set_nruns 1 -derivative -demean -write motion_deriv.1D +1d_tool.py -infile dfile_rall.1D -set_nruns 1 -show_censor_count -censor_prev_TR -censor_motion 0.5 motion_sub_03 +total number of censored TRs (simple form) = 0 +set ktrs = `1d_tool.py -infile motion_${subj}_censor.1D + -show_trs_uncensored encoded` +1d_tool.py -infile motion_sub_03_censor.1D -show_trs_uncensored encoded +3dDeconvolve -input pb04.sub_03.r01.scale+tlrc.HEAD -censor motion_sub_03_censor.1D -polort 4 -num_stimts 17 -stim_times 1 stimuli/timing_sub-03_ses-retest_Correct_Task.1D GAM -stim_label 1 Correct_Task -stim_times 2 stimuli/timing_sub-03_ses-retest_Incorrect_Task.1D GAM -stim_label 2 Incorrect_Task -stim_times 3 stimuli/timing_sub-03_ses-retest_No_Response_Control.1D GAM -stim_label 3 No_Response_Control -stim_times 4 stimuli/timing_sub-03_ses-retest_No_Response_Task.1D GAM -stim_label 4 No_Response_Task -stim_times 5 stimuli/timing_sub-03_ses-retest_Response_Control.1D GAM -stim_label 5 Response_Control -stim_file 6 motion_demean.1D[0] -stim_base 6 -stim_label 6 roll_01 -stim_file 7 motion_demean.1D[1] -stim_base 7 -stim_label 7 pitch_01 -stim_file 8 motion_demean.1D[2] -stim_base 8 -stim_label 8 yaw_01 -stim_file 9 motion_demean.1D[3] -stim_base 9 -stim_label 9 dS_01 -stim_file 10 motion_demean.1D[4] -stim_base 10 -stim_label 10 dL_01 -stim_file 11 motion_demean.1D[5] -stim_base 11 -stim_label 11 dP_01 -stim_file 12 motion_deriv.1D[0] -stim_base 12 -stim_label 12 roll_02 -stim_file 13 motion_deriv.1D[1] -stim_base 13 -stim_label 13 pitch_02 -stim_file 14 motion_deriv.1D[2] -stim_base 14 -stim_label 14 yaw_02 -stim_file 15 motion_deriv.1D[3] -stim_base 15 -stim_label 15 dS_02 -stim_file 16 motion_deriv.1D[4] -stim_base 16 -stim_label 16 dL_02 -stim_file 17 motion_deriv.1D[5] -stim_base 17 -stim_label 17 dP_02 -gltsym SYM: 0.5*Correct_Task +0.5*Incorrect_Task -Response_Control -glt_label 1 Landmark-Detection -fout -tout -x1D X.xmat.1D -xjpeg X.jpg -x1D_uncensored X.nocensor.xmat.1D -fitts fitts.sub_03 -errts errts.sub_03 -bucket stats.sub_03 +++ 3dDeconvolve: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: B. Douglas Ward, et al. +++ loading dataset pb04.sub_03.r01.scale+tlrc.HEAD +++ STAT automask has 100230 voxels (out of 109350 = 91.7%) +++ Skipping check for initial transients +++ Input polort=4; Longest run=592.5 s; Recommended minimum polort=4 ++ OK ++ +++ -stim_times using TR=2.5 s for stimulus timing conversion +++ -stim_times using TR=2.5 s for any -iresp output datasets +++ [you can alter the -iresp TR via the -TR_times option] +++ ** -stim_times NOTE ** guessing GLOBAL times if 1 time per line; LOCAL otherwise +++ ** GUESSED ** -stim_times 1 using LOCAL times +++ ** GUESSED ** -stim_times 2 using LOCAL times +++ ** GUESSED ** -stim_times 3 using LOCAL times +++ ** GUESSED ** -stim_times 4 using LOCAL times +++ ** GUESSED ** -stim_times 5 using LOCAL times +------------------------------------------------------------ +GLT matrix from 'SYM: 0.5*Correct_Task +0.5*Incorrect_Task -Response_Control': + 0 0 0 0 0 0.5 0.5 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 + +++ Number of time points: 237 (no censoring) + + Number of parameters: 22 [17 baseline ; 5 signal] +++ Memory required for output bricks = 215,638,200 bytes (about 216 million [mega]) +++ Wrote matrix image to file X.jpg +++ Wrote matrix values to file X.xmat.1D +++ ========= Things you can do with the matrix file ========= +++ (a) Linear regression with ARMA(1,1) modeling of serial correlation: + +3dREMLfit -matrix X.xmat.1D -input pb04.sub_03.r01.scale+tlrc.HEAD \ + -fout -tout -Rbuck stats.sub_03_REML -Rvar stats.sub_03_REMLvar \ + -Rfitts fitts.sub_03_REML -Rerrts errts.sub_03_REML -verb + +++ N.B.: 3dREMLfit command above written to file stats.REML_cmd +++ (b) Visualization/analysis of the matrix via ExamineXmat.R +++ (c) Synthesis of sub-model datasets using 3dSynthesize +++ ========================================================== +++ Wrote matrix values to file X.nocensor.xmat.1D +++ ----- Signal+Baseline matrix condition [X] (237x22): 5.15025 ++ VERY GOOD ++ +++ ----- Signal-only matrix condition [X] (237x5): 1.40108 ++ VERY GOOD ++ +++ ----- Baseline-only matrix condition [X] (237x17): 5.05637 ++ VERY GOOD ++ +++ ----- stim_base-only matrix condition [X] (237x12): 3.89229 ++ VERY GOOD ++ +++ ----- polort-only matrix condition [X] (237x5): 1.01409 ++ VERY GOOD ++ +++ +++++ Matrix inverse average error = 2.52458e-15 ++ VERY GOOD ++ +++ Matrix setup time = 0.66 s +++ Calculations starting; elapsed time=1.251 +++ voxel loop:0123456789.0123456789.0123456789.0123456789.0123456789. +++ Calculations finished; elapsed time=16.434 +++ Smallest FDR q [0 Full_Fstat] = 1.58949e-13 +++ Smallest FDR q [2 Correct_Task#0_Tstat] = 1.14183e-12 +++ Smallest FDR q [3 Correct_Task_Fstat] = 1.14177e-12 +++ Smallest FDR q [5 Incorrect_Task#0_Tstat] = 2.37228e-06 +++ Smallest FDR q [6 Incorrect_Task_Fstat] = 2.37223e-06 +++ Smallest FDR q [8 No_Response_Control#0_Tstat] = 0.00142543 +++ Smallest FDR q [9 No_Response_Control_Fstat] = 0.0014255 +++ Smallest FDR q [11 No_Response_Task#0_Tstat] = 0.00041271 +++ Smallest FDR q [12 No_Response_Task_Fstat] = 0.000412699 +++ Smallest FDR q [14 Response_Control#0_Tstat] = 4.63842e-13 +++ Smallest FDR q [15 Response_Control_Fstat] = 4.63842e-13 +++ Smallest FDR q [17 Landmark-Detection_GLT#0_Tstat] = 7.39797e-06 +++ Smallest FDR q [18 Landmark-Detection_GLT_Fstat] = 7.39878e-06 +++ Wrote bucket dataset into ./stats.sub_03+tlrc.BRIK + + created 13 FDR curves in bucket header +++ Wrote 3D+time dataset into ./fitts.sub_03+tlrc.BRIK +++ Wrote 3D+time dataset into ./errts.sub_03+tlrc.BRIK +++ #Flops=4.33688e+10 Average Dot Product=37.4925 +if ( 0 != 0 ) then +1d_tool.py -show_cormat_warnings -infile X.xmat.1D +tee out.cormat_warn.txt + +Warnings regarding Correlation Matrix: X.xmat.1D + + severity correlation cosine regressor pair + -------- ----------- ------ ---------------------------------------- + medium: 0.447 0.539 ( 5 vs. 6) Correct_Task#0 vs. Incorrect_Task#0 + +3dTcat -prefix all_runs.sub_03 pb04.sub_03.r01.scale+tlrc.HEAD +++ 3dTcat: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ elapsed time = 0.3 s +3dTstat -mean -prefix rm.signal.all all_runs.sub_03+tlrc[0..236] +++ 3dTstat: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: KR Hammett & RW Cox +++ Output dataset ./rm.signal.all+tlrc.BRIK +3dTstat -stdev -prefix rm.noise.all errts.sub_03+tlrc[0..236] +++ 3dTstat: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: KR Hammett & RW Cox +++ Output dataset ./rm.noise.all+tlrc.BRIK +3dcalc -a rm.signal.all+tlrc -b rm.noise.all+tlrc -c full_mask.sub_03+tlrc -expr c*a/b -prefix TSNR.sub_03 +++ 3dcalc: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: A cast of thousands +++ Output dataset ./TSNR.sub_03+tlrc.BRIK +3dTnorm -norm2 -prefix rm.errts.unit errts.sub_03+tlrc +++ 3dTnorm: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: RW Cox +++ Output dataset ./rm.errts.unit+tlrc.BRIK +3dmaskave -quiet -mask full_mask.sub_03+tlrc rm.errts.unit+tlrc +++ 3dmaskave: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] ++++ 33173 voxels survive the mask +3dTstat -sos -prefix - gmean.errts.unit.1D' +++ 3dTstat: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: KR Hammett & RW Cox +*+ WARNING: Input dataset is not 3D+time; assuming TR=1.0 +echo -- GCOR = `cat out.gcor.1D` +cat out.gcor.1D +-- GCOR = 0.0592107 +3dcalc -a rm.errts.unit+tlrc -b gmean.errts.unit.1D -expr a*b -prefix rm.DP +++ 3dcalc: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: A cast of thousands +++ Output dataset ./rm.DP+tlrc.BRIK +3dTstat -sum -prefix corr_brain rm.DP+tlrc +++ 3dTstat: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: KR Hammett & RW Cox +++ Output dataset ./corr_brain+tlrc.BRIK +1dcat X.nocensor.xmat.1D[5] +1dcat X.nocensor.xmat.1D[6] +1dcat X.nocensor.xmat.1D[7] +1dcat X.nocensor.xmat.1D[8] +1dcat X.nocensor.xmat.1D[9] +set reg_cols = `1d_tool.py -infile X.nocensor.xmat.1D -show_indices_interest` +1d_tool.py -infile X.nocensor.xmat.1D -show_indices_interest +3dTstat -sum -prefix sum_ideal.1D X.nocensor.xmat.1D[5..9] +++ 3dTstat: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: KR Hammett & RW Cox +*+ WARNING: Input dataset is not 3D+time; assuming TR=1.0 +++ Output dataset ./sum_ideal.1D +1dcat X.nocensor.xmat.1D[5..9] +touch blur_est.sub_03.1D +mkdir files_ACF +touch blur.epits.1D +foreach run ( 01 ) +set trs = `1d_tool.py -infile X.xmat.1D -show_trs_uncensored encoded + -show_trs_run $run` +1d_tool.py -infile X.xmat.1D -show_trs_uncensored encoded -show_trs_run 01 +if ( 0..236 == ) continue +3dFWHMx -detrend -mask full_mask.sub_03+tlrc -ACF files_ACF/out.3dFWHMx.ACF.epits.r01.1D all_runs.sub_03+tlrc[0..236] +++ 3dFWHMx: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: The Bob +++ Number of voxels in mask = 33173 +*+ WARNING: removed 239 voxels from mask because they are constant in time +++ detrending start: 17 baseline funcs, 237 time points + + detrending done (2.92 CPU s thus far) +++ start ACF calculations out to radius = 19.39 mm + + ACF done (37.41 CPU s thus far) +++ ACF 1D file [radius ACF mixed_model gaussian_NEWmodel] written to files_ACF/out.3dFWHMx.ACF.epits.r01.1D +++ 1dplot: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: RWC et al. + + and 1dplot-ed to file files_ACF/out.3dFWHMx.ACF.epits.r01.1D.png +end +set blurs = ( `3dTstat -mean -prefix - blur.epits.1D'{0..$(2)}'\'` ) +3dTstat -mean -prefix - blur.epits.1D{0..$(2)}' +++ 3dTstat: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: KR Hammett & RW Cox +*+ WARNING: Input dataset has 1 sub-brick ==> -tdiff is turned off +*+ WARNING: Input dataset is not 3D+time; assuming TR=1.0 +echo average epits FWHM blurs: 0 0 0 0 +average epits FWHM blurs: 0 0 0 0 +echo 0 0 0 0 # epits FWHM blur estimates +set blurs = ( `3dTstat -mean -prefix - blur.epits.1D'{1..$(2)}'\'` ) +3dTstat -mean -prefix - blur.epits.1D{1..$(2)}' +++ 3dTstat: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: KR Hammett & RW Cox +*+ WARNING: Input dataset has 1 sub-brick ==> -tdiff is turned off +*+ WARNING: Input dataset is not 3D+time; assuming TR=1.0 +echo average epits ACF blurs: 0.788541 3.59942 12.8144 9.29002 +average epits ACF blurs: 0.788541 3.59942 12.8144 9.29002 +echo 0.788541 3.59942 12.8144 9.29002 # epits ACF blur estimates +touch blur.errts.1D +foreach run ( 01 ) +set trs = `1d_tool.py -infile X.xmat.1D -show_trs_uncensored encoded + -show_trs_run $run` +1d_tool.py -infile X.xmat.1D -show_trs_uncensored encoded -show_trs_run 01 +if ( 0..236 == ) continue +3dFWHMx -detrend -mask full_mask.sub_03+tlrc -ACF files_ACF/out.3dFWHMx.ACF.errts.r01.1D errts.sub_03+tlrc[0..236] +++ 3dFWHMx: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: The Bob +++ Number of voxels in mask = 33173 +*+ WARNING: removed 239 voxels from mask because they are constant in time +++ detrending start: 17 baseline funcs, 237 time points + + detrending done (2.86 CPU s thus far) +++ start ACF calculations out to radius = 19.25 mm + + ACF done (37.78 CPU s thus far) +++ ACF 1D file [radius ACF mixed_model gaussian_NEWmodel] written to files_ACF/out.3dFWHMx.ACF.errts.r01.1D +++ 1dplot: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: RWC et al. + + and 1dplot-ed to file files_ACF/out.3dFWHMx.ACF.errts.r01.1D.png +end +set blurs = ( `3dTstat -mean -prefix - blur.errts.1D'{0..$(2)}'\'` ) +3dTstat -mean -prefix - blur.errts.1D{0..$(2)}' +++ 3dTstat: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: KR Hammett & RW Cox +*+ WARNING: Input dataset has 1 sub-brick ==> -tdiff is turned off +*+ WARNING: Input dataset is not 3D+time; assuming TR=1.0 +echo average errts FWHM blurs: 0 0 0 0 +average errts FWHM blurs: 0 0 0 0 +echo 0 0 0 0 # errts FWHM blur estimates +set blurs = ( `3dTstat -mean -prefix - blur.errts.1D'{1..$(2)}'\'` ) +3dTstat -mean -prefix - blur.errts.1D{1..$(2)}' +++ 3dTstat: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: KR Hammett & RW Cox +*+ WARNING: Input dataset has 1 sub-brick ==> -tdiff is turned off +*+ WARNING: Input dataset is not 3D+time; assuming TR=1.0 +echo average errts ACF blurs: 0.838314 3.62939 13.5545 9.21637 +average errts ACF blurs: 0.838314 3.62939 13.5545 9.21637 +echo 0.838314 3.62939 13.5545 9.21637 # errts ACF blur estimates +gen_epi_review.py -script @epi_review.sub_03 -dsets pb00.sub_03.r01.tcat+orig.HEAD +gen_ss_review_scripts.py -mot_limit 0.5 -exit0 +++ writing ss review basic: @ss_review_basic +++ writing ss review driver: @ss_review_driver +++ writing ss review drive commands: @ss_review_driver_commands +rm -f rm.DP+tlrc.BRIK rm.DP+tlrc.HEAD rm.epi.1.r01+tlrc.BRIK.gz rm.epi.1.r01+tlrc.HEAD rm.epi.all1+orig.BRIK.gz rm.epi.all1+orig.HEAD rm.epi.min.r01+tlrc.BRIK.gz rm.epi.min.r01+tlrc.HEAD rm.epi.nomask.r01+tlrc.BRIK rm.epi.nomask.r01+tlrc.HEAD rm.epi.volreg.r01+orig.BRIK rm.epi.volreg.r01+orig.HEAD rm.errts.unit+tlrc.BRIK rm.errts.unit+tlrc.HEAD rm.mask_r01+tlrc.BRIK.gz rm.mask_r01+tlrc.HEAD rm.mean_r01+tlrc.BRIK rm.mean_r01+tlrc.HEAD rm.noise.all+tlrc.BRIK rm.noise.all+tlrc.HEAD rm.resam.anat+tlrc.BRIK rm.resam.anat+tlrc.HEAD rm.resam.group+tlrc.BRIK rm.resam.group+tlrc.HEAD rm.signal.all+tlrc.BRIK rm.signal.all+tlrc.HEAD +tee out.ss_review.sub_03.txt +if ( -e @ss_review_basic ) ./@ss_review_basic +./@ss_review_basic + +subject ID : sub_03 +TRs removed (per run) : 1 +num stim classes provided : 5 +final anatomy dset : anat_final.sub_03+tlrc.HEAD +final stats dset : stats.sub_03+tlrc.HEAD +final voxel resolution : 4.000000 4.000000 4.000000 + +motion limit : 0.5 +num TRs above mot limit : 0 +average motion (per TR) : 0.0785451 +average censored motion : 0.0785451 +max motion displacement : 1.72403 +max censored displacement : 1.72403 +outlier limit : 0.1 +average outlier frac (TR) : 0.0019311 +num TRs above out limit : 0 + +num runs found : 1 +num TRs per run : 237 +num TRs per run (applied) : 237 +num TRs per run (censored): 0 +fraction censored per run : 0 +TRs total (uncensored) : 237 +TRs total : 237 +degrees of freedom used : 22 +degrees of freedom left : 215 + +TRs censored : 0 +censor fraction : 0.000000 +num regs of interest : 5 +num TRs per stim (orig) : 78 56 46 19 79 +num TRs censored per stim : 0 0 0 0 0 +fraction TRs censored : 0.000 0.000 0.000 0.000 0.000 +ave mot per sresp (orig) : 0.074047 0.073782 0.065246 0.067506 0.063698 +ave mot per sresp (cens) : 0.074047 0.073782 0.065246 0.067506 0.063698 + +TSNR average : 176.458 +global correlation (GCOR) : 0.0592107 +anat/EPI mask Dice coef : 0.882018 +maximum F-stat (masked) : 83.3662 +blur estimates (ACF) : 0.838314 3.62939 13.5545 +blur estimates (FWHM) : 0 0 0 + + +cd .. +echo execution finished: `date` +date +execution finished: Sat Aug 5 16:42:02 EDT 2017 diff --git a/hw2/Exp-2/subject_results/group.retest/subj.sub_03/proc.sub_03 b/hw2/Exp-2/subject_results/group.retest/subj.sub_03/proc.sub_03 new file mode 100755 index 0000000..c782fff --- /dev/null +++ b/hw2/Exp-2/subject_results/group.retest/subj.sub_03/proc.sub_03 @@ -0,0 +1,478 @@ +#!/bin/tcsh -xef + +echo "auto-generated by afni_proc.py, Sat Aug 5 16:37:42 2017" +echo "(version 5.15, April 25, 2017)" +echo "execution started: `date`" + +# execute via : +# tcsh -xef proc.sub_03 |& tee output.proc.sub_03 + +# =========================== auto block: setup ============================ +# script setup + +# take note of the AFNI version +afni -ver + +# check that the current AFNI version is recent enough +afni_history -check_date 23 Sep 2016 +if ( $status ) then + echo "** this script requires newer AFNI binaries (than 23 Sep 2016)" + echo " (consider: @update.afni.binaries -defaults)" + exit +endif + +# the user may specify a single subject to run with +if ( $#argv > 0 ) then + set subj = $argv[1] +else + set subj = sub_03 +endif + +# assign output directory name +set output_dir = $subj.results + +# verify that the results directory does not yet exist +if ( -d $output_dir ) then + echo output dir "$subj.results" already exists + exit +endif + +# set list of runs +set runs = (`count -digits 2 1 1`) + +# create results and stimuli directories +mkdir $output_dir +mkdir $output_dir/stimuli + +# copy stim files into stimulus directory +cp /Users/mli/Desktop/playground/timing_sub-03_ses-retest_Correct_Task.1D \ + /Users/mli/Desktop/playground/timing_sub-03_ses-retest_Incorrect_Task.1D \ + /Users/mli/Desktop/playground/timing_sub-03_ses-retest_No_Response_Control.1D \ + /Users/mli/Desktop/playground/timing_sub-03_ses-retest_No_Response_Task.1D \ + /Users/mli/Desktop/playground/timing_sub-03_ses-retest_Response_Control.1D \ + $output_dir/stimuli + +# copy anatomy to results dir +3dcopy \ + /Users/mli/Desktop/playground/sub-03/ses-retest/anat/sub-03_ses-retest_T1w.nii.gz \ + $output_dir/sub-03_ses-retest_T1w + +# ============================ auto block: tcat ============================ +# apply 3dTcat to copy input dsets to results dir, while +# removing the first 1 TRs +3dTcat -prefix $output_dir/pb00.$subj.r01.tcat \ + /Users/mli/Desktop/playground/sub-03/ses-retest/func/sub-03_ses-retest_task-linebisection_bold.nii.gz'[1..$]' + +# and make note of repetitions (TRs) per run +set tr_counts = ( 237 ) + +# ------------------------------------------------------- +# enter the results directory (can begin processing data) +cd $output_dir + + +# ========================== auto block: outcount ========================== +# data check: compute outlier fraction for each volume +touch out.pre_ss_warn.txt +foreach run ( $runs ) + 3dToutcount -automask -fraction -polort 4 -legendre \ + pb00.$subj.r$run.tcat+orig > outcount.r$run.1D + + # outliers at TR 0 might suggest pre-steady state TRs + if ( `1deval -a outcount.r$run.1D"{0}" -expr "step(a-0.4)"` ) then + echo "** TR #0 outliers: possible pre-steady state TRs in run $run" \ + >> out.pre_ss_warn.txt + endif +end + +# catenate outlier counts into a single time series +cat outcount.r*.1D > outcount_rall.1D + +# ================================= tshift ================================= +# time shift data so all slice timing is the same +foreach run ( $runs ) + 3dTshift -tzero 0 -quintic -prefix pb01.$subj.r$run.tshift \ + -tpattern alt+z \ + pb00.$subj.r$run.tcat+orig +end + +# -------------------------------- +# extract volreg registration base +3dbucket -prefix vr_base pb01.$subj.r01.tshift+orig"[2]" + +# ================================= align ================================== +# for e2a: compute anat alignment transformation to EPI registration base +# (new anat will be intermediate, stripped, sub-03_ses-retest_T1w_ns+orig) +align_epi_anat.py -anat2epi -anat sub-03_ses-retest_T1w+orig \ + -save_skullstrip -suffix _al_junk \ + -epi vr_base+orig -epi_base 0 \ + -epi_strip 3dAutomask \ + -volreg off -tshift off + +# ================================== tlrc ================================== +# warp anatomy to standard space +@auto_tlrc -base MNI_avg152T1+tlrc -input sub-03_ses-retest_T1w_ns+orig -no_ss + +# store forward transformation matrix in a text file +cat_matvec sub-03_ses-retest_T1w_ns+tlrc::WARP_DATA -I > warp.anat.Xat.1D + +# ================================= volreg ================================= +# align each dset to base volume, align to anat, warp to tlrc space + +# verify that we have a +tlrc warp dataset +if ( ! -f sub-03_ses-retest_T1w_ns+tlrc.HEAD ) then + echo "** missing +tlrc warp dataset: sub-03_ses-retest_T1w_ns+tlrc.HEAD" + exit +endif + +# register and warp +foreach run ( $runs ) + # register each volume to the base + 3dvolreg -verbose -zpad 1 -base vr_base+orig \ + -1Dfile dfile.r$run.1D -prefix rm.epi.volreg.r$run \ + -cubic \ + -1Dmatrix_save mat.r$run.vr.aff12.1D \ + pb01.$subj.r$run.tshift+orig + + # create an all-1 dataset to mask the extents of the warp + 3dcalc -overwrite -a pb01.$subj.r$run.tshift+orig -expr 1 \ + -prefix rm.epi.all1 + + # catenate volreg/epi2anat/tlrc xforms + cat_matvec -ONELINE \ + sub-03_ses-retest_T1w_ns+tlrc::WARP_DATA -I \ + sub-03_ses-retest_T1w_al_junk_mat.aff12.1D -I \ + mat.r$run.vr.aff12.1D > mat.r$run.warp.aff12.1D + + # apply catenated xform: volreg/epi2anat/tlrc + 3dAllineate -base sub-03_ses-retest_T1w_ns+tlrc \ + -input pb01.$subj.r$run.tshift+orig \ + -1Dmatrix_apply mat.r$run.warp.aff12.1D \ + -mast_dxyz 4 \ + -prefix rm.epi.nomask.r$run + + # warp the all-1 dataset for extents masking + 3dAllineate -base sub-03_ses-retest_T1w_ns+tlrc \ + -input rm.epi.all1+orig \ + -1Dmatrix_apply mat.r$run.warp.aff12.1D \ + -mast_dxyz 4 -final NN -quiet \ + -prefix rm.epi.1.r$run + + # make an extents intersection mask of this run + 3dTstat -min -prefix rm.epi.min.r$run rm.epi.1.r$run+tlrc +end + +# make a single file of registration params +cat dfile.r*.1D > dfile_rall.1D + +# ---------------------------------------- +# create the extents mask: mask_epi_extents+tlrc +# (this is a mask of voxels that have valid data at every TR) +# (only 1 run, so just use 3dcopy to keep naming straight) +3dcopy rm.epi.min.r01+tlrc mask_epi_extents + +# and apply the extents mask to the EPI data +# (delete any time series with missing data) +foreach run ( $runs ) + 3dcalc -a rm.epi.nomask.r$run+tlrc -b mask_epi_extents+tlrc \ + -expr 'a*b' -prefix pb02.$subj.r$run.volreg +end + +# warp the volreg base EPI dataset to make a final version +cat_matvec -ONELINE \ + sub-03_ses-retest_T1w_ns+tlrc::WARP_DATA -I \ + sub-03_ses-retest_T1w_al_junk_mat.aff12.1D -I > \ + mat.basewarp.aff12.1D + +3dAllineate -base sub-03_ses-retest_T1w_ns+tlrc \ + -input vr_base+orig \ + -1Dmatrix_apply mat.basewarp.aff12.1D \ + -mast_dxyz 4 \ + -prefix final_epi_vr_base + +# create an anat_final dataset, aligned with stats +3dcopy sub-03_ses-retest_T1w_ns+tlrc anat_final.$subj + +# record final registration costs +3dAllineate -base final_epi_vr_base+tlrc -allcostX \ + -input anat_final.$subj+tlrc |& tee out.allcostX.txt + +# ----------------------------------------- +# warp anat follower datasets (affine) +3dAllineate -source sub-03_ses-retest_T1w+orig \ + -master anat_final.$subj+tlrc \ + -final wsinc5 -1Dmatrix_apply warp.anat.Xat.1D \ + -prefix anat_w_skull_warped + +# ================================== blur ================================== +# blur each volume of each run +foreach run ( $runs ) + 3dmerge -1blur_fwhm 3.0 -doall -prefix pb03.$subj.r$run.blur \ + pb02.$subj.r$run.volreg+tlrc +end + +# ================================== mask ================================== +# create 'full_mask' dataset (union mask) +foreach run ( $runs ) + 3dAutomask -dilate 1 -prefix rm.mask_r$run pb03.$subj.r$run.blur+tlrc +end + +# create union of inputs, output type is byte +3dmask_tool -inputs rm.mask_r*+tlrc.HEAD -union -prefix full_mask.$subj + +# ---- create subject anatomy mask, mask_anat.$subj+tlrc ---- +# (resampled from tlrc anat) +3dresample -master full_mask.$subj+tlrc -input sub-03_ses-retest_T1w_ns+tlrc \ + -prefix rm.resam.anat + +# convert to binary anat mask; fill gaps and holes +3dmask_tool -dilate_input 5 -5 -fill_holes -input rm.resam.anat+tlrc \ + -prefix mask_anat.$subj + +# compute overlaps between anat and EPI masks +3dABoverlap -no_automask full_mask.$subj+tlrc mask_anat.$subj+tlrc \ + |& tee out.mask_ae_overlap.txt + +# note Dice coefficient of masks, as well +3ddot -dodice full_mask.$subj+tlrc mask_anat.$subj+tlrc \ + |& tee out.mask_ae_dice.txt + +# ---- create group anatomy mask, mask_group+tlrc ---- +# (resampled from tlrc base anat, MNI_avg152T1+tlrc) +3dresample -master full_mask.$subj+tlrc -prefix ./rm.resam.group \ + -input /Users/mli/abin/MNI_avg152T1+tlrc + +# convert to binary group mask; fill gaps and holes +3dmask_tool -dilate_input 5 -5 -fill_holes -input rm.resam.group+tlrc \ + -prefix mask_group + +# ================================= scale ================================== +# scale each voxel time series to have a mean of 100 +# (be sure no negatives creep in) +# (subject to a range of [0,200]) +foreach run ( $runs ) + 3dTstat -prefix rm.mean_r$run pb03.$subj.r$run.blur+tlrc + 3dcalc -a pb03.$subj.r$run.blur+tlrc -b rm.mean_r$run+tlrc \ + -c mask_epi_extents+tlrc \ + -expr 'c * min(200, a/b*100)*step(a)*step(b)' \ + -prefix pb04.$subj.r$run.scale +end + +# ================================ regress ================================= + +# compute de-meaned motion parameters (for use in regression) +1d_tool.py -infile dfile_rall.1D -set_nruns 1 \ + -demean -write motion_demean.1D + +# compute motion parameter derivatives (for use in regression) +1d_tool.py -infile dfile_rall.1D -set_nruns 1 \ + -derivative -demean -write motion_deriv.1D + +# create censor file motion_${subj}_censor.1D, for censoring motion +1d_tool.py -infile dfile_rall.1D -set_nruns 1 \ + -show_censor_count -censor_prev_TR \ + -censor_motion 0.5 motion_${subj} + +# note TRs that were not censored +set ktrs = `1d_tool.py -infile motion_${subj}_censor.1D \ + -show_trs_uncensored encoded` + +# ------------------------------ +# run the regression analysis +3dDeconvolve -input pb04.$subj.r*.scale+tlrc.HEAD \ + -censor motion_${subj}_censor.1D \ + -polort 4 \ + -num_stimts 17 \ + -stim_times 1 stimuli/timing_sub-03_ses-retest_Correct_Task.1D 'GAM' \ + -stim_label 1 Correct_Task \ + -stim_times 2 stimuli/timing_sub-03_ses-retest_Incorrect_Task.1D 'GAM' \ + -stim_label 2 Incorrect_Task \ + -stim_times 3 stimuli/timing_sub-03_ses-retest_No_Response_Control.1D \ + 'GAM' \ + -stim_label 3 No_Response_Control \ + -stim_times 4 stimuli/timing_sub-03_ses-retest_No_Response_Task.1D 'GAM' \ + -stim_label 4 No_Response_Task \ + -stim_times 5 stimuli/timing_sub-03_ses-retest_Response_Control.1D 'GAM' \ + -stim_label 5 Response_Control \ + -stim_file 6 motion_demean.1D'[0]' -stim_base 6 -stim_label 6 roll_01 \ + -stim_file 7 motion_demean.1D'[1]' -stim_base 7 -stim_label 7 pitch_01 \ + -stim_file 8 motion_demean.1D'[2]' -stim_base 8 -stim_label 8 yaw_01 \ + -stim_file 9 motion_demean.1D'[3]' -stim_base 9 -stim_label 9 dS_01 \ + -stim_file 10 motion_demean.1D'[4]' -stim_base 10 -stim_label 10 dL_01 \ + -stim_file 11 motion_demean.1D'[5]' -stim_base 11 -stim_label 11 dP_01 \ + -stim_file 12 motion_deriv.1D'[0]' -stim_base 12 -stim_label 12 roll_02 \ + -stim_file 13 motion_deriv.1D'[1]' -stim_base 13 -stim_label 13 pitch_02 \ + -stim_file 14 motion_deriv.1D'[2]' -stim_base 14 -stim_label 14 yaw_02 \ + -stim_file 15 motion_deriv.1D'[3]' -stim_base 15 -stim_label 15 dS_02 \ + -stim_file 16 motion_deriv.1D'[4]' -stim_base 16 -stim_label 16 dL_02 \ + -stim_file 17 motion_deriv.1D'[5]' -stim_base 17 -stim_label 17 dP_02 \ + -gltsym 'SYM: 0.5*Correct_Task +0.5*Incorrect_Task -Response_Control' \ + -glt_label 1 Landmark-Detection \ + -fout -tout -x1D X.xmat.1D -xjpeg X.jpg \ + -x1D_uncensored X.nocensor.xmat.1D \ + -fitts fitts.$subj \ + -errts errts.${subj} \ + -bucket stats.$subj + + +# if 3dDeconvolve fails, terminate the script +if ( $status != 0 ) then + echo '---------------------------------------' + echo '** 3dDeconvolve error, failing...' + echo ' (consider the file 3dDeconvolve.err)' + exit +endif + + +# display any large pairwise correlations from the X-matrix +1d_tool.py -show_cormat_warnings -infile X.xmat.1D |& tee out.cormat_warn.txt + +# create an all_runs dataset to match the fitts, errts, etc. +3dTcat -prefix all_runs.$subj pb04.$subj.r*.scale+tlrc.HEAD + +# -------------------------------------------------- +# create a temporal signal to noise ratio dataset +# signal: if 'scale' block, mean should be 100 +# noise : compute standard deviation of errts +3dTstat -mean -prefix rm.signal.all all_runs.$subj+tlrc"[$ktrs]" +3dTstat -stdev -prefix rm.noise.all errts.${subj}+tlrc"[$ktrs]" +3dcalc -a rm.signal.all+tlrc \ + -b rm.noise.all+tlrc \ + -c full_mask.$subj+tlrc \ + -expr 'c*a/b' -prefix TSNR.$subj + +# --------------------------------------------------- +# compute and store GCOR (global correlation average) +# (sum of squares of global mean of unit errts) +3dTnorm -norm2 -prefix rm.errts.unit errts.${subj}+tlrc +3dmaskave -quiet -mask full_mask.$subj+tlrc rm.errts.unit+tlrc \ + > gmean.errts.unit.1D +3dTstat -sos -prefix - gmean.errts.unit.1D\' > out.gcor.1D +echo "-- GCOR = `cat out.gcor.1D`" + +# --------------------------------------------------- +# compute correlation volume +# (per voxel: average correlation across masked brain) +# (now just dot product with average unit time series) +3dcalc -a rm.errts.unit+tlrc -b gmean.errts.unit.1D -expr 'a*b' -prefix rm.DP +3dTstat -sum -prefix corr_brain rm.DP+tlrc + +# create ideal files for fixed response stim types +1dcat X.nocensor.xmat.1D'[5]' > ideal_Correct_Task.1D +1dcat X.nocensor.xmat.1D'[6]' > ideal_Incorrect_Task.1D +1dcat X.nocensor.xmat.1D'[7]' > ideal_No_Response_Control.1D +1dcat X.nocensor.xmat.1D'[8]' > ideal_No_Response_Task.1D +1dcat X.nocensor.xmat.1D'[9]' > ideal_Response_Control.1D + +# -------------------------------------------------------- +# compute sum of non-baseline regressors from the X-matrix +# (use 1d_tool.py to get list of regressor colums) +set reg_cols = `1d_tool.py -infile X.nocensor.xmat.1D -show_indices_interest` +3dTstat -sum -prefix sum_ideal.1D X.nocensor.xmat.1D"[$reg_cols]" + +# also, create a stimulus-only X-matrix, for easy review +1dcat X.nocensor.xmat.1D"[$reg_cols]" > X.stim.xmat.1D + +# ============================ blur estimation ============================= +# compute blur estimates +touch blur_est.$subj.1D # start with empty file + +# create directory for ACF curve files +mkdir files_ACF + +# -- estimate blur for each run in epits -- +touch blur.epits.1D + +# restrict to uncensored TRs, per run +foreach run ( $runs ) + set trs = `1d_tool.py -infile X.xmat.1D -show_trs_uncensored encoded \ + -show_trs_run $run` + if ( $trs == "" ) continue + 3dFWHMx -detrend -mask full_mask.$subj+tlrc \ + -ACF files_ACF/out.3dFWHMx.ACF.epits.r$run.1D \ + all_runs.$subj+tlrc"[$trs]" >> blur.epits.1D +end + +# compute average FWHM blur (from every other row) and append +set blurs = ( `3dTstat -mean -prefix - blur.epits.1D'{0..$(2)}'\'` ) +echo average epits FWHM blurs: $blurs +echo "$blurs # epits FWHM blur estimates" >> blur_est.$subj.1D + +# compute average ACF blur (from every other row) and append +set blurs = ( `3dTstat -mean -prefix - blur.epits.1D'{1..$(2)}'\'` ) +echo average epits ACF blurs: $blurs +echo "$blurs # epits ACF blur estimates" >> blur_est.$subj.1D + +# -- estimate blur for each run in errts -- +touch blur.errts.1D + +# restrict to uncensored TRs, per run +foreach run ( $runs ) + set trs = `1d_tool.py -infile X.xmat.1D -show_trs_uncensored encoded \ + -show_trs_run $run` + if ( $trs == "" ) continue + 3dFWHMx -detrend -mask full_mask.$subj+tlrc \ + -ACF files_ACF/out.3dFWHMx.ACF.errts.r$run.1D \ + errts.${subj}+tlrc"[$trs]" >> blur.errts.1D +end + +# compute average FWHM blur (from every other row) and append +set blurs = ( `3dTstat -mean -prefix - blur.errts.1D'{0..$(2)}'\'` ) +echo average errts FWHM blurs: $blurs +echo "$blurs # errts FWHM blur estimates" >> blur_est.$subj.1D + +# compute average ACF blur (from every other row) and append +set blurs = ( `3dTstat -mean -prefix - blur.errts.1D'{1..$(2)}'\'` ) +echo average errts ACF blurs: $blurs +echo "$blurs # errts ACF blur estimates" >> blur_est.$subj.1D + + +# ================== auto block: generate review scripts =================== + +# generate a review script for the unprocessed EPI data +gen_epi_review.py -script @epi_review.$subj \ + -dsets pb00.$subj.r*.tcat+orig.HEAD + +# generate scripts to review single subject results +# (try with defaults, but do not allow bad exit status) +gen_ss_review_scripts.py -mot_limit 0.5 -exit0 + +# ========================== auto block: finalize ========================== + +# remove temporary files +\rm -f rm.* + +# if the basic subject review script is here, run it +# (want this to be the last text output) +if ( -e @ss_review_basic ) ./@ss_review_basic |& tee out.ss_review.$subj.txt + +# return to parent directory +cd .. + +echo "execution finished: `date`" + + + + +# ========================================================================== +# script generated by the command: +# +# afni_proc.py -subj_id sub_03 -script proc.sub_03 -scr_overwrite -blocks \ +# tshift align tlrc volreg blur mask scale regress -copy_anat \ +# /Users/mli/Desktop/playground/sub-03/ses-retest/anat/sub-03_ses-retest_T1w.nii.gz \ +# -tcat_remove_first_trs 1 -tshift_opts_ts -tpattern alt+z -dsets \ +# /Users/mli/Desktop/playground/sub-03/ses-retest/func/sub-03_ses-retest_task-linebisection_bold.nii.gz \ +# -tlrc_base MNI_avg152T1+tlrc -volreg_align_to third -volreg_align_e2a \ +# -volreg_tlrc_warp -blur_size 3.0 -regress_stim_times \ +# /Users/mli/Desktop/playground/timing_sub-03_ses-retest_Correct_Task.1D \ +# /Users/mli/Desktop/playground/timing_sub-03_ses-retest_Incorrect_Task.1D \ +# /Users/mli/Desktop/playground/timing_sub-03_ses-retest_No_Response_Control.1D \ +# /Users/mli/Desktop/playground/timing_sub-03_ses-retest_No_Response_Task.1D \ +# /Users/mli/Desktop/playground/timing_sub-03_ses-retest_Response_Control.1D \ +# -regress_stim_labels Correct_Task Incorrect_Task No_Response_Control \ +# No_Response_Task Response_Control -regress_basis GAM \ +# -regress_censor_motion 0.5 -regress_apply_mot_types demean deriv \ +# -regress_opts_3dD -gltsym 'SYM: 0.5*Correct_Task +0.5*Incorrect_Task \ +# -Response_Control' -glt_label 1 Landmark-Detection \ +# -regress_make_ideal_sum sum_ideal.1D -regress_est_blur_epits \ +# -regress_est_blur_errts -regress_run_clustsim no diff --git a/hw2/Exp-2/subject_results/group.test/subj.sub_03/.orig.cmd.ap.sub_03 b/hw2/Exp-2/subject_results/group.test/subj.sub_03/.orig.cmd.ap.sub_03 new file mode 100755 index 0000000..70784fa --- /dev/null +++ b/hw2/Exp-2/subject_results/group.test/subj.sub_03/.orig.cmd.ap.sub_03 @@ -0,0 +1,48 @@ +#!/usr/bin/env tcsh + +# created by uber_subject.py: version 0.40 (March 30, 2017) +# creation date: Thu Aug 3 22:01:15 2017 + +# set data directories +set top_dir = /Users/monicali/Google-Drive/IBRAIN/playground +set anat_dir = $top_dir/sub-03/ses-test/anat +set epi_dir = $top_dir/sub-03/ses-test/func + +# set subject and group identifiers +set subj = sub_03 +set group_id = test + +# run afni_proc.py to create a single subject processing script +afni_proc.py -subj_id $subj \ + -script proc.$subj -scr_overwrite \ + -blocks tshift align tlrc volreg blur mask scale regress \ + -copy_anat $anat_dir/sub-03_ses-test_T1w.nii.gz \ + -tcat_remove_first_trs 0 \ + -dsets $epi_dir/sub-03_ses-test_task-linebisection_bold.nii.gz \ + -tlrc_base MNI_avg152T1+tlrc \ + -volreg_align_to third \ + -volreg_align_e2a \ + -volreg_tlrc_warp \ + -blur_size 6.0 \ + -regress_stim_times \ + $top_dir/timing_sub-03_ses-test_Correct_Task.1D \ + $top_dir/timing_sub-03_ses-test_Incorrect_Task.1D \ + $top_dir/timing_sub-03_ses-test_No_Response_Control.1D \ + $top_dir/timing_sub-03_ses-test_No_Response_Task.1D \ + $top_dir/timing_sub-03_ses-test_Response_Control.1D \ + -regress_stim_labels \ + Correct_Task Incorrect_Task No_Response_Control No_Response_Task \ + Response_Control \ + -regress_basis 'GAM' \ + -regress_censor_motion 0.3 \ + -regress_censor_outliers 0.5 \ + -regress_apply_mot_types demean deriv \ + -regress_opts_3dD \ + -gltsym 'SYM: 0.333*Correct_Task +0.333*Incorrect_Task \ + +0.333*No_Response_Task -0.5*Response_Control \ + -0.5*No_Response_Control' -glt_label 1 Landmark-Detection \ + -regress_make_ideal_sum sum_ideal.1D \ + -regress_est_blur_epits \ + -regress_est_blur_errts \ + -regress_run_clustsim no + diff --git a/hw2/Exp-2/subject_results/group.test/subj.sub_03/.orig.cmd.usubj.sub_03 b/hw2/Exp-2/subject_results/group.test/subj.sub_03/.orig.cmd.usubj.sub_03 new file mode 100644 index 0000000..8b80dbd --- /dev/null +++ b/hw2/Exp-2/subject_results/group.test/subj.sub_03/.orig.cmd.usubj.sub_03 @@ -0,0 +1,29 @@ +uber_subject.py \ + -cvar subj_dir subject_results/group.test/subj.sub_03 \ + -svar anat \ + /Users/monicali/Google-Drive/IBRAIN/playground/sub-03/ses-test/anat/sub-03_ses-test_T1w.nii.gz \ + \ + -svar blur_size 6.0 \ + -svar epi \ + /Users/monicali/Google-Drive/IBRAIN/playground/sub-03/ses-test/func/sub-03_ses-test_task-linebisection_bold.nii.gz \ + \ + -svar gid test \ + -svar gltsym '0.333*Correct_Task +0.333*Incorrect_Task \ + +0.333*No_Response_Task -0.5*Response_Control -0.5*No_Response_Control' \ + -svar gltsym_label Landmark-Detection \ + -svar outlier_limit 0.5 \ + -svar regress_mot_deriv yes \ + -svar run_clustsim no \ + -svar sid sub_03 \ + -svar stim \ + /Users/monicali/Google-Drive/IBRAIN/playground/timing_sub-03_ses-test_Correct_Task.1D \ + /Users/monicali/Google-Drive/IBRAIN/playground/timing_sub-03_ses-test_Incorrect_Task.1D \ + /Users/monicali/Google-Drive/IBRAIN/playground/timing_sub-03_ses-test_No_Response_Control.1D \ + /Users/monicali/Google-Drive/IBRAIN/playground/timing_sub-03_ses-test_No_Response_Task.1D \ + /Users/monicali/Google-Drive/IBRAIN/playground/timing_sub-03_ses-test_Response_Control.1D \ + \ + -svar stim_basis 'GAM' 'GAM' 'GAM' 'GAM' 'GAM' \ + -svar stim_label Correct_Task Incorrect_Task No_Response_Control \ + No_Response_Task Response_Control \ + -svar stim_type times times times times times \ + -svar tlrc_base MNI_avg152T1+tlrc diff --git a/hw2/Exp-2/subject_results/group.test/subj.sub_03/.orig.proc.sub_03 b/hw2/Exp-2/subject_results/group.test/subj.sub_03/.orig.proc.sub_03 new file mode 100755 index 0000000..bb99a95 --- /dev/null +++ b/hw2/Exp-2/subject_results/group.test/subj.sub_03/.orig.proc.sub_03 @@ -0,0 +1,491 @@ +#!/bin/tcsh -xef + +echo "auto-generated by afni_proc.py, Thu Aug 3 22:01:23 2017" +echo "(version 5.15, April 25, 2017)" +echo "execution started: `date`" + +# execute via : +# tcsh -xef proc.sub_03 |& tee output.proc.sub_03 + +# =========================== auto block: setup ============================ +# script setup + +# take note of the AFNI version +afni -ver + +# check that the current AFNI version is recent enough +afni_history -check_date 23 Sep 2016 +if ( $status ) then + echo "** this script requires newer AFNI binaries (than 23 Sep 2016)" + echo " (consider: @update.afni.binaries -defaults)" + exit +endif + +# the user may specify a single subject to run with +if ( $#argv > 0 ) then + set subj = $argv[1] +else + set subj = sub_03 +endif + +# assign output directory name +set output_dir = $subj.results + +# verify that the results directory does not yet exist +if ( -d $output_dir ) then + echo output dir "$subj.results" already exists + exit +endif + +# set list of runs +set runs = (`count -digits 2 1 1`) + +# create results and stimuli directories +mkdir $output_dir +mkdir $output_dir/stimuli + +# copy stim files into stimulus directory +cp \ + /Users/monicali/Google-Drive/IBRAIN/playground/timing_sub-03_ses-test_Correct_Task.1D \ + /Users/monicali/Google-Drive/IBRAIN/playground/timing_sub-03_ses-test_Incorrect_Task.1D \ + /Users/monicali/Google-Drive/IBRAIN/playground/timing_sub-03_ses-test_No_Response_Control.1D \ + /Users/monicali/Google-Drive/IBRAIN/playground/timing_sub-03_ses-test_No_Response_Task.1D \ + /Users/monicali/Google-Drive/IBRAIN/playground/timing_sub-03_ses-test_Response_Control.1D \ + $output_dir/stimuli + +# copy anatomy to results dir +3dcopy \ + /Users/monicali/Google-Drive/IBRAIN/playground/sub-03/ses-test/anat/sub-03_ses-test_T1w.nii.gz \ + $output_dir/sub-03_ses-test_T1w + +# ============================ auto block: tcat ============================ +# apply 3dTcat to copy input dsets to results dir, while +# removing the first 0 TRs +3dTcat -prefix $output_dir/pb00.$subj.r01.tcat \ + /Users/monicali/Google-Drive/IBRAIN/playground/sub-03/ses-test/func/sub-03_ses-test_task-linebisection_bold.nii.gz'[0..$]' + +# and make note of repetitions (TRs) per run +set tr_counts = ( 238 ) + +# ------------------------------------------------------- +# enter the results directory (can begin processing data) +cd $output_dir + + +# ========================== auto block: outcount ========================== +# data check: compute outlier fraction for each volume +touch out.pre_ss_warn.txt +foreach run ( $runs ) + 3dToutcount -automask -fraction -polort 4 -legendre \ + pb00.$subj.r$run.tcat+orig > outcount.r$run.1D + + # censor outlier TRs per run, ignoring the first 0 TRs + # - censor when more than 0.5 of automask voxels are outliers + # - step() defines which TRs to remove via censoring + 1deval -a outcount.r$run.1D -expr "1-step(a-0.5)" > rm.out.cen.r$run.1D + + # outliers at TR 0 might suggest pre-steady state TRs + if ( `1deval -a outcount.r$run.1D"{0}" -expr "step(a-0.4)"` ) then + echo "** TR #0 outliers: possible pre-steady state TRs in run $run" \ + >> out.pre_ss_warn.txt + endif +end + +# catenate outlier counts into a single time series +cat outcount.r*.1D > outcount_rall.1D + +# catenate outlier censor files into a single time series +cat rm.out.cen.r*.1D > outcount_${subj}_censor.1D + +# ================================= tshift ================================= +# time shift data so all slice timing is the same +foreach run ( $runs ) + 3dTshift -tzero 0 -quintic -prefix pb01.$subj.r$run.tshift \ + pb00.$subj.r$run.tcat+orig +end + +# -------------------------------- +# extract volreg registration base +3dbucket -prefix vr_base pb01.$subj.r01.tshift+orig"[2]" + +# ================================= align ================================== +# for e2a: compute anat alignment transformation to EPI registration base +# (new anat will be intermediate, stripped, sub-03_ses-test_T1w_ns+orig) +align_epi_anat.py -anat2epi -anat sub-03_ses-test_T1w+orig \ + -save_skullstrip -suffix _al_junk \ + -epi vr_base+orig -epi_base 0 \ + -epi_strip 3dAutomask \ + -volreg off -tshift off + +# ================================== tlrc ================================== +# warp anatomy to standard space +@auto_tlrc -base MNI_avg152T1+tlrc -input sub-03_ses-test_T1w_ns+orig -no_ss + +# store forward transformation matrix in a text file +cat_matvec sub-03_ses-test_T1w_ns+tlrc::WARP_DATA -I > warp.anat.Xat.1D + +# ================================= volreg ================================= +# align each dset to base volume, align to anat, warp to tlrc space + +# verify that we have a +tlrc warp dataset +if ( ! -f sub-03_ses-test_T1w_ns+tlrc.HEAD ) then + echo "** missing +tlrc warp dataset: sub-03_ses-test_T1w_ns+tlrc.HEAD" + exit +endif + +# register and warp +foreach run ( $runs ) + # register each volume to the base + 3dvolreg -verbose -zpad 1 -base vr_base+orig \ + -1Dfile dfile.r$run.1D -prefix rm.epi.volreg.r$run \ + -cubic \ + -1Dmatrix_save mat.r$run.vr.aff12.1D \ + pb01.$subj.r$run.tshift+orig + + # create an all-1 dataset to mask the extents of the warp + 3dcalc -overwrite -a pb01.$subj.r$run.tshift+orig -expr 1 \ + -prefix rm.epi.all1 + + # catenate volreg/epi2anat/tlrc xforms + cat_matvec -ONELINE \ + sub-03_ses-test_T1w_ns+tlrc::WARP_DATA -I \ + sub-03_ses-test_T1w_al_junk_mat.aff12.1D -I \ + mat.r$run.vr.aff12.1D > mat.r$run.warp.aff12.1D + + # apply catenated xform: volreg/epi2anat/tlrc + 3dAllineate -base sub-03_ses-test_T1w_ns+tlrc \ + -input pb01.$subj.r$run.tshift+orig \ + -1Dmatrix_apply mat.r$run.warp.aff12.1D \ + -mast_dxyz 4 \ + -prefix rm.epi.nomask.r$run + + # warp the all-1 dataset for extents masking + 3dAllineate -base sub-03_ses-test_T1w_ns+tlrc \ + -input rm.epi.all1+orig \ + -1Dmatrix_apply mat.r$run.warp.aff12.1D \ + -mast_dxyz 4 -final NN -quiet \ + -prefix rm.epi.1.r$run + + # make an extents intersection mask of this run + 3dTstat -min -prefix rm.epi.min.r$run rm.epi.1.r$run+tlrc +end + +# make a single file of registration params +cat dfile.r*.1D > dfile_rall.1D + +# ---------------------------------------- +# create the extents mask: mask_epi_extents+tlrc +# (this is a mask of voxels that have valid data at every TR) +# (only 1 run, so just use 3dcopy to keep naming straight) +3dcopy rm.epi.min.r01+tlrc mask_epi_extents + +# and apply the extents mask to the EPI data +# (delete any time series with missing data) +foreach run ( $runs ) + 3dcalc -a rm.epi.nomask.r$run+tlrc -b mask_epi_extents+tlrc \ + -expr 'a*b' -prefix pb02.$subj.r$run.volreg +end + +# warp the volreg base EPI dataset to make a final version +cat_matvec -ONELINE \ + sub-03_ses-test_T1w_ns+tlrc::WARP_DATA -I \ + sub-03_ses-test_T1w_al_junk_mat.aff12.1D -I > \ + mat.basewarp.aff12.1D + +3dAllineate -base sub-03_ses-test_T1w_ns+tlrc \ + -input vr_base+orig \ + -1Dmatrix_apply mat.basewarp.aff12.1D \ + -mast_dxyz 4 \ + -prefix final_epi_vr_base + +# create an anat_final dataset, aligned with stats +3dcopy sub-03_ses-test_T1w_ns+tlrc anat_final.$subj + +# record final registration costs +3dAllineate -base final_epi_vr_base+tlrc -allcostX \ + -input anat_final.$subj+tlrc |& tee out.allcostX.txt + +# ----------------------------------------- +# warp anat follower datasets (affine) +3dAllineate -source sub-03_ses-test_T1w+orig \ + -master anat_final.$subj+tlrc \ + -final wsinc5 -1Dmatrix_apply warp.anat.Xat.1D \ + -prefix anat_w_skull_warped + +# ================================== blur ================================== +# blur each volume of each run +foreach run ( $runs ) + 3dmerge -1blur_fwhm 6.0 -doall -prefix pb03.$subj.r$run.blur \ + pb02.$subj.r$run.volreg+tlrc +end + +# ================================== mask ================================== +# create 'full_mask' dataset (union mask) +foreach run ( $runs ) + 3dAutomask -dilate 1 -prefix rm.mask_r$run pb03.$subj.r$run.blur+tlrc +end + +# create union of inputs, output type is byte +3dmask_tool -inputs rm.mask_r*+tlrc.HEAD -union -prefix full_mask.$subj + +# ---- create subject anatomy mask, mask_anat.$subj+tlrc ---- +# (resampled from tlrc anat) +3dresample -master full_mask.$subj+tlrc -input sub-03_ses-test_T1w_ns+tlrc \ + -prefix rm.resam.anat + +# convert to binary anat mask; fill gaps and holes +3dmask_tool -dilate_input 5 -5 -fill_holes -input rm.resam.anat+tlrc \ + -prefix mask_anat.$subj + +# compute overlaps between anat and EPI masks +3dABoverlap -no_automask full_mask.$subj+tlrc mask_anat.$subj+tlrc \ + |& tee out.mask_ae_overlap.txt + +# note Dice coefficient of masks, as well +3ddot -dodice full_mask.$subj+tlrc mask_anat.$subj+tlrc \ + |& tee out.mask_ae_dice.txt + +# ---- create group anatomy mask, mask_group+tlrc ---- +# (resampled from tlrc base anat, MNI_avg152T1+tlrc) +3dresample -master full_mask.$subj+tlrc -prefix ./rm.resam.group \ + -input /Users/monicali/abin/MNI_avg152T1+tlrc + +# convert to binary group mask; fill gaps and holes +3dmask_tool -dilate_input 5 -5 -fill_holes -input rm.resam.group+tlrc \ + -prefix mask_group + +# ================================= scale ================================== +# scale each voxel time series to have a mean of 100 +# (be sure no negatives creep in) +# (subject to a range of [0,200]) +foreach run ( $runs ) + 3dTstat -prefix rm.mean_r$run pb03.$subj.r$run.blur+tlrc + 3dcalc -a pb03.$subj.r$run.blur+tlrc -b rm.mean_r$run+tlrc \ + -c mask_epi_extents+tlrc \ + -expr 'c * min(200, a/b*100)*step(a)*step(b)' \ + -prefix pb04.$subj.r$run.scale +end + +# ================================ regress ================================= + +# compute de-meaned motion parameters (for use in regression) +1d_tool.py -infile dfile_rall.1D -set_nruns 1 \ + -demean -write motion_demean.1D + +# compute motion parameter derivatives (for use in regression) +1d_tool.py -infile dfile_rall.1D -set_nruns 1 \ + -derivative -demean -write motion_deriv.1D + +# create censor file motion_${subj}_censor.1D, for censoring motion +1d_tool.py -infile dfile_rall.1D -set_nruns 1 \ + -show_censor_count -censor_prev_TR \ + -censor_motion 0.3 motion_${subj} + +# combine multiple censor files +1deval -a motion_${subj}_censor.1D -b outcount_${subj}_censor.1D \ + -expr "a*b" > censor_${subj}_combined_2.1D + +# note TRs that were not censored +set ktrs = `1d_tool.py -infile censor_${subj}_combined_2.1D \ + -show_trs_uncensored encoded` + +# ------------------------------ +# run the regression analysis +3dDeconvolve -input pb04.$subj.r*.scale+tlrc.HEAD \ + -censor censor_${subj}_combined_2.1D \ + -polort 4 \ + -num_stimts 17 \ + -stim_times 1 stimuli/timing_sub-03_ses-test_Correct_Task.1D 'GAM' \ + -stim_label 1 Correct_Task \ + -stim_times 2 stimuli/timing_sub-03_ses-test_Incorrect_Task.1D 'GAM' \ + -stim_label 2 Incorrect_Task \ + -stim_times 3 stimuli/timing_sub-03_ses-test_No_Response_Control.1D 'GAM' \ + -stim_label 3 No_Response_Control \ + -stim_times 4 stimuli/timing_sub-03_ses-test_No_Response_Task.1D 'GAM' \ + -stim_label 4 No_Response_Task \ + -stim_times 5 stimuli/timing_sub-03_ses-test_Response_Control.1D 'GAM' \ + -stim_label 5 Response_Control \ + -stim_file 6 motion_demean.1D'[0]' -stim_base 6 -stim_label 6 roll_01 \ + -stim_file 7 motion_demean.1D'[1]' -stim_base 7 -stim_label 7 pitch_01 \ + -stim_file 8 motion_demean.1D'[2]' -stim_base 8 -stim_label 8 yaw_01 \ + -stim_file 9 motion_demean.1D'[3]' -stim_base 9 -stim_label 9 dS_01 \ + -stim_file 10 motion_demean.1D'[4]' -stim_base 10 -stim_label 10 dL_01 \ + -stim_file 11 motion_demean.1D'[5]' -stim_base 11 -stim_label 11 dP_01 \ + -stim_file 12 motion_deriv.1D'[0]' -stim_base 12 -stim_label 12 roll_02 \ + -stim_file 13 motion_deriv.1D'[1]' -stim_base 13 -stim_label 13 pitch_02 \ + -stim_file 14 motion_deriv.1D'[2]' -stim_base 14 -stim_label 14 yaw_02 \ + -stim_file 15 motion_deriv.1D'[3]' -stim_base 15 -stim_label 15 dS_02 \ + -stim_file 16 motion_deriv.1D'[4]' -stim_base 16 -stim_label 16 dL_02 \ + -stim_file 17 motion_deriv.1D'[5]' -stim_base 17 -stim_label 17 dP_02 \ + -gltsym 'SYM: 0.333*Correct_Task +0.333*Incorrect_Task \ + +0.333*No_Response_Task -0.5*Response_Control -0.5*No_Response_Control' \ + -glt_label 1 Landmark-Detection \ + -fout -tout -x1D X.xmat.1D -xjpeg X.jpg \ + -x1D_uncensored X.nocensor.xmat.1D \ + -fitts fitts.$subj \ + -errts errts.${subj} \ + -bucket stats.$subj + + +# if 3dDeconvolve fails, terminate the script +if ( $status != 0 ) then + echo '---------------------------------------' + echo '** 3dDeconvolve error, failing...' + echo ' (consider the file 3dDeconvolve.err)' + exit +endif + + +# display any large pairwise correlations from the X-matrix +1d_tool.py -show_cormat_warnings -infile X.xmat.1D |& tee out.cormat_warn.txt + +# create an all_runs dataset to match the fitts, errts, etc. +3dTcat -prefix all_runs.$subj pb04.$subj.r*.scale+tlrc.HEAD + +# -------------------------------------------------- +# create a temporal signal to noise ratio dataset +# signal: if 'scale' block, mean should be 100 +# noise : compute standard deviation of errts +3dTstat -mean -prefix rm.signal.all all_runs.$subj+tlrc"[$ktrs]" +3dTstat -stdev -prefix rm.noise.all errts.${subj}+tlrc"[$ktrs]" +3dcalc -a rm.signal.all+tlrc \ + -b rm.noise.all+tlrc \ + -c full_mask.$subj+tlrc \ + -expr 'c*a/b' -prefix TSNR.$subj + +# --------------------------------------------------- +# compute and store GCOR (global correlation average) +# (sum of squares of global mean of unit errts) +3dTnorm -norm2 -prefix rm.errts.unit errts.${subj}+tlrc +3dmaskave -quiet -mask full_mask.$subj+tlrc rm.errts.unit+tlrc \ + > gmean.errts.unit.1D +3dTstat -sos -prefix - gmean.errts.unit.1D\' > out.gcor.1D +echo "-- GCOR = `cat out.gcor.1D`" + +# --------------------------------------------------- +# compute correlation volume +# (per voxel: average correlation across masked brain) +# (now just dot product with average unit time series) +3dcalc -a rm.errts.unit+tlrc -b gmean.errts.unit.1D -expr 'a*b' -prefix rm.DP +3dTstat -sum -prefix corr_brain rm.DP+tlrc + +# create ideal files for fixed response stim types +1dcat X.nocensor.xmat.1D'[5]' > ideal_Correct_Task.1D +1dcat X.nocensor.xmat.1D'[6]' > ideal_Incorrect_Task.1D +1dcat X.nocensor.xmat.1D'[7]' > ideal_No_Response_Control.1D +1dcat X.nocensor.xmat.1D'[8]' > ideal_No_Response_Task.1D +1dcat X.nocensor.xmat.1D'[9]' > ideal_Response_Control.1D + +# -------------------------------------------------------- +# compute sum of non-baseline regressors from the X-matrix +# (use 1d_tool.py to get list of regressor colums) +set reg_cols = `1d_tool.py -infile X.nocensor.xmat.1D -show_indices_interest` +3dTstat -sum -prefix sum_ideal.1D X.nocensor.xmat.1D"[$reg_cols]" + +# also, create a stimulus-only X-matrix, for easy review +1dcat X.nocensor.xmat.1D"[$reg_cols]" > X.stim.xmat.1D + +# ============================ blur estimation ============================= +# compute blur estimates +touch blur_est.$subj.1D # start with empty file + +# create directory for ACF curve files +mkdir files_ACF + +# -- estimate blur for each run in epits -- +touch blur.epits.1D + +# restrict to uncensored TRs, per run +foreach run ( $runs ) + set trs = `1d_tool.py -infile X.xmat.1D -show_trs_uncensored encoded \ + -show_trs_run $run` + if ( $trs == "" ) continue + 3dFWHMx -detrend -mask full_mask.$subj+tlrc \ + -ACF files_ACF/out.3dFWHMx.ACF.epits.r$run.1D \ + all_runs.$subj+tlrc"[$trs]" >> blur.epits.1D +end + +# compute average FWHM blur (from every other row) and append +set blurs = ( `3dTstat -mean -prefix - blur.epits.1D'{0..$(2)}'\'` ) +echo average epits FWHM blurs: $blurs +echo "$blurs # epits FWHM blur estimates" >> blur_est.$subj.1D + +# compute average ACF blur (from every other row) and append +set blurs = ( `3dTstat -mean -prefix - blur.epits.1D'{1..$(2)}'\'` ) +echo average epits ACF blurs: $blurs +echo "$blurs # epits ACF blur estimates" >> blur_est.$subj.1D + +# -- estimate blur for each run in errts -- +touch blur.errts.1D + +# restrict to uncensored TRs, per run +foreach run ( $runs ) + set trs = `1d_tool.py -infile X.xmat.1D -show_trs_uncensored encoded \ + -show_trs_run $run` + if ( $trs == "" ) continue + 3dFWHMx -detrend -mask full_mask.$subj+tlrc \ + -ACF files_ACF/out.3dFWHMx.ACF.errts.r$run.1D \ + errts.${subj}+tlrc"[$trs]" >> blur.errts.1D +end + +# compute average FWHM blur (from every other row) and append +set blurs = ( `3dTstat -mean -prefix - blur.errts.1D'{0..$(2)}'\'` ) +echo average errts FWHM blurs: $blurs +echo "$blurs # errts FWHM blur estimates" >> blur_est.$subj.1D + +# compute average ACF blur (from every other row) and append +set blurs = ( `3dTstat -mean -prefix - blur.errts.1D'{1..$(2)}'\'` ) +echo average errts ACF blurs: $blurs +echo "$blurs # errts ACF blur estimates" >> blur_est.$subj.1D + + +# ================== auto block: generate review scripts =================== + +# generate a review script for the unprocessed EPI data +gen_epi_review.py -script @epi_review.$subj \ + -dsets pb00.$subj.r*.tcat+orig.HEAD + +# generate scripts to review single subject results +# (try with defaults, but do not allow bad exit status) +gen_ss_review_scripts.py -mot_limit 0.3 -out_limit 0.5 -exit0 + +# ========================== auto block: finalize ========================== + +# remove temporary files +\rm -f rm.* + +# if the basic subject review script is here, run it +# (want this to be the last text output) +if ( -e @ss_review_basic ) ./@ss_review_basic |& tee out.ss_review.$subj.txt + +# return to parent directory +cd .. + +echo "execution finished: `date`" + + + + +# ========================================================================== +# script generated by the command: +# +# afni_proc.py -subj_id sub_03 -script proc.sub_03 -scr_overwrite -blocks \ +# tshift align tlrc volreg blur mask scale regress -copy_anat \ +# /Users/monicali/Google-Drive/IBRAIN/playground/sub-03/ses-test/anat/sub-03_ses-test_T1w.nii.gz \ +# -tcat_remove_first_trs 0 -dsets \ +# /Users/monicali/Google-Drive/IBRAIN/playground/sub-03/ses-test/func/sub-03_ses-test_task-linebisection_bold.nii.gz \ +# -tlrc_base MNI_avg152T1+tlrc -volreg_align_to third -volreg_align_e2a \ +# -volreg_tlrc_warp -blur_size 6.0 -regress_stim_times \ +# /Users/monicali/Google-Drive/IBRAIN/playground/timing_sub-03_ses-test_Correct_Task.1D \ +# /Users/monicali/Google-Drive/IBRAIN/playground/timing_sub-03_ses-test_Incorrect_Task.1D \ +# /Users/monicali/Google-Drive/IBRAIN/playground/timing_sub-03_ses-test_No_Response_Control.1D \ +# /Users/monicali/Google-Drive/IBRAIN/playground/timing_sub-03_ses-test_No_Response_Task.1D \ +# /Users/monicali/Google-Drive/IBRAIN/playground/timing_sub-03_ses-test_Response_Control.1D \ +# -regress_stim_labels Correct_Task Incorrect_Task No_Response_Control \ +# No_Response_Task Response_Control -regress_basis GAM \ +# -regress_censor_motion 0.3 -regress_censor_outliers 0.5 \ +# -regress_apply_mot_types demean deriv -regress_opts_3dD -gltsym 'SYM: \ +# 0.333*Correct_Task +0.333*Incorrect_Task +0.333*No_Response_Task \ +# -0.5*Response_Control -0.5*No_Response_Control' -glt_label 1 \ +# Landmark-Detection -regress_make_ideal_sum sum_ideal.1D \ +# -regress_est_blur_epits -regress_est_blur_errts -regress_run_clustsim no diff --git a/hw2/Exp-2/subject_results/group.test/subj.sub_03/cmd.ap.sub_03 b/hw2/Exp-2/subject_results/group.test/subj.sub_03/cmd.ap.sub_03 new file mode 100644 index 0000000..59fa428 --- /dev/null +++ b/hw2/Exp-2/subject_results/group.test/subj.sub_03/cmd.ap.sub_03 @@ -0,0 +1,47 @@ +#!/usr/bin/env tcsh + +# created by uber_subject.py: version 0.40 (March 30, 2017) +# creation date: Thu Aug 3 22:01:15 2017 + +# set data directories +set top_dir = /Users/mli/Desktop/playground +set anat_dir = $top_dir/sub-03/ses-test/anat +set epi_dir = $top_dir/sub-03/ses-test/func + +# set subject and group identifiers +set subj = sub_03 +set group_id = test + +# run afni_proc.py to create a single subject processing script +afni_proc.py -subj_id $subj \ + -script proc.$subj -scr_overwrite \ + -blocks tshift align tlrc volreg blur mask scale regress \ + -copy_anat $anat_dir/sub-03_ses-test_T1w.nii.gz \ + -tcat_remove_first_trs 1 \ + -tshift_opts_ts -tpattern alt+z \ + -dsets $epi_dir/sub-03_ses-test_task-linebisection_bold.nii.gz \ + -tlrc_base MNI_avg152T1+tlrc \ + -volreg_align_to third \ + -volreg_align_e2a \ + -volreg_tlrc_warp \ + -blur_size 3.0 \ + -regress_stim_times \ + $top_dir/timing_sub-03_ses-test_Correct_Task.1D \ + $top_dir/timing_sub-03_ses-test_Incorrect_Task.1D \ + $top_dir/timing_sub-03_ses-test_No_Response_Control.1D \ + $top_dir/timing_sub-03_ses-test_No_Response_Task.1D \ + $top_dir/timing_sub-03_ses-test_Response_Control.1D \ + -regress_stim_labels \ + Correct_Task Incorrect_Task No_Response_Control No_Response_Task \ + Response_Control \ + -regress_basis 'GAM' \ + -regress_censor_motion 0.5 \ + -regress_apply_mot_types demean deriv \ + -regress_opts_3dD \ + -gltsym 'SYM: 0.5*Correct_Task +0.5*Incorrect_Task \ + -Response_Control' -glt_label 1 Landmark-Detection \ + -regress_make_ideal_sum sum_ideal.1D \ + -regress_est_blur_epits \ + -regress_est_blur_errts \ + -regress_run_clustsim no + diff --git a/hw2/Exp-2/subject_results/group.test/subj.sub_03/output.cmd.ap.sub_03 b/hw2/Exp-2/subject_results/group.test/subj.sub_03/output.cmd.ap.sub_03 new file mode 100644 index 0000000..c85d9ed --- /dev/null +++ b/hw2/Exp-2/subject_results/group.test/subj.sub_03/output.cmd.ap.sub_03 @@ -0,0 +1,30 @@ +set top_dir = /Users/mli/Desktop/playground +set anat_dir = /Users/mli/Desktop/playground/sub-03/ses-test/anat +set epi_dir = /Users/mli/Desktop/playground/sub-03/ses-test/func +set subj = sub_03 +set group_id = test +afni_proc.py -subj_id sub_03 -script proc.sub_03 -scr_overwrite -blocks tshift align tlrc volreg blur mask scale regress -copy_anat /Users/mli/Desktop/playground/sub-03/ses-test/anat/sub-03_ses-test_T1w.nii.gz -tcat_remove_first_trs 1 -tshift_opts_ts -tpattern alt+z -dsets /Users/mli/Desktop/playground/sub-03/ses-test/func/sub-03_ses-test_task-linebisection_bold.nii.gz -tlrc_base MNI_avg152T1+tlrc -volreg_align_to third -volreg_align_e2a -volreg_tlrc_warp -blur_size 3.0 -regress_stim_times /Users/mli/Desktop/playground/timing_sub-03_ses-test_Correct_Task.1D /Users/mli/Desktop/playground/timing_sub-03_ses-test_Incorrect_Task.1D /Users/mli/Desktop/playground/timing_sub-03_ses-test_No_Response_Control.1D /Users/mli/Desktop/playground/timing_sub-03_ses-test_No_Response_Task.1D /Users/mli/Desktop/playground/timing_sub-03_ses-test_Response_Control.1D -regress_stim_labels Correct_Task Incorrect_Task No_Response_Control No_Response_Task Response_Control -regress_basis GAM -regress_censor_motion 0.5 -regress_apply_mot_types demean deriv -regress_opts_3dD -gltsym SYM: 0.5*Correct_Task +0.5*Incorrect_Task + -Response_Control -glt_label 1 Landmark-Detection -regress_make_ideal_sum sum_ideal.1D -regress_est_blur_epits -regress_est_blur_errts -regress_run_clustsim no +-- applying orig view as +orig +** warning: removing first 1 TRs from beginning of each run + --> the stimulus timing files must reflect the removal of these TRs +-- tcat: reps is now 237 +++ updating polort to 4, from run len 592.5 s +-- volreg: using base dset vr_base+orig +++ volreg: applying volreg/epi2anat/tlrc xforms to isotropic 4 mm tlrc voxels +-- applying anat warps to 1 dataset(s): sub-03_ses-test_T1w +-- masking: group anat = 'MNI_avg152T1+tlrc', exists = 1 +-- have 1 ROI dict entries ... +-- will apply motion types: demean, deriv +-- using default: will not apply EPI Automask + (see 'MASKING NOTE' from the -help for details) + +------------------------------------- +** warning have only 1 run to analyze +------------------------------------- + +--> script is file: proc.sub_03 + consider the script execution command: + + tcsh -xef proc.sub_03 |& tee output.proc.sub_03 + diff --git a/hw2/Exp-2/subject_results/group.test/subj.sub_03/output.proc.sub_03 b/hw2/Exp-2/subject_results/group.test/subj.sub_03/output.proc.sub_03 new file mode 100644 index 0000000..6b7e8d9 --- /dev/null +++ b/hw2/Exp-2/subject_results/group.test/subj.sub_03/output.proc.sub_03 @@ -0,0 +1,939 @@ +echo auto-generated by afni_proc.py, Sat Aug 5 16:33:35 2017 +auto-generated by afni_proc.py, Sat Aug 5 16:33:35 2017 +echo (version 5.15, April 25, 2017) +(version 5.15, April 25, 2017) +echo execution started: `date` +date +execution started: Sat Aug 5 16:33:36 EDT 2017 +afni -ver +Precompiled binary macosx_10.7_local: Jul 27 2017 (Version AFNI_17.2.05) +afni_history -check_date 23 Sep 2016 +-- is current: afni_history as new as: 23 Sep 2016 + most recent entry is: 27 Jul 2017 +if ( 0 ) then +if ( 0 > 0 ) then +set subj = sub_03 +endif +set output_dir = sub_03.results +if ( -d sub_03.results ) then +set runs = ( `count -digits 2 1 1` ) +count -digits 2 1 1 +mkdir sub_03.results +mkdir sub_03.results/stimuli +cp /Users/mli/Desktop/playground/timing_sub-03_ses-test_Correct_Task.1D /Users/mli/Desktop/playground/timing_sub-03_ses-test_Incorrect_Task.1D /Users/mli/Desktop/playground/timing_sub-03_ses-test_No_Response_Control.1D /Users/mli/Desktop/playground/timing_sub-03_ses-test_No_Response_Task.1D /Users/mli/Desktop/playground/timing_sub-03_ses-test_Response_Control.1D sub_03.results/stimuli +3dcopy /Users/mli/Desktop/playground/sub-03/ses-test/anat/sub-03_ses-test_T1w.nii.gz sub_03.results/sub-03_ses-test_T1w +++ 3dcopy: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +3dTcat -prefix sub_03.results/pb00.sub_03.r01.tcat /Users/mli/Desktop/playground/sub-03/ses-test/func/sub-03_ses-test_task-linebisection_bold.nii.gz[1..$] +++ 3dTcat: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ elapsed time = 0.8 s +set tr_counts = ( 237 ) +cd sub_03.results +touch out.pre_ss_warn.txt +foreach run ( 01 ) +3dToutcount -automask -fraction -polort 4 -legendre pb00.sub_03.r01.tcat+orig +++ 3dToutcount: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +*+ WARNING: If you are performing spatial transformations on an oblique dset, + such as ./pb00.sub_03.r01.tcat+orig.BRIK, + or viewing/combining it with volumes of differing obliquity, + you should consider running: + 3dWarp -deoblique + on this and other oblique datasets in the same session. + See 3dWarp -help for details. +++ Oblique dataset:./pb00.sub_03.r01.tcat+orig.BRIK is 6.153038 degrees from plumb. +++ 17835 voxels passed mask/clip +if ( `1deval -a outcount.r$run.1D"{0}" -expr "step(a-0.4)"` ) then +1deval -a outcount.r01.1D{0} -expr step(a-0.4) +end +cat outcount.r01.1D +foreach run ( 01 ) +3dTshift -tzero 0 -quintic -prefix pb01.sub_03.r01.tshift -tpattern alt+z pb00.sub_03.r01.tcat+orig +++ 3dTshift: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +*+ WARNING: If you are performing spatial transformations on an oblique dset, + such as ./pb00.sub_03.r01.tcat+orig.BRIK, + or viewing/combining it with volumes of differing obliquity, + you should consider running: + 3dWarp -deoblique + on this and other oblique datasets in the same session. + See 3dWarp -help for details. +++ Oblique dataset:./pb00.sub_03.r01.tcat+orig.BRIK is 6.153038 degrees from plumb. +end +3dbucket -prefix vr_base pb01.sub_03.r01.tshift+orig[2] +++ 3dbucket: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +align_epi_anat.py -anat2epi -anat sub-03_ses-test_T1w+orig -save_skullstrip -suffix _al_junk -epi vr_base+orig -epi_base 0 -epi_strip 3dAutomask -volreg off -tshift off +#++ align_epi_anat version: 1.57 +#++ turning off volume registration +#Script is running (command trimmed): + 3dAttribute DELTA ./vr_base+orig +#Script is running (command trimmed): + 3dAttribute DELTA ./vr_base+orig +#Script is running (command trimmed): + 3dAttribute DELTA ./sub-03_ses-test_T1w+orig +#++ Multi-cost is lpc +#++ Removing all the temporary files +#Script is running: + \rm -f ./__tt_vr_base* +#Script is running: + \rm -f ./__tt_sub-03_ses-test_T1w* +#Script is running (command trimmed): + 3dcopy ./sub-03_ses-test_T1w+orig ./__tt_sub-03_ses-test_T1w+orig +++ 3dcopy: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +#++ Removing skull from anat data +#Script is running (command trimmed): + 3dSkullStrip -orig_vol -input ./__tt_sub-03_ses-test_T1w+orig -prefix ./__tt_sub-03_ses-test_T1w_ns +*+ WARNING: If you are performing spatial transformations on an oblique dset, + such as ./__tt_sub-03_ses-test_T1w+orig.BRIK, + or viewing/combining it with volumes of differing obliquity, + you should consider running: + 3dWarp -deoblique + on this and other oblique datasets in the same session. + See 3dWarp -help for details. +++ Oblique dataset:./__tt_sub-03_ses-test_T1w+orig.BRIK is 6.455733 degrees from plumb. +#Script is running (command trimmed): + 3dinfo ./__tt_sub-03_ses-test_T1w_ns+orig | \grep 'Data Axes Tilt:'|\grep 'Oblique' +#++ Dataset /Users/mli/Desktop/playground/Exp-2/subject_results/group.test/subj.sub_03/sub_03.results/__tt_sub-03_ses-test_T1w_ns+orig is ***oblique**** +#Script is running (command trimmed): + 3dAttribute DELTA ./__tt_sub-03_ses-test_T1w_ns+orig +#++ Spacing for anat to oblique epi alignment is 1.000000 +#++ Matching obliquity of anat to epi +#Script is running (command trimmed): + 3dWarp -verb -card2oblique ./vr_base+orig -prefix ./__tt_sub-03_ses-test_T1w_ns_ob -newgrid 1.000000 ./__tt_sub-03_ses-test_T1w_ns+orig | \grep -A 4 '# mat44 Obliquity Transformation ::' > ./__tt_sub-03_ses-test_T1w_ns_obla2e_mat.1D +++ 3dWarp: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: RW Cox +++ Deobliquing original dataset before obliquing +++ Combining oblique transformations +#++ using 0th sub-brick because only one found +#Script is running (command trimmed): + 3dbucket -prefix ./__tt_vr_base_ts ./vr_base+orig'[0]' +++ 3dbucket: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +#++ resampling epi to match anat data +#Script is running (command trimmed): + 3dresample -master ./__tt_sub-03_ses-test_T1w_ns_ob+orig -prefix ./__tt_vr_base_ts_rs -inset ./__tt_vr_base_ts+orig'' -rmode Cu +*+ WARNING: If you are performing spatial transformations on an oblique dset, + such as ./__tt_vr_base_ts+orig.BRIK, + or viewing/combining it with volumes of differing obliquity, + you should consider running: + 3dWarp -deoblique + on this and other oblique datasets in the same session. + See 3dWarp -help for details. +++ Oblique dataset:./__tt_vr_base_ts+orig.BRIK is 6.153038 degrees from plumb. +#++ removing skull or area outside brain +#Script is running (command trimmed): + 3dAutomask -apply_prefix ./__tt_vr_base_ts_rs_ns ./__tt_vr_base_ts_rs+orig +++ 3dAutomask: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: Emperor Zhark +++ Loading dataset ./__tt_vr_base_ts_rs+orig +++ Forming automask + + Fixed clip level = 720.187500 + + Used gradual clip level = 622.540100 .. 825.700012 + + Number voxels above clip level = 1139151 + + Clustering voxels ... + + Largest cluster has 1137868 voxels + + Clustering voxels ... + + Largest cluster has 1137453 voxels + + Filled 420 voxels in small holes; now have 1137873 voxels + + Filled 17758 voxels in large holes; now have 1155631 voxels + + Clustering voxels ... + + Largest cluster has 1155621 voxels + + Clustering non-brain voxels ... + + Clustering voxels ... + + Largest cluster has 15251532 voxels + + Mask now has 1155621 voxels +++ 1155621 voxels in the mask [out of 16407153: 7.04%] +++ first 71 x-planes are zero [from R] +++ last 75 x-planes are zero [from L] +++ first 33 y-planes are zero [from A] +++ last 17 y-planes are zero [from P] +++ first 123 z-planes are zero [from I] +++ last 36 z-planes are zero [from S] +++ applying mask to original data +++ Writing masked data +++ CPU time = 3.400000 sec +#++ Computing weight mask +#Script is running (command trimmed): + 3dBrickStat -automask -percentile 90.000000 1 90.000000 ./__tt_vr_base_ts_rs_ns+orig +#++ Applying threshold of 1884.000000 on /Users/mli/Desktop/playground/Exp-2/subject_results/group.test/subj.sub_03/sub_03.results/__tt_vr_base_ts_rs_ns+orig +#Script is running (command trimmed): + 3dcalc -datum float -prefix ./__tt_vr_base_ts_rs_ns_wt -a ./__tt_vr_base_ts_rs_ns+orig -expr 'min(1,(a/1884.000000))' +++ 3dcalc: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: A cast of thousands +#++ Aligning anat data to epi data +#Script is running (command trimmed): + 3dAllineate -lpc -wtprefix ./__tt_sub-03_ses-test_T1w_ns_ob_al_junk_wtal -weight ./__tt_vr_base_ts_rs_ns_wt+orig -source ./__tt_sub-03_ses-test_T1w_ns_ob+orig -prefix ./__tt_sub-03_ses-test_T1w_ns_ob_temp_al_junk -base ./__tt_vr_base_ts_rs_ns+orig -nocmass -1Dmatrix_save ./sub-03_ses-test_T1w_al_junk_e2a_only_mat.aff12.1D -master SOURCE -weight_frac 1.0 -maxrot 6 -maxshf 10 -VERB -warp aff -source_automask+4 -onepass +++ 3dAllineate: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: Zhark the Registrator +++ Source dataset: ./__tt_sub-03_ses-test_T1w_ns_ob+orig.HEAD +++ Base dataset: ./__tt_vr_base_ts_rs_ns+orig.HEAD +++ Loading datasets +++ 1350442 voxels in -source_automask+4 +++ Zero-pad: not needed +++ 1155621 voxels [7.0%] in weight mask +++ Number of points for matching = 1155621 +++ Local correlation: blok type = 'RHDD(6.54321)' +++ shift param auto-range: -89.2..89.2 -69.3..69.3 -86.7..86.7 + + Range param#4 [z-angle] = -6.000000 .. 6.000000 + + Range param#5 [x-angle] = -6.000000 .. 6.000000 + + Range param#6 [y-angle] = -6.000000 .. 6.000000 + + Range param#1 [x-shift] = -10.000000 .. 10.000000 + + Range param#2 [y-shift] = -10.000000 .. 10.000000 + + Range param#3 [z-shift] = -10.000000 .. 10.000000 + + 12 free parameters +++ Normalized convergence radius = 0.001000 +++ OpenMP thread count = 4 +++ ======= Allineation of 1 sub-bricks using Local Pearson Correlation Signed ======= +++ ========== sub-brick #0 ========== [total CPU to here=9.2 s] +++ *** Fine pass begins *** + + * Enter alignment setup routine + + - copying base image + + - copying source image + + - copying weight image + + - using 1155621 points from base image [use_all=0] + + * Exit alignment setup routine + + 1095318 total points stored in 2076 'RHDD(6.54321)' bloks + + - Initial cost = -0.091164 + + - Initial fine Parameters = 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 1.0000 1.0000 0.0000 0.0000 0.0000 +************************************************************************************************************************************************************************************************************** + + - Finalish cost = -0.223788 ; 478 funcs +* + + - Final cost = -0.223788 ; 109 funcs + + Final fine fit Parameters: + x-shift= 0.1988 y-shift=-0.6640 z-shift=-1.7061 + z-angle=-0.6160 x-angle= 4.7517 y-angle=-1.0181 + x-scale= 0.9680 y-scale= 0.9748 z-scale= 1.0199 + y/x-shear=-0.0035 z/x-shear= 0.0100 z/y-shear= 0.0924 + + - Fine net CPU time = 38.6 s +++ Computing output image +++ image warp: parameters = 0.1988 -0.6640 -1.7061 -0.6160 4.7517 -1.0181 0.9680 0.9748 1.0199 -0.0035 0.0100 0.0924 +++ Wrote -1Dmatrix_save ./sub-03_ses-test_T1w_al_junk_e2a_only_mat.aff12.1D +++ 3dAllineate: total CPU time = 50.5 sec Elapsed = 31.9 +++ ########################################################### +++ # Please check results visually for alignment quality # +++ ########################################################### +++ # '-autoweight' is recommended when using -lpc or -lpa # +++ # If your results are not good, please try again. # +++ ########################################################### +#Script is running (command trimmed): + cat_matvec -ONELINE ./sub-03_ses-test_T1w_al_junk_e2a_only_mat.aff12.1D ./__tt_sub-03_ses-test_T1w_ns_obla2e_mat.1D -I > ./sub-03_ses-test_T1w_al_junk_mat.aff12.1D +#++ Combining anat to epi and oblique transformations +#Script is running (command trimmed): + 3dAllineate -base ./__tt_vr_base_ts_rs_ns+orig -1Dmatrix_apply ./sub-03_ses-test_T1w_al_junk_mat.aff12.1D -prefix ./sub-03_ses-test_T1w_al_junk -input ./__tt_sub-03_ses-test_T1w_ns+orig -master SOURCE -weight_frac 1.0 -maxrot 6 -maxshf 10 -VERB -warp aff -source_automask+4 -onepass +++ 3dAllineate: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: Zhark the Registrator +*+ WARNING: If you are performing spatial transformations on an oblique dset, + such as ./__tt_sub-03_ses-test_T1w_ns+orig.BRIK, + or viewing/combining it with volumes of differing obliquity, + you should consider running: + 3dWarp -deoblique + on this and other oblique datasets in the same session. + See 3dWarp -help for details. +++ Oblique dataset:./__tt_sub-03_ses-test_T1w_ns+orig.BRIK is 6.455733 degrees from plumb. +++ Source dataset: ./__tt_sub-03_ses-test_T1w_ns+orig.HEAD +++ Base dataset: ./__tt_vr_base_ts_rs_ns+orig.HEAD +++ Loading datasets + + Range param#4 [z-angle] = -6.000000 .. 6.000000 + + Range param#5 [x-angle] = -6.000000 .. 6.000000 + + Range param#6 [y-angle] = -6.000000 .. 6.000000 + + Range param#1 [x-shift] = -10.000000 .. 10.000000 + + Range param#2 [y-shift] = -10.000000 .. 10.000000 + + Range param#3 [z-shift] = -10.000000 .. 10.000000 +++ OpenMP thread count = 4 +++ ========== Applying transformation to 1 sub-bricks ========== +++ ========== sub-brick #0 ========== [total CPU to here=0.1 s] + + * Enter alignment setup routine + + - copying base image + + - copying source image + + - no weight image + + - using 11 points from base image [use_all=0] + + * Exit alignment setup routine +++ using -1Dmatrix_apply +++ Computing output image +++ image warp: parameters = 0.9647 -0.0767 -0.0644 8.2560 0.0414 0.9697 -0.0702 -8.0361 0.0573 0.0012 1.0210 -4.6777 +++ 3dAllineate: total CPU time = 2.1 sec Elapsed = 1.8 +++ ########################################################### +#++ Creating final output: skullstripped anat data +copying from dataset /Users/mli/Desktop/playground/Exp-2/subject_results/group.test/subj.sub_03/sub_03.results/__tt_sub-03_ses-test_T1w_ns+orig to /Users/mli/Desktop/playground/Exp-2/subject_results/group.test/subj.sub_03/sub_03.results/sub-03_ses-test_T1w_ns+orig +#Script is running (command trimmed): + 3dcopy ./__tt_sub-03_ses-test_T1w_ns+orig sub-03_ses-test_T1w_ns +++ 3dcopy: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +#++ Creating final output: anat data aligned to epi +# copy is not necessary +#++ Saving history +#Script is running (command trimmed): + 3dNotes -h "align_epi_anat.py -anat2epi -anat sub-03_ses-test_T1w+orig \ + -save_skullstrip -suffix _al_junk -epi vr_base+orig -epi_base 0 \ + -epi_strip 3dAutomask -volreg off -tshift off" \ + ./sub-03_ses-test_T1w_al_junk+orig + +#++ Removing all the temporary files +#Script is running: + \rm -f ./__tt_vr_base* +#Script is running: + \rm -f ./__tt_sub-03_ses-test_T1w* + +# Finished alignment successfully + +@auto_tlrc -base MNI_avg152T1+tlrc -input sub-03_ses-test_T1w_ns+orig -no_ss +*+ WARNING: If you are performing spatial transformations on an oblique dset, + such as ./sub-03_ses-test_T1w_ns+orig.BRIK, + or viewing/combining it with volumes of differing obliquity, + you should consider running: + 3dWarp -deoblique + on this and other oblique datasets in the same session. + See 3dWarp -help for details. +++ Oblique dataset:./sub-03_ses-test_T1w_ns+orig.BRIK is 6.455733 degrees from plumb. +*+ WARNING: If you are performing spatial transformations on an oblique dset, + such as ./sub-03_ses-test_T1w_ns+orig.BRIK, + or viewing/combining it with volumes of differing obliquity, + you should consider running: + 3dWarp -deoblique + on this and other oblique datasets in the same session. + See 3dWarp -help for details. +++ Oblique dataset:./sub-03_ses-test_T1w_ns+orig.BRIK is 6.455733 degrees from plumb. + +*********** Warning ************* +Dataset centers are 52.843487 mm +apart. If registration fails, or if +parts of the original anatomy gets +cropped, try adding option + -init_xform AUTO_CENTER +to your @auto_tlrc command. + +********************************* + +Padding ... +++ 3dZeropad: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ output dataset: ./__ats_tmp__ref_MNI_avg152T1_40pad+tlrc.BRIK +Resampling ... +*+ WARNING: If you are performing spatial transformations on an oblique dset, + such as ./sub-03_ses-test_T1w_ns+orig.BRIK, + or viewing/combining it with volumes of differing obliquity, + you should consider running: + 3dWarp -deoblique + on this and other oblique datasets in the same session. + See 3dWarp -help for details. +++ Oblique dataset:./sub-03_ses-test_T1w_ns+orig.BRIK is 6.455733 degrees from plumb. +++ 3dcalc: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: A cast of thousands +*+ WARNING: If you are performing spatial transformations on an oblique dset, + such as ./__ats_tmp__resamp_step+orig.BRIK, + or viewing/combining it with volumes of differing obliquity, + you should consider running: + 3dWarp -deoblique + on this and other oblique datasets in the same session. + See 3dWarp -help for details. +++ Oblique dataset:./__ats_tmp__resamp_step+orig.BRIK is 6.455733 degrees from plumb. +++ 3dcalc: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: A cast of thousands +*+ WARNING: If you are performing spatial transformations on an oblique dset, + such as ./sub-03_ses-test_T1w_ns+orig.BRIK, + or viewing/combining it with volumes of differing obliquity, + you should consider running: + 3dWarp -deoblique + on this and other oblique datasets in the same session. + See 3dWarp -help for details. +++ Oblique dataset:./sub-03_ses-test_T1w_ns+orig.BRIK is 6.455733 degrees from plumb. +Clipping -0.000100 1158.000100 ... +++ 3dcalc: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: A cast of thousands +++ 3drefit: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: RW Cox +++ Processing AFNI dataset __ats_tmp___rs_sub-03_ses-test_T1w_ns+tlrc.HEAD + + Changed dataset view type and filenames. +++ 3drefit processed 1 datasets +++ 3drefit: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: RW Cox +++ Processing AFNI dataset __ats_tmp__resamp_NN+tlrc.HEAD + + Changed dataset view type and filenames. +++ 3drefit processed 1 datasets +++ 3drefit: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: RW Cox +++ Processing AFNI dataset __ats_tmp__resamp_edge_art+tlrc.HEAD + + Changed dataset view type and filenames. +++ 3drefit processed 1 datasets +Registration (linear final interpolation) ... +++ 3dWarpDrive: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: RW Cox +++ Initial scale factor set to 0.30/273.95=9.2e+02 +RMS[0] = 0.384861 0.16449 ITER = 6/137 +0.384861 + +Warping has converged. + +++ 3dcopy: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ 3dWarp: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: RW Cox +*+ WARNING: If you are performing spatial transformations on an oblique dset, + such as ./sub-03_ses-test_T1w_ns+orig.BRIK, + or viewing/combining it with volumes of differing obliquity, + you should consider running: + 3dWarp -deoblique + on this and other oblique datasets in the same session. + See 3dWarp -help for details. +++ Oblique dataset:./sub-03_ses-test_T1w_ns+orig.BRIK is 6.455733 degrees from plumb. +++ 6.455733 degrees from plumb. +*+ WARNING: Deoblique datasets with 3dWarp before proceeding with other transformations +Applying brain mask +++ 3dcalc: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: A cast of thousands +++ 3dWarp: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: RW Cox +++ 3drename: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ THD_rename_dataset_files: rename __ats_tmp___pad40_sub-03_ses-test_T1w_ns+orig.HEAD -> __ats_tmp___pad40_sub-03_ses-test_T1w_ns.skl+orig.HEAD +++ THD_rename_dataset_files: rename __ats_tmp___pad40_sub-03_ses-test_T1w_ns+orig.BRIK.gz -> __ats_tmp___pad40_sub-03_ses-test_T1w_ns.skl+orig.BRIK.gz +++ 3dcalc: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: A cast of thousands +Unpadding ... +++ 3dZeropad: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ output dataset: ./__ats_tmp___upad40_sub-03_ses-test_T1w_ns+orig.BRIK +++ 3drefit: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: RW Cox +++ Processing AFNI dataset __ats_tmp___upad40_sub-03_ses-test_T1w_ns+orig +*+ WARNING: Changing the space of an ORIG view dataset may cause confusion! +*+ WARNING: NIFTI copies will be interpreted as TLRC view (not TLRC space). +*+ WARNING: Consider changing the view of the dataset to TLRC view also +++ 3drefit processed 1 datasets +Changing view of transformed anatomy +++ 3drefit: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: RW Cox +++ Processing AFNI dataset __ats_tmp___upad40_sub-03_ses-test_T1w_ns+orig.HEAD + + Changed dataset view type and filenames. +++ 3drefit processed 1 datasets +Setting parent with 3drefit -wset sub-03_ses-test_T1w_ns+orig __ats_tmp___upad40_sub-03_ses-test_T1w_ns+tlrc +++ 3drefit: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: RW Cox +++ Processing AFNI dataset __ats_tmp___upad40_sub-03_ses-test_T1w_ns+tlrc +++ 3drefit processed 1 datasets +++ 3drename: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Warning: ignoring +tlrc on new_prefix. +++ THD_rename_dataset_files: rename __ats_tmp___upad40_sub-03_ses-test_T1w_ns+tlrc.HEAD -> sub-03_ses-test_T1w_ns+tlrc.HEAD +++ THD_rename_dataset_files: rename __ats_tmp___upad40_sub-03_ses-test_T1w_ns+tlrc.BRIK -> sub-03_ses-test_T1w_ns+tlrc.BRIK +Cleanup ... +cat_matvec sub-03_ses-test_T1w_ns+tlrc::WARP_DATA -I +if ( ! -f sub-03_ses-test_T1w_ns+tlrc.HEAD ) then +foreach run ( 01 ) +3dvolreg -verbose -zpad 1 -base vr_base+orig -1Dfile dfile.r01.1D -prefix rm.epi.volreg.r01 -cubic -1Dmatrix_save mat.r01.vr.aff12.1D pb01.sub_03.r01.tshift+orig +++ 3dvolreg: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: RW Cox +*+ WARNING: If you are performing spatial transformations on an oblique dset, + such as ./vr_base+orig.BRIK, + or viewing/combining it with volumes of differing obliquity, + you should consider running: + 3dWarp -deoblique + on this and other oblique datasets in the same session. + See 3dWarp -help for details. +++ Oblique dataset:./vr_base+orig.BRIK is 6.153038 degrees from plumb. +++ Reading in base dataset ./vr_base+orig.BRIK +++ Oblique dataset:./pb01.sub_03.r01.tshift+orig.BRIK is 6.153038 degrees from plumb. +++ Reading input dataset ./pb01.sub_03.r01.tshift+orig.BRIK +++ Edging: x=3 y=3 z=2 +++ Creating mask for -maxdisp + + Automask has 18925 voxels + + 3320 voxels left in -maxdisp mask after erosion +++ Initializing alignment base +++ Starting final pass on 237 sub-bricks: 0..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..65..66..67..68..69..70..71..72..73..74..75..76..77..78..79..80..81..82..83..84..85..86..87..88..89..90..91..92..93..94..95..96..97..98..99..100..101..102..103..104..105..106..107..108..109..110..111..112..113..114..115..116..117..118..119..120..121..122..123..124..125..126..127..128..129..130..131..132..133..134..135..136..137..138..139..140..141..142..143..144..145..146..147..148..149..150..151..152..153..154..155..156..157..158..159..160..161..162..163..164..165..166..167..168..169..170..171..172..173..174..175..176..177..178..179..180..181..182..183..184..185..186..187..188..189..190..191..192..193..194..195..196..197..198..199..200..201..202..203..204..205..206..207..208..209..210..211..212..213..214..215..216..217..218..219..220..221..222..223..224..225..226..227..228..229..230..231..232..233..234..235..236.. +++ CPU time for realignment=8.6 s [=0.0363 s/sub-brick] +++ Min : roll=-0.099 pitch=-0.764 yaw=-0.000 dS=-0.132 dL=-0.087 dP=-0.636 +++ Mean: roll=+0.252 pitch=-0.320 yaw=+1.503 dS=+1.540 dL=+0.638 dP=-0.281 +++ Max : roll=+0.752 pitch=+1.091 yaw=+2.787 dS=+2.524 dL=+1.597 dP=+0.138 +++ Max displacements (mm) for each sub-brick: + 0.39(0.00) 0.36(0.73) 0.00(0.36) 0.63(0.63) 0.68(0.12) 0.32(0.39) 0.49(0.19) 0.69(0.22) 0.80(0.17) 0.77(0.07) 0.87(0.11) 1.05(0.21) 1.19(0.18) 1.18(0.10) 1.20(0.06) 1.23(0.03) 1.31(0.12) 1.33(0.10) 1.29(0.05) 1.34(0.08) 1.30(0.16) 1.25(0.18) 1.38(0.16) 1.41(0.06) 1.39(0.05) 1.47(0.08) 1.44(0.10) 1.57(0.15) 1.50(0.11) 1.56(0.08) 1.52(0.08) 1.57(0.08) 1.57(0.11) 1.70(0.15) 1.78(0.09) 1.83(0.09) 1.93(0.10) 1.96(0.05) 2.01(0.12) 2.07(0.10) 2.02(0.15) 2.12(0.14) 2.12(0.08) 2.15(0.06) 2.19(0.17) 2.21(0.08) 2.19(0.10) 2.18(0.12) 1.95(0.43) 1.65(1.28) 1.81(1.18) 0.91(1.59) 0.84(0.26) 1.58(1.54) 1.51(1.33) 2.08(1.14) 2.54(2.35) 4.01(2.10) 3.02(1.06) 3.51(0.78) 3.27(0.29) 3.24(0.12) 2.33(1.09) 2.04(0.58) 2.77(1.27) 2.07(0.91) 1.23(1.41) 2.13(1.65) 2.55(0.48) 2.61(0.10) 2.79(0.21) 2.87(0.10) 2.69(0.63) 2.86(0.46) 2.78(0.20) 2.80(0.09) 2.86(0.10) 2.74(0.19) 2.71(0.23) 2.69(0.07) 2.77(0.09) 2.81(0.09) 2.84(0.06) 3.03(0.22) 2.87(0.20) 3.06(0.19) 3.20(0.15) 3.24(0.05) 3.37(0.18) 3.40(0.05) 3.51(0.12) 3.48(0.05) 3.62(0.16) 3.55(0.08) 3.53(0.16) 3.33(0.44) 3.18(0.42) 3.17(0.09) 3.29(0.30) 3.36(0.08) 3.42(0.11) 3.09(0.86) 3.16(0.30) 3.64(0.63) 3.61(0.19) 3.70(0.14) 3.81(0.18) 3.81(0.09) 3.82(0.05) 3.78(0.13) 3.72(0.11) 3.57(0.23) 3.56(0.07) 3.63(0.12) 3.78(0.23) 3.90(0.18) 3.95(0.11) 4.10(0.18) 3.99(0.23) 4.25(0.31) 4.11(0.21) 4.14(0.07) 4.20(0.15) 3.91(0.41) 3.78(0.20) 3.72(0.13) 3.61(0.37) 3.73(0.29) 3.84(0.14) 3.84(0.03) 4.10(0.33) 4.06(0.10) 4.12(0.08) 4.08(0.14) 4.05(0.12) 4.20(0.20) 4.04(0.21) 4.41(0.43) 4.12(0.54) 4.20(0.16) 4.38(0.22) 4.53(0.19) 4.86(0.35) 4.55(0.38) 4.62(0.12) 4.52(0.17) 4.57(0.11) 4.52(0.18) 4.52(0.11) 4.77(0.38) 4.63(0.18) 4.55(0.20) 4.40(0.22) 4.57(0.23) 4.59(0.02) 4.52(0.07) 4.65(0.14) 4.57(0.13) 4.72(0.18) 4.82(0.10) 4.90(0.24) 5.30(0.79) 5.50(0.43) 4.99(1.04) 5.21(0.24) 5.46(0.32) 5.64(0.36) 5.66(0.07) 5.83(0.19) 5.76(0.14) 5.76(0.16) 5.73(0.05) 5.73(0.12) 5.58(0.27) 5.46(0.28) 5.45(0.40) 5.46(0.25) 5.37(0.21) 5.32(0.09) 5.45(0.18) 5.51(0.08) 5.68(0.25) 5.56(0.16) 5.63(0.07) 5.66(0.05) 5.57(0.25) 5.19(0.64) 5.48(0.78) 5.32(0.22) 4.57(1.04) 4.55(0.14) 4.88(0.39) 5.27(0.59) 5.64(0.60) 5.82(0.26) 5.70(0.27) 5.88(0.33) 5.87(0.05) 5.80(0.19) 5.75(0.11) 5.78(0.23) 5.98(0.27) 5.96(0.11) 5.92(0.10) 6.02(0.29) 6.04(0.11) 6.10(0.12) 6.10(0.10) 6.10(0.06) 6.10(0.08) 6.11(0.03) 6.03(0.13) 6.13(0.13) 6.12(0.15) 6.07(0.13) 6.13(0.15) 6.03(0.17) 6.10(0.14) 6.03(0.09) 6.01(0.05) 6.16(0.23) 5.98(0.22) 5.86(0.22) 5.94(0.10) 5.83(0.15) 5.68(0.26) 5.88(0.46) 6.00(0.25) 5.97(0.26) 6.05(0.12) 6.24(0.32) 6.26(0.17) 6.33(0.24) 6.15(0.32) 5.98(0.38) 6.01(0.05) 6.10(0.15) +++ Max displacement in automask = 6.33 (mm) at sub-brick 232 +++ Max delta displ in automask = 2.35 (mm) at sub-brick 56 +++ Wrote dataset to disk in ./rm.epi.volreg.r01+orig.BRIK +3dcalc -overwrite -a pb01.sub_03.r01.tshift+orig -expr 1 -prefix rm.epi.all1 +++ 3dcalc: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: A cast of thousands +*+ WARNING: input 'a' is not used in the expression +cat_matvec -ONELINE sub-03_ses-test_T1w_ns+tlrc::WARP_DATA -I sub-03_ses-test_T1w_al_junk_mat.aff12.1D -I mat.r01.vr.aff12.1D +3dAllineate -base sub-03_ses-test_T1w_ns+tlrc -input pb01.sub_03.r01.tshift+orig -1Dmatrix_apply mat.r01.warp.aff12.1D -mast_dxyz 4 -prefix rm.epi.nomask.r01 +++ 3dAllineate: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: Zhark the Registrator +*+ WARNING: If you are performing spatial transformations on an oblique dset, + such as ./pb01.sub_03.r01.tshift+orig.BRIK, + or viewing/combining it with volumes of differing obliquity, + you should consider running: + 3dWarp -deoblique + on this and other oblique datasets in the same session. + See 3dWarp -help for details. +++ Oblique dataset:./pb01.sub_03.r01.tshift+orig.BRIK is 6.153038 degrees from plumb. +++ Source dataset: ./pb01.sub_03.r01.tshift+orig.HEAD +++ Base dataset: ./sub-03_ses-test_T1w_ns+tlrc.HEAD +++ Loading datasets +++ NOTE: base and source coordinate systems have different handedness + + Orientations: base=Right handed (LPI); source=Left handed (RPI) +++ master dataset for output = base +++ changing output grid spacing to 4.0000 mm +++ OpenMP thread count = 4 +++ ========== Applying transformation to 237 sub-bricks ========== +volume 0..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..65..66..67..68..69..70..71..72..73..74..75..76..77..78..79..80..81..82..83..84..85..86..87..88..89..90..91..92..93..94..95..96..97..98..99..100..101..102..103..104..105..106..107..108..109..110..111..112..113..114..115..116..117..118..119..120..121..122..123..124..125..126..127..128..129..130..131..132..133..134..135..136..137..138..139..140..141..142..143..144..145..146..147..148..149..150..151..152..153..154..155..156..157..158..159..160..161..162..163..164..165..166..167..168..169..170..171..172..173..174..175..176..177..178..179..180..181..182..183..184..185..186..187..188..189..190..191..192..193..194..195..196..197..198..199..200..201..202..203..204..205..206..207..208..209..210..211..212..213..214..215..216..217..218..219..220..221..222..223..224..225..226..227..228..229..230..231..232..233..234..235..236Ø++ Output dataset ./rm.epi.nomask.r01+tlrc.BRIK +++ 3dAllineate: total CPU time = 6.0 sec Elapsed = 4.1 +++ ########################################################### +3dAllineate -base sub-03_ses-test_T1w_ns+tlrc -input rm.epi.all1+orig -1Dmatrix_apply mat.r01.warp.aff12.1D -mast_dxyz 4 -final NN -quiet -prefix rm.epi.1.r01 +++ 3dAllineate: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: Zhark the Registrator +*+ WARNING: If you are performing spatial transformations on an oblique dset, + such as ./rm.epi.all1+orig.BRIK, + or viewing/combining it with volumes of differing obliquity, + you should consider running: + 3dWarp -deoblique + on this and other oblique datasets in the same session. + See 3dWarp -help for details. +++ Oblique dataset:./rm.epi.all1+orig.BRIK is 6.153038 degrees from plumb. +++ NOTE: base and source coordinate systems have different handedness + + Orientations: base=Right handed (LPI); source=Left handed (RPI) +++ 3dAllineate: total CPU time = 3.5 sec Elapsed = 3.2 +3dTstat -min -prefix rm.epi.min.r01 rm.epi.1.r01+tlrc +++ 3dTstat: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: KR Hammett & RW Cox +end +cat dfile.r01.1D +3dcopy rm.epi.min.r01+tlrc mask_epi_extents +++ 3dcopy: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +foreach run ( 01 ) +3dcalc -a rm.epi.nomask.r01+tlrc -b mask_epi_extents+tlrc -expr a*b -prefix pb02.sub_03.r01.volreg +++ 3dcalc: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: A cast of thousands +++ Output dataset ./pb02.sub_03.r01.volreg+tlrc.BRIK +end +cat_matvec -ONELINE sub-03_ses-test_T1w_ns+tlrc::WARP_DATA -I sub-03_ses-test_T1w_al_junk_mat.aff12.1D -I +3dAllineate -base sub-03_ses-test_T1w_ns+tlrc -input vr_base+orig -1Dmatrix_apply mat.basewarp.aff12.1D -mast_dxyz 4 -prefix final_epi_vr_base +++ 3dAllineate: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: Zhark the Registrator +*+ WARNING: If you are performing spatial transformations on an oblique dset, + such as ./vr_base+orig.BRIK, + or viewing/combining it with volumes of differing obliquity, + you should consider running: + 3dWarp -deoblique + on this and other oblique datasets in the same session. + See 3dWarp -help for details. +++ Oblique dataset:./vr_base+orig.BRIK is 6.153038 degrees from plumb. +++ Source dataset: ./vr_base+orig.HEAD +++ Base dataset: ./sub-03_ses-test_T1w_ns+tlrc.HEAD +++ Loading datasets +++ NOTE: base and source coordinate systems have different handedness + + Orientations: base=Right handed (LPI); source=Left handed (RPI) +++ master dataset for output = base +++ changing output grid spacing to 4.0000 mm +++ OpenMP thread count = 4 +++ ========== Applying transformation to 1 sub-bricks ========== +volume 0Ø++ Output dataset ./final_epi_vr_base+tlrc.BRIK +++ 3dAllineate: total CPU time = 0.0 sec Elapsed = 0.1 +++ ########################################################### +3dcopy sub-03_ses-test_T1w_ns+tlrc anat_final.sub_03 +++ 3dcopy: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +3dAllineate -base final_epi_vr_base+tlrc -allcostX -input anat_final.sub_03+tlrc +tee out.allcostX.txt +++ 3dAllineate: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: Zhark the Registrator +++ Source dataset: ./anat_final.sub_03+tlrc.HEAD +++ Base dataset: ./final_epi_vr_base+tlrc.HEAD +++ Loading datasets +++ 223015 voxels in source_automask+0 +++ Zero-pad: xbot=1 xtop=2 +++ Zero-pad: ybot=0 ytop=1 +++ Zero-pad: zbot=1 ztop=1 +++ Computing -autobox +++ 111006 voxels [89.5%] in weight mask +++ Number of points for matching = 52172 +++ Local correlation: blok type = 'RHDD(14.76)' +*+ WARNING: No output dataset will be calculated +++ OpenMP thread count = 4 +volume 0Ø + initial Parameters = 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 1.0000 1.0000 0.0000 0.0000 0.0000 +++ allcost output: init #0 + ls = 0.18269 + sp = 0.302214 + mi = -0.542443 + crM = 0.0831465 + nmi = 0.868037 + je = 3.5681 + hel = -0.108642 + crA = 0.288642 + crU = 0.301598 + lss = 0.81731 + lpc = 0.373345 + lpa = 0.626655 + lpc+ = 0.57125 + ncd = 0.966558 +++ 3dAllineate: total CPU time = 0.3 sec Elapsed = 0.4 +++ ########################################################### +3dAllineate -source sub-03_ses-test_T1w+orig -master anat_final.sub_03+tlrc -final wsinc5 -1Dmatrix_apply warp.anat.Xat.1D -prefix anat_w_skull_warped +++ 3dAllineate: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: Zhark the Registrator +*+ WARNING: If you are performing spatial transformations on an oblique dset, + such as ./sub-03_ses-test_T1w+orig.BRIK, + or viewing/combining it with volumes of differing obliquity, + you should consider running: + 3dWarp -deoblique + on this and other oblique datasets in the same session. + See 3dWarp -help for details. +++ Oblique dataset:./sub-03_ses-test_T1w+orig.BRIK is 6.455733 degrees from plumb. +++ -1Dmatrix_apply: converting input 3x4 array to 1 row of 12 numbers +++ Source dataset: ./sub-03_ses-test_T1w+orig.HEAD +++ Base dataset: (not given) +++ Loading datasets +++ OpenMP thread count = 4 +++ ========== Applying transformation to 1 sub-bricks ========== +volume 0Ø++ wsinc5 interpolation setup: + + taper function = Min sidelobe 3 term + + taper cut point = 0.000 + + window radius = 5 voxels + + window shape = Cubical + + The above can be altered via the AFNI_WSINC5_* environment variables. + + (To avoid this message, 'setenv AFNI_WSINC5_SILENT YES'.) + + wsinc5 CUBE(5) mask has 1000 points +++ Output dataset ./anat_w_skull_warped+tlrc.BRIK +++ 3dAllineate: total CPU time = 3.1 sec Elapsed = 1.4 +++ ########################################################### +foreach run ( 01 ) +3dmerge -1blur_fwhm 3.0 -doall -prefix pb03.sub_03.r01.blur pb02.sub_03.r01.volreg+tlrc +++ 3dmerge: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ default -1dindex = 0 +++ default -1tindex = 1 +Program 3dmerge +3dmerge: edit and combine 3D datasets, by RW Cox +++ editing input dataset in memory (49.4 MB) +.............................................................................................................................................................................................................................................-- Wrote edited dataset: ./pb03.sub_03.r01.blur+tlrc.BRIK + +end +foreach run ( 01 ) +3dAutomask -dilate 1 -prefix rm.mask_r01 pb03.sub_03.r01.blur+tlrc +++ 3dAutomask: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: Emperor Zhark +++ Loading dataset pb03.sub_03.r01.blur+tlrc +++ Forming automask + + Fixed clip level = 720.255432 + + Used gradual clip level = 635.817200 .. 804.311340 + + Number voxels above clip level = 27991 + + Clustering voxels ... + + Largest cluster has 27974 voxels + + Clustering voxels ... + + Largest cluster has 27811 voxels + + Filled 108 voxels in small holes; now have 27919 voxels + + Clustering voxels ... + + Largest cluster has 27919 voxels + + Clustering non-brain voxels ... + + Clustering voxels ... + + Largest cluster has 81423 voxels + + Mask now has 27927 voxels +++ Dilating automask + + Clustering voxels ... + + Largest cluster has 76296 voxels +++ 33054 voxels in the mask [out of 109350: 30.23%] +++ first 4 x-planes are zero [from L] +++ last 3 x-planes are zero [from R] +++ first 4 y-planes are zero [from P] +++ last 3 y-planes are zero [from A] +++ first 3 z-planes are zero [from I] +++ last 3 z-planes are zero [from S] +++ CPU time = 0.250000 sec +end +3dmask_tool -inputs rm.mask_r01+tlrc.HEAD -union -prefix full_mask.sub_03 +++ processing 1 input datasets... +++ padding all datasets by 0 (for dilations) +++ frac 0 over 1 volumes gives min count 0 +++ voxel limits: 0 clipped, 33054 survived, 76296 were zero +++ writing result full_mask.sub_03... +3dresample -master full_mask.sub_03+tlrc -input sub-03_ses-test_T1w_ns+tlrc -prefix rm.resam.anat +3dmask_tool -dilate_input 5 -5 -fill_holes -input rm.resam.anat+tlrc -prefix mask_anat.sub_03 +++ no -frac option: defaulting to -union +++ processing 1 input datasets... +++ padding all datasets by 5 (for dilations) +++ frac 0 over 1 volumes gives min count 0 +++ voxel limits: 0 clipped, 30704 survived, 78646 were zero +++ filled 0 holes (0 voxels) +++ writing result mask_anat.sub_03... +3dABoverlap -no_automask full_mask.sub_03+tlrc mask_anat.sub_03+tlrc +tee out.mask_ae_overlap.txt +++ 3dOverlap: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +#A=./full_mask.sub_03+tlrc.BRIK B=./mask_anat.sub_03+tlrc.BRIK +#A #B #(A uni B) #(A int B) #(A \ B) #(B \ A) %(A \ B) %(B \ A) Rx(B/A) Ry(B/A) Rz(B/A) +33054 30704 35804 27954 5100 2750 15.4293 8.9565 0.9508 0.9280 0.9784 +3ddot -dodice full_mask.sub_03+tlrc mask_anat.sub_03+tlrc +tee out.mask_ae_dice.txt +0.876878 +3dresample -master full_mask.sub_03+tlrc -prefix ./rm.resam.group -input /Users/mli/abin/MNI_avg152T1+tlrc +3dmask_tool -dilate_input 5 -5 -fill_holes -input rm.resam.group+tlrc -prefix mask_group +++ no -frac option: defaulting to -union +++ processing 1 input datasets... +++ padding all datasets by 5 (for dilations) +++ frac 0 over 1 volumes gives min count 0 +++ voxel limits: 0 clipped, 30980 survived, 78370 were zero +++ filled 0 holes (0 voxels) +++ writing result mask_group... +foreach run ( 01 ) +3dTstat -prefix rm.mean_r01 pb03.sub_03.r01.blur+tlrc +++ 3dTstat: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: KR Hammett & RW Cox +++ Output dataset ./rm.mean_r01+tlrc.BRIK +3dcalc -a pb03.sub_03.r01.blur+tlrc -b rm.mean_r01+tlrc -c mask_epi_extents+tlrc -expr c * min(200, a/b*100)*step(a)*step(b) -prefix pb04.sub_03.r01.scale +++ 3dcalc: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: A cast of thousands +++ Output dataset ./pb04.sub_03.r01.scale+tlrc.BRIK +end +1d_tool.py -infile dfile_rall.1D -set_nruns 1 -demean -write motion_demean.1D +1d_tool.py -infile dfile_rall.1D -set_nruns 1 -derivative -demean -write motion_deriv.1D +1d_tool.py -infile dfile_rall.1D -set_nruns 1 -show_censor_count -censor_prev_TR -censor_motion 0.5 motion_sub_03 +total number of censored TRs (simple form) = 22 +set ktrs = `1d_tool.py -infile motion_${subj}_censor.1D + -show_trs_uncensored encoded` +1d_tool.py -infile motion_sub_03_censor.1D -show_trs_uncensored encoded +3dDeconvolve -input pb04.sub_03.r01.scale+tlrc.HEAD -censor motion_sub_03_censor.1D -polort 4 -num_stimts 17 -stim_times 1 stimuli/timing_sub-03_ses-test_Correct_Task.1D GAM -stim_label 1 Correct_Task -stim_times 2 stimuli/timing_sub-03_ses-test_Incorrect_Task.1D GAM -stim_label 2 Incorrect_Task -stim_times 3 stimuli/timing_sub-03_ses-test_No_Response_Control.1D GAM -stim_label 3 No_Response_Control -stim_times 4 stimuli/timing_sub-03_ses-test_No_Response_Task.1D GAM -stim_label 4 No_Response_Task -stim_times 5 stimuli/timing_sub-03_ses-test_Response_Control.1D GAM -stim_label 5 Response_Control -stim_file 6 motion_demean.1D[0] -stim_base 6 -stim_label 6 roll_01 -stim_file 7 motion_demean.1D[1] -stim_base 7 -stim_label 7 pitch_01 -stim_file 8 motion_demean.1D[2] -stim_base 8 -stim_label 8 yaw_01 -stim_file 9 motion_demean.1D[3] -stim_base 9 -stim_label 9 dS_01 -stim_file 10 motion_demean.1D[4] -stim_base 10 -stim_label 10 dL_01 -stim_file 11 motion_demean.1D[5] -stim_base 11 -stim_label 11 dP_01 -stim_file 12 motion_deriv.1D[0] -stim_base 12 -stim_label 12 roll_02 -stim_file 13 motion_deriv.1D[1] -stim_base 13 -stim_label 13 pitch_02 -stim_file 14 motion_deriv.1D[2] -stim_base 14 -stim_label 14 yaw_02 -stim_file 15 motion_deriv.1D[3] -stim_base 15 -stim_label 15 dS_02 -stim_file 16 motion_deriv.1D[4] -stim_base 16 -stim_label 16 dL_02 -stim_file 17 motion_deriv.1D[5] -stim_base 17 -stim_label 17 dP_02 -gltsym SYM: 0.5*Correct_Task +0.5*Incorrect_Task -Response_Control -glt_label 1 Landmark-Detection -fout -tout -x1D X.xmat.1D -xjpeg X.jpg -x1D_uncensored X.nocensor.xmat.1D -fitts fitts.sub_03 -errts errts.sub_03 -bucket stats.sub_03 +++ 3dDeconvolve: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: B. Douglas Ward, et al. +++ loading dataset pb04.sub_03.r01.scale+tlrc.HEAD +++ STAT automask has 97106 voxels (out of 109350 = 88.8%) +++ Skipping check for initial transients +++ Input polort=4; Longest run=592.5 s; Recommended minimum polort=4 ++ OK ++ +++ -stim_times using TR=2.5 s for stimulus timing conversion +++ -stim_times using TR=2.5 s for any -iresp output datasets +++ [you can alter the -iresp TR via the -TR_times option] +++ ** -stim_times NOTE ** guessing GLOBAL times if 1 time per line; LOCAL otherwise +++ ** GUESSED ** -stim_times 1 using LOCAL times +++ ** GUESSED ** -stim_times 2 using LOCAL times +++ ** GUESSED ** -stim_times 3 using LOCAL times +++ ** GUESSED ** -stim_times 4 using LOCAL times +++ ** GUESSED ** -stim_times 5 using LOCAL times +------------------------------------------------------------ +GLT matrix from 'SYM: 0.5*Correct_Task +0.5*Incorrect_Task -Response_Control': + 0 0 0 0 0 0.5 0.5 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 + +++ Number of time points: 237 (before censor) ; 215 (after) + + Number of parameters: 22 [17 baseline ; 5 signal] +++ Memory required for output bricks = 215,638,200 bytes (about 216 million [mega]) +++ Wrote matrix image to file X.jpg +++ Wrote matrix values to file X.xmat.1D +++ ========= Things you can do with the matrix file ========= +++ (a) Linear regression with ARMA(1,1) modeling of serial correlation: + +3dREMLfit -matrix X.xmat.1D -input pb04.sub_03.r01.scale+tlrc.HEAD \ + -fout -tout -Rbuck stats.sub_03_REML -Rvar stats.sub_03_REMLvar \ + -Rfitts fitts.sub_03_REML -Rerrts errts.sub_03_REML -verb + +++ N.B.: 3dREMLfit command above written to file stats.REML_cmd +++ (b) Visualization/analysis of the matrix via ExamineXmat.R +++ (c) Synthesis of sub-model datasets using 3dSynthesize +++ ========================================================== +++ Wrote matrix values to file X.nocensor.xmat.1D +++ ----- Signal+Baseline matrix condition [X] (215x22): 7.47726 ++ VERY GOOD ++ +++ ----- Signal-only matrix condition [X] (215x5): 1.47181 ++ VERY GOOD ++ +++ ----- Baseline-only matrix condition [X] (215x17): 7.3131 ++ VERY GOOD ++ +++ ----- stim_base-only matrix condition [X] (215x12): 6.12753 ++ VERY GOOD ++ +++ ----- polort-only matrix condition [X] (215x5): 1.09962 ++ VERY GOOD ++ +++ +++++ Matrix inverse average error = 9.39256e-15 ++ VERY GOOD ++ +++ Matrix setup time = 0.54 s +++ Calculations starting; elapsed time=1.143 +++ voxel loop:0123456789.0123456789.0123456789.0123456789.0123456789. +++ Calculations finished; elapsed time=15.405 +++ Smallest FDR q [0 Full_Fstat] = 6.364e-13 +++ Smallest FDR q [2 Correct_Task#0_Tstat] = 4.42671e-12 +++ Smallest FDR q [3 Correct_Task_Fstat] = 4.42671e-12 +++ Smallest FDR q [5 Incorrect_Task#0_Tstat] = 0.069944 +++ Smallest FDR q [6 Incorrect_Task_Fstat] = 0.0699435 +++ Smallest FDR q [8 No_Response_Control#0_Tstat] = 0.00160631 +++ Smallest FDR q [9 No_Response_Control_Fstat] = 0.00160642 +++ Smallest FDR q [11 No_Response_Task#0_Tstat] = 3.41585e-11 +++ Smallest FDR q [12 No_Response_Task_Fstat] = 3.41585e-11 +++ Smallest FDR q [14 Response_Control#0_Tstat] = 5.26673e-10 +++ Smallest FDR q [15 Response_Control_Fstat] = 5.26673e-10 +++ Smallest FDR q [17 Landmark-Detection_GLT#0_Tstat] = 0.0192157 +++ Smallest FDR q [18 Landmark-Detection_GLT_Fstat] = 0.019215 +++ Wrote bucket dataset into ./stats.sub_03+tlrc.BRIK + + created 13 FDR curves in bucket header +++ Wrote 3D+time dataset into ./fitts.sub_03+tlrc.BRIK +++ Wrote 3D+time dataset into ./errts.sub_03+tlrc.BRIK +++ #Flops=3.93533e+10 Average Dot Product=37.1935 +if ( 0 != 0 ) then +1d_tool.py -show_cormat_warnings -infile X.xmat.1D +tee out.cormat_warn.txt + +Warnings regarding Correlation Matrix: X.xmat.1D + + severity correlation cosine regressor pair + -------- ----------- ------ ---------------------------------------- + medium: 0.570 0.649 ( 7 vs. 9) No_Response_Control#0 vs. Response_Control#0 + +3dTcat -prefix all_runs.sub_03 pb04.sub_03.r01.scale+tlrc.HEAD +++ 3dTcat: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ elapsed time = 0.4 s +3dTstat -mean -prefix rm.signal.all all_runs.sub_03+tlrc[0..47,59,60,68..161,164..187,190..236] +++ 3dTstat: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: KR Hammett & RW Cox +++ Output dataset ./rm.signal.all+tlrc.BRIK +3dTstat -stdev -prefix rm.noise.all errts.sub_03+tlrc[0..47,59,60,68..161,164..187,190..236] +++ 3dTstat: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: KR Hammett & RW Cox +++ Output dataset ./rm.noise.all+tlrc.BRIK +3dcalc -a rm.signal.all+tlrc -b rm.noise.all+tlrc -c full_mask.sub_03+tlrc -expr c*a/b -prefix TSNR.sub_03 +++ 3dcalc: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: A cast of thousands +++ Output dataset ./TSNR.sub_03+tlrc.BRIK +3dTnorm -norm2 -prefix rm.errts.unit errts.sub_03+tlrc +++ 3dTnorm: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: RW Cox +++ Output dataset ./rm.errts.unit+tlrc.BRIK +3dmaskave -quiet -mask full_mask.sub_03+tlrc rm.errts.unit+tlrc +++ 3dmaskave: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] ++++ 33054 voxels survive the mask +3dTstat -sos -prefix - gmean.errts.unit.1D' +++ 3dTstat: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: KR Hammett & RW Cox +*+ WARNING: Input dataset is not 3D+time; assuming TR=1.0 +echo -- GCOR = `cat out.gcor.1D` +cat out.gcor.1D +-- GCOR = 0.0781041 +3dcalc -a rm.errts.unit+tlrc -b gmean.errts.unit.1D -expr a*b -prefix rm.DP +++ 3dcalc: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: A cast of thousands +++ Output dataset ./rm.DP+tlrc.BRIK +3dTstat -sum -prefix corr_brain rm.DP+tlrc +++ 3dTstat: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: KR Hammett & RW Cox +++ Output dataset ./corr_brain+tlrc.BRIK +1dcat X.nocensor.xmat.1D[5] +1dcat X.nocensor.xmat.1D[6] +1dcat X.nocensor.xmat.1D[7] +1dcat X.nocensor.xmat.1D[8] +1dcat X.nocensor.xmat.1D[9] +set reg_cols = `1d_tool.py -infile X.nocensor.xmat.1D -show_indices_interest` +1d_tool.py -infile X.nocensor.xmat.1D -show_indices_interest +3dTstat -sum -prefix sum_ideal.1D X.nocensor.xmat.1D[5..9] +++ 3dTstat: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: KR Hammett & RW Cox +*+ WARNING: Input dataset is not 3D+time; assuming TR=1.0 +++ Output dataset ./sum_ideal.1D +1dcat X.nocensor.xmat.1D[5..9] +touch blur_est.sub_03.1D +mkdir files_ACF +touch blur.epits.1D +foreach run ( 01 ) +set trs = `1d_tool.py -infile X.xmat.1D -show_trs_uncensored encoded + -show_trs_run $run` +1d_tool.py -infile X.xmat.1D -show_trs_uncensored encoded -show_trs_run 01 +if ( 0..47,59,60,68..161,164..187,190..236 == ) continue +3dFWHMx -detrend -mask full_mask.sub_03+tlrc -ACF files_ACF/out.3dFWHMx.ACF.epits.r01.1D all_runs.sub_03+tlrc[0..47,59,60,68..161,164..187,190..236] +++ 3dFWHMx: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: The Bob +++ Number of voxels in mask = 33054 +*+ WARNING: removed 255 voxels from mask because they are constant in time +++ detrending start: 17 baseline funcs, 215 time points + + detrending done (2.58 CPU s thus far) +++ start ACF calculations out to radius = 19.16 mm + + ACF done (34.40 CPU s thus far) +++ ACF 1D file [radius ACF mixed_model gaussian_NEWmodel] written to files_ACF/out.3dFWHMx.ACF.epits.r01.1D +++ 1dplot: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: RWC et al. + + and 1dplot-ed to file files_ACF/out.3dFWHMx.ACF.epits.r01.1D.png +end +set blurs = ( `3dTstat -mean -prefix - blur.epits.1D'{0..$(2)}'\'` ) +3dTstat -mean -prefix - blur.epits.1D{0..$(2)}' +++ 3dTstat: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: KR Hammett & RW Cox +*+ WARNING: Input dataset has 1 sub-brick ==> -tdiff is turned off +*+ WARNING: Input dataset is not 3D+time; assuming TR=1.0 +echo average epits FWHM blurs: 0 0 0 0 +average epits FWHM blurs: 0 0 0 0 +echo 0 0 0 0 # epits FWHM blur estimates +set blurs = ( `3dTstat -mean -prefix - blur.epits.1D'{1..$(2)}'\'` ) +3dTstat -mean -prefix - blur.epits.1D{1..$(2)}' +++ 3dTstat: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: KR Hammett & RW Cox +*+ WARNING: Input dataset has 1 sub-brick ==> -tdiff is turned off +*+ WARNING: Input dataset is not 3D+time; assuming TR=1.0 +echo average epits ACF blurs: 0.798127 3.52816 13.8595 9.13476 +average epits ACF blurs: 0.798127 3.52816 13.8595 9.13476 +echo 0.798127 3.52816 13.8595 9.13476 # epits ACF blur estimates +touch blur.errts.1D +foreach run ( 01 ) +set trs = `1d_tool.py -infile X.xmat.1D -show_trs_uncensored encoded + -show_trs_run $run` +1d_tool.py -infile X.xmat.1D -show_trs_uncensored encoded -show_trs_run 01 +if ( 0..47,59,60,68..161,164..187,190..236 == ) continue +3dFWHMx -detrend -mask full_mask.sub_03+tlrc -ACF files_ACF/out.3dFWHMx.ACF.errts.r01.1D errts.sub_03+tlrc[0..47,59,60,68..161,164..187,190..236] +++ 3dFWHMx: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: The Bob +++ Number of voxels in mask = 33054 +*+ WARNING: removed 255 voxels from mask because they are constant in time +++ detrending start: 17 baseline funcs, 215 time points + + detrending done (2.56 CPU s thus far) +++ start ACF calculations out to radius = 19.06 mm + + ACF done (34.59 CPU s thus far) +++ ACF 1D file [radius ACF mixed_model gaussian_NEWmodel] written to files_ACF/out.3dFWHMx.ACF.errts.r01.1D +++ 1dplot: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: RWC et al. + + and 1dplot-ed to file files_ACF/out.3dFWHMx.ACF.errts.r01.1D.png +end +set blurs = ( `3dTstat -mean -prefix - blur.errts.1D'{0..$(2)}'\'` ) +3dTstat -mean -prefix - blur.errts.1D{0..$(2)}' +++ 3dTstat: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: KR Hammett & RW Cox +*+ WARNING: Input dataset has 1 sub-brick ==> -tdiff is turned off +*+ WARNING: Input dataset is not 3D+time; assuming TR=1.0 +echo average errts FWHM blurs: 0 0 0 0 +average errts FWHM blurs: 0 0 0 0 +echo 0 0 0 0 # errts FWHM blur estimates +set blurs = ( `3dTstat -mean -prefix - blur.errts.1D'{1..$(2)}'\'` ) +3dTstat -mean -prefix - blur.errts.1D{1..$(2)}' +++ 3dTstat: AFNI version=AFNI_17.2.05 (Jul 27 2017) [64-bit] +++ Authored by: KR Hammett & RW Cox +*+ WARNING: Input dataset has 1 sub-brick ==> -tdiff is turned off +*+ WARNING: Input dataset is not 3D+time; assuming TR=1.0 +echo average errts ACF blurs: 0.835807 3.5609 14.5821 9.09429 +average errts ACF blurs: 0.835807 3.5609 14.5821 9.09429 +echo 0.835807 3.5609 14.5821 9.09429 # errts ACF blur estimates +gen_epi_review.py -script @epi_review.sub_03 -dsets pb00.sub_03.r01.tcat+orig.HEAD +gen_ss_review_scripts.py -mot_limit 0.5 -exit0 +++ writing ss review basic: @ss_review_basic +++ writing ss review driver: @ss_review_driver +++ writing ss review drive commands: @ss_review_driver_commands +rm -f rm.DP+tlrc.BRIK rm.DP+tlrc.HEAD rm.epi.1.r01+tlrc.BRIK.gz rm.epi.1.r01+tlrc.HEAD rm.epi.all1+orig.BRIK.gz rm.epi.all1+orig.HEAD rm.epi.min.r01+tlrc.BRIK.gz rm.epi.min.r01+tlrc.HEAD rm.epi.nomask.r01+tlrc.BRIK rm.epi.nomask.r01+tlrc.HEAD rm.epi.volreg.r01+orig.BRIK rm.epi.volreg.r01+orig.HEAD rm.errts.unit+tlrc.BRIK rm.errts.unit+tlrc.HEAD rm.mask_r01+tlrc.BRIK.gz rm.mask_r01+tlrc.HEAD rm.mean_r01+tlrc.BRIK rm.mean_r01+tlrc.HEAD rm.noise.all+tlrc.BRIK rm.noise.all+tlrc.HEAD rm.resam.anat+tlrc.BRIK rm.resam.anat+tlrc.HEAD rm.resam.group+tlrc.BRIK rm.resam.group+tlrc.HEAD rm.signal.all+tlrc.BRIK rm.signal.all+tlrc.HEAD +tee out.ss_review.sub_03.txt +if ( -e @ss_review_basic ) ./@ss_review_basic +./@ss_review_basic + +subject ID : sub_03 +TRs removed (per run) : 1 +num stim classes provided : 5 +final anatomy dset : anat_final.sub_03+tlrc.HEAD +final stats dset : stats.sub_03+tlrc.HEAD +final voxel resolution : 4.000000 4.000000 4.000000 + +motion limit : 0.5 +num TRs above mot limit : 16 +average motion (per TR) : 0.160024 +average censored motion : 0.115175 +max motion displacement : 4.03483 +max censored displacement : 4.03483 +outlier limit : 0.1 +average outlier frac (TR) : 0.0119293 +num TRs above out limit : 8 + +num runs found : 1 +num TRs per run : 237 +num TRs per run (applied) : 215 +num TRs per run (censored): 22 +fraction censored per run : 0.092827 +TRs total (uncensored) : 237 +TRs total : 215 +degrees of freedom used : 22 +degrees of freedom left : 193 + +TRs censored : 22 +censor fraction : 0.092827 +num regs of interest : 5 +num TRs per stim (orig) : 71 43 64 28 79 +num TRs censored per stim : 0 0 13 7 11 +fraction TRs censored : 0.000 0.000 0.203 0.250 0.139 +ave mot per sresp (orig) : 0.105296 0.103826 0.216156 0.210735 0.179376 +ave mot per sresp (cens) : 0.105296 0.103826 0.108428 0.100787 0.100622 + +TSNR average : 148.219 +global correlation (GCOR) : 0.0781041 +anat/EPI mask Dice coef : 0.876878 +maximum F-stat (masked) : 55.9274 +blur estimates (ACF) : 0.835807 3.5609 14.5821 +blur estimates (FWHM) : 0 0 0 + + +cd .. +echo execution finished: `date` +date +execution finished: Sat Aug 5 16:37:42 EDT 2017 diff --git a/hw2/Exp-2/subject_results/group.test/subj.sub_03/proc.sub_03 b/hw2/Exp-2/subject_results/group.test/subj.sub_03/proc.sub_03 new file mode 100755 index 0000000..d0d55fa --- /dev/null +++ b/hw2/Exp-2/subject_results/group.test/subj.sub_03/proc.sub_03 @@ -0,0 +1,477 @@ +#!/bin/tcsh -xef + +echo "auto-generated by afni_proc.py, Sat Aug 5 16:33:35 2017" +echo "(version 5.15, April 25, 2017)" +echo "execution started: `date`" + +# execute via : +# tcsh -xef proc.sub_03 |& tee output.proc.sub_03 + +# =========================== auto block: setup ============================ +# script setup + +# take note of the AFNI version +afni -ver + +# check that the current AFNI version is recent enough +afni_history -check_date 23 Sep 2016 +if ( $status ) then + echo "** this script requires newer AFNI binaries (than 23 Sep 2016)" + echo " (consider: @update.afni.binaries -defaults)" + exit +endif + +# the user may specify a single subject to run with +if ( $#argv > 0 ) then + set subj = $argv[1] +else + set subj = sub_03 +endif + +# assign output directory name +set output_dir = $subj.results + +# verify that the results directory does not yet exist +if ( -d $output_dir ) then + echo output dir "$subj.results" already exists + exit +endif + +# set list of runs +set runs = (`count -digits 2 1 1`) + +# create results and stimuli directories +mkdir $output_dir +mkdir $output_dir/stimuli + +# copy stim files into stimulus directory +cp /Users/mli/Desktop/playground/timing_sub-03_ses-test_Correct_Task.1D \ + /Users/mli/Desktop/playground/timing_sub-03_ses-test_Incorrect_Task.1D \ + /Users/mli/Desktop/playground/timing_sub-03_ses-test_No_Response_Control.1D \ + /Users/mli/Desktop/playground/timing_sub-03_ses-test_No_Response_Task.1D \ + /Users/mli/Desktop/playground/timing_sub-03_ses-test_Response_Control.1D \ + $output_dir/stimuli + +# copy anatomy to results dir +3dcopy \ + /Users/mli/Desktop/playground/sub-03/ses-test/anat/sub-03_ses-test_T1w.nii.gz \ + $output_dir/sub-03_ses-test_T1w + +# ============================ auto block: tcat ============================ +# apply 3dTcat to copy input dsets to results dir, while +# removing the first 1 TRs +3dTcat -prefix $output_dir/pb00.$subj.r01.tcat \ + /Users/mli/Desktop/playground/sub-03/ses-test/func/sub-03_ses-test_task-linebisection_bold.nii.gz'[1..$]' + +# and make note of repetitions (TRs) per run +set tr_counts = ( 237 ) + +# ------------------------------------------------------- +# enter the results directory (can begin processing data) +cd $output_dir + + +# ========================== auto block: outcount ========================== +# data check: compute outlier fraction for each volume +touch out.pre_ss_warn.txt +foreach run ( $runs ) + 3dToutcount -automask -fraction -polort 4 -legendre \ + pb00.$subj.r$run.tcat+orig > outcount.r$run.1D + + # outliers at TR 0 might suggest pre-steady state TRs + if ( `1deval -a outcount.r$run.1D"{0}" -expr "step(a-0.4)"` ) then + echo "** TR #0 outliers: possible pre-steady state TRs in run $run" \ + >> out.pre_ss_warn.txt + endif +end + +# catenate outlier counts into a single time series +cat outcount.r*.1D > outcount_rall.1D + +# ================================= tshift ================================= +# time shift data so all slice timing is the same +foreach run ( $runs ) + 3dTshift -tzero 0 -quintic -prefix pb01.$subj.r$run.tshift \ + -tpattern alt+z \ + pb00.$subj.r$run.tcat+orig +end + +# -------------------------------- +# extract volreg registration base +3dbucket -prefix vr_base pb01.$subj.r01.tshift+orig"[2]" + +# ================================= align ================================== +# for e2a: compute anat alignment transformation to EPI registration base +# (new anat will be intermediate, stripped, sub-03_ses-test_T1w_ns+orig) +align_epi_anat.py -anat2epi -anat sub-03_ses-test_T1w+orig \ + -save_skullstrip -suffix _al_junk \ + -epi vr_base+orig -epi_base 0 \ + -epi_strip 3dAutomask \ + -volreg off -tshift off + +# ================================== tlrc ================================== +# warp anatomy to standard space +@auto_tlrc -base MNI_avg152T1+tlrc -input sub-03_ses-test_T1w_ns+orig -no_ss + +# store forward transformation matrix in a text file +cat_matvec sub-03_ses-test_T1w_ns+tlrc::WARP_DATA -I > warp.anat.Xat.1D + +# ================================= volreg ================================= +# align each dset to base volume, align to anat, warp to tlrc space + +# verify that we have a +tlrc warp dataset +if ( ! -f sub-03_ses-test_T1w_ns+tlrc.HEAD ) then + echo "** missing +tlrc warp dataset: sub-03_ses-test_T1w_ns+tlrc.HEAD" + exit +endif + +# register and warp +foreach run ( $runs ) + # register each volume to the base + 3dvolreg -verbose -zpad 1 -base vr_base+orig \ + -1Dfile dfile.r$run.1D -prefix rm.epi.volreg.r$run \ + -cubic \ + -1Dmatrix_save mat.r$run.vr.aff12.1D \ + pb01.$subj.r$run.tshift+orig + + # create an all-1 dataset to mask the extents of the warp + 3dcalc -overwrite -a pb01.$subj.r$run.tshift+orig -expr 1 \ + -prefix rm.epi.all1 + + # catenate volreg/epi2anat/tlrc xforms + cat_matvec -ONELINE \ + sub-03_ses-test_T1w_ns+tlrc::WARP_DATA -I \ + sub-03_ses-test_T1w_al_junk_mat.aff12.1D -I \ + mat.r$run.vr.aff12.1D > mat.r$run.warp.aff12.1D + + # apply catenated xform: volreg/epi2anat/tlrc + 3dAllineate -base sub-03_ses-test_T1w_ns+tlrc \ + -input pb01.$subj.r$run.tshift+orig \ + -1Dmatrix_apply mat.r$run.warp.aff12.1D \ + -mast_dxyz 4 \ + -prefix rm.epi.nomask.r$run + + # warp the all-1 dataset for extents masking + 3dAllineate -base sub-03_ses-test_T1w_ns+tlrc \ + -input rm.epi.all1+orig \ + -1Dmatrix_apply mat.r$run.warp.aff12.1D \ + -mast_dxyz 4 -final NN -quiet \ + -prefix rm.epi.1.r$run + + # make an extents intersection mask of this run + 3dTstat -min -prefix rm.epi.min.r$run rm.epi.1.r$run+tlrc +end + +# make a single file of registration params +cat dfile.r*.1D > dfile_rall.1D + +# ---------------------------------------- +# create the extents mask: mask_epi_extents+tlrc +# (this is a mask of voxels that have valid data at every TR) +# (only 1 run, so just use 3dcopy to keep naming straight) +3dcopy rm.epi.min.r01+tlrc mask_epi_extents + +# and apply the extents mask to the EPI data +# (delete any time series with missing data) +foreach run ( $runs ) + 3dcalc -a rm.epi.nomask.r$run+tlrc -b mask_epi_extents+tlrc \ + -expr 'a*b' -prefix pb02.$subj.r$run.volreg +end + +# warp the volreg base EPI dataset to make a final version +cat_matvec -ONELINE \ + sub-03_ses-test_T1w_ns+tlrc::WARP_DATA -I \ + sub-03_ses-test_T1w_al_junk_mat.aff12.1D -I > \ + mat.basewarp.aff12.1D + +3dAllineate -base sub-03_ses-test_T1w_ns+tlrc \ + -input vr_base+orig \ + -1Dmatrix_apply mat.basewarp.aff12.1D \ + -mast_dxyz 4 \ + -prefix final_epi_vr_base + +# create an anat_final dataset, aligned with stats +3dcopy sub-03_ses-test_T1w_ns+tlrc anat_final.$subj + +# record final registration costs +3dAllineate -base final_epi_vr_base+tlrc -allcostX \ + -input anat_final.$subj+tlrc |& tee out.allcostX.txt + +# ----------------------------------------- +# warp anat follower datasets (affine) +3dAllineate -source sub-03_ses-test_T1w+orig \ + -master anat_final.$subj+tlrc \ + -final wsinc5 -1Dmatrix_apply warp.anat.Xat.1D \ + -prefix anat_w_skull_warped + +# ================================== blur ================================== +# blur each volume of each run +foreach run ( $runs ) + 3dmerge -1blur_fwhm 3.0 -doall -prefix pb03.$subj.r$run.blur \ + pb02.$subj.r$run.volreg+tlrc +end + +# ================================== mask ================================== +# create 'full_mask' dataset (union mask) +foreach run ( $runs ) + 3dAutomask -dilate 1 -prefix rm.mask_r$run pb03.$subj.r$run.blur+tlrc +end + +# create union of inputs, output type is byte +3dmask_tool -inputs rm.mask_r*+tlrc.HEAD -union -prefix full_mask.$subj + +# ---- create subject anatomy mask, mask_anat.$subj+tlrc ---- +# (resampled from tlrc anat) +3dresample -master full_mask.$subj+tlrc -input sub-03_ses-test_T1w_ns+tlrc \ + -prefix rm.resam.anat + +# convert to binary anat mask; fill gaps and holes +3dmask_tool -dilate_input 5 -5 -fill_holes -input rm.resam.anat+tlrc \ + -prefix mask_anat.$subj + +# compute overlaps between anat and EPI masks +3dABoverlap -no_automask full_mask.$subj+tlrc mask_anat.$subj+tlrc \ + |& tee out.mask_ae_overlap.txt + +# note Dice coefficient of masks, as well +3ddot -dodice full_mask.$subj+tlrc mask_anat.$subj+tlrc \ + |& tee out.mask_ae_dice.txt + +# ---- create group anatomy mask, mask_group+tlrc ---- +# (resampled from tlrc base anat, MNI_avg152T1+tlrc) +3dresample -master full_mask.$subj+tlrc -prefix ./rm.resam.group \ + -input /Users/mli/abin/MNI_avg152T1+tlrc + +# convert to binary group mask; fill gaps and holes +3dmask_tool -dilate_input 5 -5 -fill_holes -input rm.resam.group+tlrc \ + -prefix mask_group + +# ================================= scale ================================== +# scale each voxel time series to have a mean of 100 +# (be sure no negatives creep in) +# (subject to a range of [0,200]) +foreach run ( $runs ) + 3dTstat -prefix rm.mean_r$run pb03.$subj.r$run.blur+tlrc + 3dcalc -a pb03.$subj.r$run.blur+tlrc -b rm.mean_r$run+tlrc \ + -c mask_epi_extents+tlrc \ + -expr 'c * min(200, a/b*100)*step(a)*step(b)' \ + -prefix pb04.$subj.r$run.scale +end + +# ================================ regress ================================= + +# compute de-meaned motion parameters (for use in regression) +1d_tool.py -infile dfile_rall.1D -set_nruns 1 \ + -demean -write motion_demean.1D + +# compute motion parameter derivatives (for use in regression) +1d_tool.py -infile dfile_rall.1D -set_nruns 1 \ + -derivative -demean -write motion_deriv.1D + +# create censor file motion_${subj}_censor.1D, for censoring motion +1d_tool.py -infile dfile_rall.1D -set_nruns 1 \ + -show_censor_count -censor_prev_TR \ + -censor_motion 0.5 motion_${subj} + +# note TRs that were not censored +set ktrs = `1d_tool.py -infile motion_${subj}_censor.1D \ + -show_trs_uncensored encoded` + +# ------------------------------ +# run the regression analysis +3dDeconvolve -input pb04.$subj.r*.scale+tlrc.HEAD \ + -censor motion_${subj}_censor.1D \ + -polort 4 \ + -num_stimts 17 \ + -stim_times 1 stimuli/timing_sub-03_ses-test_Correct_Task.1D 'GAM' \ + -stim_label 1 Correct_Task \ + -stim_times 2 stimuli/timing_sub-03_ses-test_Incorrect_Task.1D 'GAM' \ + -stim_label 2 Incorrect_Task \ + -stim_times 3 stimuli/timing_sub-03_ses-test_No_Response_Control.1D 'GAM' \ + -stim_label 3 No_Response_Control \ + -stim_times 4 stimuli/timing_sub-03_ses-test_No_Response_Task.1D 'GAM' \ + -stim_label 4 No_Response_Task \ + -stim_times 5 stimuli/timing_sub-03_ses-test_Response_Control.1D 'GAM' \ + -stim_label 5 Response_Control \ + -stim_file 6 motion_demean.1D'[0]' -stim_base 6 -stim_label 6 roll_01 \ + -stim_file 7 motion_demean.1D'[1]' -stim_base 7 -stim_label 7 pitch_01 \ + -stim_file 8 motion_demean.1D'[2]' -stim_base 8 -stim_label 8 yaw_01 \ + -stim_file 9 motion_demean.1D'[3]' -stim_base 9 -stim_label 9 dS_01 \ + -stim_file 10 motion_demean.1D'[4]' -stim_base 10 -stim_label 10 dL_01 \ + -stim_file 11 motion_demean.1D'[5]' -stim_base 11 -stim_label 11 dP_01 \ + -stim_file 12 motion_deriv.1D'[0]' -stim_base 12 -stim_label 12 roll_02 \ + -stim_file 13 motion_deriv.1D'[1]' -stim_base 13 -stim_label 13 pitch_02 \ + -stim_file 14 motion_deriv.1D'[2]' -stim_base 14 -stim_label 14 yaw_02 \ + -stim_file 15 motion_deriv.1D'[3]' -stim_base 15 -stim_label 15 dS_02 \ + -stim_file 16 motion_deriv.1D'[4]' -stim_base 16 -stim_label 16 dL_02 \ + -stim_file 17 motion_deriv.1D'[5]' -stim_base 17 -stim_label 17 dP_02 \ + -gltsym 'SYM: 0.5*Correct_Task +0.5*Incorrect_Task -Response_Control' \ + -glt_label 1 Landmark-Detection \ + -fout -tout -x1D X.xmat.1D -xjpeg X.jpg \ + -x1D_uncensored X.nocensor.xmat.1D \ + -fitts fitts.$subj \ + -errts errts.${subj} \ + -bucket stats.$subj + + +# if 3dDeconvolve fails, terminate the script +if ( $status != 0 ) then + echo '---------------------------------------' + echo '** 3dDeconvolve error, failing...' + echo ' (consider the file 3dDeconvolve.err)' + exit +endif + + +# display any large pairwise correlations from the X-matrix +1d_tool.py -show_cormat_warnings -infile X.xmat.1D |& tee out.cormat_warn.txt + +# create an all_runs dataset to match the fitts, errts, etc. +3dTcat -prefix all_runs.$subj pb04.$subj.r*.scale+tlrc.HEAD + +# -------------------------------------------------- +# create a temporal signal to noise ratio dataset +# signal: if 'scale' block, mean should be 100 +# noise : compute standard deviation of errts +3dTstat -mean -prefix rm.signal.all all_runs.$subj+tlrc"[$ktrs]" +3dTstat -stdev -prefix rm.noise.all errts.${subj}+tlrc"[$ktrs]" +3dcalc -a rm.signal.all+tlrc \ + -b rm.noise.all+tlrc \ + -c full_mask.$subj+tlrc \ + -expr 'c*a/b' -prefix TSNR.$subj + +# --------------------------------------------------- +# compute and store GCOR (global correlation average) +# (sum of squares of global mean of unit errts) +3dTnorm -norm2 -prefix rm.errts.unit errts.${subj}+tlrc +3dmaskave -quiet -mask full_mask.$subj+tlrc rm.errts.unit+tlrc \ + > gmean.errts.unit.1D +3dTstat -sos -prefix - gmean.errts.unit.1D\' > out.gcor.1D +echo "-- GCOR = `cat out.gcor.1D`" + +# --------------------------------------------------- +# compute correlation volume +# (per voxel: average correlation across masked brain) +# (now just dot product with average unit time series) +3dcalc -a rm.errts.unit+tlrc -b gmean.errts.unit.1D -expr 'a*b' -prefix rm.DP +3dTstat -sum -prefix corr_brain rm.DP+tlrc + +# create ideal files for fixed response stim types +1dcat X.nocensor.xmat.1D'[5]' > ideal_Correct_Task.1D +1dcat X.nocensor.xmat.1D'[6]' > ideal_Incorrect_Task.1D +1dcat X.nocensor.xmat.1D'[7]' > ideal_No_Response_Control.1D +1dcat X.nocensor.xmat.1D'[8]' > ideal_No_Response_Task.1D +1dcat X.nocensor.xmat.1D'[9]' > ideal_Response_Control.1D + +# -------------------------------------------------------- +# compute sum of non-baseline regressors from the X-matrix +# (use 1d_tool.py to get list of regressor colums) +set reg_cols = `1d_tool.py -infile X.nocensor.xmat.1D -show_indices_interest` +3dTstat -sum -prefix sum_ideal.1D X.nocensor.xmat.1D"[$reg_cols]" + +# also, create a stimulus-only X-matrix, for easy review +1dcat X.nocensor.xmat.1D"[$reg_cols]" > X.stim.xmat.1D + +# ============================ blur estimation ============================= +# compute blur estimates +touch blur_est.$subj.1D # start with empty file + +# create directory for ACF curve files +mkdir files_ACF + +# -- estimate blur for each run in epits -- +touch blur.epits.1D + +# restrict to uncensored TRs, per run +foreach run ( $runs ) + set trs = `1d_tool.py -infile X.xmat.1D -show_trs_uncensored encoded \ + -show_trs_run $run` + if ( $trs == "" ) continue + 3dFWHMx -detrend -mask full_mask.$subj+tlrc \ + -ACF files_ACF/out.3dFWHMx.ACF.epits.r$run.1D \ + all_runs.$subj+tlrc"[$trs]" >> blur.epits.1D +end + +# compute average FWHM blur (from every other row) and append +set blurs = ( `3dTstat -mean -prefix - blur.epits.1D'{0..$(2)}'\'` ) +echo average epits FWHM blurs: $blurs +echo "$blurs # epits FWHM blur estimates" >> blur_est.$subj.1D + +# compute average ACF blur (from every other row) and append +set blurs = ( `3dTstat -mean -prefix - blur.epits.1D'{1..$(2)}'\'` ) +echo average epits ACF blurs: $blurs +echo "$blurs # epits ACF blur estimates" >> blur_est.$subj.1D + +# -- estimate blur for each run in errts -- +touch blur.errts.1D + +# restrict to uncensored TRs, per run +foreach run ( $runs ) + set trs = `1d_tool.py -infile X.xmat.1D -show_trs_uncensored encoded \ + -show_trs_run $run` + if ( $trs == "" ) continue + 3dFWHMx -detrend -mask full_mask.$subj+tlrc \ + -ACF files_ACF/out.3dFWHMx.ACF.errts.r$run.1D \ + errts.${subj}+tlrc"[$trs]" >> blur.errts.1D +end + +# compute average FWHM blur (from every other row) and append +set blurs = ( `3dTstat -mean -prefix - blur.errts.1D'{0..$(2)}'\'` ) +echo average errts FWHM blurs: $blurs +echo "$blurs # errts FWHM blur estimates" >> blur_est.$subj.1D + +# compute average ACF blur (from every other row) and append +set blurs = ( `3dTstat -mean -prefix - blur.errts.1D'{1..$(2)}'\'` ) +echo average errts ACF blurs: $blurs +echo "$blurs # errts ACF blur estimates" >> blur_est.$subj.1D + + +# ================== auto block: generate review scripts =================== + +# generate a review script for the unprocessed EPI data +gen_epi_review.py -script @epi_review.$subj \ + -dsets pb00.$subj.r*.tcat+orig.HEAD + +# generate scripts to review single subject results +# (try with defaults, but do not allow bad exit status) +gen_ss_review_scripts.py -mot_limit 0.5 -exit0 + +# ========================== auto block: finalize ========================== + +# remove temporary files +\rm -f rm.* + +# if the basic subject review script is here, run it +# (want this to be the last text output) +if ( -e @ss_review_basic ) ./@ss_review_basic |& tee out.ss_review.$subj.txt + +# return to parent directory +cd .. + +echo "execution finished: `date`" + + + + +# ========================================================================== +# script generated by the command: +# +# afni_proc.py -subj_id sub_03 -script proc.sub_03 -scr_overwrite -blocks \ +# tshift align tlrc volreg blur mask scale regress -copy_anat \ +# /Users/mli/Desktop/playground/sub-03/ses-test/anat/sub-03_ses-test_T1w.nii.gz \ +# -tcat_remove_first_trs 1 -tshift_opts_ts -tpattern alt+z -dsets \ +# /Users/mli/Desktop/playground/sub-03/ses-test/func/sub-03_ses-test_task-linebisection_bold.nii.gz \ +# -tlrc_base MNI_avg152T1+tlrc -volreg_align_to third -volreg_align_e2a \ +# -volreg_tlrc_warp -blur_size 3.0 -regress_stim_times \ +# /Users/mli/Desktop/playground/timing_sub-03_ses-test_Correct_Task.1D \ +# /Users/mli/Desktop/playground/timing_sub-03_ses-test_Incorrect_Task.1D \ +# /Users/mli/Desktop/playground/timing_sub-03_ses-test_No_Response_Control.1D \ +# /Users/mli/Desktop/playground/timing_sub-03_ses-test_No_Response_Task.1D \ +# /Users/mli/Desktop/playground/timing_sub-03_ses-test_Response_Control.1D \ +# -regress_stim_labels Correct_Task Incorrect_Task No_Response_Control \ +# No_Response_Task Response_Control -regress_basis GAM \ +# -regress_censor_motion 0.5 -regress_apply_mot_types demean deriv \ +# -regress_opts_3dD -gltsym 'SYM: 0.5*Correct_Task +0.5*Incorrect_Task \ +# -Response_Control' -glt_label 1 Landmark-Detection \ +# -regress_make_ideal_sum sum_ideal.1D -regress_est_blur_epits \ +# -regress_est_blur_errts -regress_run_clustsim no diff --git a/hw2/HomeworkAnswers.md b/hw2/HomeworkAnswers.md new file mode 100644 index 0000000..3292c37 --- /dev/null +++ b/hw2/HomeworkAnswers.md @@ -0,0 +1,12 @@ +# Dice Coefficient Output +## Experiment 1 (smoothing FWHM = 6 mm) ++++ 30980 voxels in the mask +0.198745 + +## Experiment 2 (smoothing FWHM = 3 mm) ++++ 30980 voxels in the mask +0.161541 + +# Interpretation +The Dice coefficient is larger when the smoothing kernel is larger. +This is because there is less noise when the data is more smoothed, resulting in higher reliability between test and retest sessions due to more robust signal. diff --git a/hw2/sub-03/ses-retest/func/sub-03_ses-retest_task-linebisection_events.tsv b/hw2/sub-03/ses-retest/func/sub-03_ses-retest_task-linebisection_events.tsv new file mode 100755 index 0000000..fe96fb0 --- /dev/null +++ b/hw2/sub-03/ses-retest/func/sub-03_ses-retest_task-linebisection_events.tsv @@ -0,0 +1,161 @@ +onset duration weight trial_type +24.3064 1 1.0 Correct_Task +25.9464 1 1.0 Incorrect_Task +27.5864 1 1.0 Correct_Task +29.2264 1 1.0 Correct_Task +30.8664 1 1.0 Correct_Task +32.5064 1 1.0 Correct_Task +34.1464 1 1.0 Incorrect_Task +35.7863 1 1.0 Correct_Task +37.4263 1 1.0 Correct_Task +39.0663 1 1.0 Correct_Task +56.9728 1 1.0 Response_Control +58.6128 1 1.0 Response_Control +60.2528 1 1.0 Response_Control +61.8928 1 1.0 No_Response_Control +63.5328 1 1.0 Response_Control +65.1728 1 1.0 Response_Control +66.8128 1 1.0 Response_Control +68.4528 1 1.0 Response_Control +70.0928 1 1.0 Response_Control +71.7327 1 1.0 No_Response_Control +89.6393 1 1.0 Correct_Task +91.2793 1 1.0 Correct_Task +92.9193 1 1.0 Correct_Task +94.5592 1 1.0 Incorrect_Task +96.1992 1 1.0 Correct_Task +97.8392 1 1.0 Incorrect_Task +99.4792 1 1.0 Correct_Task +101.1192 1 1.0 Correct_Task +102.7592 1 1.0 Correct_Task +104.3992 1 1.0 Correct_Task +122.3057 1 1.0 Response_Control +123.9457 1 1.0 Response_Control +125.5857 1 1.0 Response_Control +127.2257 1 1.0 Response_Control +128.8657 1 1.0 Response_Control +130.5056 1 1.0 Response_Control +132.1456 1 1.0 Response_Control +133.7856 1 1.0 Response_Control +135.4256 1 1.0 Response_Control +137.0656 1 1.0 No_Response_Control +154.9721 1 1.0 Incorrect_Task +156.6121 1 1.0 Correct_Task +158.2521 1 1.0 Correct_Task +159.8921 1 1.0 Correct_Task +161.5321 1 1.0 Incorrect_Task +163.1721 1 1.0 Incorrect_Task +164.8121 1 1.0 Correct_Task +166.4521 1 1.0 Correct_Task +168.092 1 1.0 Incorrect_Task +169.732 1 1.0 Correct_Task +187.6386 1 1.0 Response_Control +189.2785 1 1.0 Response_Control +190.9185 1 1.0 Response_Control +192.5585 1 1.0 Response_Control +194.1985 1 1.0 Response_Control +195.8385 1 1.0 Response_Control +197.4785 1 1.0 Response_Control +199.1185 1 1.0 Response_Control +200.7585 1 1.0 Response_Control +202.3985 1 1.0 No_Response_Control +220.305 1 1.0 Incorrect_Task +221.945 1 1.0 No_Response_Task +223.585 1 1.0 Correct_Task +225.225 1 1.0 Correct_Task +226.8649 1 1.0 No_Response_Task +228.5049 1 1.0 Correct_Task +230.1449 1 1.0 Correct_Task +231.7849 1 1.0 Correct_Task +233.4249 1 1.0 Incorrect_Task +235.0649 1 1.0 Correct_Task +252.9714 1 1.0 Response_Control +254.6114 1 1.0 Response_Control +256.2514 1 1.0 Response_Control +257.8914 1 1.0 Response_Control +259.5314 1 1.0 Response_Control +261.1714 1 1.0 Response_Control +262.8114 1 1.0 Response_Control +264.4513 1 1.0 Response_Control +266.0913 1 1.0 Response_Control +267.7313 1 1.0 No_Response_Control +285.6379 1 1.0 Correct_Task +287.2778 1 1.0 No_Response_Task +288.9178 1 1.0 Correct_Task +290.5578 1 1.0 Correct_Task +292.1978 1 1.0 Incorrect_Task +293.8378 1 1.0 No_Response_Task +295.4778 1 1.0 Correct_Task +297.1178 1 1.0 Correct_Task +298.7578 1 1.0 Correct_Task +300.3977 1 1.0 Incorrect_Task +318.3043 1 1.0 Response_Control +319.9443 1 1.0 Response_Control +321.5843 1 1.0 Response_Control +323.2243 1 1.0 Response_Control +324.8642 1 1.0 Response_Control +326.5042 1 1.0 Response_Control +328.1442 1 1.0 Response_Control +329.7842 1 1.0 Response_Control +331.4242 1 1.0 Response_Control +333.0642 1 1.0 No_Response_Control +350.9707 1 1.0 Correct_Task +352.6107 1 1.0 Correct_Task +354.2507 1 1.0 Correct_Task +355.8907 1 1.0 Correct_Task +357.5307 1 1.0 Incorrect_Task +359.1707 1 1.0 Incorrect_Task +360.8106 1 1.0 Correct_Task +362.4506 1 1.0 Correct_Task +364.0906 1 1.0 Correct_Task +365.7306 1 1.0 Correct_Task +383.6372 1 1.0 Response_Control +385.2771 1 1.0 Response_Control +386.9171 1 1.0 Response_Control +388.5571 1 1.0 Response_Control +390.1971 1 1.0 Response_Control +391.8371 1 1.0 Response_Control +393.4771 1 1.0 Response_Control +395.1171 1 1.0 Response_Control +396.7571 1 1.0 Response_Control +398.397 1 1.0 No_Response_Control +416.3036 1 1.0 Incorrect_Task +417.9436 1 1.0 Correct_Task +419.5836 1 1.0 Correct_Task +421.2235 1 1.0 Incorrect_Task +422.8635 1 1.0 Correct_Task +424.5035 1 1.0 Correct_Task +426.1435 1 1.0 Correct_Task +427.7835 1 1.0 Correct_Task +429.4235 1 1.0 Correct_Task +431.0635 1 1.0 Correct_Task +448.97 1 1.0 Response_Control +450.61 1 1.0 Response_Control +452.25 1 1.0 Response_Control +453.89 1 1.0 Response_Control +455.53 1 1.0 No_Response_Control +457.17 1 1.0 Response_Control +458.8099 1 1.0 Response_Control +460.4499 1 1.0 No_Response_Control +462.0899 1 1.0 Response_Control +463.7299 1 1.0 No_Response_Control +481.6365 1 1.0 No_Response_Task +483.2764 1 1.0 Correct_Task +484.9164 1 1.0 Correct_Task +486.5564 1 1.0 Incorrect_Task +488.1964 1 1.0 Correct_Task +489.8364 1 1.0 Correct_Task +491.4764 1 1.0 Correct_Task +493.1164 1 1.0 Correct_Task +494.7564 1 1.0 Correct_Task +496.3963 1 1.0 Correct_Task +514.3029 1 1.0 Response_Control +515.9429 1 1.0 Response_Control +517.5828 1 1.0 No_Response_Control +519.2228 1 1.0 Response_Control +520.8628 1 1.0 Response_Control +522.5028 1 1.0 Response_Control +524.1428 1 1.0 Response_Control +525.7828 1 1.0 Response_Control +527.4228 1 1.0 No_Response_Control +529.0628 1 1.0 Response_Control diff --git a/hw2/sub-03/ses-test/func/sub-03_ses-test_task-linebisection_events.tsv b/hw2/sub-03/ses-test/func/sub-03_ses-test_task-linebisection_events.tsv new file mode 100755 index 0000000..1004d66 --- /dev/null +++ b/hw2/sub-03/ses-test/func/sub-03_ses-test_task-linebisection_events.tsv @@ -0,0 +1,161 @@ +onset duration weight trial_type +24.3062 1 1.0 Correct_Task +25.9462 1 1.0 Incorrect_Task +27.5862 1 1.0 Correct_Task +29.2262 1 1.0 Correct_Task +30.8662 1 1.0 Correct_Task +32.5061 1 1.0 Correct_Task +34.1461 1 1.0 Correct_Task +35.7861 1 1.0 Correct_Task +37.4261 1 1.0 Correct_Task +39.066 1 1.0 Correct_Task +56.9724 1 1.0 Response_Control +58.6124 1 1.0 Response_Control +60.2524 1 1.0 Response_Control +61.8924 1 1.0 No_Response_Control +63.5324 1 1.0 Response_Control +65.1723 1 1.0 Response_Control +66.8123 1 1.0 No_Response_Control +68.4523 1 1.0 Response_Control +70.0923 1 1.0 Response_Control +71.7322 1 1.0 No_Response_Control +89.6386 1 1.0 Correct_Task +91.2786 1 1.0 Correct_Task +92.9186 1 1.0 No_Response_Task +94.5586 1 1.0 Correct_Task +96.1986 1 1.0 Incorrect_Task +97.8385 1 1.0 No_Response_Task +99.4785 1 1.0 Correct_Task +101.1185 1 1.0 Incorrect_Task +102.7585 1 1.0 Correct_Task +104.3984 1 1.0 Correct_Task +122.3049 1 1.0 No_Response_Control +123.9448 1 1.0 Response_Control +125.5848 1 1.0 Response_Control +127.2248 1 1.0 Response_Control +128.8648 1 1.0 No_Response_Control +130.5047 1 1.0 No_Response_Control +132.1447 1 1.0 No_Response_Control +133.7847 1 1.0 Response_Control +135.4247 1 1.0 Response_Control +137.0646 1 1.0 No_Response_Control +154.9711 1 1.0 No_Response_Task +156.611 1 1.0 No_Response_Task +158.251 1 1.0 No_Response_Task +159.891 1 1.0 No_Response_Task +161.531 1 1.0 No_Response_Task +163.1709 1 1.0 No_Response_Task +164.8109 1 1.0 No_Response_Task +166.4509 1 1.0 No_Response_Task +168.0909 1 1.0 No_Response_Task +169.7308 1 1.0 No_Response_Task +187.6373 1 1.0 Response_Control +189.2772 1 1.0 Response_Control +190.9172 1 1.0 Response_Control +192.5572 1 1.0 Response_Control +194.1972 1 1.0 No_Response_Control +195.8371 1 1.0 Response_Control +197.4771 1 1.0 Response_Control +199.1171 1 1.0 Response_Control +200.7571 1 1.0 No_Response_Control +202.397 1 1.0 Response_Control +220.3035 1 1.0 Correct_Task +221.9434 1 1.0 Incorrect_Task +223.5834 1 1.0 Correct_Task +225.2234 1 1.0 Correct_Task +226.8634 1 1.0 Correct_Task +228.5033 1 1.0 Correct_Task +230.1433 1 1.0 No_Response_Task +231.7833 1 1.0 Correct_Task +233.4233 1 1.0 Correct_Task +235.0632 1 1.0 Correct_Task +252.9697 1 1.0 Response_Control +254.6096 1 1.0 No_Response_Control +256.2496 1 1.0 No_Response_Control +257.8896 1 1.0 Response_Control +259.5296 1 1.0 Response_Control +261.1695 1 1.0 No_Response_Control +262.8095 1 1.0 Response_Control +264.4495 1 1.0 Response_Control +266.0895 1 1.0 Response_Control +267.7294 1 1.0 Response_Control +285.6359 1 1.0 No_Response_Task +287.2758 1 1.0 Correct_Task +288.9158 1 1.0 Incorrect_Task +290.5558 1 1.0 Correct_Task +292.1958 1 1.0 Correct_Task +293.8357 1 1.0 No_Response_Task +295.4757 1 1.0 Correct_Task +297.1157 1 1.0 Incorrect_Task +298.7557 1 1.0 Incorrect_Task +300.3956 1 1.0 Correct_Task +318.3021 1 1.0 Response_Control +319.942 1 1.0 Response_Control +321.582 1 1.0 Response_Control +323.222 1 1.0 Response_Control +324.862 1 1.0 Response_Control +326.5019 1 1.0 Response_Control +328.1419 1 1.0 Response_Control +329.7819 1 1.0 Response_Control +331.4219 1 1.0 No_Response_Control +333.0618 1 1.0 Response_Control +350.9683 1 1.0 Correct_Task +352.6082 1 1.0 Correct_Task +354.2482 1 1.0 Correct_Task +355.8882 1 1.0 Correct_Task +357.5282 1 1.0 Incorrect_Task +359.1681 1 1.0 Correct_Task +360.8081 1 1.0 Correct_Task +362.4481 1 1.0 Correct_Task +364.0881 1 1.0 Correct_Task +365.728 1 1.0 Incorrect_Task +383.6345 1 1.0 Response_Control +385.2744 1 1.0 Response_Control +386.9144 1 1.0 Response_Control +388.5544 1 1.0 Response_Control +390.1944 1 1.0 Response_Control +391.8343 1 1.0 No_Response_Control +393.4743 1 1.0 Response_Control +395.1143 1 1.0 Response_Control +396.7543 1 1.0 Response_Control +398.3942 1 1.0 No_Response_Control +416.3007 1 1.0 Incorrect_Task +417.9406 1 1.0 Correct_Task +419.5806 1 1.0 Correct_Task +421.2206 1 1.0 Correct_Task +422.8606 1 1.0 Correct_Task +424.5005 1 1.0 Correct_Task +426.1405 1 1.0 Correct_Task +427.7805 1 1.0 Correct_Task +429.4205 1 1.0 Correct_Task +431.0604 1 1.0 Correct_Task +448.9669 1 1.0 Response_Control +450.6068 1 1.0 No_Response_Control +452.2468 1 1.0 Response_Control +453.8868 1 1.0 Response_Control +455.5268 1 1.0 No_Response_Control +457.1667 1 1.0 Response_Control +458.8067 1 1.0 No_Response_Control +460.4467 1 1.0 Response_Control +462.0867 1 1.0 Response_Control +463.7266 1 1.0 No_Response_Control +481.6331 1 1.0 Correct_Task +483.273 1 1.0 Correct_Task +484.913 1 1.0 Incorrect_Task +486.553 1 1.0 Correct_Task +488.193 1 1.0 Correct_Task +489.8329 1 1.0 Correct_Task +491.4729 1 1.0 Correct_Task +493.1129 1 1.0 Correct_Task +494.7529 1 1.0 Incorrect_Task +496.3928 1 1.0 Correct_Task +514.2993 1 1.0 Response_Control +515.9392 1 1.0 Response_Control +517.5792 1 1.0 No_Response_Control +519.2192 1 1.0 Response_Control +520.8592 1 1.0 Response_Control +522.4991 1 1.0 No_Response_Control +524.1391 1 1.0 Response_Control +525.7791 1 1.0 Response_Control +527.4191 1 1.0 Response_Control +529.059 1 1.0 No_Response_Control diff --git a/hw2/timing.py b/hw2/timing.py new file mode 100644 index 0000000..2a6d3b1 --- /dev/null +++ b/hw2/timing.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python +subj = "03" +sessions = ["test","retest"] + +# import modules +import re #regex module + +for ses in sessions: + # open file + with open("./sub-%s/ses-%s/func/sub-%s_ses-%s_task-linebisection_events.tsv" %(subj, ses, subj, ses), 'r') as f: + s=f.read() + + # setup dictionary + timing_dic = {"Correct_Task": [], + "Incorrect_Task": [], + "No_Response_Task": [], + "Response_Control": [], + "No_Response_Control": []} + + regex = re.compile(r"([\d.]+)\s+([\d.]+)\s+([\d.]+)\s+([\w]+)", re.MULTILINE) + + matches = regex.finditer(s) + + for m in matches: + timing_dic[m.groups()[3]].append(str(float(m.groups()[0])-2.5)) + + for x in timing_dic: + with open("timing_sub-%s_ses-%s_%s.1D" %(subj, ses, x),"w") as f: + f.write(' '.join(timing_dic[x])) diff --git a/hw2/timing_sub-03_ses-retest_Correct_Task.1D b/hw2/timing_sub-03_ses-retest_Correct_Task.1D new file mode 100644 index 0000000..e4a912e --- /dev/null +++ b/hw2/timing_sub-03_ses-retest_Correct_Task.1D @@ -0,0 +1 @@ +21.8064 25.0864 26.7264 28.3664 30.0064 33.2863 34.9263 36.5663 87.1393 88.7793 90.4193 93.6992 96.9792 98.6192 100.2592 101.8992 154.1121 155.7521 157.3921 162.3121 163.9521 167.232 221.085 222.725 226.0049 227.6449 229.2849 232.5649 283.1379 286.4178 288.0578 292.9778 294.6178 296.2578 348.4707 350.1107 351.7507 353.3907 358.3106 359.9506 361.5906 363.2306 415.4436 417.0836 420.3635 422.0035 423.6435 425.2835 426.9235 428.5635 480.7764 482.4164 485.6964 487.3364 488.9764 490.6164 492.2564 493.8963 \ No newline at end of file diff --git a/hw2/timing_sub-03_ses-retest_Incorrect_Task.1D b/hw2/timing_sub-03_ses-retest_Incorrect_Task.1D new file mode 100644 index 0000000..7b8760b --- /dev/null +++ b/hw2/timing_sub-03_ses-retest_Incorrect_Task.1D @@ -0,0 +1 @@ +23.4464 31.6464 92.0592 95.3392 152.4721 159.0321 160.6721 165.592 217.805 230.9249 289.6978 297.8977 355.0307 356.6707 413.8036 418.7235 484.0564 \ No newline at end of file diff --git a/hw2/timing_sub-03_ses-retest_No_Response_Control.1D b/hw2/timing_sub-03_ses-retest_No_Response_Control.1D new file mode 100644 index 0000000..1b15c00 --- /dev/null +++ b/hw2/timing_sub-03_ses-retest_No_Response_Control.1D @@ -0,0 +1 @@ +59.3928 69.2327 134.5656 199.8985 265.2313 330.5642 395.897 453.03 457.9499 461.2299 515.0828 524.9228 \ No newline at end of file diff --git a/hw2/timing_sub-03_ses-retest_No_Response_Task.1D b/hw2/timing_sub-03_ses-retest_No_Response_Task.1D new file mode 100644 index 0000000..5531ed9 --- /dev/null +++ b/hw2/timing_sub-03_ses-retest_No_Response_Task.1D @@ -0,0 +1 @@ +219.445 224.3649 284.7778 291.3378 479.1365 \ No newline at end of file diff --git a/hw2/timing_sub-03_ses-retest_Response_Control.1D b/hw2/timing_sub-03_ses-retest_Response_Control.1D new file mode 100644 index 0000000..c02fa29 --- /dev/null +++ b/hw2/timing_sub-03_ses-retest_Response_Control.1D @@ -0,0 +1 @@ +54.4728 56.1128 57.7528 61.0328 62.6728 64.3128 65.9528 67.5928 119.8057 121.4457 123.0857 124.7257 126.3657 128.0056 129.6456 131.2856 132.9256 185.1386 186.7785 188.4185 190.0585 191.6985 193.3385 194.9785 196.6185 198.2585 250.4714 252.1114 253.7514 255.3914 257.0314 258.6714 260.3114 261.9513 263.5913 315.8043 317.4443 319.0843 320.7243 322.3642 324.0042 325.6442 327.2842 328.9242 381.1372 382.7771 384.4171 386.0571 387.6971 389.3371 390.9771 392.6171 394.2571 446.47 448.11 449.75 451.39 454.67 456.3099 459.5899 511.8029 513.4429 516.7228 518.3628 520.0028 521.6428 523.2828 526.5628 \ No newline at end of file diff --git a/hw2/timing_sub-03_ses-test_Correct_Task.1D b/hw2/timing_sub-03_ses-test_Correct_Task.1D new file mode 100644 index 0000000..3c7c10a --- /dev/null +++ b/hw2/timing_sub-03_ses-test_Correct_Task.1D @@ -0,0 +1 @@ +21.8062 25.0862 26.7262 28.3662 30.0061 31.6461 33.2861 34.9261 36.566 87.1386 88.7786 92.0586 96.9785 100.2585 101.8984 217.8035 221.0834 222.7234 224.3634 226.0033 229.2833 230.9233 232.5632 284.7758 288.0558 289.6958 292.9757 297.8956 348.4683 350.1082 351.7482 353.3882 356.6681 358.3081 359.9481 361.5881 415.4406 417.0806 418.7206 420.3606 422.0005 423.6405 425.2805 426.9205 428.5604 479.1331 480.773 484.053 485.693 487.3329 488.9729 490.6129 493.8928 \ No newline at end of file diff --git a/hw2/timing_sub-03_ses-test_Incorrect_Task.1D b/hw2/timing_sub-03_ses-test_Incorrect_Task.1D new file mode 100644 index 0000000..75cb793 --- /dev/null +++ b/hw2/timing_sub-03_ses-test_Incorrect_Task.1D @@ -0,0 +1 @@ +23.4462 93.6986 98.6185 219.4434 286.4158 294.6157 296.2557 355.0282 363.228 413.8007 482.413 492.2529 \ No newline at end of file diff --git a/hw2/timing_sub-03_ses-test_No_Response_Control.1D b/hw2/timing_sub-03_ses-test_No_Response_Control.1D new file mode 100644 index 0000000..ec0d343 --- /dev/null +++ b/hw2/timing_sub-03_ses-test_No_Response_Control.1D @@ -0,0 +1 @@ +59.3924 64.3123 69.2322 119.8049 126.3648 128.0047 129.6447 134.5646 191.6972 198.2571 252.1096 253.7496 258.6695 328.9219 389.3343 395.8942 448.1068 453.0268 456.3067 461.2266 515.0792 519.9991 526.559 \ No newline at end of file diff --git a/hw2/timing_sub-03_ses-test_No_Response_Task.1D b/hw2/timing_sub-03_ses-test_No_Response_Task.1D new file mode 100644 index 0000000..1969074 --- /dev/null +++ b/hw2/timing_sub-03_ses-test_No_Response_Task.1D @@ -0,0 +1 @@ +90.4186 95.3385 152.4711 154.111 155.751 157.391 159.031 160.6709 162.3109 163.9509 165.5909 167.2308 227.6433 283.1359 291.3357 \ No newline at end of file diff --git a/hw2/timing_sub-03_ses-test_Response_Control.1D b/hw2/timing_sub-03_ses-test_Response_Control.1D new file mode 100644 index 0000000..294cfcc --- /dev/null +++ b/hw2/timing_sub-03_ses-test_Response_Control.1D @@ -0,0 +1 @@ +54.4724 56.1124 57.7524 61.0324 62.6723 65.9523 67.5923 121.4448 123.0848 124.7248 131.2847 132.9247 185.1373 186.7772 188.4172 190.0572 193.3371 194.9771 196.6171 199.897 250.4697 255.3896 257.0296 260.3095 261.9495 263.5895 265.2294 315.8021 317.442 319.082 320.722 322.362 324.0019 325.6419 327.2819 330.5618 381.1345 382.7744 384.4144 386.0544 387.6944 390.9743 392.6143 394.2543 446.4669 449.7468 451.3868 454.6667 457.9467 459.5867 511.7993 513.4392 516.7192 518.3592 521.6391 523.2791 524.9191 \ No newline at end of file diff --git a/hw3/output/Words.group_FDR.md b/hw3/output/Words.group_FDR.md new file mode 100644 index 0000000..96f5fe4 --- /dev/null +++ b/hw3/output/Words.group_FDR.md @@ -0,0 +1,56 @@ +# Words-Fixation Activation Map (FDR Correction) +* q = .05 +* coordinates are center of mass of each cluster in MNI space +* voxel size is 3 mm x 3 mm x 3 mm + +| Cluster Size (# of Voxel) | Peak Value (Z) | x (mm) | y (mm) | z (mm) | +| ------------------------- | -------------- | ------:| ------:| ------:| +| 693 | 8.1915 | 39.7 | 68 | -10.2 | +| 528 | 6.2685 | -36.9 | 71.7 | -11.4 | +| 260 | 7.8546 | 0.5 | -9.1 | 54.6 | +| 183 | 7.8021 | 48.1 | 0.7 | 42.9 | +| 123 | 5.1566 | -43.5 | -0.2 | 44.4 | +| 101 | 6.6676 | -3.9 | 70.4 | -19.3 | +| 74 | 4.9594 | -30.2 | 57.4 | 47.3 | +| 66 | 5.544 | 25.2 | 54.2 | 46.2 | +| 63 | 5.1885 | 33.1 | -24.8 | 7.1 | +| 20 | 4.0048 | 40.9 | 22.2 | 58 | +| 15 | 4.3598 | -32.6 | 52.8 | 6.4 | +| 11 | 4.4665 | -19.6 | -35.9 | -2 | +| 11 | 3.6103 | -41.4 | -33.2 | 23.4 | +| 10 | 3.613 | -57 | 47.4 | 7.1 | +| 9 | 4.2831 | 7.9 | 20.6 | -8.4 | +| 9 | 3.8999 | 7.3 | -2.9 | 24 | +| 7 | 3.1746 | 11.1 | 21.4 | 25.3 | +| 6 | 3.9917 | 22 | -2.5 | -5.1 | +| 6 | 3.1176 | -33.5 | -25 | 2 | +| 6 | 4.1992 | 19.5 | -21 | 32.1 | +| 5 | 3.7067 | -32.4 | 70.2 | 3.1 | +| 5 | 4.0892 | 22.9 | -28.9 | 21.1 | +| 4 | 3.3746 | 45.7 | -14.2 | -20.3 | +| 4 | 3.442 | 42 | 35.3 | 26.4 | +| 4 | 3.6003 | 61.5 | -7.5 | 27 | +| 4 | 4.0509 | -9 | 22.8 | 64.3 | +| 3 | 3.1409 | 21 | 1 | 8 | +| 2 | 3.434 | 33 | 34.5 | 0 | +| 2 | 3.7155 | -34.3 | -21 | 12 | +| 2 | 3.0717 | -46.5 | -15 | 18 | +| 2 | 3.1221 | -10.5 | 21 | 21 | +| 2 | 3.3709 | 31.6 | 15 | 27 | +| 2 | 3.1388 | -33 | 13.4 | 42 | +| 2 | 3.5294 | 45 | 36 | 46.6 | +| 1 | 3.7813 | -48 | 51 | -30 | +| 1 | 2.8986 | 36 | -6 | -21 | +| 1 | 2.9016 | -42 | 15 | -18 | +| 1 | 2.993 | 30 | 12 | -12 | +| 1 | 2.8944 | 42 | 3 | -9 | +| 1 | 3.9799 | -60 | 39 | -3 | +| 1 | 3.0912 | -48 | 30 | 0 | +| 1 | 3.0622 | -21 | -27 | 0 | +| 1 | 2.9816 | -42 | -9 | 3 | +| 1 | 2.9838 | 24 | 18 | 18 | +| 1 | 3.1536 | -24 | 36 | 21 | +| 1 | 2.9768 | 27 | 21 | 30 | +| 1 | 2.8872 | -24 | 0 | 30 | +| 1 | 3.3345 | -24 | -12 | 30 | +| 1 | 3.0793 | 39 | 6 | 66 | diff --git a/hw3/output/Words.group_attr.1D b/hw3/output/Words.group_attr.1D new file mode 100644 index 0000000..f14ddaf --- /dev/null +++ b/hw3/output/Words.group_attr.1D @@ -0,0 +1,241 @@ +HISTORY_NOTE = [mli@Ringo-Lite.frontier.com: Sat Aug 19 20:23:01 2017] {AFNI_17.2.06:macosx_10.7_local} 3dttest++ -mask full_mask.group+tlrc -prefix Words.group -setA 'betas/stats*+tlrc.HEAD[Words#0_Coef]'\n[mli@Ringo-Lite.frontier.com: Sat Aug 19 20:28:10 2017] {AFNI_17.2.06:macosx_10.7_local} 3drefit -atrstring AFNI_CLUSTSIM_NN1_1sided file:cluster.NN1_1sided.niml -atrstring AFNI_CLUSTSIM_MASK file:cluster.mask -atrstring AFNI_CLUSTSIM_NN2_1sided file:cluster.NN2_1sided.niml -atrstring AFNI_CLUSTSIM_NN3_1sided file:cluster.NN3_1sided.niml -atrstring AFNI_CLUSTSIM_NN1_2sided file:cluster.NN1_2sided.niml -atrstring AFNI_CLUSTSIM_NN2_2sided file:cluster.NN2_2sided.niml -atrstring AFNI_CLUSTSIM_NN3_2sided file:cluster.NN3_2sided.niml -atrstring AFNI_CLUSTSIM_NN1_bisided file:cluster.NN1_bisided.niml -atrstring AFNI_CLUSTSIM_NN2_bisided file:cluster.NN2_bisided.niml -atrstring AFNI_CLUSTSIM_NN3_bisided file:cluster.NN3_bisided.niml Words.group+tlrc~ +TYPESTRING = 3DIM_HEAD_FUNC~ +IDCODE_STRING = AFN_hJ3bSZ43iN_GUzzAgWe4VA~ +IDCODE_DATE = Sat Aug 19 20:23:01 2017~ +SCENE_DATA = 2 11 1 -999 -999 -999 -999 -999 +LABEL_1 = zyxt~ +LABEL_2 = zyxt~ +DATASET_NAME = zyxt~ +ORIENT_SPECIFIC = 1 2 4 +ORIGIN = 90 126 -72 +DELTA = -3 -3 3 +IJK_TO_DICOM = -3 0 0 90 0 -3 0 126 0 0 3 -72 +IJK_TO_DICOM_REAL = -3 0 0 90 0 -3 0 126 0 0 3 -72 +BRICK_STATS = -0.248389 0.225726 -9.351179 8.191493 +DATASET_RANK = 3 2 0 0 0 0 0 0 +DATASET_DIMENSIONS = 61 73 61 0 0 +BRICK_TYPES = 3 3 +BRICK_FLOAT_FACS = 0 0 +BRICK_LABS = SetA_mean~SetA_Tstat~ +BRICK_STATAUX = 1 3 1 16 +BRICK_STATSYM = none;Ttest(16)~ +FDRCURVE_000001 = 0.000129 0.092062 0.443462 0.472502 0.506242 0.539848 0.577305 0.616368 0.659138 0.700843 0.744295 0.791323 0.839838 0.888438 0.939331 0.989339 1.040367 1.092791 1.146421 1.20042 1.254131 1.308733 1.362172 1.41752 1.470654 1.524289 1.577432 1.633076 1.686124 1.737868 1.791292 1.842088 1.892841 1.943333 1.991563 2.041249 2.089485 2.136528 2.181833 2.226235 2.270943 2.313704 2.355185 2.396872 2.437348 2.47631 2.514298 2.547712 2.580618 2.609116 2.646286 2.675714 2.706881 2.735897 2.763161 2.78445 2.811696 2.830003 2.851635 2.876096 2.899488 2.919909 2.942753 2.959107 2.974747 2.989804 2.997524 3.014758 3.014771 3.024873 3.036207 3.036207 3.03701 3.055237 3.065696 3.070787 3.082001 3.090105 3.10342 3.105447 3.105447 3.105447 3.105447 3.105447 3.105447 3.106586 3.10774 3.110595 3.113038 3.113038 3.113038 3.11365 3.113867 3.134915 3.159632 3.18435 3.209066 3.233783 3.258501 3.269092 3.279443 3.281517 3.281517 +MDFCURVE_000001 = -6.123312 0.200753 0.999066 0.998484 0.997668 0.996029 0.994475 0.992022 0.987634 0.981551 0.973525 0.963736 0.951574 0.935694 0.914703 0.889466 0.861413 0.824368 0.783225 0.736574 0.683813 0.622429 0.551571 0.473139 0.3865 0.293849 0.201926 0.109237 0.03316 0 +TEMPLATE_SPACE = MNI~ +INT_CMAP = 0 +BYTEORDER_STRING = LSB_FIRST~ +AFNI_CLUSTSIM_NN1_1sided = <3dClustSim_NN1 + ni_type="4*float" + ni_dimen="3" + commandline="3dClustSim -mask full_mask.group+tlrc -acf 0.823891 4.19962 14.369 -both -pthr .05 .01 .001 -athr .1 .05 .025 .01 -iter 10000 -prefix cluster -cmd refit.cmd" + thresholding="1-sided" + nxyz="61,73,61" + dxyz="3.000,3.000,3.000" + fwhmxyz="0.00,0.00,0.00" + iter="10000" + pthr="0.05,0.01,0.001" + athr="0.1,0.05,0.025,0.01" + mask_dset_idcode="AFN_Xz48B9nBZElhaRoI4RZt3Q" + mask_dset_name="./full_mask.group+tlrc.HEAD" + mask_count="57300" > + 400.5706 488.666 592 741 + 65.59692 77.91489 90.91487 108.5629 + 16.53977 19.69049 23.4056 28.62756 +~ +AFNI_CLUSTSIM_MASK = eNrtXEuS47gRBYMO04uO5iy9cBhX6GUvJkwfZY4xC4cBx1wME30R+AZccoEgDCATROJDiarq +tqpqkIuSSIEURTxkvpeZLMa6devWrVu3bt26devWrVu3bt26devWrVu3bt26detGbISXdQgv +0sLmNsOrhd16gU0Do6XAg3DUNvT7+Dz7J77GOeLhRVmYHG1hztY4szhs5zjhcdiQfWwmHB4G +TewnnOfd7V/d9O9DOIUS/hQj2zjstu5jN0QLfwHuLHOAUkCVO2J1o5T7AuMO1iOTcAnslz6H +TdO4rHDmLKy6DV6ltQtsWg6bYSZX9+qnbnevg58EG4a7UWH4DsP8aBtmHY7aYJMZOJjhJoNP +/VkQQwAWg2CBK3Bnm/D1m//Dtb+izY4Beu7rjfXfNIXhmw1v2T77t+7MAwujeXjr/Y1HoPc3 +uzt4mwJe2L/dd6Oj+rnjIrP9PyNMTVjnEmdug+n2mxznd0rTvuJuj4YRQGJxlIDZ9xMddg9p +tIFNhpsKDvYfBxjsgB2VroAjlEZE2ojnnuDUFk7phrnr+uY/Xu2i/BXsdtisdxuLf+tdmH/L +jAjezMPNvQ1Oxn+lAX/jl4n3Wspdut/UwW91C3Pz+4wgmREVY1r1En3Dhs6ATLtILiNM2ViB +RONo6mAQaQKRNiN2Ci81wOgFMTOlK5gBJBpBsgNIADNjGOR3u6F72C0k7J61P9lu3dvJuyG2 +C/9NQwhxLlZp6y9gCEFJcwhK28i0v6B/uEv8w4OETcD1zEQW7pqDZCUgGXOQcETDhOsa/Q0B +icGT4CiNfsfAwRJ3r7ibnnPEcw7wqYDB7txh0+0OIFkQJBMBSTiJRuwYK0L4dO+NO9g7Gz/K +ASbQJQcYh5dAnTw9cpQpBCUfqxYgwz4oOewo79ocg/ma3cC/wkv0OkipPbay3Tj607sEiWHh +V6llG9HpD4AKgZhZahKic0+STSg6Fg6LPxAGGK0QOxtiB+YXDp4PNEjcvSJ2djhJBhKOIBkB +DQLRMMM5vH+Ak6yIHZMjzI3+r/+q4GC4vxAXnDxInIMJhGZQ/rLd+y1c9hiC0rpAUHJk2Gsp +z5ODm5x/Dlpq/52HWOXWWnBD2n4LHtqIjJWvImfjO87Cn982SBDiUmxIFy1IDADJDsxAI0hs +AsmCzqAAiShAMuHc4LQvOO2JVmw4GqddIaQ2xA66DIwvESQbBYnFTzmCZJSInRVRsecHRzdk +4IJkcDA+hLngFL55DqwXybCykwRsgyxzzsb7G4cdBSF22RohlrrJIa25Pxmg3xL1gUY2bqJs +mDNl/+Zs+UpljUI2aSDMqNqTLIUnGa6CxOa0Ik1V2L3eYBviVSAZVOGGdnrO8M0KLogD67Uj +wHMJ/sZNrwG/KMEB8hUWBt9FCrEr3oodfqtCf7hhLMU743f/Bmxt+QJ3eQTMLDgJE5WazL4V +Ao2hVSOYUVtsAI7IZ5FkqtyTqBwkksaVMQcJr0CSoaGgFQuOwohhmXo9SJbjYASJavGcBM/C +AUr0dGuDh3HcPcLoOyG2YPpTSiV4vfcJbv4IK3VBf4MK/e/PBguC1kRswytKjg1+RUsZJxmT +rSrkJCVIxvsChXDPAyRNTyIugiSnKhVItjZI0Ic1o+SMu2sedhsk6w2mT7Qk+m2ZcgYoRCPP +GZ+dY0OqghkuAxemMQoRuRqTF7hJZAx1vQJvAT+oqM5THScgidxzv+FJxIOeJDtnDRJLFVMC +CY5qUqkBdi9HiI0L4worL9xQIjRRS+pCPZgjscTpFDnG8yywYO5xPS5oJklTnXIaguTYqNZN +8Tm7YYmhmvbCLVTsFZDMD4WbAngVSHQujViSRon1Fn4x/pqpCrE7ibwxVtVuqCA0koBEYHCf +0pKMiaWoMVYMSofa/r+bzKPQCuCQeH0mJb7mlIilCRFC4uiqSjJG2kzr5nMyxqnKJ/SaBD4F +iW0BbzhhQ7IFkoJvx6AUf83QVHS1dGvFKnLDVgKSotoRY/4AH3Na7dDi6VFIMEKpGunaIaVW +NyIHx4PpS+qg0w0r7nY2JynVkU3o3TzJbZA0Y1WRZLmln89F2QBfdUf2o74vYpWopREtiRXV +jjGltBRiRiNmtH2anv5LpoUk0ts6E8dJLC1y+tTHTtUN2ykFOO72Scb1EkjYIyAR5cHyln6e +7yj3UtFtjVi1HLGqJDRbnoumJbElgSQmx3VaqTGJMRIGw/72NOayoYc7asecJFniZe/JTS51 +uraIz4auvbQks4VbpeWvgIQ/BJK5PHh9SD9vNwmNvE1oNI1CQ5ZkiR55ScGdlsSQ3saVOhFm +oGJK5renaaJPnzAKTeeVZUXc5NROsvCHkixV7eYHgORekuWE0NwCyVLxMEMJTQKJyfVzWU7d +qyRLq24ai+vIDGLSlP3607NzLod+jsyFE2yvaQVYdjPJIiqZ0NTP00v088tAMl0EyWOs1zRY +Lz/koKSZuKmZibPnINEp08VJ+cX9DpAkn59dPZIHc5nw+pBZWZZ6AvS5fhYpPu9N/SxvZeJ+ +jH621/WzrajUy0Ei2iCZ2yAhmThdaCCkjzGzHpUIU892LEowkjGUiVlxUh4yqdvtdfqZt/Uz +/676WV/Qz+ISSGxbP597EkPqQY0Wr/02SOyRxOC0LVDZN9ZnlTMXkvlvtDud6OeWNBKVNDqZ +qu+vn1/jSexpkuXEkxQgoS1e10GiklAeaOnuzfW97AtlLjp1M8539XMhjQoteU0/qwf08z03 +9ENAcpKuvQYSRfIQDZDEbApmR32fBJWrb8++RLY7slQCVenHiVo/q5c0Kaw3pVE5z98TJC9I +19ac5KT+/BhIZOFJzkAi3/bTJxKTP3smjSTpvL8jjYbXSaMXFQReBhL9EHH9LiBhJyAxx6MK +6OVH9i7sayxHDw1pRAqkvG6j3ZsdkuolrPdSd+1D1cHlLJnGWnmSU+J6BhL7QpDwHCTv8nkB +dcjp2BQ1t6WRSL3WRRFEtsr6pwUBc4HQ3HNDj5WQL/YZFC1eut1n8FqQzHSlvjv7zKh02498 +YtkUNd+uGt0pCLCyIKCrJ34udF3mIDmt3RQFvgIkJVmnIKkfQnihJ9lOQPKvj/BgiIwNxlW/ +y0nVaKpac1tdlyeEpk7jrW3xXSDsShV4PK0CFyDZ2k+qFAvjDkhkIYE/NEgqzCzoYLAf53ge +8YT18rqhzp4TmqXdzb/cazq61U+ytHsf61YBVTzzRuKKKHofWf3M2x2QrCVxnT4uSCr7BXO9 +FmOUKHK9c6q5XyA057GqcAYn3LNoX1SNczaajvY6/15kzYpHpERRuyEkLrYmRdcbu050IYEj +SH5l3crCJCe1JnP3MZLl2iMVhXeqG6FP2hfXvNwr7xdpRtIJa4/IK8jjD5HERZDIAySAik3k +IPnSQfFoMBvpjdwO6jeeduOtjb6hk4enWfVkF30UDpPPMa84pToGK/LvWwIJJiVjvmkine3M +lk+LZb8t/oeXbj/aLVGWJPN/nbBX/51BFNyTNOBsiYbTR+nX9LDlTFLUW17uJeQje5ZnR1Tg +psL/97Eu7yLj+kex+C96ssnBYqw+ePdc1+hk+qccC1F0scVLJ6GHLmNuy5iBRNjwrxXCsLnP +zAexzxgT8AWFSUEnRBYju3Xr1q1bt27dunXr1q1bt27dunXr1q1bt27dunXr1u3D2v8AoPzl +7A=====271633~ +AFNI_CLUSTSIM_NN2_1sided = <3dClustSim_NN2 + ni_type="4*float" + ni_dimen="3" + commandline="3dClustSim -mask full_mask.group+tlrc -acf 0.823891 4.19962 14.369 -both -pthr .05 .01 .001 -athr .1 .05 .025 .01 -iter 10000 -prefix cluster -cmd refit.cmd" + thresholding="1-sided" + nxyz="61,73,61" + dxyz="3.000,3.000,3.000" + fwhmxyz="0.00,0.00,0.00" + iter="10000" + pthr="0.05,0.01,0.001" + athr="0.1,0.05,0.025,0.01" + mask_dset_idcode="AFN_Xz48B9nBZElhaRoI4RZt3Q" + mask_dset_name="./full_mask.group+tlrc.HEAD" + mask_count="57300" > + 571.4532 699.2493 857.1984 1044 + 73.46697 88.2702 103.2608 124.4334 + 17.11004 20.23859 23.90208 29.14529 +~ +AFNI_CLUSTSIM_NN3_1sided = <3dClustSim_NN3 + ni_type="4*float" + ni_dimen="3" + commandline="3dClustSim -mask full_mask.group+tlrc -acf 0.823891 4.19962 14.369 -both -pthr .05 .01 .001 -athr .1 .05 .025 .01 -iter 10000 -prefix cluster -cmd refit.cmd" + thresholding="1-sided" + nxyz="61,73,61" + dxyz="3.000,3.000,3.000" + fwhmxyz="0.00,0.00,0.00" + iter="10000" + pthr="0.05,0.01,0.001" + athr="0.1,0.05,0.025,0.01" + mask_dset_idcode="AFN_Xz48B9nBZElhaRoI4RZt3Q" + mask_dset_name="./full_mask.group+tlrc.HEAD" + mask_count="57300" > + 652 809.499 983 1204 + 75.5631 92.11592 108 130 + 17.24232 20.45582 24.07778 29.44805 +~ +AFNI_CLUSTSIM_NN1_2sided = <3dClustSim_NN1 + ni_type="4*float" + ni_dimen="3" + commandline="3dClustSim -mask full_mask.group+tlrc -acf 0.823891 4.19962 14.369 -both -pthr .05 .01 .001 -athr .1 .05 .025 .01 -iter 10000 -prefix cluster -cmd refit.cmd" + thresholding="2-sided" + nxyz="61,73,61" + dxyz="3.000,3.000,3.000" + fwhmxyz="0.00,0.00,0.00" + iter="10000" + pthr="0.05,0.01,0.001" + athr="0.1,0.05,0.025,0.01" + mask_dset_idcode="AFN_Xz48B9nBZElhaRoI4RZt3Q" + mask_dset_name="./full_mask.group+tlrc.HEAD" + mask_count="57300" > + 185.5571 217.9158 253.5976 309 + 47.13444 54.52903 62.91642 74.59404 + 14.25741 16.73355 19.50444 23.75385 +~ +AFNI_CLUSTSIM_NN2_2sided = <3dClustSim_NN2 + ni_type="4*float" + ni_dimen="3" + commandline="3dClustSim -mask full_mask.group+tlrc -acf 0.823891 4.19962 14.369 -both -pthr .05 .01 .001 -athr .1 .05 .025 .01 -iter 10000 -prefix cluster -cmd refit.cmd" + thresholding="2-sided" + nxyz="61,73,61" + dxyz="3.000,3.000,3.000" + fwhmxyz="0.00,0.00,0.00" + iter="10000" + pthr="0.05,0.01,0.001" + athr="0.1,0.05,0.025,0.01" + mask_dset_idcode="AFN_Xz48B9nBZElhaRoI4RZt3Q" + mask_dset_name="./full_mask.group+tlrc.HEAD" + mask_count="57300" > + 228.2717 271.2706 320 391 + 50.79831 60.02682 68.73059 81 + 14.61249 17.11479 19.84442 24.04511 +~ +AFNI_CLUSTSIM_NN3_2sided = <3dClustSim_NN3 + ni_type="4*float" + ni_dimen="3" + commandline="3dClustSim -mask full_mask.group+tlrc -acf 0.823891 4.19962 14.369 -both -pthr .05 .01 .001 -athr .1 .05 .025 .01 -iter 10000 -prefix cluster -cmd refit.cmd" + thresholding="2-sided" + nxyz="61,73,61" + dxyz="3.000,3.000,3.000" + fwhmxyz="0.00,0.00,0.00" + iter="10000" + pthr="0.05,0.01,0.001" + athr="0.1,0.05,0.025,0.01" + mask_dset_idcode="AFN_Xz48B9nBZElhaRoI4RZt3Q" + mask_dset_name="./full_mask.group+tlrc.HEAD" + mask_count="57300" > + 247.691 293.4423 348.499 430 + 51.93026 61.23649 70.14133 82.62376 + 14.70088 17.19333 19.93298 24.1651 +~ +AFNI_CLUSTSIM_NN1_bisided = <3dClustSim_NN1 + ni_type="4*float" + ni_dimen="3" + commandline="3dClustSim -mask full_mask.group+tlrc -acf 0.823891 4.19962 14.369 -both -pthr .05 .01 .001 -athr .1 .05 .025 .01 -iter 10000 -prefix cluster -cmd refit.cmd" + thresholding="bi-sided" + nxyz="61,73,61" + dxyz="3.000,3.000,3.000" + fwhmxyz="0.00,0.00,0.00" + iter="10000" + pthr="0.05,0.01,0.001" + athr="0.1,0.05,0.025,0.01" + mask_dset_idcode="AFN_Xz48B9nBZElhaRoI4RZt3Q" + mask_dset_name="./full_mask.group+tlrc.HEAD" + mask_count="57300" > + 185.5571 217.9158 253.5976 309 + 47.13444 54.52903 62.91642 74.59404 + 14.25741 16.73355 19.50444 23.75385 +~ +AFNI_CLUSTSIM_NN2_bisided = <3dClustSim_NN2 + ni_type="4*float" + ni_dimen="3" + commandline="3dClustSim -mask full_mask.group+tlrc -acf 0.823891 4.19962 14.369 -both -pthr .05 .01 .001 -athr .1 .05 .025 .01 -iter 10000 -prefix cluster -cmd refit.cmd" + thresholding="bi-sided" + nxyz="61,73,61" + dxyz="3.000,3.000,3.000" + fwhmxyz="0.00,0.00,0.00" + iter="10000" + pthr="0.05,0.01,0.001" + athr="0.1,0.05,0.025,0.01" + mask_dset_idcode="AFN_Xz48B9nBZElhaRoI4RZt3Q" + mask_dset_name="./full_mask.group+tlrc.HEAD" + mask_count="57300" > + 228.2717 271 319.6653 389 + 50.79831 60.02682 68.73059 81 + 14.61249 17.11479 19.84442 24.04511 +~ +AFNI_CLUSTSIM_NN3_bisided = <3dClustSim_NN3 + ni_type="4*float" + ni_dimen="3" + commandline="3dClustSim -mask full_mask.group+tlrc -acf 0.823891 4.19962 14.369 -both -pthr .05 .01 .001 -athr .1 .05 .025 .01 -iter 10000 -prefix cluster -cmd refit.cmd" + thresholding="bi-sided" + nxyz="61,73,61" + dxyz="3.000,3.000,3.000" + fwhmxyz="0.00,0.00,0.00" + iter="10000" + pthr="0.05,0.01,0.001" + athr="0.1,0.05,0.025,0.01" + mask_dset_idcode="AFN_Xz48B9nBZElhaRoI4RZt3Q" + mask_dset_name="./full_mask.group+tlrc.HEAD" + mask_count="57300" > + 246 291.4584 346.499 427 + 51.93026 61.23649 70.14133 82.62376 + 14.70088 17.19333 19.93298 24.1651 +~ +BRICK_KEYWORDS = (null) diff --git a/hw3/output/Words.group_clusters.md b/hw3/output/Words.group_clusters.md new file mode 100644 index 0000000..b08a352 --- /dev/null +++ b/hw3/output/Words.group_clusters.md @@ -0,0 +1,18 @@ +# Words-Fixation Activation Map (Cluster Correction) +* voxel-wise threshold = .001, cluster-wise threshold = .05 +* coordinates are peak voxel of each cluster in MNI space +* voxel size is 3 mm x 3 mm x 3 mm + +| Cluster Size (# of Voxel) | Peak Value (Z) | x (mm) | y (mm) | z (mm) | +| ------------------------- | -------------- | ------:| ------:| ------:| +| 413 | 5.0654 | 33 | 87 | -6 | +| 287 | 4.3925 | -42 | 57 | -18 | +| 175 | 4.9605 | 6 | -12 | 51 | +| 105 | 4.9438 | 48 | -6 | 36 | +| 44 | 3.8046 | -33 | 60 | 45 | +| 39 | 4.0637 | 51 | 48 | 0 | +| 38 | 3.9016 | -45 | 0 | 51 | +| 37 | 4.5484 | -9 | 66 | -18 | +| 31 | 4.083 | 24 | 51 | 45 | +| 30 | 3.917 | 33 | -21 | 9 | +| 22 | 3.9008 | 3 | 72 | -24 | diff --git a/hw3/scripts/Homework-3_Group-Analysis.sh b/hw3/scripts/Homework-3_Group-Analysis.sh new file mode 100755 index 0000000..b7fdda1 --- /dev/null +++ b/hw3/scripts/Homework-3_Group-Analysis.sh @@ -0,0 +1,99 @@ +#!/bin/bash + +# Part 0: Prep +3dmask_tool \ +-input masks/full_mask.sub-*+tlrc.HEAD \ +-frac 1.0 \ +-prefix full_mask.group + + +# Part 1: Group statistics +3dttest++ -mask full_mask.group+tlrc -prefix Words.group -setA 'betas/stats*+tlrc.HEAD[Words#0_Coef]' + + +# Part 2: Cluster correction +## Estimate Data Smoothness +for f in blurs/blur_est.*.1D; do + 1d_tool.py -infile $f -select_rows 5 -write - >> blurs.acf.1D +done + +1dsum -mean blurs.acf.1D > blurs.acf.avg.1D + +3dClustSim \ +-mask full_mask.group+tlrc \ +-acf `1dcat blurs.acf.avg.1D'[0:2]'` \ +-both \ +-pthr .05 .01 .001 \ +-athr .1 .05 .025 .01 \ +-iter 10000 \ +-prefix cluster \ +-cmd refit.cmd + +## attach ClustSim tables to dataset +`cat refit.cmd` Words.group+tlrc + +## convert t-values to z-values +3dmerge -1zscore -prefix statz_Words.group 'Words.group+tlrc[1]' + +## find clusters that survive threshold (pthr = .001, athr = .05) +### NN3 = 1.74 = (2*sqrt(.5^2+.5)) +### NN2 = 1.42 = (2*sqrt(.5^2+.5^2)) +### NN1 = 1.01 +### p = .05; z = 1.96 (one sided) +### p = .01; z = 2.3 (one sided) +### p = .001; z= 3 (one sided) +cluster_size=`1dcat cluster.NN3_1sided.1D'[2]{2}'` +3dclust -1Dformat -nosum \ + -inmask \ + -1noneg \ + -1clip 3 \ + -dxyz=1 \ + 1.74 $cluster_size \ + statz_Words.group+tlrc > Words.group_clusters.1D + +## create table +echo "# Words-Fixation Activation Map (Cluster Correction)" > Words.group_clusters.md +echo "* voxel-wise threshold = .001, cluster-wise threshold = .05 " >> Words.group_clusters.md +echo "* coordinates are peak voxel of each cluster in MNI space " >> Words.group_clusters.md +echo "* voxel size is 3 mm x 3 mm x 3 mm " >> Words.group_clusters.md +echo " " >> Words.group_clusters.md +echo "| Cluster Size (# of Voxel) | Peak Value (Z) | x (mm) | y (mm) | z (mm) |" >> Words.group_clusters.md +echo "| ------------------------- | -------------- | ------:| ------:| ------:|" >> Words.group_clusters.md +1d_tool.py -infile Words.group_clusters.1D \ + -select_cols '[0,12,13,14,15]' \ + -write stdout \ + | awk '{print "| " $1 " | " $2 " | " $3 " | " $4 " | " $5 " |"}' >> Words.group_clusters.md + + +# Part 3. FDR correction +## apply FDR correction and convert t-values into z-values +3dFDR -input 'Words.group+tlrc[1]' -prefix FDRz_Words.group + +## use FDR corrected z-values > 1.96 (q = .05) to mask the uncorrected z-map +3dcalc -a 'Words.group+tlrc[1]' -b FDRz_Words.group+tlrc \ + -expr 'a*ispositive(b-1.96)' -prefix FDR-masked_Words.group + +## run 3dclust on FDR correction masked z-map +3dclust -1Dformat -nosum \ + -inmask \ + -1noneg \ + -dxyz=1 \ + 1.74 1 \ + FDR-masked_Words.group+tlrc > Words.group_FDR.1D + +## create table +echo "# Words-Fixation Activation Map (FDR Correction)" > Words.group_FDR.md +echo "* q = .05 " >> Words.group_FDR.md +echo "* coordinates are center of mass of each cluster in MNI space " >> Words.group_FDR.md +echo "* voxel size is 3 mm x 3 mm x 3 mm " >> Words.group_FDR.md +echo " " >> Words.group_FDR.md +echo "| Cluster Size (# of Voxel) | Peak Value (Z) | x (mm) | y (mm) | z (mm) |" >> Words.group_FDR.md +echo "| ------------------------- | -------------- | ------:| ------:| ------:|" >> Words.group_FDR.md +1d_tool.py -infile Words.group_FDR.1D \ + -select_cols '[0,12,1,2,3]' \ + -write stdout \ + | awk '{print "| " $1 " | " $2 " | " $3 " | " $4 " | " $5 " |"}' >> Words.group_FDR.md + + +# Part 4. Output attributes +3dAttribute -all Words.group+tlrc > Words.group_attr.1D