pymedphys icon indicating copy to clipboard operation
pymedphys copied to clipboard

Interpretation of DoseVolume = \XDR:<number>\;

Open MattAWard opened this issue 3 months ago • 0 comments

In the plan.Trial file found within each plan folder for a patient treated in Pinnacle, the rtdose.py script seems to interpret the DoseVolume reference to XDR: as the corresponding binary dose data for that beam, e.g. DoseVolume = \XDR:006\ implies that the dose grid for that beam should come from plan.Trial.binary.006. However, for a given plan, there can be well over 100 of these binary files, many of them empty.

In several cases, I am presented with the error "Failed to export dose: unpack requires a buffer of 4 bytes" which I believe happens when the binary file being referenced for a given beam is empty, i.e. it comes from the penultimate line in:

if os.path.isfile(binary_file):
            with open(binary_file, "rb") as b:
                for z in range(trial_info["DoseGrid .Dimension .Z"] - 1, -1, -1):
                    for y in range(0, trial_info["DoseGrid .Dimension .Y"]):
                        for x in range(0, trial_info["DoseGrid .Dimension .X"]):
                            data_element = b.read(4)
                            value = struct.unpack(">f", data_element)[0]
                            dose_grid[x, y, z] = value

My question is, is it correct that \XDR:; is actually referencing plan.Trial.binary., or could it mean to reference some other object which is defined as the sum of a set of the binary files? I'm just wondering how this connection was made, as I'm not sure why, in this case, a plan would have 100+ binary files with around 20 that are non-empty when there's only three beams in the plan. Thanks in advance.

MattAWard avatar Aug 29 '25 17:08 MattAWard