VarianAPIs / Varian-Code-Samples

Code samples for ESAPI and other Varian APIs and web services.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PortalDosimetry : Convert pixel raw value of max dose in the predicted image

jejepalphys opened this issue · comments

Hi,

With Portal Dosimetry Scripting, I try to find max dose on predicted image in portal dosimetry.

Function pdBeam.PredictedDoseImage.GetMinMax(out int minValue, out int maxValue, false) give me the pixel max raw value. Does anyone know how convert this value to dose.

Thanks

The FrameRT class (you can get from the PredictedDoseImages.FramesRT.ElementAt(0)) has a method called VoxelToDisplayValue that should provide CU values for you.

I found it with : PredictedDoseImage.Image.FramesRT.ElementAt(0)

Thank you for your answer, it's perfect.

Your welcome!

Hi @mattcschmidt,

I'm having difficulty with using the FrameRT class.

It works perfectly if in Portal Dosimetry I display the predicted image in the context. But, when I try to apply it to all images in the context plan, it doesn't work.

Here is my code :
double maxValueCU;
foreach (PDBeam pdBeam in Context.PDPlanSetup.Beams)
{
pdBeam.PredictedDoseImage.GetMinMax(out int minValue, out int maxValue, false);
maxValueCU = pdBeam.PredictedDoseImage.Image.FramesRT.Last().VoxelToDisplayValue(maxValue);
MessageBox.Show(maxValue.ToString() + " - " + maxValueCU.ToString());
}

With this example, if I have a plan with two beams, I display the first beam in Portal Dosimetry and run the script.

The maxValue of the GetMinMax() function works well for both beams.

But the conversion to CU is only correct for the first beam, here are the results:

  • Beam1:
    maxValue = 19079 (raw data)
    maxValueCU = 0.86 CU
    max value Portal Dosimetry = 0.86 CU (OK)

  • Beam2:
    maxValue = 18780 (raw data)
    maxValueCU = 0.005846 CU
    max value Portal Dosimetry = 0.82 CU (not OK)

Do you have any idea what mistake I am making?

Thanks again