def visualize_colorbar(savedir, min=0.75, max=1.0):
    gl.resetdefaults()
    gl.minmax(0, min, max)
    gl.colorname(0, colorname)
    gl.opacity(0, 0)
    gl.colorbarposition(1)
    gl.savebmp(os.path.join(savedir, 'colorbar.png'))
def visualize_axial(niidir, savedir, min=0.75, max=1.0):
    gl.viewaxial(1)
    for method in ['grad', 'cam']:
        for network in ['Vis', 'SomMot', 'DorsAttn', 'SalVentAttn', 'Limbic', 'Cont', 'Default']:
            for gender in ['female', 'male']:
                gl.overlayload(os.path.join(niidir, 'network', 'saliency_{}_{}_top20_{}_lh'.format(method, gender, network)))
                gl.overlayload(os.path.join(niidir, 'network', 'saliency_{}_{}_top20_{}_rh'.format(method, gender, network)))
                gl.minmax(1, min, max)
                gl.minmax(2, min, max)
                gl.colorname(1, colorname)
                gl.colorname(2, colorname)

                gl.savebmp(os.path.join(savedir, '{}_{}_{}_axial.png'.format(method, network, gender)))
                gl.overlaycloseall()
def visualize_sagittal(niidir, savedir, min=0.75, max=1.0):
    for hemisphere in ['lh', 'rh']:
        if hemisphere =='lh': gl.clipazimuthelevation(0.49, 90, 0)
        elif hemisphere =='rh': gl.clipazimuthelevation(0.49, 270, 0)
        for network in ['Vis', 'SomMot', 'DorsAttn', 'SalVentAttn', 'Limbic', 'Cont', 'Default']:
            for gender in ['female', 'male']:
                gl.overlayload(os.path.join(niidir, 'network', 'saliency_{}_top20_{}_{}'.format(method, gender, network, hemisphere)))
                gl.minmax(1, min, max)
                gl.colorname(1, colorname)

                gl.viewsagittal(1)
                gl.savebmp(os.path.join(savedir, '{}_{}_sagittal_{}_lt.png'.format(network, gender, hemisphere)))
                gl.viewsagittal(0)
                gl.savebmp(os.path.join(savedir, '{}_{}_sagittal_{}_rt.png'.format(network, gender, hemisphere)))
                gl.overlaycloseall()
예제 #4
0
import gl
gl.resetdefaults()
#open background image
gl.loadimage('mni152')
gl.backcolor(255, 255, 255)
#open overlay:
gl.overlayloadsmooth(0)

#open overlay: sub 41, 1 site
gl.overlayload(
    '/Users/mflounders/Desktop/cnds/multiplied_BLA/041sph_bin.nii.gz')
gl.minmax(1, 0, 14)
gl.colorname(1, "NIH")

#open overlay: sub 81, 1 site
gl.overlayload(
    '/Users/mflounders/Desktop/cnds/multiplied_BLA/081sph_bin.nii.gz')
gl.minmax(2, 0, 14)
gl.colorname(2, "NIH")

#open overlay: sub 91, 1 site
gl.overlayload(
    '/Users/mflounders/Desktop/cnds/multiplied_BLA/091sph_bin.nii.gz')
gl.minmax(3, 0, 14)
gl.colorname(3, "NIH")

#open overlay: sub 111, 3 sites
gl.overlayload(
    '/Users/mflounders/Desktop/cnds/multiplied_BLA/111sph_bin.nii.gz')
gl.minmax(4, 0, 14)
gl.colorname(4, "NIH")
예제 #5
0
# 	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' ]

