def bundleFlatHierarchy(bundlefile, hiefile, color_palette='colors256', anat=None): import anatomist.api as anatomist_api if anat == None: anat = anatomist_api.Anatomist() locals_var = locals() #read all bundles names bunlist = [] ns = dict() exec(compile(open(bundlefile).read(), bundlefile, 'exec'), ns) bunlist = ns['attributes']['bundles'] bundles_num = len(bunlist) / 2 labels = [] for i in range(bundles_num): ind = i * 2 labels.append(bunlist[ind]) #create hierarchy pl = anat.palettes() pal = pl.find(color_palette) color = pal.get() colorlist = [] ind_color = 0 h = aims.Hierarchy() h.setSyntax('hierarchy') h['graph_syntax'] = 'RoiArg' all_tree = aims.Tree(True, 'fold_name') all_tree['name'] = 'all' h.insert(all_tree) for i in range(len(labels)): indcol = ind_color % 256 col = color.value(indcol) vcol = [col.red(), col.green(), col.blue()] tree = aims.Tree(True, 'fold_name') tree['color'] = vcol tree['name'] = labels[i] all_tree.insert(tree) ind_color = ind_color + 1 #store hierarchy aims.write(h, hiefile)
def bundleFlatHierarchyByNameList(names, labels, hiefile, color_palette='colors256', anat=None): import anatomist.api as anatomist_api if anat == None: anat = anatomist_api.Anatomist() #create hierarchy pl = anat.palettes() pal = pl.find(color_palette) color = pal.get() colorlist = [] ind_color = 0 h = aims.Hierarchy() h.setSyntax('hierarchy') h['graph_syntax'] = 'RoiArg' all_tree = aims.Tree(True, 'fold_name') all_tree['name'] = 'all' h.insert(all_tree) labelnum = len(names) for i in range(labelnum): tree = aims.Tree(True, 'fold_name') tree['name'] = names[i] all_tree.insert(tree) llist = labels[i] indcol = ind_color % 256 col = color.value(indcol) vcol = [col.red(), col.green(), col.blue()] tree['color'] = vcol for bun in llist: ntree = aims.Tree(True, 'fold_name') ntree['name'] = bun tree.insert(ntree) ind_color = ind_color + 1 #store hierarchy aims.write(h, hiefile)
def fusion2D_map_activation( dic_maps, template_file="/i2bm/local/spm12/canonical/single_subj_T1.nii", dic_templates="", threshold=3.1, maxval=10, orientation='Axial', cursor=[0, 0, 0, 0], block=False): """ Function to merge one or many activation maps with a the single_subj_T1.nii template of spm8. The defaults values are "Rainbow1-fusion" palette set to minVal = 1. Please use the interface to change values. **Parameters :** * dict_maps: dictionnary: {'name_fusion': map_file} **Outputs :** * launch Anatomist software with all activation map merged with the template """ # initialize Anatomist a = ana.Anatomist() #load the mni referential mni_ref = a.mniTemplateRef liste_ref = a.getReferentials() dic_templates_fusion = {} if len(dic_templates) == 0: template = a.loadObject(template_file) #template = a.loadObject(file_name, objectName=objectName ) # load information from header for the template template.loadReferentialFromHeader() # load referentials ref_template = template.getReferential() tmp_template = 'truth for ' + os.path.basename(template_file) liste_ref = a.getReferentials() for ref in liste_ref: dict_ref = ref.getInfos() if 'name' in dict_ref.keys(): # if dict_ref['name'] == 'Talairach-MNI template-SPM': # ref_mni_spm = ref if dict_ref['name'].find(tmp_template) != -1: ref_template = ref a.loadTransformation([0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1], ref_template, mni_ref) #dic_templates_fusion[name_contrast] = template dic_templates_fusion["template"] = template if len(dic_templates) == len(dic_maps): for name_contrast, file_name in dic_templates.items(): #template objectName = "wanatFor_" + name_contrast #template = a.loadObject(file_name) template = a.loadObject(file_name, objectName=objectName ) # load information from header for the template template.loadReferentialFromHeader() # load referentials ref_template = template.getReferential() tmp_template = 'truth for ' + os.path.basename(objectName) liste_ref = a.getReferentials() for ref in liste_ref: dict_ref = ref.getInfos() if 'name' in dict_ref.keys(): # if dict_ref['name'] == 'Talairach-MNI template-SPM': # ref_mni_spm = ref if dict_ref['name'].find(tmp_template) != -1: ref_template = ref a.loadTransformation([0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1], ref_template, mni_ref) dic_templates_fusion[name_contrast] = template else: warnings.warn('The number of templates and constrasts are differents.') fusion_list = [] window_list = [] if block: #compute the number of columns which are needed to display in block ncol=2 nrow=1 nimg=len(dic_maps) print("NB IMG", nimg) def nb_col(ncol, nrow, nimg): ncases = ncol*nrow while ncases < nimg : if (ncol - nrow == 1): ncol = ncol + 1 else : nrow = nrow + 1 ncases = ncol*nrow return ncol, nrow if nimg == 1: new_ncol = 1 else: new_ncol, new_row = nb_col(ncol, nrow, nimg) block=a.createWindowsBlock(new_ncol, new_row) #loop on maps for fusion_name, file_name in dic_maps.items(): map_activation = a.loadObject(file_name, fusion_name) # load identity transformtion to mni_SPM tmp_map = 'truth for ' + os.path.basename(fusion_name) # load information from header map_activation.loadReferentialFromHeader() # load referentials ref_map_activation = map_activation.getReferential() liste_ref = a.getReferentials() for ref in liste_ref: dict_ref = ref.getInfos() if 'name' in dict_ref.keys(): # if dict_ref['name'] == 'Talairach-MNI template-SPM': # ref_mni_spm = ref # if dict_ref['name'].find(tmp_template) != -1: # ref_template = ref if dict_ref['name'].find(tmp_map) != -1: ref_map_activation= ref a.loadTransformation([0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1], ref_map_activation, mni_ref) #palette and options map_activation.setPalette("Rainbow1-fusion", minVal=threshold, maxVal=maxval, absoluteMode=True) # create the fusion object if dic_templates_fusion.has_key("template"): fusion_map = a.fusionObjects([map_activation, dic_templates_fusion["template"]], 'Fusion2DMethod') else: fusion_map = a.fusionObjects([map_activation, dic_templates_fusion[fusion_name]], 'Fusion2DMethod') fusion_list.append(fusion_map) if block: window_list.append(a.createWindow(orientation, block=block)) else: window_list.append(a.createWindow(orientation)) #a.linkWindows(window_list, 1) #a.AWindowsBlock(nbCols=4,) for w,f in zip(window_list, fusion_list) : # show the fusion f.setReferential(mni_ref) w.assignReferential(mni_ref) w.moveLinkedCursor(cursor) a.addObjects(f, w) #changement de position du curseur a.execute('LinkedCursor', object=f, mode="linear_on_defined", rate=0.5) # start loop sys.exit(app.exec_())
def fusion3D_map_activation(list_maps, template_file="", path_mesh=""): template_file = "/neurospin/unicog/protocols/IRMf/Tests_Isa/template/avg152T1.nii" path_mesh = "/neurospin/unicog/protocols/IRMf/Tests_Isa/template/mni152_05_brain.mesh" # initialize Anatomist a = ana.Anatomist() # load the mni referential mni_ref = a.mniTemplateRef liste_ref = a.getReferentials() dic_templates_fusion = {} # load avg152_T1 template = a.loadObject(template_file) template.loadReferentialFromHeader() # load referentials ref_template = template.getReferential() tmp_template = 'truth for ' + os.path.basename(template_file) #load the mesh and assign the T1 referential path_mesh = "/neurospin/unicog/protocols/IRMf/Tests_Isa/template/mni152_05_brain.mesh" template_mesh = a.loadObject(path_mesh) template_mesh.assignReferential(ref_template) dic_templates_fusion["template"] = template_mesh def create_palette(colors, name_palette): palette = a.createPalette(name_palette) palette.setColors(colors) return palette fusion_list = [] window_list = [] list_map_activation = [] color_list = [[255, 255, 0], [255, 153, 18], [128, 42, 42], [0, 255, 0], [61, 145, 64], [50, 205, 50], [106, 90, 205], [19, 795, 0], [0, 10, 12], [0, 31, 37], [255, 64, 64], [0, 0, 255], [240, 35, 100], [74, 64, 250], [200, 150, 100]] cpt_color = 0 #loop on maps to set correctly the referential for file_name in list_maps: map_activation = a.loadObject(file_name) # load identity transformtion to mni_SPM tmp_map = 'truth for ' + os.path.basename(file_name) # load information from header map_activation.loadReferentialFromHeader() # load referentials ref_map_activation = map_activation.getReferential() liste_ref = a.getReferentials() for ref in liste_ref: dict_ref = ref.getInfos() if 'name' in dict_ref.keys(): if dict_ref['name'].find(tmp_map) != -1: ref_map_activation = ref a.loadTransformation([0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1], ref_map_activation, mni_ref) #palette and options name_palette = "palette_" + str(cpt_color) colors = [255, 255, 255] * 1 + color_list[cpt_color] * 179 pal = create_palette(colors, name_palette) cpt_color += 1 map_activation.setPalette(pal) #list of map_activation for the Fusion2DMethod list_map_activation.append(map_activation) # Fusion2DMethod for all maps fusion_map = a.fusionObjects(list_map_activation, 'Fusion2DMethod') # for each map, create a 3DFusion fusion_list = [] window_list = [] for map_activation in list_map_activation: fusion_mesh = a.fusionObjects([map_activation, template_mesh], 'Fusion3DMethod') fusion_list.append(fusion_mesh) #now create a multitexture fusion_multiTexture = a.fusionObjects(fusion_list, 'FusionMultiTextureMethod') fusion_multiTexture_mesh = a.fusionObjects( [fusion_multiTexture, template_mesh], 'FusionTexSurfMethod') w3D_multiTexture_mesh = a.createWindow('3D') w3D_multiTexture_mesh.assignReferential(mni_ref) a.addObjects(fusion_multiTexture_mesh, w3D_multiTexture_mesh) #Fusion3DMethod for all maps + T1 fusion_t1 = a.fusionObjects([fusion_map, template], 'Fusion2DMethod') #Put the Fusion3D into a 3D window w_ax = a.createWindow('Axial') w_ax.assignReferential(mni_ref) a.addObjects(fusion_t1, w_ax) file_name = '/neurospin/unicog/protocols/IRMf/Tests_Isa/Test_nitime/test_data_antonio/ROIs_analyses/IFGorb_Pallier_2011.nii' a = a.loadObject(file_name) # start loop sys.exit(app.exec_())
path_mesh = VISU_MESH mesh = aims.read(path_mesh) path_pre_roi = os.path.join(DIR_ROIS, subject + '_' + side + '_' + 'precentral.gii') path_post_roi = os.path.join(DIR_ROIS, subject + '_' + side + '_' + 'postcentral.gii') path_pre_crest = os.path.join(DIR_CRESTS, VISU_ID + '_' + 'precentral_cleaned.gii') path_post_crest = os.path.join(DIR_CRESTS, VISU_ID + '_' + 'postcentral_cleaned.gii') path_pre_line = os.path.join(DIR_CRESTS, VISU_ID + '_' + 'precentral_cleaned.mesh') path_post_line = os.path.join(DIR_CRESTS, VISU_ID + '_' + 'postcentral_cleaned.mesh') df = pd.read_csv(PPFM) pp_pre_index = int(df.loc[(df['Subject'] == int(subject)) & (df['Hemisphere'] == side), 'PP_Pre_Index_Brain']) pp_post_index = int(df.loc[(df['Subject'] == int(subject)) & (df['Hemisphere'] == side), 'PP_Post_Index_Brain']) pp_pre_sphere = index_to_sphere(mesh, pp_pre_index) pp_post_sphere = index_to_sphere(mesh, pp_post_index) a = anatomist.Anatomist() # remove anatomist cursor in all windows a.config()['linkedCursor'] = 0 # custom palettes orange_palette = a.createPalette('PreCG') orange_palette.setColors(colors=orange_colors) purple_palette = a.createPalette('PoCG') purple_palette.setColors(colors=purple_colors) # create a windows for each sub-component of the figure mesh_with_cs = a.createWindow('3D') cs_landmarks = a.createWindow('3D') cs_rois = a.createWindow('3D') raw_tractogram = a.createWindow('3D') filtered_tractogram = a.createWindow('3D')
def bundleFlatHierarchyByToken(bundlefile, hiefile, token_index=0, delimiter='_', color_palette='colors256', anat=None): import anatomist.api as anatomist_api if anat == None: anat = anatomist_api.Anatomist() #read all bundles names bunlist = [] ns = dict() exec(compile(open(bundlefile).read(), bundlefile, 'exec'), ns) bunlist = ns['attributes']['bundles'] bundles_num = len(bunlist) / 2 labels = [] for i in range(bundles_num): ind = i * 2 labels.append(bunlist[ind]) #create groups groups = dict() for lab in labels: group = lab.split(delimiter)[token_index] if (group in groups) == False: groups[group] = [] gr = groups[group] gr.append(lab) #create hierarchy pl = anat.palettes() pal = pl.find(color_palette) color = pal.get() colorlist = [] ind_color = 0 h = aims.Hierarchy() h.setSyntax('hierarchy') h['graph_syntax'] = 'RoiArg' all_tree = aims.Tree(True, 'fold_name') all_tree['name'] = 'all' h.insert(all_tree) for key in list(groups.keys()): tree = aims.Tree(True, 'fold_name') tree['name'] = key all_tree.insert(tree) group = groups[key] for bun in group: indcol = ind_color % 256 col = color.value(indcol) vcol = [col.red(), col.green(), col.blue()] ntree = aims.Tree(True, 'fold_name') ntree['color'] = vcol ntree['name'] = bun tree.insert(ntree) ind_color = ind_color + 1 #store hierarchy aims.write(h, hiefile)
def do_mesh_cluster_rendering( title, clust_mesh_file, clust_texture_file, brain_mesh_file, anat_file, palette_file="palette_signed_values_blackcenter", #a = None, check=False, verbose=True): """ Vizualization of signed stattistic map or weigths. Parameters ---------- clust_mesh_file : str (mandatory) a mesh file of interest. clust_texture_file : str (mandatory) an IMAGE from which to extract texture (for the mesh file). brain_mesh_file : str (mandatory) a mesh file of the underlying neuroanatomy. anat_file : str (mandatory) an IMAGE of the underlying neuroanatomy. check : bool (default False) manual check of the input parameters. verbose : bool (default True) print to stdout the function prototype. Returns ------- None """ #FunctionSummary(check, verbose) global ANATOMIST global VIEWS global IMAGE # instance of anatomist if ANATOMIST is None: ANATOMIST = anatomist.Anatomist() # Add new SnapshotControl button pix = QtGui.QPixmap('control.xpm') anatomist.cpp.IconDictionary.instance().addIcon('Snap', pix) ad = anatomist.cpp.ActionDictionary.instance() ad.addAction('SnapshotAction', lambda: SnapshotAction()) cd = anatomist.cpp.ControlDictionary.instance() cd.addControl('Snap', lambda: SnapshotControl(), 25) cm = anatomist.cpp.ControlManager.instance() cm.addControl('QAGLWidget3D', '', 'Snap') a = ANATOMIST # ------------ # load objects # ------------ clust_mesh = a.loadObject(clust_mesh_file) brain_mesh = a.loadObject(brain_mesh_file) clust_texture = a.loadObject(clust_texture_file) IMAGE = aims.Reader().read(clust_texture_file) image_dim = IMAGE.header()['volume_dimension'].arraydata()[:3] """ cd /home/ed203246/mega/data/mescog/wmh_patterns/summary/cluster_mesh/tvl1l20001 from soma import aims clust_texture_file = "clust_values.nii.gz" IMAGE = aims.Reader().read(clust_texture_file) image_dim = IMAGE.header()['volume_dimension'].arraydata()[:3] trm_ima_mm2ref_mm = aims.Motion(ima.header()['transformations'][0]) trm_xyz_to_mm = ima_get_trm_xyz_to_mm(ima) min_mm = trm_ima_mm2ref_mm.transform([0, 0, 0]) #a=ima.header()['volume_dimension'] ima_dim_xyz = ima.header()['volume_dimension'].arraydata()[:3] max_mm = trm_ima_mm2ref_mm.transform(ima_dim_xyz) trm_ima_mm2ref_mm = aims.Motion(ima.header()['transformations'][0]) ima_voxel_size = ima.header()['voxel_size'][:3] xyz_to_mm(trm_ima_mm2ref_mm, ima_voxel_size) """ #print clust_texture.header()#['volume_dimension'] a_anat = a.loadObject(anat_file) # mesh option material = a.Material(diffuse=[0.8, 0.8, 0.8, 0.6]) brain_mesh.setMaterial(material) # change palette #palette_file = get_sample_data("brainvisa_palette").edouard # bv_rgb_dir = os.path.join(os.environ["HOME"], ".anatomist", "rgb") # if not os.path.isdir(bv_rgb_dir): # os.makedirs(bv_rgb_dir) # bv_rgb_file = os.path.join(bv_rgb_dir, # os.path.basename(palette_file)) # if not os.path.isfile(bv_rgb_file): # shutil.copyfile(palette_file, bv_rgb_file) palette = a.getPalette(palette_file) clust_texture.setPalette(palette, minVal=-10, maxVal=10, absoluteMode=True) # view object block = a.createWindowsBlock(2) windows = list() objects = list() # -------------------------------- # 3D view = fusion 3D + brain_mesh # -------------------------------- win3d = a.createWindow("3D", block=block) # orientation front left Q_rot = [np.cos(np.pi / 8.), np.sin(np.pi / 8.), 0, 0] fusion3d = a.fusionObjects([clust_mesh, clust_texture], "Fusion3DMethod") win3d.addObjects([fusion3d, brain_mesh]) a.execute("Fusion3DParams", object=fusion3d, step=0.1, depth=5., sumbethod="max", method="line_internal") #define point of view Q1 = win3d.getInfos()["view_quaternion"] # current point of view Q = product_quaternion(Q1, Q_rot) a.execute("Camera", windows=[win3d], view_quaternion=Q) windows.append(win3d) objects.append(fusion3d) VIEWS[(title, "3d")] = [win3d, fusion3d] # ------------------------------------- # Slices view = three VIEWS offusion 2D # ------------------------------------- # fusion 2D fusion2d = a.fusionObjects([a_anat, clust_texture], "Fusion2DMethod") a.execute("Fusion2DMethod", object=fusion2d) # change 2D fusion settings a.execute("TexturingParams", texture_index=1, objects=[ fusion2d, ], mode="Geometric") #, rate=0.1) ############## # Coronal view win_coronal = a.createWindow("3D", block=block) print "win_coronal", win_coronal # Fusion cut mesh fusionmesh_coronal = a.fusionObjects([brain_mesh, fusion2d], "FusionCutMeshMethod") a.execute("FusionCutMeshMethod", object=fusionmesh_coronal) fusionmesh_coronal.addInWindows(win_coronal) # Coronal view # Slice #sclice_coronal(fusionmesh_coronal, -90) sclice_coronal(fusionmesh_coronal, int(-(image_dim / 2)[1])) # Store windows.append(win_coronal) #a.execute objects.append([fusion2d, fusionmesh_coronal]) VIEWS[(title, "coronal")] = [win_coronal, fusionmesh_coronal] ############## # Axial view win_axial = a.createWindow("3D", block=block) print "win_axial", win_axial, win_axial.getInfos() # Fusion cut mesh fusionmesh_axial = a.fusionObjects([brain_mesh, fusion2d], "FusionCutMeshMethod") a.execute("FusionCutMeshMethod", object=fusionmesh_axial) fusionmesh_axial.addInWindows(win_axial) # Axial view, orientation front top left Q_rot = [np.cos(np.pi / 8.), np.sin(np.pi / 8.), 0, np.sin(np.pi / 8.)] Q1 = win_axial.getInfos()["view_quaternion"] # current point of view Q = product_quaternion(Q1, Q_rot) a.execute("Camera", windows=[win_axial], view_quaternion=Q, zoom=0.8) # Slice sclice_axial(fusionmesh_axial, int(-(image_dim / 2)[2])) # Store windows.append(win_axial) #a.execute objects.append([fusion2d, fusionmesh_axial]) VIEWS[(title, "axial")] = [win_axial, fusionmesh_axial] ############## #Sagital view win_sagital = a.createWindow("3D", block=block) print "win_sagital", win_sagital # Fusion cut mesh fusionmesh_sagital = a.fusionObjects([brain_mesh, fusion2d], "FusionCutMeshMethod") a.execute("FusionCutMeshMethod", object=fusionmesh_sagital) fusionmesh_sagital.addInWindows(win_sagital) # Sagital view: rotation -Pi/4 --> orientation right Q_rot = [np.sqrt(2) / 2., -np.sqrt(2) / 2., 0, 0] Q1 = win_sagital.getInfos()["view_quaternion"] # current point of view Q = product_quaternion(Q1, Q_rot) a.execute("Camera", windows=[win_sagital], view_quaternion=Q, zoom=0.9) # Slice sclice_sagital(fusionmesh_sagital, int(-(image_dim / 2)[0])) # Store windows.append(win_sagital) #a.execute objects.append([fusion2d, fusionmesh_sagital]) VIEWS[(title, "sagital")] = [win_sagital, fusionmesh_sagital] # Global windows info try: block.widgetProxy().widget.setWindowTitle(str(title)) except: print "could not set name" return [ clust_mesh, brain_mesh, clust_texture, a_anat, material, palette, block, windows, objects ]
def fusion2D_map_activation( dic_maps, template_file="/i2bm/local/spm8/canonical/single_subj_T1.nii", dic_templates=""): """ Function to merge one or many activation maps with a the single_subj_T1.nii template of spm8. The defaults values are "Rainbow1-fusion" palette set to minVal = 1. Please use the interface to change values. **Parameters :** * dict_maps: dictionnary: {'name_fusion': map_file} **Outputs :** * launch Anatomist software with all activation map merged with the template """ # initialize Anatomist a = ana.Anatomist() #load the mni referential mni_ref = a.mniTemplateRef liste_ref = a.getReferentials() dic_templates_fusion = {} if len(dic_templates) == 0: template = a.loadObject(template_file) #template = a.loadObject(file_name, objectName=objectName ) # load information from header for the template template.loadReferentialFromHeader() # load referentials ref_template = template.getReferential() tmp_template = 'truth for ' + os.path.basename(template_file) liste_ref = a.getReferentials() for ref in liste_ref: dict_ref = ref.getInfos() if 'name' in dict_ref.keys(): # if dict_ref['name'] == 'Talairach-MNI template-SPM': # ref_mni_spm = ref if dict_ref['name'].find(tmp_template) != -1: ref_template = ref a.loadTransformation([0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1], ref_template, mni_ref) #dic_templates_fusion[name_contrast] = template dic_templates_fusion["template"] = template if len(dic_templates) == len(dic_maps): for name_contrast, file_name in dic_templates.items(): #template objectName = "wanatFor_" + name_contrast #template = a.loadObject(file_name) template = a.loadObject(file_name, objectName=objectName) # load information from header for the template template.loadReferentialFromHeader() # load referentials ref_template = template.getReferential() tmp_template = 'truth for ' + os.path.basename(objectName) liste_ref = a.getReferentials() for ref in liste_ref: dict_ref = ref.getInfos() if 'name' in dict_ref.keys(): # if dict_ref['name'] == 'Talairach-MNI template-SPM': # ref_mni_spm = ref if dict_ref['name'].find(tmp_template) != -1: ref_template = ref a.loadTransformation([0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1], ref_template, mni_ref) dic_templates_fusion[name_contrast] = template else: warnings.warn('The number of templates and constrasts are differents.') fusion_list = [] window_list = [] #loop on maps for fusion_name, file_name in dic_maps.items(): map_activation = a.loadObject(file_name, fusion_name) # load identity transformtion to mni_SPM tmp_map = 'truth for ' + os.path.basename(fusion_name) # load information from header map_activation.loadReferentialFromHeader() # load referentials ref_map_activation = map_activation.getReferential() liste_ref = a.getReferentials() for ref in liste_ref: dict_ref = ref.getInfos() if 'name' in dict_ref.keys(): # if dict_ref['name'] == 'Talairach-MNI template-SPM': # ref_mni_spm = ref # if dict_ref['name'].find(tmp_template) != -1: # ref_template = ref if dict_ref['name'].find(tmp_map) != -1: ref_map_activation = ref a.loadTransformation([0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1], ref_map_activation, mni_ref) #palette and options map_activation.setPalette("Rainbow1-fusion", minVal=1, absoluteMode=True) # create the fusion object if dic_templates_fusion.has_key("template"): fusion_map = a.fusionObjects( [map_activation, dic_templates_fusion["template"]], 'Fusion2DMethod') else: fusion_map = a.fusionObjects( [map_activation, dic_templates_fusion[fusion_name]], 'Fusion2DMethod') fusion_list.append(fusion_map) window_list.append(a.createWindow('Axial')) for w, f in zip(window_list, fusion_list): # show the fusion w.assignReferential(mni_ref) a.addObjects(f, w) #changement de position du curseur a.execute('LinkedCursor', object=f, mode="linear_on_defined", rate=0.5, position=[100, 100, 100, 0]) # start loop sys.exit(app.exec_())