def main(): EXP_DIR='results/graph_neural_mapping' NII_DIR='saliency_nii' SAVE_DIR='saliency_img' os.makedirs(os.path.join(EXP_DIR, SAVE_DIR), exist_ok=True) gl.resetdefaults() gl.loadimage('mni152') gl.overlayloadsmooth(True) gl.opacity(0, 50) gl.colorbarposition(0) visualize_axial(os.path.join(EXP_DIR, NII_DIR), os.path.join(EXP_DIR, SAVE_DIR)) visualize_sagittal(os.path.join(EXP_DIR, NII_DIR), os.path.join(EXP_DIR, SAVE_DIR)) visualize_colorbar(os.path.join(EXP_DIR, SAVE_DIR))
gl.resetdefaults() help(gl) # Load main image and overlay mep_path = os.path.join('C:/', 'Users', 'Enzon', 'Documents', 'Projects', 'MEP', 'mep-scripts') reference_path = os.path.join(mep_path, 'Data', 'Mouse', 'Reference') analysis_path = os.path.join(mep_path, 'Data', 'Mouse', 'Analysis') main_path = os.path.join(reference_path, 'average_template_50_reoriented.nii.gz') overlay1_path = os.path.join( analysis_path, 'annotation_50_reoriented_pVal_inv_sig_volIncrease.nii.gz') overlay2_path = os.path.join( analysis_path, 'annotation_50_reoriented_pVal_inv_sig_volDecrease.nii.gz') gl.loadimage(main_path) gl.overlayload(overlay1_path) gl.overlayload(overlay2_path) gl.opacity(1, 50) gl.opacity(2, 50) gl.minmax(1, 0, 3) gl.minmax(2, 0, 3) gl.colorname(1, '1red') gl.colorname(2, '3blue') output_dir_path = os.path.join(analysis_path, 'imageSequenceFolders', 'pVal_inv_sig_InDe') if not os.path.exists(output_dir_path): os.mkdir(output_dir_path) y_min = -13.15 y_max = 0
#Conceptual Fig import gl import sys print(sys.version) print(gl.version()) gl.resetdefaults() gl.loadimage( '//cifs.rc.ufl.edu/ufrc/rachaelseidler/tfettrow/Crunch_Code/MR_Templates/Template_4_IXI555_MNI152_GS.nii' ) # OAc_filenames=['C:/Users/tfettrow/Dropbox (UFL)/CrunchReview/Tables_and_Figs/OAc_Flat', \ # 'C:/Users/tfettrow/Dropbox (UFL)/CrunchReview/Tables_and_Figs/OAc_Low', \ # 'C:/Users/tfettrow/Dropbox (UFL)/CrunchReview/Tables_and_Figs/OAc_Med', \ # 'C:/Users/tfettrow/Dropbox (UFL)/CrunchReview/Tables_and_Figs/OAc_Hard' ] # for this_index in range(0,len(OAc_filenames)): # gl.overlaycloseall() # gl.overlayload(OAc_filenames[this_index]) # gl.minmax(1, 0, 5) # gl.colorname (1,"8redyell") # gl.opacity(1,80) # #gl.mosaic('l+ h -0.3 v -0.1 a 55 s x r 0') # gl.mosaic('a 55') # gl.colorbarposition(0) # #gl.linewidth(5) # gl.savebmp(OAc_filenames[this_index]) OAi_filenames=['C:/Users/tfettrow/Dropbox (UFL)/CrunchReview/Tables_and_Figs/OAi_Flat', \ 'C:/Users/tfettrow/Dropbox (UFL)/CrunchReview/Tables_and_Figs/OAi_Low', \ 'C:/Users/tfettrow/Dropbox (UFL)/CrunchReview/Tables_and_Figs/OAi_Med', \ 'C:/Users/tfettrow/Dropbox (UFL)/CrunchReview/Tables_and_Figs/OAi_Hard' ]
import gl gl.resetdefaults() gl.loadimage('/Users/chris/src/dcm_qa/Ref/fMRI_MB_asc_25.nii') #gl.opacity(1,5) #gl.opacity(1,50) # # if (layer > 0) then # Vol1.UpdateOverlays(vols); #str = gl.atlaslabels(1) #print(str) #gl.minmax(1, 4, 100) #gl.overlayload('aal') # #gl.generateclusters(0) #gl.generateclusters(0, 0.5, 32, 1, 0)
@author: Bryce --- deSCRIPTION --- """ # Testing - run this from 00_Multiple_files directory import gl gl.resetdefaults() gl.backcolor(0, 0, 0) gl.colorbarsize(0.02) gl.cameradistance(0.6) # load main image gl.loadimage('./outputs/LCT1/LCT1_brain.nii.gz') gl.shadername('Standard') gl.shaderadjust('surfaceColor', 1) gl.shaderadjust('brighten', 5) # load overlay 1 gl.overlayload( '/Users/Bryce/Desktop/Postdoc_Scripts/GitHub/04_mosaics_data/00_Multiple_files/outputs/LCT1/LCT1_heatmap.nii.gz' ) gl.overlayloadsmooth(1) gl.minmax(1, 1, 50) gl.colorname(1, "4hot") gl.shaderadjust('overlayDepth', 0.35) # #load overlay 2 gl.overlayload('./outputs/LCT1/LCT1_responses.nii.gz')
import gl gl.resetdefaults() gl.loadimage('chris_t2') gl.orthoviewmm(0, 50, 0) gl.minmax(0, 2, 155) gl.backcolor(255, 255, 255) gl.invertcolor(0, 1) #This MatCap looks nice for Rendering #gl.shadermatcap('Cortex') #gl.clipazimuthelevation(0.5, 0, 90)
import gl gl.resetdefaults() #open background image gl.loadimage('spm152') #open overlay: show positive regions gl.overlayloadsmooth(1); gl.overlayload('spmMotor') gl.minmax(1, 4, 4) gl.opacity(1,50) #open overlay: show negative regions gl.overlayloadsmooth(0); gl.overlayload('spmMotor') gl.minmax(2, -4, -4) gl.colorname (2,"3blue") gl.overlayloadsmooth(1); print("n.b. Blue surface is jagged (smoothing off)");
import gl gl.resetdefaults() #the desai atlas comes with AFNI # if this fails, use File/OpenAFNI to set AFNI folder # gl.loadimage(pth+'stats.FT+orig.HEAD') #gl.loadimage('TTatlas+tlrc.HEAD') gl.resetdefaults() gl.orthoviewmm(0, 0, 0) #gl.loadimage('TTatlas+tlrc') gl.loadimage('/Users/chris/src/AICHAlr') #gl.generateclusters(0) #gl.generateclusters(0, 0.5, 32, 1, 0)
import gl gl.resetdefaults() gl.loadimage('CT_Philips') gl.colorname(0, 'CT_Kidneys') gl.shadername('Tomography') gl.azimuthelevation(150, 10) gl.clipazimuthelevation(0.25, 180, 60)
import gl gl.resetdefaults() gl.orthoviewmm(0, 0, 0) gl.loadimage('/Users/chris/V1.nii.gz') #gl.loadimage('/Users/chris/FA.nii.gz') #open overlay: show positive regions #gl.overlayload('/Users/chris/V1.nii.gz') #gl.opacity(1,50) # # if (layer > 0) then # Vol1.UpdateOverlays(vols); #str = gl.atlaslabels(1) #print(str) #gl.minmax(1, 4, 100) #gl.overlayload('aal') # #gl.generateclusters(0) #gl.generateclusters(0, 0.5, 32, 1, 0)
import gl gl.resetdefaults() ktime = 30 ksteps = 72 gl.resetdefaults() gl.loadimage('CT_Abdo') #adjust contrast to show bones gl.minmax(0, -1024, 640) for x in range(1, ksteps): gl.azimuthelevation(160 + (x * 5), 30) gl.wait(ktime) #adjust color scheme to show kidneys gl.colorname(0, 'CT_Kidneys') gl.shadername('Tomography') #gl.shaderadjust('brighten', 1.2) for x in range(1, ksteps): gl.azimuthelevation(160 + (x * 5), 30) gl.wait(ktime)
import gl gl.resetdefaults() gl.backcolor(255,255,255) pth = '~/afni/' gl.loadimage(pth+'FT_anat+orig.HEAD') gl.overlayload('TSNR.FT+orig.HEAD') gl.opacity(1, 50) gl.extract(1,1,3) gl.clipazimuthelevation(0.3, 0, 120)
import gl gl.resetdefaults() gl.loadimage('chris_MRA') #load Maximum Intensity Projection Shader gl.shadername('MIP')
import gl gl.resetdefaults() pth = '~/afni/' #the desai atlas comes with AFNI # if this fails, use File/OpenAFNI to set AFNI folder gl.loadimage('TT_desai_dd_mpm+tlrc.HEAD') #set atlas saturation to 20% gl.minmax(0, 0, 20) gl.overlayload(pth+'ttest.wav.t0.p3.RT_REML.L-A.allmask+tlrc.HEAD') gl.minmax(1, 2, 5) gl.colorname(1,'Plasma') #make overlay translucent gl.opacity(1, 75) #find clusters gl.generateclusters(1) gl.orthoviewmm(0,0,0) #the 'tomography' shader works well with discrete atlases gl.shadername('Tomography')
import gl gl.resetdefaults() pth = '~/afni/' gl.loadimage(pth+'fitts.FT+orig.HEAD') gl.overlayload(pth+'stats.FT+orig.HEAD') gl.loadgraph(pth+'ideal_Arel.1D', 0) gl.loadgraph(pth+'ideal_Vrel.1D', 1) gl.graphscaling(3) gl.volume(1,8) gl.minmax(1, 6, 12) gl.colorname(1,'Viridis') gl.generateclusters(1) gl.orthoviewmm(0,0,0)
import gl import sys import random print(sys.version) print(gl.version()) gl.resetdefaults() rois_to_plot = ['neurosynth_acc_gmMasked', 'neurosynth_dlpfc_left_gmMasked', 'neurosynth_dlpfc_right_gmMasked'] # rois_to_plot = ['neurosynth_acc_mask', 'neurosynth_dlpfc_left_mask', 'neurosynth_dlpfc_right_mask'] # rois_to_plot = ['left_dlpfc', 'right_dlpfc', 'left_acc', 'right_acc'] ###################################### gl.loadimage('//exasmb.rc.ufl.edu/blue/rachaelseidler/tfettrow/Crunch_Code/MR_Templates/MNI_2mm.nii') gl.opacity(1,1) ###################################### # rois_plotted=1; # this_index=0; for this_roi in rois_to_plot: # gl.loadimage('//exasmb.rc.ufl.edu/blue/rachaelseidler/tfettrow/Crunch_Code/MR_Templates/MNI_2mm.nii') # gl.opacity(1,10) # gl.mosaic('a -36 -32 -28 -24 -20 -16 -10 -6 -2; 2 6 10 14 18 22 26 30 34; 38 42 46 50 54 58 62 66 70') # gl.mosaic("A R 0 C R 0 S R 0; A R -0 C R -0 S R -0"); gl.mosaic("A R 0"); gl.overlayload("//exasmb.rc.ufl.edu/blue/rachaelseidler/share/FromExternal/Research_Projects_UF/CRUNCH/MiM_Data/ROIs/"+this_roi) #gl.minmax(0,.01,.01) gl.colorbarposition(0) gl.colornode(1,2,255,0,0,255,255) # blue
import gl gl.resetdefaults() #the desai atlas comes with AFNI # if this fails, use File/OpenAFNI to set AFNI folder gl.loadimage( '/Users/chris/tmp/atlases/HarvardOxford-cort-maxprob-thr0-1mm.nii.gz') #gl.overlayload(pth+'ttest.wav.t0.p3.RT_REML.L-A.allmask+tlrc.HEAD')
#Conceptual Fig import gl import sys print(sys.version) print(gl.version()) gl.resetdefaults() #gl.loadimage('//cifs.rc.ufl.edu/ufrc/rachaelseidler/tfettrow/Crunch_Code/MR_Templates/Template_4_IXI555_MNI152_GS.nii') gl.loadimage( '//cifs.rc.ufl.edu/ufrc/rachaelseidler/tfettrow/Crunch_Code/MR_Templates/MNI_2mm.nii' ) OA_filename = [ '//cifs.rc.ufl.edu/ufrc/rachaelseidler/share/FromExternal/Research_Projects_UF/CRUNCH/MiM_Data/Level2_Results/MRI_files/05_MotorImagery/oldadult/spmT_0001.nii' ] #OA_filename = ['//cifs.rc.ufl.edu/ufrc/rachaelseidler/share/FromExternal/Research_Projects_UF/CRUNCH/MiM_Data/Level2_Results/MRI_files/05_MotorImagery/oldadult/spmT_0002.nii'] #OA_filename = ['//cifs.rc.ufl.edu/ufrc/rachaelseidler/share/FromExternal/Research_Projects_UF/CRUNCH/MiM_Data/Level2_Results/MRI_files/05_MotorImagery/oldadult/spmT_0003.nii'] #OA_filename = ['//cifs.rc.ufl.edu/ufrc/rachaelseidler/share/FromExternal/Research_Projects_UF/CRUNCH/MiM_Data/Level2_Results/MRI_files/05_MotorImagery/oldadult/spmT_0004.nii'] #OA_filename = ['//cifs.rc.ufl.edu/ufrc/rachaelseidler/share/FromExternal/Research_Projects_UF/CRUNCH/MiM_Data/Level2_Results/MRI_files/05_MotorImagery/oldadult/spmT_0005.nii'] gl.overlayload(OA_filename[0]) gl.minmax(1, 1, 5) gl.colorname(1, "8redyell") gl.opacity(1, 80) #gl.mosaic('l+ h -0.3 v -0.1 a 55 s x r 0') gl.mosaic('a 55') gl.colorbarposition(0) #gl.linewidth(5) gl.savebmp(OA_filename[0]) gl.loadimage( '//cifs.rc.ufl.edu/ufrc/rachaelseidler/tfettrow/Crunch_Code/MR_Templates/MNI_2mm.nii'
import gl gl.resetdefaults() gl.loadimage('/Users/chris/Neuro/MRIcroGLold/templates/inia19-NeuroMaps.nii.gz') gl.scriptformvisible(1) gl.atlashide(0) gl.atlasshow(0, 151,153,129) gl.atlasshow(0, 1215,1,3,7) print('Regions '+ str(gl.atlasmaxindex(0)) ) #print(gl.atlaslabels(0))
# %% Libraries ---------------------- import gl import os # %% General---------------------- #gl.resetdefaults() gl.backcolor(255, 255, 255) # %% background image ---------------------- gl.loadimage('mni152') # %% overlay ---------------------- FILESPATH='D:\\GD_UNICAMP\\IC_NeuroFisica\\Projetos\\fMRI_TLE_2020\\Seed_based_analysis' os.chdir(FILESPATH) networks_names=['DMN','SMOTOR','VISUAL','AUDIT','ECN_L','ECN_R'] netfile_sufx= ['_Group1X','_Group2L','_Group3R','_Group4N'] for net in networks_names: savefolder=FILESPATH + '\\' + net + '\\' for i in netfile_sufx: FILENAME=net+i SEEDFILENAME=net+"_seed" gl.overlaycloseall() gl.overlayload(FILENAME) gl.overlayload(SEEDFILENAME) gl.colorname (2,"3blue") #gl.opacity(1,50)
overlay_path = data_path + '/' + subject + '/allen_annotation_invsynned_to_' + subject + '_adjusted_cerebellum_lobular_mc_si.nii.gz' output_path = analysis_path + '/' + subject + '_50rot_overlay_si_si' print(input_path) print(overlay_path) for j in range(2): if j == 1: output_path = output_path + '_cutout' output_gif_path = output_path + '.gif' print(output_path) if not os.path.exists(output_path): os.mkdir(output_path) gl.loadimage(input_path) if i == 3: # load both subcortical and cerebellum gl.overlayload(overlay_path) gl.overlayload(overlay2_path) gl.opacity(1, 40) gl.opacity(2, 70) gl.minmax(1, 0, 1243) gl.minmax(2, 0, 1243) gl.colorname(1, 'x_rain') gl.colorname(2, 'x_rain') #gl.fullscreen(0) else: gl.overlayload(overlay_path) gl.opacity(1, 40) gl.minmax(1, 0, 1243)