public void validate_general_constructor_with_gaussian_profiletype_for_directional_rectangular_source_test()
        {
            Random  rng     = new MathNet.Numerics.Random.MersenneTwister(0); // not really necessary here, as this is now the default
            ITissue tissue  = new MultiLayerTissue();
            var     profile = new GaussianSourceProfile(_bdFWHM);

            var ps = new DirectionalRectangularSource(_polarAngle, _lengthX, _widthY, profile, _direction, _translation, _angPair)
            {
                Rng = rng
            };

            var photon = ps.GetNextPhoton(tissue);

            Assert.Less(Math.Abs(photon.DP.Direction.Ux - _tp[91]), ACCEPTABLE_PRECISION);
            Assert.Less(Math.Abs(photon.DP.Direction.Uy - _tp[92]), ACCEPTABLE_PRECISION);
            Assert.Less(Math.Abs(photon.DP.Direction.Uz - _tp[93]), ACCEPTABLE_PRECISION);

            Assert.Less(Math.Abs(photon.DP.Position.X - _tp[94]), ACCEPTABLE_PRECISION);
            Assert.Less(Math.Abs(photon.DP.Position.Y - _tp[95]), ACCEPTABLE_PRECISION);
            Assert.Less(Math.Abs(photon.DP.Position.Z - _tp[96]), ACCEPTABLE_PRECISION);
        }
示例#2
0
        public void validate_general_constructor_with_gaussian_profiletype_for_isotropic_line_source_test()
        {
            Random  rng     = new MathNet.Numerics.Random.MersenneTwister(0); // not really necessary here, as this is now the default
            ITissue tissue  = new MultiLayerTissue();
            var     profile = new GaussianSourceProfile(_bdFWHM);


            var ps = new IsotropicLineSource(_lengthX, profile, _direction, _translation, _angPair)
            {
                Rng = rng
            };

            var photon = ps.GetNextPhoton(tissue);

            Assert.Less(Math.Abs(photon.DP.Direction.Ux - _tp[48]), ACCEPTABLE_PRECISION);
            Assert.Less(Math.Abs(photon.DP.Direction.Uy - _tp[49]), ACCEPTABLE_PRECISION);
            Assert.Less(Math.Abs(photon.DP.Direction.Uz - _tp[50]), ACCEPTABLE_PRECISION);

            Assert.Less(Math.Abs(photon.DP.Position.X - _tp[51]), ACCEPTABLE_PRECISION);
            Assert.Less(Math.Abs(photon.DP.Position.Y - _tp[52]), ACCEPTABLE_PRECISION);
            Assert.Less(Math.Abs(photon.DP.Position.Z - _tp[53]), ACCEPTABLE_PRECISION);
        }
        public void validate_general_constructor_with_gaussian_profiletype_for_custom_elliptical_source_test()
        {
            Random  rng     = new MathNet.Numerics.Random.MersenneTwister(0); // not really necessary here, as this is now the default
            ITissue tissue  = new MultiLayerTissue();
            var     profile = new GaussianSourceProfile(_bdFWHM);


            var ps = new CustomEllipticalSource(_aParameter, _bParameter, profile, _polRange, _aziRange, _direction, _translation, _angPair)
            {
                Rng = rng
            };

            var photon = ps.GetNextPhoton(tissue);

            Assert.Less(Math.Abs(photon.DP.Direction.Ux - _tp[55]), ACCEPTABLE_PRECISION);
            Assert.Less(Math.Abs(photon.DP.Direction.Uy - _tp[56]), ACCEPTABLE_PRECISION);
            Assert.Less(Math.Abs(photon.DP.Direction.Uz - _tp[57]), ACCEPTABLE_PRECISION);

            Assert.Less(Math.Abs(photon.DP.Position.X - _tp[58]), ACCEPTABLE_PRECISION);
            Assert.Less(Math.Abs(photon.DP.Position.Y - _tp[59]), ACCEPTABLE_PRECISION);
            Assert.Less(Math.Abs(photon.DP.Position.Z - _tp[60]), ACCEPTABLE_PRECISION);
        }