# ROIs are defined with two variables : 1) a volume which contains integers # and 2) a vector of labels which link every integer inside the volume with a # label (for example, with the brodmann atlas, the index 4 refers to the label # brodmann 4). Here, we illustrate how to find the index of a region of # interest ##################################### # **Method 1 :** export all ROI labels and indices in an excel file # # This first method load a ROI atlas then, we use the # :class:`visbrain.objects.RoiObj.get_labels` method to save every related ROI # informations in an excel file. This first method implies that you manually # inspect in this file the index of the ROI that you're looking for. roi_to_find1 = RoiObj('brodmann') # Use Brodmann areas ref_brod = roi_to_find1.get_labels(vb_path) # Save Brodmann roi_to_find1('aal') # Switch to AAL ref_aal = roi_to_find1.get_labels(vb_path) # Save AAL roi_to_find1('talairach') # Switch to Talairach # ref_tal = roi_to_find1.get_labels(vb_path) # Save Talairach ##################################### # **Method 2 :** explicitly search where is the ROI that you're looking for # # Here, we use the :class:`visbrain.objects.RoiObj.where_is` method of the ROI # object to explicitly search string patterns # Method 2 : use the `where_is` method roi_to_find1('brodmann') # Switch to Brodmann idx_ba6 = roi_to_find1.where_is('BA6') # Find only BA6 print(ref_brod.loc[idx_ba6])
# ROIs are defined with two variables : 1) a volume which contains integers # and 2) a vector of labels which link every integer inside the volume with a # label (for example, with the brodmann atlas, the index 4 refers to the label # brodmann 4). Here, we illustrate how to find the index of a region of # interest ##################################### # **Method 1 :** export all ROI labels and indices in an excel file # # This first method load a ROI atlas then, we use the # :class:`visbrain.objects.RoiObj.get_labels` method to save every related ROI # informations in an excel file. This first method implies that you manually # inspect in this file the index of the ROI that you're looking for. roi_to_find1 = RoiObj('brodmann') # Use Brodmann areas ref_brod = roi_to_find1.get_labels(vb_path) # Save Brodmann roi_to_find1('aal') # Switch to AAL ref_aal = roi_to_find1.get_labels(vb_path) # Save AAL roi_to_find1('talairach') # Switch to Talairach # ref_tal = roi_to_find1.get_labels(vb_path) # Save Talairach ##################################### # **Method 2 :** explicitly search where is the ROI that you're looking for # # Here, we use the :class:`visbrain.objects.RoiObj.where_is` method of the ROI # object to explicitly search string patterns # Method 2 : use the `where_is` method roi_to_find1('brodmann') # Switch to Brodmann idx_ba6 = roi_to_find1.where_is('BA6') # Find only BA6 print(ref_brod.loc[idx_ba6])
) CBAR_STATE = dict(cbtxtsz=12, txtsz=10., width=.1, cbtxtsh=3., rect=(-.3, -2., 1., 4.)) sc = SceneObj(camera_state=CAM_STATE, bgcolor=(.1, .1, .1), size=(1400, 1000)) # ============================================================================= # FIND INDEX OF AN ROI # ============================================================================= """Here, we illustrate how to find the integer index of the ROI to plot """ # Method 1 : save all ROI in an excel file and search manually the ROI roi_to_find1 = RoiObj('brodmann') # Use Brodmann areas ref_brod = roi_to_find1.get_labels(vb_path) # Save Brodmann roi_to_find1('aal') # Switch to AAL ref_aal = roi_to_find1.get_labels(vb_path) # Save AAL roi_to_find1('talairach') # Switch to Talairach ref_tal = roi_to_find1.get_labels(vb_path) # Save Talairach # Method 2 : use the `where_is` method roi_to_find1('brodmann') # Switch to Brodmann idx_ba6 = roi_to_find1.where_is('BA6') # Find only BA6 print(ref_brod.loc[idx_ba6]) roi_to_find1('aal') # Switch to AAL idx_sma = roi_to_find1.where_is(['Supp Motor Area', '(L)'], union=False) # ============================================================================= # BRAIN + BA6 # =============================================================================