I’m using pylinac to extract planned and actual fluence maps from TrueBeam trajectory log files but I’d like to compare to the fluence in the DICOM RT file.
Does anybody know if pydicom and/or pylinac can relatively easily generate a similar fluence map using a dicom RT plan?
what would be the difference between the “fluence from the RTPlan” and the planned fluence from the Logfile? I always thought they are the same (Varian does the conversion for you after loading the plan).
One thing I liked about Dynalogs was that they contained the patient name.
I was thinking of writing code that would collect the trajectory logs for a specific patient. Since the RT plan file has the patient name, I was thinking of comparing the RT plan file to the trajectory log and do some kind of gamma analysis to confirm it’s the right patient trajectory log.
I think it might be possible, … (I’m a noob), but using the code:
import pydicom
from pylinac.plan_generator.fluence import generate_fluences
from pylinac import TrajectoryLog
import matplotlib.pyplot as plt
#Plot the Fluence from a DICOM file
plan = pydicom.dcmread(“path/RP_Plan.dcm”) #Path of the Dicom Plan file
fluences = generate_fluences(plan, width_mm=500, resolution_mm=1)
plt.imshow(fluences[0], cmap=‘hot’, aspect=‘auto’)
plt.colorbar(label=“Fluence Intensity (Arbitrary Units)”)
plt.xlabel(‘X Position (mm)’) # X-axis label
plt.ylabel(‘Y Position (mm)’) # Y-axis label
plt.title(‘Fluence Map from DICOM Plan’) # Title of the plot
plt.grid(True) # Show grid lines
plt.show()
#Plot the Fluence from a Trajectory log
log_path = “path/Field1.bin” #path for trajectory log
tlog = TrajectoryLog(log_path)
Log_Fluence = tlog.fluence.actual.calc_map()
plt.imshow(Log_Fluence, cmap=‘hot’, aspect=‘auto’)
plt.colorbar(label=“Fluence Intensity (Arbitrary Units)”)
plt.xlabel(‘X Position (mm)’) # X-axis label
plt.ylabel(‘Y Position (mm)’) # Y-axis label
plt.title(‘Fluence Map from Trajectory log’) # Title of the plot
plt.grid(True) # Show grid lines
plt.show()