sw0.sign = "pos"
oprefix = path.join(odir, "E_global_easythresh_surface_overlap")
sw0.set_output(oprefix)

scan1_surfs = {"lh": scan1_lh, "rh": scan1_rh}
scan2_surfs = {"lh": scan2_lh, "rh": scan2_rh}
overlap_surfs = {"lh": overlap_lh, "rh": overlap_rh}

#code.interact(local=locals())

for hemi in sw0.hemis:
    print "visualize %s" % hemi

    # Bring up the beauty (the underlay)
    brain = Brain(sw0.subject_id, hemi, sw0.surf, \
                  config_opts=sw0.config_opts, \
                  subjects_dir=sw0.subjects_dir)

    # Scan 1
    surf_data = scan1_surfs[hemi]
    if (sum(abs(surf_data)) > 0):
        print "Scan 1"
        # Overlay another hopeful beauty (functional overlay)
        brain.add_overlay(scan1_surfs[hemi], name="scan1", sign=sw0.sign)

        # Update colorbar
        tmp = brain.overlays["scan1"]
        lut = tmp.pos_bar.lut.table.to_array()
        lut[:, 0:3] = [27, 158, 119]
        tmp.pos_bar.lut.table = lut
sw0.set_underlay()
sw0.set_options()
sw0.min = 1; sw0.max = 2; sw0.sign = "pos"
oprefix = path.join(odir, "D_perms_surface_overlap")
sw0.set_output(oprefix)

scan1_surfs     = {"lh": scan1_lh, "rh": scan1_rh}
scan2_surfs     = {"lh": scan2_lh, "rh": scan2_rh}
overlap_surfs   = {"lh": overlap_lh, "rh": overlap_rh}

for hemi in sw0.hemis:
    print "visualize %s" % hemi
    
    # Bring up the beauty (the underlay)
    brain = Brain(sw0.subject_id, hemi, sw0.surf, \
                  config_opts=sw0.config_opts, \
                  subjects_dir=sw0.subjects_dir)
    
    # Scan 1
    surf_data = scan1_surfs[hemi]
    if (sum(abs(surf_data)) > 0):
        # Overlay another hopeful beauty (functional overlay)
        brain.add_overlay(surf_data, name="scan1", sign=sw0.sign)
    
        # Update colorbar
        tmp = brain.overlays["scan1"]
        lut = tmp.pos_bar.lut.table.to_array()
        lut[:,0:3] = [27,158,119]
        tmp.pos_bar.lut.table = lut
        
        # Refresh