Esempio n. 1
0
        public void PhysicalDose_Addition_Test()
        {
            var dosis = DoubleRange.FromMinMax(0.0, 1000, 0.001).Select(x => x.Gy()).ToList();
            var xs    = Enumerable.Range(1, dosis.Count);

            foreach (var t in dosis.Zip(xs, (d, i) => Tuple.Create(d.Value, i)))
            {
                var sum  = PhysicalDoseValue.InGy(t.Item1 + t.Item2) + PhysicalDoseValue.InGy(t.Item2);
                var sum1 = PhysicalDoseValue.InGy(t.Item1 + 2 * t.Item2);
                Assert.Equal(sum, sum1);
            }
        }
Esempio n. 2
0
        public void PhysicalDose_Multiplication_Test()
        {
            var dosis = DoubleRange.FromMinMax(0.0, 2, 0.000001).Select(x => x.Gy());
            var xs    = Enumerable.Range(1, 100000000);

            foreach (var t in dosis.Zip(xs, (d, i) => Tuple.Create(d.Value, i)))
            {
                var sum  = PhysicalDoseValue.InGy(t.Item1) * t.Item1;
                var sum1 = PhysicalDoseValue.InGy(Math.Round(t.Item1 * t.Item1, 9));
                Assert.Equal(sum, sum1);
            }
        }
        public void DDVH_ctor_Test()
        {
            int numberOfVoxels = 100;
            var doses          = PhysicalDoseValue
                                 .Range(start: 0, stop: 100, step: 1, bIncludeLastValue: true, unit: PhysicalDoseValue.DoseUnit.GY)
                                 .Take(numberOfVoxels);
            var volumes = Enumerable.Repeat(VolumeValue.New(8, VolumeValue.VolumeUnit.MM3), numberOfVoxels);
            var tuples  = doses.Zip(volumes, (dose, volume) => Tuple.Create(dose, volume));

            var dvpoints = tuples.ToDVPoints();

            var settings = DVHSettingsFactory <PhysicalDoseValue> .FromMinMax(min : 0, max : 200, numberOfBins : 200,
                                                                              doseUnit : PhysicalDoseValue.DoseUnit.GY, volumeUnit : VolumeValue.VolumeUnit.MM3);

            var ddvh = DVHFactory <PhysicalDoseValue> .FromDifferentialDoseVolumePairs(type : DVHType.DIFFERENTIAL,
                                                                                       settings : settings, pairs : dvpoints);
        }