I would like to take the output of a cartesian binned dose from USRBIN and send the binary .bnn file to a different program to use as a dose map.
This requires me to read the binary .bnn and extract the binned data and reconstruct a 3 dimensional array. I have used the usbrea exectuable to convert the file to ASCII just to see what it would look like (I have also used the FLAIR ASCII converter as well).
I have tried to go through the usbrea.f to figure out how to read the .bnn directly but I cannot quite decipher how to do it. I know there is some header information that gets read before the actual binned values but I am not sure how to correctly read out the .bnn.
Any help would be greatly appreciated.
For reference, my .bnn is binned as follows.
Cartesian binning n. 1 "Dose " , generalized particle n. 228
X coordinate: from -4.2750E+00 to 4.2750E+00 cm, 171 bins ( 5.0000E-02 cm wide)
Y coordinate: from -4.2750E+00 to 4.2750E+00 cm, 171 bins ( 5.0000E-02 cm wide)
Z coordinate: from -7.0000E+00 to 0.0000E+00 cm, 140 bins ( 5.0000E-02 cm wide)
please find the following Python code to read a simple URSBIN binary result file. Please note, that it only works when the the .bnn fine contains data from only one scoring.