This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
root=xxx | |
subj=01 | |
path_to_anatomical=${root}/fmriprep/sub-${subj}/anat/sub-${subj}_T1w_preproc.nii.gz | |
path_to_1stmap=${root}/analysis/sub-${subj}/video/betaseries/inT1/level_2.gfeat_old/cope1.feat/stats/zstat2.nii.gz | |
path_to_2nd_map=${root}/analysis/sub-${subj}/video/betaseries/inT1/level_2.gfeat/cope1.feat/stats/zstat2.nii.gz | |
fsleyes ${path_to_anatomical} \ | |
${path_to_1stmap} -dr 3 8 -cm blue \ | |
${path_to_2nd_map} -dr 3 8 -cm red |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub=sub-01 | |
hemi=rh | |
tksurfer ${sub} ${hemi} inflated -gray \ | |
-overlay path_to_map.mgh \ | |
-overlay path_to_2nd_map.mgh \ | |
-fthresh 2.3 -truncphaseflag 1 -fmid 3.3 -fslope 1 -annot aparc.annot & |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
root=path/to/root | |
cd $root | |
sub=sub-01 | |
freeview -v \ | |
$sub/mri/T1.mgz \ | |
$sub/mri/wm.mgz \ | |
$sub/mri/brainmask.mgz \ | |
$sub/mri/aseg.mgz:colormap=lut:opacity=0.2 \ | |
-f \ | |
$sub/surf/lh.white:edgecolor=blue \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from glob import glob | |
import nibabel as nib | |
import numpy as np | |
root='path' | |
subject_ids = [s[-6:] for s in sorted(glob(root + 'sub-*'))] # to get subject ids in format sub-01 | |
# load the functional files for every participant | |
funcs = sorted(glob(root+'fmriprep/sub-*/func/sub-*_task-x_run-01_bold_space-MNI152NLin2009cAsym_preproc.nii.gz')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from nipype.interfaces.ants import ApplyTransforms | |
# necessary files | |
norm_template = root + '/derivatives/mni152_bet.nii' | |
ants_transforms = sorted(glob(root + 'derivatives/fmriprep/sub-*/anat/sub-*_T1w_target-MNI152NLin2009cAsym_warp.h5')) | |
# files to transform from T1w to MNI | |
copes = sorted(glob(root + 'derivatives/analysis/sub-*/video/betaseries/level_2.gfeat/cope1.feat/stats/cope1.nii.gz')) | |
# loop and transform files for all participants |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bash_root=/Users/ilkay.isik/project_folder_temp/fc_content/MRI_data/lscp_data/derivatives | |
# simple version | |
for hemi in lh rh; do | |
src_file=${bash_root}/analysis/video/odata_prmtc_inMNI/level_2.gfeat/cope3.feat/thresh_zstat1.nii.gz | |
src_name=${src_file##*/} # take everything after the last / | |
out_file=${bash_root}/analysis/video/odata_prmtc_inMNI/level_2.gfeat/cope3.feat/${hemi}_${src_name%.nii*}.mgh #remove .nii.gz | |
echo ${src_file} ${out_file} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for FILENAME in $(find /Users/ilkay.isik/git/ilkayisik.github.io -type f) ; do | |
echo $FILENAME | |
if grep -q isik "$FILENAME"; then | |
echo "isik is found" | |
fi | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# if temp is mgz then use --identity as the reg method | |
bash_root=/Users/ilkay.isik/project_folder_temp/fc_content/MRI_data/lscp_data/derivatives | |
mri_label2vol --subject sub-01 --hemi rh \ | |
--identity \ | |
--label ${bash_root}/path/ffa.label \ | |
--temp ${bash_root}/freesurfer/sub-01/mri/orig.mgz \ | |
--fillthresh .3 --proj frac 0 1 .2 \ | |
--o ${bash_root}/path/ffa_label.nii | |
# if temp is t1w then use -reg and provide reg file as the reg method |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from nibabel import load, save, Nifti1Image | |
# load main image | |
nii_path = path_to_nii_file | |
zmap = load(nii_path) | |
img_data = zmap.get_data() | |
# load anothor image to mask | |
mask_path = path_to_mask | |
mask = load(mask_path) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for s in range(nr_sub): | |
sub = 'sub-{}'.format(str(s+1).zfill(2)) |
OlderNewer