Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
1.5 kB
1
Indexable
Never
    fig = plt.figure()
        
    ax = plt.subplot(111)

    
    
    for structure_name, color in zip( ['eyeglobe', 'target'], my_colors):
    
        

        struct = eyeplan_model.structure_set_clips_registered[structure_name]
        
        struct.resample_contour_points_in_grid(1)
        bmask = struct.binary_mask
        
        mask_accumulated += bmask
        
        new_mask = mask * bmask 
        
        
        dvh_de = DVH(de_2D, new_mask )
        dvh_ep = DVH(ep_2D, new_mask)
            
        #volume_fractions = np.linspace(0, 1, 100)
        dose_fractions = np.linspace(0, 1, 100)
        
        volumes_de = dvh_de.V(dose_fractions)
        volumes_ep = dvh_ep.V(dose_fractions)
        
        plt.plot(dose_fractions*100, volumes_de*100, label =  structure_name, color = color)
        
        # key1 = list(df.keys())[0]
        # key2 = list(df.keys())[1]
        plt.plot(dose_fractions*100, volumes_ep*100, color = color, linestyle = "--")
    
    
    plt.plot([], [], color = "k", linewidth = 2, label = "Dose engine")
    
    plt.plot([], [], color = "k", linestyle = "--" , label = "Eyeplan")
    
    plt.legend()
    
    
    plt.xlabel("% Dose", fontsize = 12)
    plt.ylabel("% Volume or surface", fontsize = 12)
    
    plt.title("2D", fontsize = 14)
    
    plt.grid(linewidth = 0.3)
    
    xlength = 8
    fig.set_size_inches(xlength, xlength/1.61803398875)
    plt.show()