コード例 #1
0
def get_logfile_mu_density_bygantry(logfile_groups, mosaiq_gantry_angles,
                                    logfile_delivery_data_bygantry):
    logfile_mu_density_bygantry = dict()

    for logfile_group in logfile_groups:
        delivery_data = logfile_delivery_data_bygantry[logfile_group]
        logfile_mu_density_bygantry[logfile_group] = dict()

        for file_hash in logfile_group:
            for mosaiq_gantry_angle in mosaiq_gantry_angles:
                num_control_points = len(
                    delivery_data[file_hash][mosaiq_gantry_angle]['mu'])
                if num_control_points > 0:
                    mu_density = [
                        get_grid(),
                        delivery_data[file_hash][mosaiq_gantry_angle].mudensity()
                    ]

                    if mosaiq_gantry_angle not in logfile_mu_density_bygantry[logfile_group]:
                        logfile_mu_density_bygantry[logfile_group][mosaiq_gantry_angle] = list(
                            mu_density)
                    else:
                        assert np.all(
                            logfile_mu_density_bygantry[logfile_group][mosaiq_gantry_angle][0] == mu_density[0])
                        assert np.all(
                            logfile_mu_density_bygantry[logfile_group][mosaiq_gantry_angle][1] == mu_density[1])
                        logfile_mu_density_bygantry[logfile_group][mosaiq_gantry_angle][2] += mu_density[2]

    return logfile_mu_density_bygantry
コード例 #2
0
def compare_logfile_group_bygantry(index, config, cursor, logfile_group,
                                   gantry_angle, grid_resolution=1):
    field_id = get_field_id_from_logfile_group(index, logfile_group)

    mosaiq_delivery_data = multi_fetch_and_verify_mosaiq(cursor, field_id)

    mosaiq_mu_density = [
        get_grid(grid_resolution=grid_resolution),
        mosaiq_delivery_data.mudensity(
            gantry_angle, grid_resolution=grid_resolution)
    ]

    normalisation = calc_normalisation(mosaiq_delivery_data)

    logfile_mu_density = calc_logfile_mu_density_bygantry(
        index, config, logfile_group, gantry_angle)

    grid_xx = logfile_mu_density[0]
    grid_yy = logfile_mu_density[1]
    assert np.all(grid_xx == mosaiq_mu_density[0])
    assert np.all(grid_yy == mosaiq_mu_density[1])

    comparison = calc_comparison(
        logfile_mu_density[2], mosaiq_mu_density[2], normalisation)

    print(comparison)
    plot_results(
        grid_xx, grid_yy, logfile_mu_density[2], mosaiq_mu_density[2])

    return comparison
コード例 #3
0
def get_mosaiq_mu_density_bygantry(mosaiq_delivery_data_bygantry):
    mosaiq_mu_density_bygantry = dict()
    mosaiq_gantry_angles = mosaiq_delivery_data_bygantry.keys()

    for mosaiq_gantry_angle in mosaiq_gantry_angles:
        mu_density = [
            get_grid(),
            mosaiq_delivery_data_bygantry[mosaiq_gantry_angle].mudensity()
        ]
        mosaiq_mu_density_bygantry[mosaiq_gantry_angle] = mu_density

    return mosaiq_mu_density_bygantry
コード例 #4
0
def calc_logfile_mu_density_bygantry(index, config, logfile_group,
                                     gantry_angle, grid_resolution=1):
    logfile_mu_density = None

    for filehash in logfile_group:
        filepath = get_filepath(index, config, filehash)
        logfile_delivery_data = DeliveryDatabases.from_logfile(filepath)

        a_logfile_mu_density = [
            get_grid(grid_resolution=grid_resolution),
            logfile_delivery_data.mudensity(
                gantry_angle, grid_resolution=grid_resolution)
        ]

        if logfile_mu_density is None:
            logfile_mu_density = a_logfile_mu_density
        else:
            assert np.all(logfile_mu_density[0] == a_logfile_mu_density[0])
            assert np.all(logfile_mu_density[1] == a_logfile_mu_density[1])
            logfile_mu_density[2] += a_logfile_mu_density[2]

    return logfile_mu_density
コード例 #5
0
from pymedphys_mudensity.mudensity import calc_mu_density, get_grid, display_mu_density

leaf_pair_widths = (5, 5, 5)
max_leaf_gap = 10

mu = [0, 2, 5, 10]
mlc = [
    [[1, 1], [2, 2], [3, 3]],
    [[2, 2], [3, 3], [4, 4]],
    [[-2, 3], [-2, 4], [-2, 5]],
    [[0, 0], [0, 0], [0, 0]],
]

jaw = [[7.5, 7.5], [7.5, 7.5], [-2, 7.5], [0, 0]]

grid = get_grid(max_leaf_gap=max_leaf_gap, leaf_pair_widths=leaf_pair_widths)

mu_density = calc_mu_density(mu,
                             mlc,
                             jaw,
                             max_leaf_gap=max_leaf_gap,
                             leaf_pair_widths=leaf_pair_widths)

display_mu_density(grid, mu_density)