示例#1
0
 /// <summary>
 /// constructor for simulation options, a class sub to SimulationInput
 /// </summary>
 /// <param name="seed">random number generator seed (-1=randomly chosen seed, >=0 reproducible sequence)</param>
 /// <param name="rngType">random number generator type</param>
 /// <param name="absWeightingType">absorption weighting type</param>
 /// <param name="phaseFunctionType">phase function type</param>
 /// <param name="databases">list of DatabaseType indicating data to be written database for post-processing</param>
 /// <param name="trackStatistics">flag indicating whether to track statistics about where photons end up</param>
 /// <param name="russianRouletteWeightThreshold">weight threshold to perform RR (default=0, no RR)</param>
 /// <param name="simulationIndex">index of simulation</param>
 public SimulationOptions(
     int seed,
     RandomNumberGeneratorType rngType,
     AbsorptionWeightingType absWeightingType,
     PhaseFunctionType phaseFunctionType,
     IList <DatabaseType> databases,
     bool trackStatistics,
     double russianRouletteWeightThreshold,
     int simulationIndex)
 {
     RandomNumberGeneratorType = rngType;
     AbsorptionWeightingType   = absWeightingType;
     PhaseFunctionType         = phaseFunctionType;
     Databases = databases;
     // check if databases list is null and if so make empty
     if (Databases == null)
     {
         Databases = new List <DatabaseType>()
         {
         };
     }
     Seed = seed;
     //if (Seed == -1) // handling of random seed moved to RNGFactory 10/01/11
     //{
     //    Seed = GetRandomSeed();
     //}
     SimulationIndex = simulationIndex;
     TrackStatistics = trackStatistics;
     RussianRouletteWeightThreshold = russianRouletteWeightThreshold;
 }
示例#2
0
        /// <summary>
        /// Required factory method to create the corresponding
        /// ITissue based on the ITissueInput data
        /// </summary>
        /// <param name="awt">Absorption Weighting Type</param>
        /// <param name="pft">Phase Function Type</param>
        /// <param name="russianRouletteWeightThreshold">Russian Roulette Weight Threshold</param>
        /// <returns></returns>
        public ITissue CreateTissue(AbsorptionWeightingType awt, PhaseFunctionType pft, double russianRouletteWeightThreshold)
        {
            var t = new BoundedTissue(CylinderRegion, LayerRegions);

            t.Initialize(awt, pft, russianRouletteWeightThreshold);

            return(t);
        }
示例#3
0
        /// <summary>
        ///// Required factory method to create the corresponding
        ///// ITissue based on the ITissueInput data
        /// </summary>
        /// <param name="awt">Absorption Weighting Type</param>
        /// <param name="pft">Phase Function Type</param>
        /// <param name="russianRouletteWeightThreshold">Russian Roulette Weight Threshold</param>
        /// <returns></returns>
        public ITissue CreateTissue(AbsorptionWeightingType awt, PhaseFunctionType pft, double russianRouletteWeightThreshold)
        {
            var t = new SingleInclusionTissue(EllipsoidRegion, LayerRegions);

            t.Initialize(awt, pft, russianRouletteWeightThreshold);

            return(t);
        }
示例#4
0
        /// <summary>
        /// Required factory method to create the corresponding
        /// ITissue based on the ITissueInput data
        /// </summary>
        /// <param name="awt">Absorption Weighting Type</param>
        /// <param name="pft">Phase Function Type</param>
        /// <param name="russianRouletteWeightThreshold">Russian Roulette Weight Threshold</param>
        /// <returns></returns>
        public ITissue CreateTissue(AbsorptionWeightingType awt, PhaseFunctionType pft, double russianRouletteWeightThreshold)
        {
            var t = new MultiConcentricInfiniteCylinderTissue(InfiniteCylinderRegions, LayerRegions);

            t.Initialize(awt, pft, russianRouletteWeightThreshold);

            return(t);
        }
        /// <summary>
        ///// Required factory method to create the corresponding
        ///// ITissue based on the ITissueInput data
        /// </summary>
        /// <param name="awt">Absorption Weighting Type</param>
        /// <param name="pft">Phase Function Type</param>
        /// <param name="russianRouletteWeightThreshold">Russian Roulette Weight Threshold</param>
        /// <returns></returns>
        public ITissue CreateTissue(AbsorptionWeightingType awt, PhaseFunctionType pft, double russianRouletteWeightThreshold)
        {
            var t = new MultiLayerWithSurfaceFiberTissue(SurfaceFiberRegion, LayerRegions);

            t.Initialize(awt, pft, russianRouletteWeightThreshold);

            return(t);
        }
示例#6
0
        /// <summary>
        /// Required factory method to create the corresponding
        /// ITissue based on the ITissueInput data
        /// </summary>
        /// <param name="awt">Absorption Weighting Type</param>
        /// <param name="pft">Phase Function Type</param>
        /// <param name="russianRouletteWeightThreshold">Russian Roulette Weight Threshold</param>
        /// <returns></returns>
        public ITissue CreateTissue(AbsorptionWeightingType awt, PhaseFunctionType pft, double russianRouletteWeightThreshold)
        {
            throw new NotImplementedException();

            //var t = new SingleInclusionTissue(EllipsoidRegions, LayerRegions); // todo: add implementation

            //t.Initialize(awt, pft, russianRouletteWeightThreshold);

            //return t;
        }
        /// <summary>
        /// Required method to initialiize the corresponding ITissue
        /// </summary>
        /// <param name="tissue"></param>
        public void Initialize(
            AbsorptionWeightingType awt           = AbsorptionWeightingType.Discrete,
            PhaseFunctionType pft                 = PhaseFunctionType.HenyeyGreenstein,
            double russianRouletteWeightThreshold = 0.0)
        {
            AbsorptionWeightingType        = awt;
            PhaseFunctionType              = pft;
            RussianRouletteWeightThreshold = russianRouletteWeightThreshold;

            RegionScatterLengths = Regions.Select(region => region.RegionOP.GetScatterLength(awt)).ToArray();
        }