for this_index in range(0, len(OAi_filenames)):
    gl.overlaycloseall()
    gl.overlayload(OAi_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(OAi_filenames[this_index])

# YA_filenames=['C:/Users/tfettrow/Dropbox (UFL)/CrunchReview/Tables_and_Figs/YA_Flat', \
#  'C:/Users/tfettrow/Dropbox (UFL)/CrunchReview/Tables_and_Figs/YA_Low', \
# 'C:/Users/tfettrow/Dropbox (UFL)/CrunchReview/Tables_and_Figs/YA_Med', \
# 'C:/Users/tfettrow/Dropbox (UFL)/CrunchReview/Tables_and_Figs/YA_Hard' ]

# for this_index in range(0,len(YA_filenames)):
# 	gl.overlaycloseall()
예제 #6
0
subject_path_list = glob.glob(os.path.join(data_path, '*'))

print(subject_path_list)

for subject_path in subject_path_list:
	subject = subject_path.split(os.sep)[-1]

	main_path = os.path.join(subject_path, subject+'_reoriented.nii.gz')
	overlay1_path = os.path.join(subject_path, subject+'_annotation_orsuit_thrarg_adjusted_lobular_mc.nii.gz')

	gl.loadimage(main_path)
	gl.overlayloadsmooth(0)
	gl.overlayload(overlay1_path)

	gl.opacity(1, 50)
	gl.minmax(1, 0, 34)
	gl.colorname(1, 'x_rain')

	output_dir_path = os.path.join(analysis_path, 'imageSequenceFolders', subject+'_orthoview')
	if not os.path.exists(output_dir_path):
		os.mkdir(output_dir_path)

	if subject == 'patient':
		y_min = -84
		y_max = -14
	else:
		y_min = -80
		y_max = -10
	
	y_step = 1
예제 #7
0
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')
gl.overlayloadsmooth(1)
gl.minmax(2, 0, 50)
gl.colorname(2, "2green")
gl.shaderadjust('overlayDepth', 0.35)

# #open background image
# gl.loadimage('spm152')
# #open overlay: show positive regions
# gl.overlayload('spmMotor')
# gl.minmax(1, 4, 4)
예제 #8
0
            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)
                gl.colorname(1, 'x_rain')
                #gl.fullscreen(0)

            if j == 1:
                if i < 3:
                    gl.cutout(0.5, 0.5, 0.5, 0, 0, 1)
                else:
예제 #9
0
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'
)
YA_filename = [
    '//cifs.rc.ufl.edu/ufrc/rachaelseidler/share/FromExternal/Research_Projects_UF/CRUNCH/MiM_Data/Level2_Results/MRI_files/05_MotorImagery/youngadult/spmT_0001.nii'
]
#YA_filename = ['//cifs.rc.ufl.edu/ufrc/rachaelseidler/share/FromExternal/Research_Projects_UF/CRUNCH/MiM_Data/Level2_Results/MRI_files/05_MotorImagery/youngadult/spmT_0002.nii']
예제 #10
0
import gl
gl.resetdefaults()
gl.overlayloadsmooth(1)
gl.loadimage('spm152')
gl.overlayload('spmMotor')
gl.removesmallclusters(1, 3.5, 800)
gl.minmax(1, 3.5, 3.5)
gl.overlayload('spmMotor')
gl.removesmallclusters(2, -2.5, 800)
gl.minmax(2, -2.5, -2.5)
print("overlays only have large clusters");
예제 #11
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)
예제 #12
0
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')
예제 #13
0
#gl.colorname(11,'GE_color')
#gl.colorfromzero(11,1)
#gl.overlayload("//cifs.rc.ufl.edu/ufrc/rachaelseidler/share/FromExternal/Research_Projects_UF/CRUNCH/MiM_Data/ROIs/Gordon2016_Visual_mask")
#gl.minmax(12, 0.01,0.1)
#gl.colorname(12,'CT_Kidneys')
#gl.colorfromzero(12,1)

##Power Networks
gl.loadimage(
    '//cifs.rc.ufl.edu/ufrc/rachaelseidler/tfettrow/Crunch_Code/MR_Templates/MNI_1mm.nii'
)
gl.opacity(1, 50)
gl.overlayload(
    "//cifs.rc.ufl.edu/ufrc/rachaelseidler/share/FromExternal/Research_Projects_UF/CRUNCH/MiM_Data/ROIs/Power2011_Auditory_mask"
)
gl.minmax(1, 0.01, 0.1)
gl.colorname(1, '1red')
gl.colorfromzero(1, 1)
gl.overlayload(
    "//cifs.rc.ufl.edu/ufrc/rachaelseidler/share/FromExternal/Research_Projects_UF/CRUNCH/MiM_Data/ROIs/Power2011_Cingulo-opercular_Control_mask"
)
gl.minmax(2, 0.01, 0.1)
gl.colorname(2, '2green')
gl.colorfromzero(2, 1)
gl.overlayload(
    "//cifs.rc.ufl.edu/ufrc/rachaelseidler/share/FromExternal/Research_Projects_UF/CRUNCH/MiM_Data/ROIs/Power2011_Default_mode_mask"
)
gl.minmax(3, 0.01, 0.1)
gl.colorname(3, '3blue')
gl.colorfromzero(3, 1)
gl.overlayload(
예제 #14
0
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)
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
y_step = 0.05

