예제 #1
0
        public void execute_Monte_Carlo()
        {
            // delete any previously generated files and folders
            clear_folders_and_files();

            _input = new SimulationInput(
                10000, // number needed to get enough photons to Td
                "results",
                new SimulationOptions(
                    0,
                    RandomNumberGeneratorType.MersenneTwister,
                    AbsorptionWeightingType.Analog,
                    PhaseFunctionType.Bidirectional,
                    new List <DatabaseType>()
            {
            },            // databases to be written
                    true, // track statistics
                    0.0,  // RR threshold -> 0 = no RR performed
                    0),
                new DirectionalPointSourceInput(
                    new Position(0.0, 0.0, 0.0),
                    new Direction(0.0, 0.0, 1.0),
                    0
                    ),
                new MultiLayerTissueInput(
                    new ITissueRegion[]
            {
                new LayerTissueRegion(
                    new DoubleRange(double.NegativeInfinity, 0.0),
                    new OpticalProperties(0.0, 1e-10, 0.0, 1.0)),
                new LayerTissueRegion(
                    new DoubleRange(0.0, _slabThickness),
                    new OpticalProperties(_mua, _musp, _g, 1.0)),         // index matched slab
                new LayerTissueRegion(
                    new DoubleRange(_slabThickness, double.PositiveInfinity),
                    new OpticalProperties(0.0, 1e-10, 0.0, 1.0))
            }
                    ),
                new List <IDetectorInput>()
            {
                new RDiffuseDetectorInput()
                {
                    TallySecondMoment = true
                },
                new ATotalDetectorInput()
                {
                    TallySecondMoment = true
                },
                new TDiffuseDetectorInput()
                {
                    TallySecondMoment = true
                }
            }
                );
            _output = new MonteCarloSimulation(_input).Run();

            _simulationStatistics = SimulationStatistics.FromFile(_input.OutputName + "/statistics.txt");
        }
예제 #2
0
        public void execute_Monte_Carlo()
        {
            // delete any previously generated files
            clear_folders_and_files();

            _input = new SimulationInput(
                100,
                "Output",
                new SimulationOptions(
                    0,
                    RandomNumberGeneratorType.MersenneTwister,
                    AbsorptionWeightingType.Analog,
                    PhaseFunctionType.HenyeyGreenstein,
                    new List <DatabaseType>()
            {
            },            // databases to be written
                    true, // track statistics
                    0.0,  // RR threshold -> 0 = no RR performed
                    0),
                new DirectionalPointSourceInput(
                    new Position(0.0, 0.0, 0.0),
                    new Direction(0.0, 0.0, 1.0),
                    1 // start off inside tissue
                    ),
                new MultiLayerTissueInput(
                    new ITissueRegion[]
            {
                new LayerTissueRegion(
                    new DoubleRange(double.NegativeInfinity, 0.0),
                    new OpticalProperties(0.0, 1e-10, 1.0, 1.0)),
                new LayerTissueRegion(
                    new DoubleRange(0.0, 20.0),
                    new OpticalProperties(0.01, 1.0, 0.8, 1.4)),
                new LayerTissueRegion(
                    new DoubleRange(20.0, double.PositiveInfinity),
                    new OpticalProperties(0.0, 1e-10, 1.0, 1.0))
            }
                    ),
                new List <IDetectorInput>
            {
                new RDiffuseDetectorInput()
                {
                    TallySecondMoment = true
                },
                new ROfAngleDetectorInput()
                {
                    Angle = new DoubleRange(Math.PI / 2, Math.PI, 2)
                },
                new ROfRhoDetectorInput()
                {
                    Rho = new DoubleRange(0.0, 10.0, 101), TallySecondMoment = true
                },
                new ROfRhoAndAngleDetectorInput()
                {
                    Rho = new DoubleRange(0.0, 10.0, 101), Angle = new DoubleRange(Math.PI / 2, Math.PI, 2)
                },
                new ROfRhoAndTimeDetectorInput()
                {
                    Rho = new DoubleRange(0.0, 10.0, 101), Time = new DoubleRange(0.0, 1.0, 101)
                },
                new ROfXAndYDetectorInput()
                {
                    X = new DoubleRange(-10.0, 10.0, 101), Y = new DoubleRange(-10.0, 10.0, 101)
                },
                new ROfRhoAndOmegaDetectorInput()
                {
                    Rho = new DoubleRange(0.0, 10.0, 101), Omega = new DoubleRange(0.05, 1.0, 20)
                },                                                                                                                 // frequency sampling points (not bins)
                new TDiffuseDetectorInput(),
                new TOfAngleDetectorInput()
                {
                    Angle = new DoubleRange(0.0, Math.PI / 2, 2)
                },
                new TOfRhoDetectorInput()
                {
                    Rho = new DoubleRange(0.0, 10.0, 101)
                },
                new TOfRhoAndAngleDetectorInput()
                {
                    Rho = new DoubleRange(0.0, 10.0, 101), Angle = new DoubleRange(0.0, Math.PI / 2, 2)
                },
                new AOfRhoAndZDetectorInput()
                {
                    Rho = new DoubleRange(0.0, 10.0, 101), Z = new DoubleRange(0.0, 10.0, 101)
                },
                new ATotalDetectorInput(),
                new FluenceOfRhoAndZDetectorInput()
                {
                    Rho = new DoubleRange(0.0, 10.0, 101), Z = new DoubleRange(0.0, 10.0, 101)
                },
                new FluenceOfRhoAndZAndTimeDetectorInput()
                {
                    Rho  = new DoubleRange(0.0, 10.0, 101),
                    Z    = new DoubleRange(0.0, 10.0, 101),
                    Time = new DoubleRange(0.0, 1.0, 11)
                },
                new RadianceOfRhoAndZAndAngleDetectorInput()
                {
                    Rho   = new DoubleRange(0.0, 10.0, 101),
                    Z     = new DoubleRange(0.0, 10.0, 101),
                    Angle = new DoubleRange(-Math.PI / 2, Math.PI / 2, 5)
                }
            }
                );

            _output = new MonteCarloSimulation(_input).Run();

            _simulationStatistics = SimulationStatistics.FromFile(_input.OutputName + "/statistics.txt");

            _factor = 1.0 - Optics.Specular(
                _input.TissueInput.Regions[0].RegionOP.N,
                _input.TissueInput.Regions[1].RegionOP.N);
        }