示例#8
0
        // todo: revisit to make signatures here and in Tissue/TissueInput class signatures strongly typed
        /// <summary>
        /// Method to return ITissue given inputs
        /// </summary>
        /// <param name="ti">ITissueInput</param>
        /// <param name="awt">AbsorptionWeightingType enum</param>
        /// <param name="pft">PhaseFunctionType enum</param>
        /// <param name="russianRouletteWeightThreshold">Russian Roulette weight threshold</param>
        /// <returns>ITissue</returns>
        public static ITissue GetTissue(ITissueInput ti, AbsorptionWeightingType awt, PhaseFunctionType pft, double russianRouletteWeightThreshold)
        {
            ITissue t = ti.CreateTissue(awt, pft, russianRouletteWeightThreshold);

            if (t == null)
            {
                throw new ArgumentException(
                          "Problem generating ITissue instance. Check that TissueInput, ti, has a matching ITissue definition.");
            }

            return(t);
        }
        /// <summary>
        /// Method to determine scattering length given the absorption weighting type
        /// </summary>
        /// <param name="op">optical properties</param>
        /// <param name="awt">absorption weighting type</param>
        /// <returns>scatter length</returns>
        public static double GetScatterLength(this OpticalProperties op, AbsorptionWeightingType awt)
        {
            switch (awt)
            {
            default:
            case AbsorptionWeightingType.Discrete:
            case AbsorptionWeightingType.Analog:
                return(op.Mua + op.Mus);

            case AbsorptionWeightingType.Continuous:
                return(op.Mus);
            }
        }
示例#10
0
 /// <summary>
 /// constructor that uses Henyey-Greenstein phase function, does not save photon data to database,
 /// tallies 2nd moment information, does not track statistics and designates simulation index to 0
 /// </summary>
 /// <param name="seed"></param>
 /// <param name="rngType"></param>
 /// <param name="absWeightingType"></param>
 public SimulationOptions(
     int seed,
     RandomNumberGeneratorType rngType,
     AbsorptionWeightingType absWeightingType)
     : this(seed,
            rngType,
            absWeightingType,
            PhaseFunctionType.HenyeyGreenstein,
            new List <DatabaseType>() { }, // databases to be written
            false,                         // track statistics
            0.0,                           // Russian Roulette weight threshold: =0.0 -> no RR performed
            0)
 {
 }
示例#11
0
        /// <summary>
        /// Set the absorption to discrete or continuous
        /// </summary>
        /// <param name="awt">absorption weighting type</param>
        protected void SetAbsorbAction(AbsorptionWeightingType awt)
        {
            switch (awt)
            {
            // note: pMC is not applied to analog processing,
            // only DAW and CAW
            case AbsorptionWeightingType.Continuous:
                _absorbAction = AbsorbContinuous;
                break;

            case AbsorptionWeightingType.Discrete:
            default:
                _absorbAction = AbsorbDiscrete;
                break;
            }
        }
示例#12
0
        public void Initialize(ITissue tissue, Random rng)
        {
            // assign any user-defined outputs (except arrays...we'll make those on-demand)
            TallyCount = 0;

            // if the data arrays are null, create them (only create second moment if TallySecondMoment is true)
            Mean         = Mean ?? new double[Rho.Count - 1];
            SecondMoment = SecondMoment ?? (TallySecondMoment ? new double[Rho.Count - 1] : null);

            // intialize any other necessary class fields here
            _perturbedOps            = PerturbedOps;
            _perturbedRegionsIndices = PerturbedRegionsIndices;
            _referenceOps            = tissue.Regions.Select(r => r.RegionOP).ToList();
            SetAbsorbAction(tissue.AbsorptionWeightingType);
            TallyCount = 0;
            _awt       = tissue.AbsorptionWeightingType;
        }
示例#13
0
文件: Photon.cs 项目: acs3235/VTS
        private void SetAbsorbAction(AbsorptionWeightingType awt)
        {
            switch (awt)
            {
            case AbsorptionWeightingType.Analog:
                Absorb = AbsorbAnalog;
                break;

            case AbsorptionWeightingType.Continuous:
                Absorb = AbsorbContinuous;
                break;

            case AbsorptionWeightingType.Discrete:
            default:
                Absorb = AbsorbDiscrete;
                break;
            }
        }
示例#14
0
 /// <summary>
 /// CylinderTissueRegion assumes cylinder axis is parallel with z-axis
 /// </summary>
 /// <param name="center">center position</param>
 /// <param name="radius">radius in x-y plane</param>
 /// <param name="height">height along z axis</param>
 /// <param name="op">optical properties of cylinder</param>
 /// <param name="awt">absorption weighting type</param>
 public CylinderTissueRegion(Position center, double radius, double height, OpticalProperties op, AbsorptionWeightingType awt)
 {
     TissueRegionType = "Cylinder";
     Center           = center;
     Radius           = radius;
     Height           = height;
     RegionOP         = op;
 }