Esempio n. 1
0
def get_meg_data(per_condition=True):
    time_range = range(_addon().get_max_time_steps())
    brain_obj = bpy.data.objects['Brain']
    if per_condition:
        meg_data, meg_colors = OrderedDict(), OrderedDict()
        rois_objs = bpy.data.objects['Cortex-lh'].children + bpy.data.objects['Cortex-rh'].children
        for roi_obj in rois_objs:
            if roi_obj.animation_data:
                meg_data_roi, meg_colors_roi = mu.evaluate_fcurves(roi_obj, time_range)
                meg_data.update(meg_data_roi)
                meg_colors.update(meg_colors_roi)
    else:
        meg_data, meg_colors = mu.evaluate_fcurves(brain_obj, time_range)
    return meg_data, meg_colors
Esempio n. 2
0
def get_meg_data(per_condition=True):
    time_range = range(PlayPanel.addon.get_max_time_steps())
    brain_obj = bpy.data.objects['Brain']
    if per_condition:
        meg_data, meg_colors = OrderedDict(), OrderedDict()
        rois_objs = bpy.data.objects['Cortex-lh'].children + bpy.data.objects['Cortex-rh'].children
        for roi_obj in rois_objs:
            if roi_obj.animation_data:
                meg_data_roi, meg_colors_roi = mu.evaluate_fcurves(roi_obj, time_range)
                meg_data.update(meg_data_roi)
                meg_colors.update(meg_colors_roi)
    else:
        meg_data, meg_colors = mu.evaluate_fcurves(brain_obj, time_range)
    return meg_data, meg_colors
Esempio n. 3
0
def get_connectivity_data():
    time_range = range(_addon().get_max_time_steps())
    parent_name = _addon().get_connections_parent_name()
    parent_obj = bpy.data.objects.get(parent_name)
    if not parent_obj is None:
        return mu.evaluate_fcurves(parent_obj, time_range)
    else:
        return None, None
Esempio n. 4
0
def capture_graph_data(per_condition):
    parent_obj = bpy.data.objects.get(PARENT_OBJ, None)
    if parent_obj:
        time_range = range(0, ConnectionsPanel.addon.get_max_time_steps(), bpy.context.scene.play_dt)
        if per_condition:
            #todo: implement
            pass
        else:
            data, colors = mu.evaluate_fcurves(parent_obj, time_range)
        return data, colors
    else:
        return {}, {}
Esempio n. 5
0
def get_electrodes_data(per_condition=True):
    if bpy.context.scene.selection_type == 'spec_cond' and bpy.context.scene.conditions_selection == '':
        print('You must choose the condition first!')
        return None, None
    elecs_data, elecs_colors = OrderedDict(), OrderedDict()
    time_range = range(_addon().get_max_time_steps())
    if per_condition:
        for obj_name in PlayPanel.electrodes_names:
            if bpy.data.objects.get(obj_name) is None:
                continue
            elec_obj = bpy.data.objects[obj_name]
            if elec_obj.hide or elec_obj.animation_data is None:
                continue
            curr_cond = bpy.context.scene.conditions_selection if \
                bpy.context.scene.selection_type == 'spec_cond' else None
            data, colors = mu.evaluate_fcurves(elec_obj, time_range, curr_cond)
            elecs_data.update(data)
            elecs_colors.update(colors)
    else:
        parent_obj = bpy.data.objects['Deep_electrodes']
        elecs_data, elecs_colors = mu.evaluate_fcurves(parent_obj, time_range)
    return elecs_data, elecs_colors
Esempio n. 6
0
def get_electrodes_data(per_condition=True):
    if bpy.context.scene.selection_type == 'spec_cond' and bpy.context.scene.conditions_selection == '':
        print('You must choose the condition first!')
        return None, None
    elecs_data, elecs_colors = OrderedDict(), OrderedDict()
    time_range = range(PlayPanel.addon.get_max_time_steps())
    if per_condition:
        for obj_name in PlayPanel.electrodes_names:
            if bpy.data.objects.get(obj_name) is None:
                continue
            elec_obj = bpy.data.objects[obj_name]
            if elec_obj.hide or elec_obj.animation_data is None:
                continue
            curr_cond = bpy.context.scene.conditions_selection if \
                bpy.context.scene.selection_type == 'spec_cond' else None
            data, colors = mu.evaluate_fcurves(elec_obj, time_range, curr_cond)
            elecs_data.update(data)
            elecs_colors.update(colors)
    else:
        parent_obj = bpy.data.objects['Deep_electrodes']
        elecs_data, elecs_colors = mu.evaluate_fcurves(parent_obj, time_range)
    return elecs_data, elecs_colors
Esempio n. 7
0
def capture_graph_data(per_condition):
    parent_obj = bpy.data.objects.get(PARENT_OBJ, None)
    if parent_obj:
        time_range = range(0, ConnectionsPanel.addon.get_max_time_steps(),
                           bpy.context.scene.play_dt)
        if per_condition:
            #todo: implement
            pass
        else:
            data, colors = mu.evaluate_fcurves(parent_obj, time_range)
        return data, colors
    else:
        return {}, {}
Esempio n. 8
0
def get_fmri_data():
    time_range = range(_addon().get_max_time_steps())
    brain_obj = bpy.data.objects['fMRI']
    data, colors = mu.evaluate_fcurves(brain_obj, time_range)
    return data, colors