y = y_min
count = 0
while y <= y_max:
예제 #16
0
import gl
gl.resetdefaults()
#open background image
gl.loadimage('spm152')
gl.overlayloadsmooth(1)
#open overlay: show positive regions
gl.overlayload('spmMotor')
gl.minmax(1, -2, -5)
gl.colorname(1, '8redyell')
gl.colorfromzero(1, 1)
gl.overlayload('spmMotor')
gl.minmax(2, 2, 5)
gl.colorname(2, '5winter')
gl.colorfromzero(2, 1)
gl.hiddenbycutout(1, 1)
gl.cutout(0.5, 0.5, 0.5, 0, 1, 1)
gl.shadername('OverlaySurface')
gl.backcolor(255, 255, 255)
예제 #17
0
import gl
gl.resetdefaults()
gl.loadimage('mni152')
gl.overlayload('spmMotor')
gl.minmax(1, 4, 4)
gl.shadername('Glass')
gl.shaderadjust('boundThresh', 0.3)
gl.shaderadjust('edgeThresh', 0.42)
gl.shaderadjust('edgeBoundMix', 0.05)
gl.shaderadjust('boundBrightness', 0.0)
gl.shaderadjust('colorTemp', 0.8)
gl.backcolor(255, 255, 255)
gl.viewsagittal(1)
예제 #18
0
import gl
gl.resetdefaults()
gl.view(16)
#open background image
gl.loadimage('spm152')
#open overlay: show positive regions
gl.overlayload('spmMotor')
gl.minmax(1, -4, 4)
gl.colorname(1, 'blue2red')
gl.opacity(1, 80)
gl.orthoviewmm(0, 0, 60)
gl.zerointensityinvisible(1, 1)
예제 #19
0
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)
analysis_path = os.path.join(mep_path, 'Data', 'Human', 'Analysis')
main_path = os.path.join(reference_path, 'standard', 'MNI152_T1_0.5mm.nii.gz')
overlay1_path = os.path.join(analysis_path, 'Lobules-SUIT_aFD_volIncrease.nii.gz')
overlay2_path = os.path.join(analysis_path, 'Lobules-SUIT_aFD_volDecrease.nii.gz')
overlay3_path = os.path.join(analysis_path, 'prob_atlas_bilateral_thrarg_0_aFD_volIncrease.nii.gz')
overlay4_path = os.path.join(analysis_path, 'prob_atlas_bilateral_thrarg_0_aFD_volDecrease.nii.gz')
gl.loadimage(main_path)
gl.overlayload(overlay1_path)
gl.overlayload(overlay2_path)
gl.overlayload(overlay3_path)
gl.overlayload(overlay4_path)
gl.opacity(1, 50)
gl.opacity(2, 50)
gl.opacity(3, 50)
gl.opacity(4, 50)
gl.minmax(1, 0, 0.25)
gl.minmax(2, 0, 0.25)
gl.minmax(3, 0, 0.25)
gl.minmax(4, 0, 0.25)
gl.colorname(1, '1red')
gl.colorname(2, '3blue')
gl.colorname(3, '1red')
gl.colorname(4, '3blue')
output_dir_path = os.path.join(analysis_path, 'imageSequenceFolders', 'aFD_InDe')
if not os.path.exists(output_dir_path):
	os.mkdir(output_dir_path)

y_min = -120
y_max = 90
y_step = 1
예제 #21
0
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)");
            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)

            if i == 2:
                gl.loadimage(input_path)
                gl.overlayload(overlay_path)
                gl.overlayload(overlay2_path)
                gl.opacity(1, 40)
                gl.opacity(2, 70)
                gl.minmax(1, 0, 34)
                gl.minmax(2, 6, 10)
                gl.colorname(1, 'x_rain')
                gl.colorname(2, 'x_rain')
                #gl.fullscreen(0)
            else:
                gl.loadimage(input_path)
                gl.overlayload(overlay_path)
                gl.opacity(1, 40)
                gl.minmax(1, 0, 34)
                gl.colorname(1, 'x_rain')
                #gl.fullscreen(0)

            if j == 1:
                if i < 2:
                    gl.cutout(0.5, 0.5, 0.5, 0, 0, 1)