def vizify(self): for hemi in self.hemis: print "visualize %s" % hemi # Bring up the beauty (the underlay) brain = Brain(self.subject_id, hemi, self.surf, \ config_opts=self.config_opts, \ subjects_dir=self.subjects_dir) surf_data = io.read_scalar_data(self.overlay_surf[hemi]) if (sum(abs(surf_data)) > 0): # Overlay another hopeful beauty (functional overlay) brain.add_overlay(self.overlay_surf[hemi], name=self.overlay_name, min=self.min, max=self.max, sign=self.sign) # Update colorbar #brain.overlays[self.overlay_name].pos_bar.lut_mode = self.colorbar tmp = brain.overlays[self.overlay_name] lut = tmp.pos_bar.lut.table.to_array() lut[:,0:3] = self.colorbar tmp.pos_bar.lut.table = lut # Refresh brain.show_view("lat") brain.hide_colorbar() # Save the beauts brain.save_imageset("%s_%s" % (self.outprefix, hemi), self.views, 'jpg', colorbar=None) # End a great journey, till another life brain.close() return
def vizify(self): for hemi in self.hemis: print "visualize %s" % hemi # Bring up the beauty (the underlay) brain = Brain(self.subject_id, hemi, self.surf, \ config_opts=self.config_opts, \ subjects_dir=self.subjects_dir) surf_data = io.read_scalar_data(self.overlay_surf[hemi]) if (sum(abs(surf_data)) > 0): # Overlay another hopeful beauty (functional overlay) brain.add_overlay(self.overlay_surf[hemi], name=self.overlay_name, min=self.min, max=self.max, sign=self.sign) # Update colorbar #brain.overlays[self.overlay_name].pos_bar.lut_mode = self.colorbar tmp = brain.overlays[self.overlay_name] lut = tmp.pos_bar.lut.table.to_array() lut[:, 0:3] = self.colorbar tmp.pos_bar.lut.table = lut # Refresh brain.show_view("lat") brain.hide_colorbar() # Save the beauts brain.save_imageset("%s_%s" % (self.outprefix, hemi), self.views, 'jpg', colorbar=None) # End a great journey, till another life brain.close() return
config_opts=dict(background="white"), subjects_dir="/home2/data/PublicProgram/freesurfer") """Get the volume => surface file""" cwas_file = path.join(mdmr_dir, "surf_lh_fdr_logp_%s.nii.gz" % factor) """ You can pass this array to the add_overlay method for a typical activation overlay (with thresholding, etc.) """ brain.add_overlay(cwas_file, min=2, max=max_zvals[i], name="%s_lh" % factor) ## get overlay and color bar tmp1 = brain.overlays["%s_lh" % factor] lut = tmp1.pos_bar.lut.table.to_array() ## update color scheme lut[:,0:3] = cols tmp1.pos_bar.lut.table = lut ## refresh view brain.show_view("lat") brain.hide_colorbar() """Save Pictures""" brain.save_imageset(path.join(odir, "zpics_%s_%s_surface_lh" % (sample, factor)), ['med', 'lat', 'ros', 'caud'], 'jpg') brain.close()
## get overlay and color bar tmp1 = brain.overlays["tmp1"] lut = tmp1.pos_bar.lut.table.to_array() ## update color scheme single = [251, 154, 143] overlap = [227, 26, 28] lut[0:85,0:3] = single lut[85:170,0:3] = single lut[170:256,0:3] = overlap tmp1.pos_bar.lut.table = lut ## refresh view brain.show_view("lat") brain.hide_colorbar() """Save Pictures""" odir = "/home/data/Projects/CWAS/age+gender/03_robustness/viz_cwas/pysurfer" brain.save_imageset(path.join(odir, "zpics_overlap_age_surface_lh"), ['med', 'lat', 'ros', 'caud'], 'jpg') brain.close() ## SEX """Bring up the visualization""" brain = Brain("fsaverage_copy", "lh", "iter8_inflated", config_opts=dict(background="white"), subjects_dir="/home2/data/PublicProgram/freesurfer")