public void GeneratePDD() { RTDose sourceMatrix = _source.DoseMatrix(); RTDose targetMatrix = _target.DoseMatrix(); double yMin = (sourceMatrix.Y0 > targetMatrix.Y0) ? sourceMatrix.Y0 : targetMatrix.Y0; double yMax = (sourceMatrix.YMax < targetMatrix.YMax) ? sourceMatrix.YMax : targetMatrix.YMax; double yRes = sourceMatrix.YRes; EvilDICOM.Core.Helpers.Vector3 startPoint = new EvilDICOM.Core.Helpers.Vector3(0, yMin, 0); EvilDICOM.Core.Helpers.Vector3 endPoint = new EvilDICOM.Core.Helpers.Vector3(0, yMax, 0); SourcePDD = sourceMatrix.GetLineDose(startPoint, endPoint, yRes); TargetPDD = targetMatrix.GetLineDose(startPoint, endPoint, yRes); }
/// <summary> /// If the file is a Dicom Dose file then the list of doses is returned. /// This is implemented as a method as a mitigation against memory abuse. /// </summary> /// <returns>List of Doses from the dicom file</returns> /// <exception cref="InvalidOperationException"> Thrown if the file is not a dose file</exception> public List <double> DoseValues() { if (IsDoseFile) { DICOMObject dcm1 = DICOMObject.Read(FileName); RTDose dcmMatrix = new RTDose(dcm1); X = dcmMatrix.DimensionX; Y = dcmMatrix.DimensionY; Z = dcmMatrix.DimensionZ; return(dcmMatrix.DoseValues); } else { throw new InvalidOperationException("Cannot call for dose on a Dicom file that is not a dose file"); } }
public void GeneratePDD() { RTDose sourceMatrix = _source.DoseMatrix(); RTDose targetMatrix = _target.DoseMatrix(); double yMin = (sourceMatrix.Y0 > targetMatrix.Y0) ? sourceMatrix.Y0 : targetMatrix.Y0; double yMax = (sourceMatrix.YMax < targetMatrix.YMax) ? sourceMatrix.YMax : targetMatrix.YMax; double yRes = sourceMatrix.YRes; EvilDICOM.Core.Helpers.Vector3 startPoint = new EvilDICOM.Core.Helpers.Vector3(0, yMin, 0); EvilDICOM.Core.Helpers.Vector3 endPoint = new EvilDICOM.Core.Helpers.Vector3(0, yMax, 0); try { SourcePDD = sourceMatrix.GetLineDose(startPoint, endPoint, yRes); TargetPDD = targetMatrix.GetLineDose(startPoint, endPoint, yRes); } catch (Exception) { double xMidSource = (sourceMatrix.XMax - sourceMatrix.X0) / 2; double zMidSource = (sourceMatrix.ZMax - sourceMatrix.Z0) / 2; if ((targetMatrix.XMax > xMidSource && xMidSource > targetMatrix.X0) && (targetMatrix.ZMax > zMidSource && zMidSource > targetMatrix.Z0)) { startPoint = new EvilDICOM.Core.Helpers.Vector3(xMidSource, yMin, zMidSource); endPoint = new EvilDICOM.Core.Helpers.Vector3(xMidSource, yMax, zMidSource); SourcePDD = sourceMatrix.GetLineDose(startPoint, endPoint, yRes); TargetPDD = targetMatrix.GetLineDose(startPoint, endPoint, yRes); } else { TargetPDD = new List <DoseValue>(); SourcePDD = new List <DoseValue>(); for (double pt = sourceMatrix.Y0; pt <= sourceMatrix.YMax; pt += sourceMatrix.YRes) { var tempDose = new DoseValue(0, pt, 0, 0); TargetPDD.Add(tempDose); SourcePDD.Add(tempDose); } } } }