Exemple #1
0
def process2(folder):
    """ Post process data Delta"""
    print(folder)
    util.setup(folder)
    params = ['Delta_qol', 'Delta_qol2', 'Delta_mobility', 'Delta_selfcare', 'Delta_activity', 'Delta_pain', 'Delta_anixety', 'Delta_kps']
    image_ids = find_images()
    result = util.post_calculations(image_ids)
    print(len(result['all']))
    util.avg_calculation(result['all'], 'all_N=112', None, True, folder, save_sum=True)
    util.avg_calculation(result['img'], 'img_N=112', None, True, folder)
    print("\n\n\n\n\n")

    for qol_param in params:
        if qol_param == "Delta_qol2":
            (image_ids_with_qol, qol) = util.get_qol(image_ids, "Delta_qol")
            qol = [-1 if _temp <= -0.15 else 0 if _temp < 0.15 else 1 for _temp in qol]
        else:
            (image_ids_with_qol, qol) = util.get_qol(image_ids, qol_param)
        qol = [_temp * 100 for _temp in qol]
        default_value = -300
        print(qol_param, len(qol))
        result = util.post_calculations(image_ids_with_qol)
        for label in result:
            if label == 'img':
                continue
            print(label)
            # util.avg_calculation(result[label], label + '_' + qol_param, qol, True, folder, default_value=default_value)
            util.median_calculation(result[label], label + '_' + qol_param, qol, True, folder, default_value=default_value)
Exemple #2
0
def process3(folder):
    """ Post process data """
    print(folder)
    util.setup(folder)
    params = ['Mobility', 'Selfcare', 'Activity', 'Pain', 'Anxiety', 'karnofsky', 'Index_value']
    image_ids = find_images()
    result = util.post_calculations(image_ids)
    print(len(result['all']))
    # util.avg_calculation(result['all'], 'all_N=112', None, True, folder, save_sum=True)
    # util.avg_calculation(result['img'], 'img_N=112', None, True, folder)

    for qol_param in params:
        if qol_param == "Delta_qol2":
            (image_ids_with_qol, qol) = util.get_qol(image_ids, "Delta_qol")
            qol = [-1 if _temp <= -0.15 else 0 if _temp < 0.15 else 1 for _temp in qol]
        else:
            (image_ids_with_qol, qol) = util.get_qol(image_ids, qol_param)
        if qol_param not in ["karnofsky", "Delta_kps"]:
            qol = [_temp * 100 for _temp in qol]
        default_value = -100
        print(qol_param)
        print(len(qol))
        result = util.post_calculations(image_ids_with_qol)
        for label in result:
            if label == 'img':
                continue
            print(label)
            util.avg_calculation(result[label], label + '_' + qol_param + '_N=112', qol, True, folder, default_value=default_value)
            util.median_calculation(result[label], label + '_' + qol_param + '_N=112', qol, True, folder, default_value=default_value)
Exemple #3
0
def process(folder):
    """ Post process data distribution and baseline"""
    print(folder)
    util.setup(folder)
    params = ['Mobility', 'Selfcare', 'Activity', 'Pain', 'Anxiety', 'karnofsky', 'Index_value']
    image_ids = find_images_163()
    result = util.post_calculations(image_ids)
    print(len(result['all']))
    util.avg_calculation(result['all'], 'all_N=163', None, True, folder, save_sum=True)
    util.avg_calculation(result['img'], 'img_N=163', None, True, folder)

    image_ids = do_img_registration_GBM.find_images()
    result = util.post_calculations(image_ids)
    print(len(result['all']))
    util.avg_calculation(result['all'], 'all_N=170', None, True, folder, save_sum=True)
    util.avg_calculation(result['img'], 'img_N=170', None, True, folder)
    for qol_param in params:
        (image_ids_with_qol, qol) = util.get_qol(image_ids, qol_param)
        if qol_param not in ["karnofsky", "Delta_kps"]:
            qol = [_temp * 100 for _temp in qol]
        default_value = -100
        print(qol_param)
        print(len(qol))
        result = util.post_calculations(image_ids_with_qol)
        for label in result:
            if label == 'img':
                continue
            print(label)
            # util.avg_calculation(result[label], label + '_' + qol_param, qol, True, folder, default_value=default_value)
            util.median_calculation(result[label], label + '_' + qol_param, qol, True, folder, default_value=default_value)
Exemple #4
0
def process_vlsm(folder, n_permutations):
    """ Post process vlsm data """
    print(folder)
    util.setup(folder)
    image_ids = find_images()
    params = [
        'Index_value', 'karnofsky', 'Mobility', 'Selfcare', 'Activity', 'Pain',
        'Anxiety'
    ]
    alternative = [
        'less', 'less', 'greater', 'greater', 'greater', 'greater', 'greater'
    ]
    stat_func = [
        util.brunner_munzel_test, util.mannwhitneyu_test,
        util.mannwhitneyu_test, util.mannwhitneyu_test, util.mannwhitneyu_test,
        util.mannwhitneyu_test, util.mannwhitneyu_test
    ]
    for (qol_param, stat_func_i, alternative_i) in zip(params, stat_func,
                                                       alternative):
        (image_ids_with_qol, qol) = util.get_qol(image_ids, qol_param)
        result = util.post_calculations(image_ids_with_qol)
        for label in result:
            print(label)
            if label == 'img':
                continue
            util.vlsm(result[label],
                      label + '_' + qol_param,
                      stat_func_i,
                      qol,
                      folder,
                      n_permutations=n_permutations,
                      alternative=alternative_i)